Whamcloud - gitweb
b=23185 use resolve_arch() in the test too
[fs/lustre-release.git] / build / lbuild-sles10
index a35607d..d278e06 100644 (file)
@@ -3,7 +3,8 @@
 # increment this if you have made a change that should force a new kernel
 # to build built
 #BUILD_GEN=1
-BUILD_GEN=2    # bz19952: remove -lustre tag from kernel RPM names
+#BUILD_GEN=2   # bz19952: remove -lustre tag from kernel RPM names
+BUILD_GEN=3    # bz19975 enable the building of src.rpms by default
 
 source ${0%/*}/lbuild-sles
 
@@ -12,7 +13,7 @@ edit_specs() {
     # edit the SPECs with our changes
     local spec
     for spec in $RPMSMPTYPE source; do
-        #cp $TOPDIR/SPECS/kernel-$spec.spec{,.orig}
+        #cp $TOPDIR/SOURCES/kernel-$spec.spec{,.orig}
         sed -i -e "s/^Release:.*/&_${buildid}/" \
                -e "s/^ExclusiveArch:.*/& ppc ppc64/" \
                -e '/^# Apply the patches needed for this architecture\./a\
@@ -20,7 +21,7 @@ cp  %_sourcedir/linux-2.6.16-lustre.patch %_builddir/%{name}-%{version}/lustre.p
 ! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
                -e "/flavor=\${config/a\
     [ \"\$flavor\" == \"$RPMSMPTYPE\" ] || continue" \
-          SPECS/kernel-${spec}.spec
+          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
@@ -31,7 +32,7 @@ Provides:       kernel-$spec = %{version}-%{release}
 " \
                    -e 's/\(.*\)\([^#].*\)fookernel-source/\1\2kernel-lustre-source/g' \
                    -e '/^%build/,/^%changelog/s/kernel-\({*\)source/kernel-\1lustre-source/g' \
-              SPECS/kernel-${spec}.spec
+              SOURCES/kernel-${spec}.spec || fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
         fi
 
     # XXX - a building-on-Ubuntu hack
@@ -41,7 +42,30 @@ curl ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17/2.6.17
                -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
                -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
                -e 's/ -a 109//' \
-          SPECS/kernel-${spec}.spec
+          SOURCES/kernel-${spec}.spec || fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
      fi
     done
 }
+
+unpack_linux_devel_rpm-sles10() {
+    local callers_rpm="$1"
+
+    # get the Module.symvers out of the kenrel-flavor RPM
+    local kernelrpm=${callers_rpm/-source-/-$RPMSMPTYPE-}
+
+    if ! rpm2cpio < "$kernelrpm" | cpio -id ./usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH)/$RPMSMPTYPE/Module.symvers ./boot/sym\* > /dev/null 2>&1; then
+        return 255
+    fi
+
+    # now just sanity check that everything needed to build properly versioned
+    # modules is in place
+    if [ ! -f usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH)/$RPMSMPTYPE/Module.symvers ]; then
+        fatal 1 "cannot build kernel modules: the Kernel's Module.symvers is missing."
+    fi
+    if [ ! -f boot/symsets-${lnxmaj}${lnxmin}-${lnxrel}-$RPMSMPTYPE.tar.gz ]; then
+        fatal 1 "cannot build modules: the Kernel's symsets is missing."
+    fi
+
+    return 0
+
+}