Package building under RPM hasn’t actually changed a whole lot in the last decade. While I have notes scattered around the website on building and maintaining package repositories; the one part that has changed significantly is the use of git for version control. Thankfully tagging, archiving, and building packages is pretty simple under git basically consisting of the following three steps:
- git tag -a 1.1 -m “Version 1.1”
- git archive –prefix=projectname-1.1/ 1.1 |bzip2 > ~/Temp/projectname-1.1.tar.bz2
- rpmbuild -tb ~/Temp/projectname-1.1.tar.bz2
The -a option will create a “true” package tag although it will not be signed with a digital key. Of course the rpmbuild command depends on correctly formatted spec file in the base of your project directory. Make sure the spec file version and changelog have the same version number as your tag. FYI for scripting purposes it is good to remember that changelog dates use the following date command format:
date +’%a %b %d %Y’
The reason I mention scripting is because I am working at extending my automated build script for software packages I manage. Way back in my days at DPS I had developed a bash configuration that would allow me to download, package, and build a piece of software directly from the CVS repository.
When I moved to Cobb Engineering I also changes version control software and started using SVN. Extending my previous script to supportboth CVS and SVN wasn’t too hard. Now I have a number of personal projects at home as well as software examples I keep for my students at ITT-Tech; all of which is stored/managed in Git. The new software package script is almost done but I would really like to be able to update a spec file, changelog, tag, package, and build with one command.
The most useful part of my build script is that is doesn’t require me to spend any time remembering how to use it. By default is has both auto-complete as well as logical default behaviors. I just run buildpackage and it will list the available projects that I have ready to build. If I run buildpackage project it will present me with a list of versions that have already been tagged. One of these days I will post it publicly but I seriously doubt there is much interest in the broader community as almost everyone who develops at this level seems to already have their own custom build scripts.