Recently I’ve been doing some Meego work (rumours of its death are slightly exaggerated), and also moved to running Fedora since Ubuntu aren’t prepared to put enough resources into packaging Gnome 3 for it to actually work very well. All of this means a lot more involvement with RPM!
In fact my first experience with Linux was with SuSE 6.x and I had such bad experiences with RPM constantly complaining about missing dependencies that swore to avoid it for the rest of my life and spent many years running Slackware, which of course lets you manage your own missing dependencies. I think my recent reversal of this view largely stems from having tried my hand at Debian packaging and realising just how complex that system is.
So, anyway, making .rpm’s seems easier than .deb’s, mainly because there are fewer levels of indirection between the recipe and the actions being taken. There’s also minimal documentation, sadly. Here I’ve collected some general tips for the benefit of search engines.
rpmlint is a very simple Python tool to sanity-check packages. It’s written in Python and essentially runs a bunch of regexes over the file. SUSE have some helpful docs.
You can ignore false positives with an rpmlintrc file, which is simply some Python source code. A useful function is addFilter() – this allows you to ignore false positives, and is literally a regexp over the console output for that warning. In my case I was getting lots of the following:
vala.i586: W: files-duplicate /usr/share/vala-0.14/vapi/sdl-mixer.deps /usr/share/vala-0.14/vapi/sdl-net.deps:/usr/share/vala-0.14/vapi/sdl-ttf.deps:/usr/share/vala-0.14/vapi/sdl-image.deps:/usr/share/vala-0.14/vapi/sdl-gfx.deps
These files aren’t duplicates, they just happen to have the same contents, so we want to ignore this warning. I created this vala-rpmlintrc file:
from Config import * # Prevent duplicate warnings for the vapi .deps files addFilter("files-duplicate (/usr/share/vala-0.14/vapi/.+\\.deps)+")
Another problem I had was the following error:
vala-devel.i586: E: library-without-ldconfig-postun (Badness: 300) /usr/lib/libvala-0.14.so.0.0.0 This package contains a library and provides no %postun scriptlet containing a call to ldconfig. vala-devel.i586: E: library-without-ldconfig-postin (Badness: 300) /usr/lib/libvala-0.14.so.0.0.0 This package contains a library and provides no %post scriptlet containing a call to ldconfig.
This confused me for a long time. I had the correct code there, but it turned out that I had
%post -p /sbin/ldconfig %postun -p /sbin/ldconfig
…but this is for the wrong package! The correct solution was to change it to this:
%post -n vala-devel -p /sbin/ldconfig %postun -n vala-devel -p /sbin/ldconfig
I hope this helps, people from the future!