[OpenAFS-devel] [PATCH] change OpenAFS-1.2.10 SRPM to work better with RedHat
David Howells
dhowells@redhat.com
Fri, 15 Aug 2003 16:25:04 +0100
> > The changes that this patch makes are:
> >
> > (1) The only kernel modules built are all appropriate to the
> > currently running kernel version and the target CPU specified
> > on the command line.
>
> I like everything but this. Right now I can build modules for multiple
> kernels on one box by firing off the rpm build and coming back later
> when then are all built. Of course I must have all of the
> kernel-source RPMs installed, and I do.
Hmmm...
It would be quite easy to make it so that the kernel version being built for
is not the one running, I think.
The whole "what kernel?" question is resolved in the first few lines of the
revised spec file by the following:
%define krpmvers %(rpm -q --whatprovides kernel | sort | tail -1)
Actually, I got that wrong - it's not the "running kernel" but the "latest
installed version" that gets used.
If this line is changed to the following four:
%define krpmvers_on_cmdline %{?krpmvers:1}%{!?krpmvers:0}
%if !%{krpmvers_on_cmdline}
%define krpmvers %(rpm -q --whatprovides kernel | sort | tail -1)
%endif
Then the kernel to build for can also be specified on the command line, and
should build provided the appropriate sources are available:
rpmbuild -bb \
--target=i386 \
--define "krpmvers kernel-2.4.20-1.1931.2.231.2.11.ent" \
/usr/src/redhat/SPECS/openafs.spec
Then you just need a shell script to go through the list of installed kernels
and build them all:
#!/bin/sh
rpm -q --whatprovides kernel |
sed -e 's/^kernel[a-z-]*-/kernel-/' |
sort -u |
while read krpmvers
do
for cpu in i686 athlon
do
rpmbuild -bb \
--target=$cpu \
--define "krpmvers $krpmvers" \
/usr/src/redhat/SPECS/openafs.spec
done
done
And you only need one set of userspace RPMs and one source RPM:
rpmbuild -ba --target i386 /usr/src/redhat/SPECS/openafs.spec
> I would prefer that we still be able to build this way, since I (at
> least) do not have a build farm running each kernel,
Our build farm (I think) only runs the latest version of the kernel for any
given distribution.
> but I still need to provide kernel modules to allow for AFS to run on any of
> the kernels for a given Red Hat version.
That's a _lot_ of kernels from where I sit.
David