Whamcloud - gitweb
Branch b1_8
authoryangsheng <yangsheng>
Mon, 25 May 2009 14:55:33 +0000 (14:55 +0000)
committeryangsheng <yangsheng>
Mon, 25 May 2009 14:55:33 +0000 (14:55 +0000)
b=18668

i=johann, girish, brian

SLES11 support patches.

build/lbuild
build/lbuild-sles [new file with mode: 0644]
build/lbuild-sles10
build/lbuild-sles11
build/lbuild.old_school
ldiskfs/configure.ac

index 18665ad..9b8d965 100755 (executable)
@@ -279,6 +279,9 @@ check_options() {
         2.6-sles10)
             CANONICAL_TARGET="sles10-2.6"
             ;;
+        2.6-sles11)
+            CANONICAL_TARGET="sles11"
+            ;;
         hp_pnnl-2.4)
             CANONICAL_TARGET="hp-pnnl-2.4"
             ;;
@@ -834,7 +837,7 @@ find_linux_rpm() {
 # needs to completely refactored.  It completely ingores that $BUILD_ARCHS may
 # contain a list of arches for which rpmbuild commands (including the one for
 # lustre itself)
-unpack_linux_rpm() {
+unpack_linux_devel_rpm() {
     local kernelrpm="${1}"
     # it's worth noting that neither sles10 nor rhel5 appear to use their
     # extra_version delimiter for the dirname under /usr/src, so we could
@@ -842,17 +845,36 @@ unpack_linux_rpm() {
     local delimiter=${2:-"-"}
 
     [ -f "$kernelrpm" ] || return 255
-    [ -d $TOPDIR/reused ] || mkdir $TOPDIR/reused
+    [ -d $TOPDIR/reused ] || mkdir $TOPDIR/reused || return 255
 
     pushd $TOPDIR/reused || return 255
 
+    if ! rpm2cpio < "$kernelrpm" | cpio -id > /dev/null 2>&1; then
+        return 255
+    fi
+
+    # call a distro specific hook, if available
+    if type -p unpack_linux_devel_rpm-$DISTRO; then
+        unpack_linux_devel_rpm-$DISTRO
+    fi
+
+    popd
+
+    find_linux_devel_paths $TOPDIR/reused
+
+    return 0
+
+}
+
+# XXX - this rhel/sles goop needs abstracting out into the
+#       lbuild-{rhel5,sles10} method files
+find_linux_devel_paths() {
+    local path="$1"
+
     local RC=0
 
-    rpm2cpio < "$kernelrpm" | cpio -id > /dev/null 2>&1
-    if [ ${PIPESTATUS[0]} -eq 0 ]; then
+    pushd $path
         # RHEL-style and SLES-style rpms
-        # XXX - this rhel/sles goop needs abstracting out into the
-        #       lbuild-{rhel5,sles10} method files
         # XXX - until bug 19336 cleans this up, we need to extricate the
         #       ${lnxmin}- from the $lnxrel
         local paths="kernels/${lnxmaj}${lnxmin}${delimiter}${lnxrel}-${TARGET_ARCH} linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}"
@@ -889,9 +911,6 @@ unpack_linux_rpm() {
                 RC=255
             fi
         fi
-    else
-        RC=255
-    fi
     popd
     return $RC
 }
@@ -1158,7 +1177,7 @@ build_with_srpm() {
             # install the -devel RPM in preparation for the lustre build
             # note that the EXTRA_VERSION_DELIMITER is *NOT* used in the
             # version of the directory name under /usr/src
-            if ! lnxrel="$kernel_extra_version" unpack_linux_rpm \
+            if ! lnxrel="$kernel_extra_version" unpack_linux_devel_rpm \
                            "$TOPDIR/RPMS/$arch/$kernel_devel_rpm" "-"; then
                 fatal 1 "Could not find the Linux tree in $TOPDIR/RPMS/$arch/$kernel_devel_rpm"
             fi
@@ -1170,7 +1189,7 @@ build_with_srpm() {
         if ! kernelrpm=$(find_linux_rpm "-$DEVEL_KERNEL_TYPE" ${EXTRA_VERSION_DELIMITER:-"-"}); then
             fatal 1 "Could not find the kernel-$DEVEL_KERNEL_TYPE RPM in ${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}"
         fi
-        if ! lnxrel="$lnxrel" unpack_linux_rpm "$kernelrpm" "-"; then
+        if ! lnxrel="$lnxrel" unpack_linux_devel_rpm "$kernelrpm" "-"; then
             fatal 1 "Could not find the Linux tree in $kernelrpm"
         fi
     fi
diff --git a/build/lbuild-sles b/build/lbuild-sles
new file mode 100644 (file)
index 0000000..5b97064
--- /dev/null
@@ -0,0 +1,79 @@
+# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
+
+DEVEL_KERNEL_TYPE="source"
+
+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}"
+
+    # do release specific spec editing
+    edit_specs
+
+    # 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
+    done
+
+    tar cjf SOURCES/config.tar.bz2 config
+    rm -rf config
+
+    # do we need any special rpm build options
+    local rpmbuildopt="-bb"
+    if $DO_SRC; then
+        rpmbuildopt="-ba"
+    fi
+
+    # XXX - ignore the kabi changes.  need to figure out what this is really
+    #       all about.
+    touch SOURCES/IGNORE-KABI-BADNESS
+
+
+# XXX testing speedup hack - never let an inspection pass without this
+#     commented out!  in fact it should be removed completely before a
+#     landing.
+#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"
+    fi
+#fi
+
+    # for SLES, 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"
+    fi
+
+}
+
+devel_kernel_name() {
+    local lustre=${1:-false}
+
+    if $lustre; then
+        echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
+    else
+        echo "kernel-$DEVEL_KERNEL_TYPE"
+    fi
+
+}
+
+rpm_BUILD_kernel_dirname() {
+    local rpmsmptype="$1"
+    local lnxmaj="$2"
+    local lnxmin="$3"
+    local arch="$4"
+
+    echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
+}
index ca1ca79..d2296e0 100644 (file)
@@ -4,17 +4,9 @@
 # to build built
 BUILD_GEN=1
 
-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
@@ -44,65 +36,5 @@ curl ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17/2.6.17
                -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
     done
-
-    tar cjf SOURCES/config.tar.bz2 config
-    rm -rf config
-
-    # do we need any special rpm build options
-    local rpmbuildopt="-bb"
-    if $DO_SRC; then
-        rpmbuildopt="-ba"
-    fi
-
-    # XXX - ignore the kabi changes.  need to figure out what this is really
-    #       all about.
-    touch SOURCES/IGNORE-KABI-BADNESS
-
-
-# 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"
-    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"
-    fi
-
-}
-
-devel_kernel_name() {
-    local lustre=${1:-false}
-
-    if $lustre; then
-        echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
-    else
-        echo "kernel-$DEVEL_KERNEL_TYPE"
-    fi
-
-}
-
-rpm_BUILD_kernel_dirname() {
-    local rpmsmptype="$1"
-    local lnxmaj="$2"
-    local lnxmin="$3"
-    local arch="$4"
-
-    echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
 }
index ca1ca79..995c356 100644 (file)
 # to build built
 BUILD_GEN=1
 
-DEVEL_KERNEL_TYPE="source"
+source ${0%/*}/lbuild-sles
 
-prepare_and_build_srpm() {
+# this is what lnxrel really should be, once bug 19336 lands
+real_lnxrel=${lnxrel##${lnxmin#.}-}
 
-    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 "s/^\(Release: *\).*$/\1${real_lnxrel}_${buildid}/" \
                -e "/^Provides:  *kernel = /a\
 Provides:       kernel-$spec = %{version}-%{release}
 " \
                -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' \
+               -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 "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/" \
+               -e "s/^\(BuildRequires:  kernel-dummy\)/# \1/" \
           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\
+        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
-    done
-
-    tar cjf SOURCES/config.tar.bz2 config
-    rm -rf config
-
-    # do we need any special rpm build options
-    local rpmbuildopt="-bb"
-    if $DO_SRC; then
-        rpmbuildopt="-ba"
+                   -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
+                   -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
+                   -e 's/ -a 109//' \
+              SPECS/kernel-${spec}.spec
     fi
+    done
+}
 
-    # XXX - ignore the kabi changes.  need to figure out what this is really
-    #       all about.
-    touch SOURCES/IGNORE-KABI-BADNESS
-
-
-# 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"
+unpack_linux_devel_rpm-sles11() {
+    local kernelrpm
+    if ! kernelrpm=$(find_rpm "$TOPDIR/RPMS/$arch/" provides "^kernel-lustre-default-base ="); then
+        fatal 1 "Could not find the kernel-lustre-default-base in $TOPDIR/RPMS/$arch/"
     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 ! rpm2cpio < "$TOPDIR/RPMS/$arch/$kernelrpm" | cpio -id > /dev/null 2>&1; then
+        fatal 1 "Unpack error for $kernelrpm"
     fi
 
 }
 
-devel_kernel_name() {
-    local lustre=${1:-false}
+# this is actually valid for sles10 and sles11 but let's test it on sles11 only, first
+find_linux_devel_paths() {
+    local path="$1"
 
-    if $lustre; then
-        echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
-    else
-        echo "kernel-$DEVEL_KERNEL_TYPE"
-    fi
+    LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}
 
-}
+    local objects=$TARGET_ARCH/$RPMSMPTYPE
+    if [ -d $path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/powerpc ]; then
+        objects="powerpc/$TARGET_ARCH"
+    elif [ $TARGET_ARCH == 'i686' ]; then
+        objects="i386/$RPMSMPTYPE"
+    fi
 
-rpm_BUILD_kernel_dirname() {
-    local rpmsmptype="$1"
-    local lnxmaj="$2"
-    local lnxmin="$3"
-    local arch="$4"
+    LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/$objects
 
-    echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
+    LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX})
+    if [ -z "$LINUXRELEASE" ]; then
+        echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}"
+        RC=255
+    fi
 }
index fcb4ddb..d36861b 100644 (file)
@@ -533,7 +533,7 @@ patchless_build_sequence() {
     TARGET_ARCH=$(rpm -q --queryformat "%{ARCH}" -p "$kernel_devel_rpm")
     BUILD_ARCHS="$TARGET_ARCH"
 
-    unpack_linux_rpm "$kernel_devel_rpm" "$delimiter" && rpmfound=true
+    unpack_linux_devel_rpm "$kernel_devel_rpm" "$delimiter" && rpmfound=true
 
     [ -d SRPMS ] || mkdir SRPMS
     [ -d RPMS ] || mkdir RPMS
index a57aa75..1102b81 100644 (file)
@@ -92,12 +92,20 @@ LB_DEFINE_LDISKFS_OPTIONS
 
 AC_MSG_CHECKING([whether to build ldisk based on ext4])
 AC_ARG_ENABLE([ext4],
-             AC_HELP_STRING([--enable-ext4],
-                            [enable building of ldiskfs based on ext4]),
+             AC_HELP_STRING([--disable-ext4],
+                            [enable building of ldiskfs based on ext4]),[],
                             [LC_KERNEL_WITH_EXT4([enable_ext4='yes'],
-                            [enable_ext4='no'])],[])
+                            [enable_ext4='no'])])
 AC_MSG_RESULT([$enable_ext4])
 
+# Remove this part when RHEL5 ext4 patches landed.
+case $LINUXRELEASE in
+2.6.18*) if test x$RHEL_KENEL = xyes; then
+        enable_ext4=no
+        fi
+;;
+esac
+
 if test x$enable_ext4 = xyes ; then
         AC_DEFINE(HAVE_EXT4_LDISKFS, 1, [ldiskfs based on ext4])
         BACKFS=ext4