Helper Functions for SGUG-RSE RPM Building

massiverobot

irix detailer
Feb 8, 2019
121
108
43
Philly
twitter.com
Want to get onto the RPM train? There are a lot of things to do, across a spectrum of abilities. To help with some repetitive tasks for build IRIX RPM packages using SGUG-RSE I've create a tiny file in a gist you can quickly use to make building RPMs from existing SPEC files just a few commands.

Clearly, the hard work is creating the IRIX specific spec files themselves- this will not show you that. This will however let you dip your foot into the RPM building process so can play around with existing packages and help test, document and maybe eventually contribute back some novel SPEC files yourself.

To get started, make your git-fu strong so you can follow along.

Read these READMEs:

You will also want to fork and or just git clone them down and follow the directions to setup the sgug-rse env in that first read-me.

I cloned both of these projects right into my rpmbuild dir, so it looks like this:

dillera@fuel ~ $ cd ~/rpmbuild
dillera@fuel ~/rpmbuild $ ls -1
BUILD
BUILDROOT
RPMS
SOURCES
SPECS
SRPMS
sgug-rse

sgug-rse-wip



The RPM build and install process breaks down into 5 Steps:
  1. Invoke the sgugshell.sh to setup the proper bash env
  2. RPM install the src rpm
  3. Copy the IRIX specific spec files into your RPMBUILD hierarchy
  4. rpmbuild will download a clean source tarball, it will be patched (according to .spec) and then gcc will build it
  5. Install the RPM binary (as root)

You will do a lot of jumping around between the git repo, the SPEC, SRPMS, RPMS folders a lot. You will also repeat those 5 steps over and over again. Which is where my little helper functions come in. They are available as a gist here:

If you download that and save it as .sgug_bashrc in your home dir you will have those functions available in the sgugshell and now those five operations can be done with the use of some bash commands/functions.

You can also pop this into your .bashrc to make the bootsrap even easier:
alias sginit="~/rpmbuild/sgug-rse/sgugshell.sh"

WIP - Work in Progress
The sgug-rse-wip repo above can be used to play with some projects that are in progress, but haven't made it into the final releases. It's a good place to start hacking around.

In there as of today is python 3.8.1. Here is the full command list using my functions to build that locally, after a fresh login:

dillera@fuel ~ $ sginit
[sgugshell dillera@fuel ~]$ sgspec
[sgugshell dillera@fuel SPECS]$ sgsbuild python38
[sgugshell dillera@fuel SPECS]$ sgwipcp python38
[sgugshell dillera@fuel SPECS]$ sgrbuild python38
warning: Downloading https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz to /usr/people/dillera/rpmbuild/SOURCES/Python-3.8.1.tgz
Executing(%prep): /usr/sgug/bin/sh -e /usr/sgug/var/tmp/rpm-tmp.115104
.....

[bunch of stuff as python is built]


So what is going on here?

  • sginit - is the alias in my .bashrc that just runs sgugshell
  • sgugshell has a hook in it that will read in a file called .sgug_bashrc if it exists
  • in my .sgug_bashrc I have defined sgsbuild, sgwipcp and sgrbuild to take in one parameter and execute the commands needed for them (reference the sgugs-rse readme.md)

My functions are based on:

  • sg - prefix for "sgug-rse"
  • wipcp - wip repo cp
  • cp - cp from sgug-rse repo
  • sg s build - do the source 's' build
  • sg r build - do the rpm build

It also defines some simple alias that move you into the common dirs.

It's simple but useful and if you do a couple of these it becomes old very quickly to keep typing in those commands. Just examine that gist to see what is going on.
 
  • Like
Reactions: Elf

massiverobot

irix detailer
Feb 8, 2019
121
108
43
Philly
twitter.com
And when it's done:

Provides: python38-wip = 3.8.1-1wip.sgugbeta python38-wip(mips-32) = 3.8.1-1wip.sgugbeta
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/sgug/lib/rpm/check-files /usr/people/dillera/rpmbuild/BUILDROOT/python38-wip-3.8.1-1wip.sgugbeta.mips
Wrote: /usr/people/dillera/rpmbuild/SRPMS/python38-wip-3.8.1-1wip.sgugbeta.src.rpm
Wrote: /usr/people/dillera/rpmbuild/RPMS/mips/python38-wip-3.8.1-1wip.sgugbeta.mips.rpm
Executing(%clean): /usr/sgug/bin/sh -e /usr/sgug/var/tmp/rpm-tmp.115104
+ umask 022
+ cd /usr/people/dillera/rpmbuild/BUILD
+ cd Python-3.8.1
+ /usr/sgug/bin/rm -rf /usr/people/dillera/rpmbuild/BUILDROOT/python38-wip-3.8.1-1wip.sgugbeta.mips
+ RPM_EC=0
++ jobs -p
+ exit 0
[sgugshell dillera@fuel SPECS]$



And, since I've already installed sudo via RPM:

[sgugshell dillera@fuel SPECS]$ sudo rpm -ivh ~/rpmbuild/RPMS/mips/python38-wip-3.8.1-1wip.sgugbeta.mips.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:python38-wip-3.8.1-1wip.sgugbeta ################################# [100%]


[sgugshell dillera@fuel SPECS]$ /usr/sgug/bin/python3 --version

Python 3.8.1


And now we are getting very close to something amazing for everyone with a SGI.
 

About us

  • Silicon Graphics User Group (SGUG) is a community for users, developers, and admirers of Silicon Graphics (SGI) products. We aim to be a friendly hobbyist community for discussing all aspects of SGIs, including use, software development, the IRIX Operating System, and troubleshooting, as well as facilitating hardware exchange.

User Menu