Thursday, November 12, 2009

Tip for repackaging commercial software

Where I work, we like everything to be in a package. It allows for unattended and repeatable installations, dependencies, and easy removal. You also get to ensure that the software is installed in the correct location on your servers, rather than whatever ridiculous location the vendor thought should be used. RPM is our package format of choice.

If we need to install a new piece of software that someone has brought into the company, the first thing we do is repackage it into an RPM. Commercial software is almost never provided as an RPM to begin with, particularly if it has a really large footprint. The bigger the footprint, the stupider the packaging.

However, one thing about the rpmbuild command that is not very helpful in repackaging commercial code is that it attempts to strip ELF binaries before it adds them to the package. We do not want to modify commercial software, we just want to repackage it. You never know what kind of idiocy is being perpetrated in commercial software. They may depend on those symbols somehow! Or maybe there is a file in the package that is not actually an elf library, and causes brp-strip to choke.

To prevent this behavior, this little trick will do it:

Just in case that link doesn't last, you just write these definitions at the top of your spec file:


%define __spec_install_post /usr/lib/rpm/brp-compress || :
%define debug_package %{nil}

Apparently Dag Wieers deserves credit for that hack. Coincidentally, Dag is also the developer of mrepo, which is the greatest little program you've never heard of. It creates and updates APT and YUM repos.

3 comments:

KateMadd/skmckinn said...

Damn, man. Every time they slip you something as a "substitute" for the elf library, the magic just won't happen. You're all ready, you push up your sleeves, and right at the crucial moment, you realize the grimoire you need isn't there. The call number corresponds to _Soda Bread Recipes of Nova Scotia_, or some shit.

Digitizdat said...

Wow - grimoire... What an awesome word. Old French grammaire - i.e. grammar. I had no idea that the word "glamor" is related. Its definitions are congruent in such strange ways.

KateMadd/skmckinn said...

Yeah. It's a French thing. I learned that word watching Les Schtroumpfs in France with two boys--ages 3 and 7.
Gargamel
and Le Grand Schtroumpf both have their own grimoires.

Kids shows are great when you're learning a language.