# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
# increment this if you have made a change that should force a new kernel
-# to build built
-BUILD_GEN=1
+# to build built for this distribution (only -- if you want to force a kernel
+# build on all distributions, update the BUILD_GEN variable in build/lbuild)
+BUILD_GEN+=".0"
-DEVEL_KERNEL_TYPE="source"
+source ${0%/*}/lbuild-sles
-prepare_and_build_srpm() {
-
- pushd $TOPDIR >/dev/null
- # seems there is a bug (on Ubuntu at least) where all of the .specs
- # are not put into SPECS
- mv SOURCES/*.spec SPECS/
-
- # generate our buildid
- local buildid="lustre${EXTRA_VERSION##*_lustre}"
+edit_specs() {
# edit the SPECs with our changes
local spec
for spec in $RPMSMPTYPE source; do
- #cp $TOPDIR/SPECS/kernel-$spec.spec{,.orig}
- sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
- -e "s/^Release:.*/&_${buildid}/" \
- -e "/^Provides: *kernel = /a\
-Provides: kernel-$spec = %{version}-%{release}
-" \
+ #cp $TOPDIR/SOURCES/kernel-$spec.spec{,.orig}
+ sed -i -e "s/^\(Release: *\).*$/\1${lnxrel}_${buildid}/" \
-e "s/^ExclusiveArch:.*/& ppc ppc64/" \
- -e '/^# Apply the patches needed for this architecture\./a\
-cp %_sourcedir/linux-2.6.16-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
+ -e '/^%setup /a\
+cp %_sourcedir/linux-2.6.27-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
-e "/flavor=\${config/a\
[ \"\$flavor\" == \"$RPMSMPTYPE\" ] || continue" \
- -e 's/\(.*\)\([^#].*\)fookernel-source/\1\2kernel-lustre-source/g' \
- -e '/^%build/,/^%changelog/s/kernel-\({*\)source/kernel-\1lustre-source/g' \
- SPECS/kernel-${spec}.spec
-
- # XXX - a building-on-Ubuntu hack
- if grep -q "Ubuntu" /etc/issue; then
- sed -i -e '/^%_sourcedir\/install-configs %_sourcedir .*/i\
+ -e "s/^\(BuildRequires: kernel-dummy\)/# \1/" \
+ SOURCES/kernel-${spec}.spec || \
+ fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
+
+ if $KERNEL_LUSTRE_NAMING; then
+ # these are all of the changes needed because we change the package names
+ # to kernel-lustre-*. these should all go away when we stop this insanity
+ sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
+ -e "/^Provides: *kernel = /a\
+Provides: kernel-$spec = %{version}-%{release}
+" \
+ -e 's/^\([ ][ ]*-i %_builddir\/kernel-\)\(source-2.6.27.21\/\$patch; then\)/\1lustre-\2/' \
+ -e '/^%build/,/^%changelog/s/\(kernel-\)\(source\.files\)/\1lustre-\2/g' \
+ -e '/--no-backup-if-mismatch/,/fi/s/kernel-source-/kernel-lustre-source-/g' \
+ -e "s/^\(%package -n kernel-\)\(.*\)/\1lustre-\2/" \
+ -e "s/^\(%description -n kernel-\)\(.*\)/\1lustre-\2/" \
+ -e "s/^\(%files -n kernel-\)\(.*\)/\1lustre-\2/" \
+ -e "s/^\(Provides:.*kernel-\)\(.*\)/\1lustre-\2/" \
+ -e "s/^\(Requires:.*kernel-\)\(.*\)/\1lustre-\2/" \
+ -e "s/^\(Supplements:.*kernel-\)\(.*\)/\1lustre-\2/" \
+ SOURCES/kernel-${spec}.spec || \
+ fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
+ fi
+
+ # XXX - a building-on-Ubuntu hack
+ if grep -q "Ubuntu" /etc/issue; then
+ sed -i -e '/^%_sourcedir\/install-configs %_sourcedir .*/i\
curl ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17/2.6.17-mm1/broken-out/i386-use-c-code-for-current_thread_info.patch | patch -p1' \
- -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
- -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
- -e 's/ -a 109//' \
- SPECS/kernel-${spec}.spec
- fi
-done
-
- # XXX - need to flesh this out per the rhel5 method
- local targets
- for arch in $BUILD_ARCHS; do
- targets="--target $arch $targets"
- mkdir -p config/$(basearch $arch)
- cp $CONFIG_FILE config/$(basearch $arch)/$RPMSMPTYPE
+ -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
+ -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
+ -e 's/ -a 109//' \
+ SOURCES/kernel-${spec}.spec || \
+ fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
+ fi
done
+}
- tar cjf SOURCES/config.tar.bz2 config
- rm -rf config
+unpack_linux_devel_rpm-sles11() {
+ local callers_rpm="$1"
- # do we need any special rpm build options
- local rpmbuildopt="-bb"
- if $DO_SRC; then
- rpmbuildopt="-ba"
- fi
+ local rpmdir="${callers_rpm%/*}"
- # XXX - ignore the kabi changes. need to figure out what this is really
- # all about.
- touch SOURCES/IGNORE-KABI-BADNESS
+ local kernelrpm
+ local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}"
+ # this is a hack that should go away when the modified lustre kernel
+ # Provides kernel-default-base vvvvvvvvv
+ if ! kernelrpm=$(find_rpm "$rpmdir" provides "^kernel-(lustre-)?default-base = $wanted_kernel"); then
+ fatal 1 "Could not find the kernel-default-base in $rpmdir/"
+ fi
-# XXX temp speedup hack
-#if false; then
- # now build it
- if ! $RPMBUILD $rpmbuildopt $targets \
- --define "_topdir $TOPDIR" \
- $TOPDIR/SPECS/kernel-$RPMSMPTYPE.spec >&2; then
- fatal 1 "Failed to build kernel RPM"
+ if ! rpm2cpio < "$rpmdir/$kernelrpm" | cpio -id > /dev/null 2>&1; then
+ fatal 1 "Unpack error for $kernelrpm"
fi
-#fi
- # for SLES10, we also need to build the kernel-source rpm
- if ! $RPMBUILD $rpmbuildopt $targets \
- --define "_topdir $TOPDIR" \
- $TOPDIR/SPECS/kernel-source.spec >&2; then
- fatal 1 "Failed to build kernel source RPM"
+ if ! kernelrpm=$(find_rpm "$rpmdir" provides "^kernel-(lustre-)?default-devel = $wanted_kernel"); then
+ fatal 1 "Could not find the kernel-default-devel in $rpmdir/"
+ fi
+
+ if ! rpm2cpio < "$rpmdir/$kernelrpm" | cpio -id > /dev/null 2>&1; then
+ fatal 1 "Unpack error for $kernelrpm"
fi
}
-devel_kernel_name() {
- local lustre=${1:-false}
+find_linux_rpm-sles11() {
+ local prefix="$1"
+ local wanted_kernel="$2"
+ local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
- if $lustre; then
- echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
- else
- echo "kernel-$DEVEL_KERNEL_TYPE"
- fi
+ # what, oh what, do we do for sles11?
+ # if anyone knows how we get an arbitrary (kernel-source and
+ # kernel-default-base in this case) from the Suse update mechanism,
+ # please feel free to fix this
-}
+ fatal 1 "I don't know how to get packages for SLES11"
-rpm_BUILD_kernel_dirname() {
- local rpmsmptype="$1"
- local lnxmaj="$2"
- local lnxmin="$3"
- local arch="$4"
+ return 0
- echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
}