X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=contrib%2Flbuild%2Flbuild-rhel;h=8611f195e2fb82ceb23458dbd9cf9238f1aaa83e;hb=1aae733c16161513b07d7f8cc046299e2de5aad3;hp=8f2027089572af74363add18590bfa0ad4fe57c2;hpb=71d2ea0fde17ecde0bf237f486d4bafb5d54fe3f;p=fs%2Flustre-release.git diff --git a/contrib/lbuild/lbuild-rhel b/contrib/lbuild/lbuild-rhel index 8f20270..8611f19 100644 --- a/contrib/lbuild/lbuild-rhel +++ b/contrib/lbuild/lbuild-rhel @@ -6,7 +6,8 @@ # in build/lbuild) #BUILD_GEN+=".0" #BUILD_GEN+=".1" # refactor both rhel5 and rhel6 -BUILD_GEN+=".0" # TT-107: don't cache the BUILD dir (reset major to 5) +#BUILD_GEN+=".0" # TT-107: don't cache the BUILD dir (reset major to 5) +BUILD_GEN+=".2" # LU-9850 DEVEL_KERNEL_TYPE="devel" RPM_HELPERS_DIR="/usr/lib/rpm/redhat" @@ -21,7 +22,11 @@ get_rpmbuildopts() { # patching common to all releases patch_spec_common() { - sed -i -e '/find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\ + sed -i -e '/Provides: kernel-uname-r =/a\ +Provides: kernel-lustre = %{KVRA}%{?1:.%{1}}\\' \ + -e '/Provides: kernel-devel-uname-r =/a\ +Provides: kernel-devel-lustre = %{KVRA}%{?1:.%{1}}\\' \ + -e '/find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\ cp -a fs/ext3/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext3 \ cp -a fs/ext4/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4' \ SPECS/$SPEC_NAME 2>&1 || \ @@ -36,51 +41,33 @@ patch_spec_common() { fatal 1 "Error while editing SPECS/$SPEC_NAME" fi - } prepare_and_build_srpm() { - pushd $TOPDIR >/dev/null - - # create the buildid - local buildid="_lustre${EXTRA_VERSION##*_lustre}" - - # edit the SPEC with our changes - patch_spec - - popd >/dev/null - - # this concept of being able to build a list of targets with a single - # lbuild is a fine idea, but in reality I think it's (very) broken. I - # don't even think the lustre.spec can handle being called with "--target - # ". It certainly can't handle the issue where each - # arch has it's own kernel location. - # but we will do the best we can and put the plumbing in place so that - # this could work when the other broken bits are fixed. - # in reality, our current use of lbuild only ever has a single arch in - # $BUILD_ARCHS - local arch - local targets="" - for arch in $BUILD_ARCHS; do - # XXX - ok. so here's a hack that needs to be fixed properly - # ppc64 was merged to ppc some time ago pre 2.6.18 - if [ $arch = ppc64 ]; then - arch=ppc - fi - targets="--target $arch $targets" - # copy our .config into the RPM build tree - (echo "# $(basearch $arch)"; cat $CONFIG_FILE) > \ - SOURCES/kernel-$lnxmaj-$arch.config - - # XXX - hackity hack -- until we get (or generate from the base - # config) configs for xen and debug - local f="" - for f in SOURCES/kernel-${lnxmaj}-*.config; do - grep -q "^CONFIG_SD_IOSTATS=y" $f || \ - echo "CONFIG_SD_IOSTATS=y" >> $f - done - done + pushd $TOPDIR >/dev/null + # create the buildid + if $ENABLE_KERNEL_DEBUG; then + local buildid="_lustre_debug${EXTRA_VERSION##*_lustre}" + else + local buildid="_lustre${EXTRA_VERSION##*_lustre}" + fi + + # edit the SPEC with our changes + patch_spec + popd >/dev/null + + # copy our .config into the RPM build tree + (echo "# $(basearch ${TARGET_ARCH})"; cat $CONFIG_FILE) > \ + SOURCES/kernel-$lnxmaj-${TARGET_ARCH}.config + + # XXX - hackity hack -- until we get (or generate from the base + # config) configs for xen and debug + local f="" + for f in SOURCES/kernel-${lnxmaj}-*.config; do + grep -q "^CONFIG_SD_IOSTATS=y" $f || \ + echo "CONFIG_SD_IOSTATS=y" >> $f + done # do we need any special rpm build options local rpmbuildopt="-bb" @@ -101,19 +88,19 @@ prepare_and_build_srpm() { # get any release specific build options rpmbuildopt="$rpmbuildopt $(get_rpmbuildopts)" - # now build it - if ! eval rpmbuild $rpmbuildopt $targets --with baseonly \ - --define \"_topdir $TOPDIR\" \ - --define \"buildid $buildid\" \ - --define \"_tmppath $TMPDIR\" \ - $TOPDIR/SPECS/$SPEC_NAME 2>&1; then - return 1 - fi + # now build it + if ! eval rpmbuild $rpmbuildopt --target ${TARGET_ARCH} --with baseonly \ + --define \"_topdir $TOPDIR\" \ + ${buildid:+--define \"buildid $buildid\"} \ + --define \"_tmppath $TMPDIR\" \ + $TOPDIR/SPECS/$SPEC_NAME 2>&1; then + return 1 + fi # for informative purposes, display a diff between the .config that # was actually built and what we proposed as a .config echo "Diffs between $(basename $CONFIG_FILE) and the built kernel's .config:" - local rpmname="$TOPDIR/RPMS/${BUILD_ARCHS# }/kernel-${lnxmaj}-${lnxrel}${buildid}.${BUILD_ARCHS# }.rpm" + local rpmname="$TOPDIR/RPMS/${TARGET_ARCH}/kernel-${lnxmaj}-${lnxrel}${buildid}.${TARGET_ARCH}.rpm" rpmcfg=$(rpm -qpl $rpmname | grep '/boot/config-') rpm2cpio $rpmname | cpio -id .$rpmcfg diff -u $CONFIG_FILE .$rpmcfg