Everything was ready. The deploy should have been clean and fast. But then, the developers had added just another language module. Not a big thing, just something you could have pulled down, and stashed somewhere below /usr/local. But then, there is this policy that was added early in the project process: All software should be packaged as rpm files. Sounded a dream for the ops people, this time we should get it done right. But for this single library, there are no packages to find. You’ve searched EPEL, you’ve been through rpmfusion, and you’ve googled them all, rpmfind, pbone, and even fedora but nope, no package to be found. So what do you do?

You could of course write the specfile from scratch and build the package. But you should already be on your way home. Are there any shortcuts? Well, of course there are.

On your el7 epel equipped buildbox, start by setting up an rpm build tree. You need to install the epel repos, of course.

$ sudo yum install rpmdevtools
$ rpmdev-setuptree

Wrap some perl modules

Try cpanspec! As a random example, we use the perl module DateTimeX::Seinfeld:

$ sudo yum install cpanspec
$ cd ~/rpmbuild/SPECS
$ cpanspec -v --packager "Random J. Hacker <random@example.com>" DateTimeX::Seinfeld
$ sudo yum-builddep perl-DateTimeX-Seinfeld.spec
$ rpmbuild -bb Color-Palette-0.100003.tar.gz

Done! Next!

Bundle some python modules

For easy python pip module packing, try pyp2rpm. Here we use the kaptan module as example, building it for python2.7:

$ sudo yum install pyp2rpm
$ sudo sed -i 's/http:/https:/g;' \
	  /usr/lib/python2.7/site-packages/pyp2rpm/settings.py # Yep, that's a bug
$ pyp2rpm -p2 kaptan > ~/rpmbuild/SPECS/python-kaptan.spec
$ sudo yum-builddep ~/rpmbuild/SPECS/python2-kaptan.spec
$ rpmbuild -bb ~/rpmbuild/SPECS/python2-kaptan.spec

Package a few ruby gems

For fast ruby gem packaging, we use gem2rpm. Here we use another random example, a gem called sawyer:

$ sudo yum install rubygem-gem2rpm
$ cd ~/rpmbuild/SOURCES
$ gem fetch sawyer
$ gem2rpm -t fedora-21-25 sawyer-0.8.1.gem -o \
	  ~/rpmbuild/SPECS/rubygem-sawyer.spec
$ rpmbuild -bb ~/rpmbuild/SPECS/rubygem-sawyer.spec

Note that we use the fedora templates. They tend to work quite well with both el7 and epel.

Swaddle some pear modules

For smart packaging of php pear modules, try the built-in function make-rpm-spec. For this example, we use the Archive_Tar module

$ sudo yum install php-pear-PEAR-Command-Packaging
$ cd ~/rpmbuild/SOURCES
$ pear download Archive_Tar
$ pear make-rpm-spec Archive_Tar-1.4.3.tgz
$ rpmbuild -bb php-pear-Archive-Tar.spec

Easy!