X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=build%2Flbuild;h=d4409dc374525c140e927d313d4caa5040c284d3;hp=88e650c536b107faa7143ebd692d6b8b0ad9c9b9;hb=eea0b5248b5c08acb1a20f47f40bc5672db62dd4;hpb=a44ad7646d729964369df9a0ca79d687f251618d diff --git a/build/lbuild b/build/lbuild index 88e650c..d4409dc 100755 --- a/build/lbuild +++ b/build/lbuild @@ -16,7 +16,7 @@ RELEASE=false # search through this file (and lbuild.old_school -- but that will # be going away soon) for "-bb" and see how many places # simply don't account for this option -DO_SRC=false +DO_SRC=true DOWNLOAD=true TAG= CANONICAL_TARGET= @@ -46,6 +46,8 @@ XEN=false LINUXOBJ= DISTRO= KERNELTREE= +# default to not adding -lustre- into the kernel RPM package names +KERNEL_LUSTRE_NAMING=false # patchless build KERNELRPMSBASE= @@ -279,6 +281,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" ;; @@ -752,6 +757,11 @@ skeep_ldiskfs_rpm() { [[ $tag == $skiptag ]] && skip=true && break done fi + + pushd $TOPDIR/BUILD/lustre-[1-9]* >/dev/null + grep -q '^SERVER_TRUE[ \t]=[ \t]#$' autoMakefile && skip=true + popd >/dev/null + echo $skip } @@ -780,6 +790,10 @@ set_rpm_smp_type() { [ $infact_arch == $smp_type ] && RPMSMPTYPE=bigsmp && break done + for smp_type in $DEFAULT_ARCHS; do + [ $infact_arch == $smp_type ] && RPMSMPTYPE=default && break + done + } # This function takes a linux source pool and digs out the linux release @@ -796,6 +810,8 @@ find_linux_release() { } +# XXX this needs to be re-written as a wrapper around find_rpm +# or just gotten rid of. :-) find_linux_rpm() { local prefix="$1" local delimiter=${2:-"-"} @@ -830,7 +846,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 @@ -838,17 +854,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 "$kernelrpm" + 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#.}-}" @@ -885,9 +920,6 @@ unpack_linux_rpm() { RC=255 fi fi - else - RC=255 - fi popd return $RC } @@ -915,7 +947,7 @@ build_kernel_ib() { --define "KVERSION ${LINUXRELEASE}" \ --define "$K_SRC ${LINUXOBJ:-${LINUX}}" \ --define "LIB_MOD_DIR /lib/modules/${LINUXRELEASE}/updates" \ - --define "configure_options --without-quilt --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-srp-target-mod --with-core-mod --with-mthca-mod --with-mlx4-mod --with-cxgb3-mod --with-nes-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --without-srp-target-mod --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" ${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm + --define "configure_options --without-quilt --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-srp-target-mod --with-core-mod --with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-cxgb3-mod --with-nes-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" ${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm if [ ${PIPESTATUS[0]} != 0 ]; then fatal 1 "Error building kernel-ib" @@ -937,6 +969,11 @@ store_for_reuse() { location="$location"/"$signature"/"$module" mkdir -p "$location" + # the cleanup script removes any directory that doesn't have a + # .lastused, so let's try to prevent that as soon as we can + # this solution still slightly racy with the cleanup script + # but the race is a lot tighter now + touch -t 197001010000 "$location/.lastused" ## use eval/echo here to make sure shell expansions are performed #if ! cp -a${linkflag} $(eval echo $articles) "$location"; then local article @@ -1043,7 +1080,7 @@ find_rpm() { fatal 1 "Unable to chdir to directory \"$dir\" in find_rpm()" local file - for file in $(ls); do + for file in $(ls *.rpm); do if [ ! -f "$file" ]; then continue fi @@ -1075,7 +1112,7 @@ build_kernel_with_srpm() { # get an md5sum of the kernel patch + config for reuse check # XXX really, there needs to be a signature and a CONFIG_FILE per arch # in BUILD_ARCHS - local REUSE_SIGNATURE=$((echo $BUILD_GEN; cat $CONFIG_FILE $TARGET_FILE $FULL_PATCH) | md5sum | cut -d" " -f1) + local REUSE_SIGNATURE=$({ echo $BUILD_GEN; cat $CONFIG_FILE $TARGET_FILE $FULL_PATCH; } | md5sum | cut -d" " -f1) # see if we can link to the reuse pool # XXX - hrm. i'm not convinced this doesn't belong in the reuse "library" @@ -1089,29 +1126,23 @@ build_kernel_with_srpm() { # the extra version string to use for the kernel (which might be a reused # kernel, remember) local kernel_extra_version="" - if $REUSERPM && reuse kernel "$TOPDIR" "$CAN_LINK_FOR_REUSE" \ - "$REUSE_SIGNATURE"; then - # figure out the EXTRA_VERSION of the kernel we are re-using - local KERNEL_RPM - if ! KERNEL_RPM=$(find_rpm "$TOPDIR/RPMS/$TARGET_ARCH/" provides "^kernel ="); then - fatal 1 "Failed to find a kernel RPM in $TOPDIR/RPMS/$TARGET_ARCH/" - fi - kernel_extra_version=$(rpm -q --queryformat "%{RELEASE}" -p $TOPDIR/RPMS/$TARGET_ARCH/$KERNEL_RPM) - else + if $REUSERPM && ! reuse kernel "$TOPDIR" "$CAN_LINK_FOR_REUSE" \ + "$REUSE_SIGNATURE"; then # nothing cached, build from scratch if [ ! -r "$KERNELDIR/$KERNEL_SRPM" ]; then - download_srpm "$CANONICAL_TARGET" "$KERNEL_SRPM" + download_srpm "$CANONICAL_TARGET" "$KERNEL_SRPM" >&2 fi - rpm -ivh $KERNELDIR/$KERNEL_SRPM --define "_topdir $TOPDIR" >&2 || { - # should we clean this up or leave it for analysis? + if ! rpm -ivh $KERNELDIR/$KERNEL_SRPM \ + --define "_topdir $TOPDIR" >&2; then + # should we clean this up or leave it for analysis? #rm -rf $RPMTOPDIR fatal 1 "Error installing kernel SRPM." - } + fi # put the Lustre kernel patch into the RPM build tree cp $FULL_PATCH $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch - prepare_and_build_srpm + prepare_and_build_srpm >&2 # store the resulting kernel RPM build tree for future use if ! store_for_reuse "$TOPDIR/{SPECS,SOURCES,BUILD,SRPMS,RPMS}" \ @@ -1121,9 +1152,15 @@ build_kernel_with_srpm() { echo "unknown" return 1 fi - kernel_extra_version=$EXTRA_VERSION fi # build reuse + # figure out the EXTRA_VERSION of the kernel we built or are re-using + local KERNEL_RPM + if ! KERNEL_RPM=$(find_rpm "$TOPDIR/RPMS/$TARGET_ARCH/" provides "^kernel ="); then + fatal 1 "Failed to find a kernel RPM in $TOPDIR/RPMS/$TARGET_ARCH/" + fi + kernel_extra_version=$(rpm -q --queryformat "%{RELEASE}" -p $TOPDIR/RPMS/$TARGET_ARCH/$KERNEL_RPM) + # should now have the following RPMs # $TOPDIR/RPMS/$arch/kernel-lustre-2.6.18-53.1.21.el5_lustre.1.6.5.1.$arch.rpm # $TOPDIR/RPMS/$arch/kernel-lustre-devel-2.6.18-53.1.21.el5_lustre.1.6.5.1.$arch.rpm @@ -1147,14 +1184,14 @@ build_with_srpm() { for arch in $BUILD_ARCHS; do local kernel_devel_rpm - if ! kernel_devel_rpm=$(find_rpm "$TOPDIR/RPMS/$arch/" provides "^$(devel_kernel_name true) ="); then + if ! kernel_devel_rpm=$(find_rpm "$TOPDIR/RPMS/$arch/" provides "^$(devel_kernel_name $KERNEL_LUSTRE_NAMING) ="); then fatal 1 "Failed to find a kernel development RPM in $TOPDIR/RPMS/$arch/" fi # 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 @@ -1166,7 +1203,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 @@ -1249,12 +1286,15 @@ build_with_srpm() { create_rpmbuild_dirs() { - if [ ! -d RPMS ]; then - mkdir -p RPMS - for arch in $BUILD_ARCHS; do - mkdir RPMS/$arch - done - fi + [ -d RPMS ] || mkdir RPMS + for arch in $BUILD_ARCHS; do + if [[ $arch = i?86 ]]; then + # some stupidity in the sles11 kernel spec requires an RPMS/i386 + # even if the target arch is i686 + [ -d RPMS/i386 ] || mkdir RPMS/i386 + fi + [ -d RPMS/$arch ] || mkdir RPMS/$arch + done [ -d BUILD ] || mkdir BUILD [ -d SOURCES ] || mkdir SOURCES [ -d SPECS ] || mkdir SPECS