Sven Hoexter: Out of the comfort zone: Backporting net-snmp from CentOS 7 to CentOS 5 and 6
Lately I faced the requirement to create a backport of net-snmp 5.7.2,
which is part of CentOS 7, to a largely CentOS 5 and 6 based infrastructure. Due to
some prior adventures
in the rpm world I already knew about Mock
(the Fedora equivalent to pbuilder).
The easy part was the backporting to CentOS 6. Here the major objectiv is ripping out the newly
added systemd support. That boils down to just ripping out a patch, removing a configure flag, some
%post, %preun, %postun script snippets and the corresponding %install magic from the spec file.
Builds fine but leaves us with the issue that the init script ships in a package net-snmp-sysvinit
but the whole chkconfig registration magic is gone.
I put that aside for a moment and moved on to CentOS 5. It did not even start to build.
- There is no tcp_wrappers-devel in CentOS 5.
- The perl libraries are in the main perl package and not in perl-devel.
- lm_sensors-devel is not at version 3.
BuildRoot: % _tmppath /% name -% version -% release -root
%global RPM_BUILD_ROOT % buildroot
About ten minutes later I had a set of rpm files for CentOS 5.
Tried to install it, failed due to a depedency on libmysqlclient15
which is part of the mysql package in CentOS 5.
Yes, eight years back RedHat did not split off the lib packages
and that would mean for us to install a mysql database on every
system. So no, we won't do it and we just removed the mysql
support.
Left with only the init script setup missing I tried to be clever
and failed miserable. Be warned, this would've also been a bad
idea in the Debian world.
Since we have the init script in a seperate binary package I thought
I could just use something like
Requires: net-snmp-sysvinit
in the main net-snmp package and re-add the old %post, %preun
and %postun magic. Of course that failed at install time for
a good reason.
In the second (desperate) try to work around it I tried something
similar to "PreDepends"
Requires(post): net-snmp-sysvinit
That works at install time but still breaks on a removal/update.
So I think I did the right thing in the end (after reading some
more documentation) and just added the scripts to the net-snmp-sysvinit
package. It's just about adding the package name to the %post macro
invocation.
My initial plan included the wish to have one spec file that is usable
to build on CentOS 5 and 6 but now I'm left with a number of special
cases for CentOS 5.
I already knew about the %if %endif conditional macro you can use in rpm spec
files, so what was missing was a proper variable to base my decisions
on. Every CentOS release ships with a "/etc/rpm/" directory that
includes several macro file. Within those one can find the % rhel
variable that defines an int we can use.
%if % rhel <= 5
BuildRequires: perl
%else
BuildRequires: perl-devel
%endif
And finally I could build from one spec file a backport for CentOS 5 and 6.
My diff against the CentOS 7 spec is at https://sven.stormbind.net/centos/netsnmp-bp-el56/net-snmp-backport.from_el7.diff
Drawbacks of the resulting packages:
- No tcp-wrapper support, we don't care but that should be just another package name issue for the conditional Requires, simililar to the perl isssue.
- No mysql support. We do not care, one could change that and/or make it conditional or build against newer mysql releases where the -lib package is split.
- No DTLS support on CentOS 5. We do not care and that is not easy to fix.
- You've to install the net-snmp-sysvinit script to get back the usual setup you'd expect.
- We ripped out the systemd support, I did not investigate yet if it's possible to keep that included and just not enable it.
- If you build a src.rpm with mock you've to copy it out of the result directory before you rebuild it with mock to create the binary package. Mock deletes everything from the result directory when starting a new build. So I guess parallel builds for the same chroot will not work.
- Depedencies on files instead of packages are a strange thing.
- How on earth do you maintain a patchset of over a hundred patches without something like quilt? I guess you always have to apply them in a for loop on your source directory and then you create a copy of that to implement your modifications and create another patch. I'm pretty sure eight years ago Fedora was far away from using git so I would rule out patch branches in a VCS for the moment. Not sure what they invented inside RedHat to keep track of it.
If the bug title of
With
Debian's latest round of angry mailing list threads have been about some
combination of init systems, future direction and project governance.
The details aren't particularly important here, and pretty much everything
worthwhile in favour of or against each position has already been said several
times, but I think this bit is important enough that it bears repeating:
the reason I voted "we didn't need this General Resolution" ahead
of the other options is that I hope we can continue to use our normal
technical and decision-making processes to make Debian 8 the best possible
OS distribution for everyone. That includes people who like systemd,
people who dislike systemd, people who don't care either way and just
want the OS to work, and everyone in between those extremes.
I think that works best when we do things, and least well when a lot
of time and energy get diverted into talking about doing things.
I've been trying to do my small part of the former by
This is a reply to Josselin Mouette's blog article
I first want to clarify for the people not intimately involved with Debian that
Wednesday 1:
This is an update of