build/autoconf/lustre-build-linux.m4 \
build/autoconf/lustre-build-darwin.m4 \
build/autoconf/lustre-build.m4 build/rdac_spec \
- build/mptlinux.spec.patch build/patches \
- build/exit_traps.sh
+ build/mptlinux.spec.patch build/patches \
+ build/funcs.sh build/find_linux_rpms build/exit_traps.sh
rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | sed -re 's/--(en|dis)able-tests//'); \
if [ -d .git ]; then \
build/extract_patches .; \
fi
+ cat debian/patches/* | sed -ne '/^diff --git/h' -e '/^deleted file/{G;s/^.* b\/\(.*\)/\1/p;}' | xargs rm -f; \
rm -rf debs
dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
rc=$${PIPESTATUS[0]}; \
AC_MSG_RESULT([$enable_tests])
])
+# LB_CONFIG_DIST
+#
+# Just enough configure so that "make dist" is useful
+#
+# this simply re-adjusts some defaults, which of course can be overridden
+# on the configure line after the --enable-dist option
+#
+AC_DEFUN([LB_CONFIG_DIST],
+[AC_MSG_CHECKING([whether to configure just enough for make dist])
+AC_ARG_ENABLE([dist],
+ AC_HELP_STRING([--enable-dist],
+ [only configure enough for make dist]),
+ [enable_dist='yes'],[enable_dist='no'])
+AC_MSG_RESULT([$enable_dist])
+if test x$enable_dist != xno; then
+ enable_modules='no'
+ enable_utils='no'
+ enable_liblustre='no'
+ enable_doc='no'
+ enable_tests='no'
+fi
+])
+
#
# LB_CONFIG_DOCS
#
[skip creation of pdf documentation]),
[
if test x$enable_doc = xyes ; then
- ENABLE_DOC=1
+ ENABLE_DOC=1
else
ENABLE_DOC=0
fi
AC_DEFUN([LB_CONFIGURE],
[LB_CANONICAL_SYSTEM
+LB_CONFIG_DIST
+
LB_USES_DPKG
LB_LIBCFS_DIR
--- /dev/null
+#!/bin/bash
+
+# this is an alternative FD for stdout, to be used especially when we are
+# taking stdout from a function as it's return value. i.e. foo=$(bar)
+# this is a workaround until a version of bash where we can put xtrace
+# on a specific FD
+#exec 3>&1; STDOUT=3
+STDOUT=2
+
+. ${0%/find_linux_rpms}/funcs.sh
+
+TOPDIR=$PWD
+
+# same as lbuild's --kernelrpm switch
+KERNELRPMSDIR="$1"
+
+DISTRO=$(autodetect_distro)
+
+source ${0%/*}/lbuild-$DISTRO
+
+TARGET_ARCH="$(uname -m)"
+TARGET_ARCHS="$(uname -m)"
+TARGET_ARCHS_ALL="$(uname -m)"
+
+# need lnxmaj from the target file
+TARGET=$(autodetect_target "$DISTRO")
+TARGET_FILE="$TOPDIR/lustre/kernel_patches/targets/$TARGET.target"
+. "$TARGET_FILE"
+
+if ! kernelrpm=$(find_linux_rpms "-$DEVEL_KERNEL_TYPE" "$KERNELRPMSDIR"); then
+ fatal 1 "Could not find the kernel-$DEVEL_KERNEL_TYPE RPM in ${KERNELRPMSDIR}"
+fi
+
+echo "$kernelrpm"
--- /dev/null
+cleanup() {
+
+ true
+}
+
+error() {
+ local msg="$1"
+
+ [ -n "$msg" ] && echo -e "\n${0##*/}: $msg" >&$STDOUT
+
+}
+
+fatal() {
+
+ cleanup
+ error "$2"
+ exit $1
+
+}
+
+#
+# in a given directory, find the first rpm matching given requirements
+#
+find_rpm() {
+ local dir="$1"
+ local match_type="$2"
+ local match="$3"
+
+ pushd "$dir" > /dev/null || \
+ fatal 1 "Unable to chdir to directory \"$dir\" in find_rpm()"
+
+ local file
+ for file in $(ls *.rpm); do
+ if [ ! -f "$file" ]; then
+ continue
+ fi
+ case "$match_type" in
+ provides)
+ # match is any valid ERE (i.e. given to egrep) match
+ if rpm -q --provides -p "$file" 2>&$STDOUT | egrep "$match" >&$STDOUT; then
+ echo "$file"
+ popd >/dev/null
+ return 0
+ fi
+ ;;
+ *)
+ popd >/dev/null
+ fatal 1 "Unknown match type \"$match_type\" given to find_rpm()"
+ ;;
+ esac
+ done
+
+ popd >/dev/null
+ return 1
+}
+
+find_linux_rpms() {
+ local prefix="$1"
+ local pathtorpms=${2:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
+
+ local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}"
+ local kernel_rpms=$(find_linux_rpm "$prefix" "$pathtorpms")
+ # call a distro specific hook, if available
+ if type -p find_linux_rpms-$DISTRO; then
+ local rpm
+ if rpm=$(find_linux_rpms-$DISTRO "$prefix" "$wanted_kernel" "$pathtorpms"); then
+ kernel_rpms="$kernel_rpms $rpm"
+ else
+ return 255
+ fi
+ fi
+
+ echo "$kernel_rpms"
+ return 0
+
+}
+
+# a noop function which can be overridden by a distro method implementation
+resolve_arch() {
+ local arch="$1"
+
+ echo "$arch"
+}
+
+# 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 pathtorpms=${2:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
+
+ local found_rpm=""
+ local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}"
+ local ret=1
+ if [ -d "$pathtorpms" ]; then
+ local rpm
+ for rpm in $(ls ${pathtorpms}/*.$(resolve_arch $TARGET_ARCH $PATCHLESS).rpm); do
+ if rpm -q --provides -p "$rpm" 2>&$STDOUT | grep -q "kernel${prefix} = $wanted_kernel" 2>&$STDOUT; then
+ found_rpm="$rpm"
+ ret=0
+ break
+ fi
+ done
+ else
+ mkdir -p "$pathtorpms"
+ fi
+ # see above "XXX"
+ # [ -f "$found_rpm" ] && break
+ # done
+ if [ -z "$found_rpm" ]; then
+ # see if there is a distro specific way of getting the RPM
+ if type -p find_linux_rpm-$DISTRO; then
+ if found_rpm=$(find_linux_rpm-$DISTRO "$prefix" "$wanted_kernel" "$pathtorpms"); then
+ found_rpm="${pathtorpms}/$found_rpm"
+ ret=0
+ else
+ ret=${PIPESTATUS[0]}
+ fi
+ fi
+ fi
+
+ echo "$found_rpm"
+ return $ret
+
+}
+
+# autodetect used Distro
+autodetect_distro() {
+
+ local name
+ local version
+
+ if which lsb_release >/dev/null 2>&1; then
+ name="$(lsb_release -s -i)"
+ version="$(lsb_release -s -r)"
+ case "$name" in
+ "EnterpriseEnterpriseServer")
+ name="oel"
+ version="${version%%.*}"
+ ;;
+ "RedHatEnterpriseServer" | "ScientificSL" | "CentOS")
+ name="rhel"
+ version="${version%%.*}"
+ ;;
+ "SUSE LINUX")
+ name="sles"
+ ;;
+ *)
+ fatal 1 "I don't know what distro name $name and version $version is.\nEither update autodetect_distro() or use the --distro argument."
+ ;;
+ esac
+ else
+ echo "You really ought to install lsb_release for accurate distro identification"
+ # try some heuristics
+ if [ -f /etc/SuSE-release ]; then
+ name=sles
+ version=$(grep ^VERSION /etc/SuSE-release)
+ version=${version#*= }
+ elif [ -f /etc/redhat-release ]; then
+ #name=$(head -1 /etc/redhat-release)
+ name=rhel
+ version=$(echo "$distroname" |
+ sed -e 's/^[^0-9.]*//g' | sed -e 's/[ \.].*//')
+ fi
+ if [ -z "$name" -o -z "$version" ]; then
+ fatal 1 "I don't know how to determine distro type/version.\nEither update autodetect_distro() or use the --distro argument."
+ fi
+ fi
+
+ echo ${name}${version}
+ return 0
+
+}
+
+# autodetect target
+autodetect_target() {
+ local distro="$1"
+
+ local target=""
+ case ${distro} in
+ oel5) target="2.6-oel5";;
+ rhel5) target="2.6-rhel5";;
+ sles10) target="2.6-sles10";;
+ sles11) target="2.6-sles11";;
+ *) fatal 1 "I don't know what distro $distro is.\nEither update autodetect_target() or use the --target argument.";;
+ esac
+
+ echo ${target}
+ return 0
+
+}
# include the exit_traps library
. ${0%/lbuild}/exit_traps.sh
+. ${0%/lbuild}/funcs.sh
# our children should die when we do
push_exit_trap "kill -INT -$$ || true" kill_children
TAG=
CANONICAL_TARGET=
TARGET=
-TARGET_ARCH=$(uname -m)
-TARGET_ARCHS=
-TARGET_ARCHS_ALL=$TARGET_ARCH
+TARGET_ARCH="$(uname -m)"
+# change default behavior to only build for the current arch
+TARGET_ARCHS="$TARGET_ARCH"
+TARGET_ARCHS_ALL="$TARGET_ARCH"
[ "$TARGET_ARCH" = "i686" ] && TARGET_ARCHS_ALL="i686 i586 i386"
CONFIGURE_FLAGS=
EXTERNAL_PATCHES=
fi
}
-cleanup() {
-
- true
-}
-
-error() {
- local msg="$1"
-
- [ -n "$msg" ] && echo -e "\n${0##*/}: $msg" >&3
-
-}
-
-fatal() {
-
- cleanup
- error "$2"
- exit $1
-
-}
-
usage() {
cat <<EOF
Usage: ${0##*/} [OPTION]... [-- <lustre configure options>]
usage 1 "A branch/tag name must be specified with --tag when not building from a tarball."
fi
+ [ -z "$DISTRO" ] && DISTRO=$(autodetect_distro)
+
if [ -z "$LINUX" ]; then
[ "$KERNELDIR" -o "$KERNELTREE" ] || \
usage 1 "A kernel directory must be specified with --kerneldir or --kerneltree."
usage 1 "When building a snapshot, a tag name must be used."
fi
- [ "$TARGET" ] || usage 1 "A target must be specified with --target."
+ [ "$TARGET" ] || TARGET=$(autodetect_target "$DISTRO")
# TARGET_FILE="$TOPDIR/lustre/kernel_patches/targets/$TARGET.target"
# [ -r "$TARGET_FILE" ] || \
# usage 1 "Target '$TARGET' was not found."
fi
fi
- [ -z "$DISTRO" ] && DISTRO=$(autodetect_distro)
-
return 0
}
-# autodetect used Distro
-autodetect_distro() {
-
- local name
- local version
-
- if [ -f /etc/SuSE-release ]; then
- name=sles
- version=$(grep ^VERSION /etc/SuSE-release)
- version=${version#*= }
- elif [ -f /etc/redhat-release ]; then
- name=$(head -1 /etc/redhat-release)
- version=$(echo "$distroname" |
- sed -e 's/^[^0-9.]*//g' | sed -e 's/[ \.].*//')
- fi
- if [ -z "$name" -o -z "$version" ]; then
- fatal 1 "I don't know how to determine distro type/version.\nEither update autodetect_distro() or use the --distro argument"
- fi
+uniqify() {
- echo ${name}${version}
- return 0
+ echo $(echo "$*" | xargs -n 1 | sort -u)
}
-uniqify() {
+fetch_url() {
+ local url="$1"
+ local target="$2"
- echo $(echo "$*" | xargs -n 1 | sort -u)
+ local rc=0
+ if which wget >/dev/null 2>&1; then
+ if ! wget -nv "$url" -O "$target"; then
+ rc=${PIPESTATUS[0]}
+ fi
+ elif which curl >/dev/null 2>&1; then
+ if ! curl -L -s -o "$target" "$url"; then
+ rc=${PIPESTATUS[0]}
+ fi
+ else
+ fatal 1 "Could not find either wget or curl to fetch URLs."
+ fi
+
+ return $rc
}
[ ! -s "$KERNELDIR/$srpm" ]; then
if $DOWNLOAD; then
local location="http://downloads.lustre.org/public/kernels/$target/old"
+ # get the location from a distro specific method if it exists
+ if type -p kernel_srpm_location; then
+ location=$(kernel_srpm_location)
+ fi
echo "Downloading $location/$srpm..."
- if ! wget -nv "$location/$srpm" -O "$KERNELDIR/$srpm" 2>&1 ||
+ if ! fetch_url "$location/$srpm" "$KERNELDIR/$srpm" 2>&1 ||
[ ! -s "$KERNELDIR/$srpm" ]; then
rm -f $KERNELDIR/$srpm
- fatal 1 "Could not download target $target's kernel SRPM $srpm from $location."
+ # punt to a distro specific method if it exists
+ if ! type -p download_srpm-$DISTRO; then
+ fatal 1 "Could not download target $target's kernel SRPM $srpm from $location."
+ else
+ if ! download_srpm-$DISTRO "$target" "$srpm" "$force"; then
+ fatal 1 "Could not download target $target's kernel SRPM $srpm using download_srpm-$DISTRO."
+ fi
+ fi
fi
else
fatal 1 "$srpm not found in directory $KERNELDIR."
# flag others so they don't try to download also
push_exit_trap "rm -f $to $semaphore" "download"
touch $semaphore
- if ! wget -nv "$from" -O "$to" || [ ! -s "$to" ]; then
+ if ! fetch_url "$from" "$to" || [ ! -s "$to" ]; then
# the trap will remove the files via the fatal below
fatal 1 "Could not download ${to##*/} from ${from%/*}/."
fi
}
-# 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 pathtorpms="${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}"
- [ -d $pathtorpms ] || return 255
-
- local kernelbinaryrpm rpmfile
- local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}"
-
- local arch ret=1
- for arch in $TARGET_ARCHS_ALL; do
- local found_rpm="" rpm
- for rpm in ${pathtorpms}/${arch}/*.rpm; do
- if rpm -q --provides -p "$rpm" 2>&3 | grep -q "kernel${prefix} = $wanted_kernel" 2>&3; then
-
- found_rpm="$rpm"
- ret=0
- break
- fi
- done
- [ -f "$found_rpm" ] && break
- done
-
- echo "$found_rpm"
- return $ret
-
-}
-
# unpack kernel(/source/devel) RPM
#
# This function and it's setting of $LINUX and $LINUXOBJ is a total hack that
}
-#
-# in a given directory, find the first rpm matching given requirements
-#
-find_rpm() {
- local dir="$1"
- local match_type="$2"
- local match="$3"
-
- pushd "$dir" > /dev/null || \
- fatal 1 "Unable to chdir to directory \"$dir\" in find_rpm()"
-
- local file
- for file in $(ls *.rpm); do
- if [ ! -f "$file" ]; then
- continue
- fi
- case "$match_type" in
- provides)
- # match is any valid ERE (i.e. given to egrep) match
- if rpm -q --provides -p "$file" 2>&3 | egrep -q "$match"; then
- echo "$file"
- popd >/dev/null
- return 0
- fi
- ;;
- *)
- popd >/dev/null
- fatal 1 "Unknown match type \"$match_type\" given to find_rpm()"
- ;;
- esac
- done
-
- popd >/dev/null
- return 1
-}
-
build_kernel_with_srpm() {
local outfd=$1
"$REUSE_SIGNATURE"; then
# nothing cached, build from scratch
if [ ! -r "$KERNELDIR/$KERNEL_SRPM" ]; then
- echo "Downloading kernel SRPM"
+ echo "Downloading kernel SRPM" >&${outfd}
download_srpm "$CANONICAL_TARGET" "$KERNEL_SRPM" >&${outfd}
fi
"kernel" "$REUSEBUILD" "$REUSE_SIGNATURE" \
"$CAN_LINK_FOR_REUSE"; then
error "Failed to store kernel RPMS for reuse"
- echo "unknown"
+ echo "unknown" >&${outfd}
return 1
fi
fi
--- /dev/null
+# 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 for all releases of 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"
+BUILD_GEN+=".1" # refactor both rhel5 and rhel6
+
+DEVEL_KERNEL_TYPE="devel"
+RPM_HELPERS_DIR="/usr/lib/rpm/redhat"
+
+# a method which can be overriden by the release specific code
+get_rpmbuildopts() {
+
+ return 0
+
+}
+
+# patching common to all releases
+patch_spec_common() {
+
+ sed -i -e 's/^\(%define signmodules \).*/\10/' \
+ -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 || \
+ fatal 1 "Error while editing SPECS/$SPEC_NAME"
+
+ # XXX - a building-on-Ubuntu hack
+ if grep -q "Ubuntu" /etc/issue; then
+ sed -i -e 's/^\(BuildPreReq: .*\)$/#NOU \1/g' \
+ -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
+ -e 's/sha512hmac/md5sum/g' \
+ SPECS/$SPEC_NAME 2>&1 || \
+ 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
+ # <multiple arches>". 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
+
+ # do we need any special rpm build options
+ local rpmbuildopt="-bb"
+ if $DO_SRC; then
+ rpmbuildopt="-ba"
+ fi
+
+ # stupid Ubuntu's rpm doesn't do debuginfo properly
+ if [ ! -f /usr/lib/rpm/debugedit ]; then
+ rpmbuildopt="$rpmbuildopt --without debuginfo"
+ fi
+
+ # XXX - need to figure this kabichk crap out -- it fails the build
+ rpmbuildopt="$rpmbuildopt --without kabichk"
+
+ # 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
+
+ return 0
+
+}
+
+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"
+
+ local lustre=""
+ if $KERNEL_LUSTRE_NAMING; then
+ $lustre="-lustre"
+ fi
+ echo kernel${lustre}${lnxmaj}${lnxmin}/linux-${lnxmaj}.$arch
+}
+
+find_linux_devel_paths() {
+ local path="$1"
+ local ARCH=$TARGET_ARCH
+
+ # If DEVEL_PATH_ARCH is set, use it. Added for fc11 as it needs i586 string for i686.
+ if [ $DEVEL_PATH_ARCH ];then
+ ARCH=$DEVEL_PATH_ARCH
+ fi
+
+ LINUX=$path/usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}${DEVEL_PATH_ARCH_DELIMETER:-"-"}${ARCH}
+ # RHEL doesn't have the -obj tree
+ LINUXOBJ=""
+ # XXX - i don't think we need this any more
+ #LINUXRELEASE=$(find_linux_release "$LINUX")
+ #if [ -z "$LINUXRELEASE" ]; then
+ # echo "Failed to find linux release in $LINUX"
+ # return 255
+ #fi
+
+ return 0
+}
+
+unpack_linux_devel_rpm-rhel() {
+ local callers_rpm="$1"
+
+ # now just sanity check that everything needed to build properly versioned
+ # modules is in place
+ if [ ! -f usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}${DEVEL_PATH_ARCH_DELIMETER:-"-"}$TARGET_ARCH/Module.symvers ]; then
+ fatal 1 "cannot build kernel modules: the Kernel's Module.symvers is missing."
+ fi
+
+ return 0
+
+}
+
+# this of course requires a sudo rule on the builder for real RHEL:
+# hudson ALL= NOPASSWD: /usr/bin/yumdownloader
+# also must disable the requiretty attribute in the sudoers file
+find_linux_rpm-rhel() {
+ local prefix="$1"
+ local wanted_kernel="$2"
+ local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
+
+ local tmpdir=$(mktemp -d $pathtorpms/yumXXXXXX)
+ local sudo=""
+ if [ "$(lsb_release -s -i)" = "RedHatEnterpriseServer" ]; then
+ sudo="sudo"
+ fi
+ if ! $sudo yumdownloader --destdir "$tmpdir" kernel-devel-"$wanted_kernel" > /dev/null; then
+ fatal 1 "failed to download kernel-devel-$wanted_kernel"
+ fi
+ local rpm=$(cd $tmpdir; echo *)
+ mv "$tmpdir/$rpm" "$pathtorpms"
+ rmdir $tmpdir
+ echo "$rpm"
+
+ return 0
+
+}
# 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
-#BUILD_GEN=2 # bz19952: remove -lustre tag from kernel RPM names
-BUILD_GEN=3 # bz19975 enable the building of src.rpms by default
-
-DEVEL_KERNEL_TYPE="devel"
-RPM_HELPERS_DIR="/usr/lib/rpm/redhat"
-
-prepare_and_build_srpm() {
-
- pushd $TOPDIR >/dev/null
- local GCC_VER=""
- read GCC_VER < <($CC --version)
- GCC_VER=${GCC_VER##* }
- if [[ $GCC_VER = 4.3* ]]; then
- # add the gcc 4.3 kernel build fix patch to it
- cat <<"EOF" >> $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch
-diff -urp linux-2.6.18.rawops/Makefile linux-2.6.18.races/Makefile
---- linux-2.6.18.rawops/Makefile 2007-02-08 19:00:31.000000000 +0200
-+++ linux-2.6.18.rawops/Makefile 2007-02-14 19:23:49.000000000 +0200
-@@ -506,6 +506,9 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
- # disable pointer signed / unsigned warnings in gcc 4.0
- CFLAGS += $(call cc-option,-Wno-pointer-sign,)
-
-+# workaround to avoid gcc 4.3 emitting libgcc calls (see gcc bug #32044)
-+CFLAGS += $(call cc-option,-fno-tree-scev-cprop,)
-+
- # Default kernel image to build when no specific target is given.
- # KBUILD_IMAGE may be overruled on the command line or
- # set in the environment
-EOF
- fi
+# to be built for this release of this distribution (only -- if you want to
+# force a kernel build on all releases of this distribution, update the BUILD_GEN
+# variable in build/lbuild-rhel and if you want to force kernel bulid for all
+# distributions, update the BUILD_GEN variable in build/lbuild)
+BUILD_GEN+=".0"
+
+source ${0%/*}/lbuild-rhel
- # create the buildid
- local buildid="_lustre${EXTRA_VERSION##*_lustre}"
+SPEC_NAME="kernel-2.6.spec"
+
+patch_spec() {
+ local buildid="$1"
# edit the SPEC with our changes
- sed -i -e 's/^\(%define signmodules \).*/\10/' \
- -e "s/^#% \(define buildid\).*/%\1 ${buildid}/" \
- -e '/-e $RPM_SOURCE_DIR\/kabi_whitelist_/i\
- rm -f $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
- -e '/_sourcedir\/kabitool -b \./a\
- cp $RPM_BUILD_ROOT/kabi_whitelist $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
- -e '/^# empty final patch file to facilitate testing of kernel patches/i\
+ patch_spec_common "$buildid"
+ sed -i -e '/^# empty final patch file to facilitate testing of kernel patches/i\
# adds Lustre patches\
Patch99995: linux-%{kversion}-lustre.patch' \
-e '/^# conditionally applied test patch for debugging convenience/i\
# lustre patch\
%patch99995 -p1\
' \
+ -e '/-e $RPM_SOURCE_DIR\/kabi_whitelist_/i\
+ rm -f $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
+ -e '/_sourcedir\/kabitool -b \./a\
+ cp $RPM_BUILD_ROOT/kabi_whitelist $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
-e '/^%prep$/,/^# END OF PATCH APPLICATIONS$/s/kernel-%{kversion}/%{name}-%{kversion}/g' \
- -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/kernel-2.6.spec 2>&1 || \
- fatal 1 "Error while editing SPECS/kernel-2.6.spec"
+ SPECS/$SPEC_NAME 2>&1 || \
+ fatal 1 "Error while editing SPECS/$SPEC_NAME"
if $KERNEL_LUSTRE_NAMING; then
# these are all of the changes needed because we change the package names
Provides: kernel-debuginfo = %{KVERREL}
Obsoletes: kernel-debuginfo
' \
- SPECS/kernel-2.6.sp 2>&1 || \
- fatal 1 "Error while editing SPECS/kernel-2.6.spec"ec
- fi
-
- # XXX - a building-on-Ubuntu hack
- if grep -q "Ubuntu" /etc/issue; then
- sed -i -e 's/^\(BuildPreReq: .*\)$/#NOU \1/g' \
- -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
- -e 's/sha512hmac/md5sum/g' \
- SPECS/kernel-2.6.spec 2>&1 || \
- fatal 1 "Error while editing SPECS/kernel-2.6.spec"
+ SPECS/$SPEC_NAME 2>&1 || \
+ fatal 1 "Error while editing SPECS/$SPEC_NAME"
fi
# finally, work around RH bug 491775, if needed
if ! grep -q "cp -a asm-x86_64 \$RPM_BUILD_ROOT/lib/modules/\$KernelVer/build/include" \
- SPECS/kernel-2.6.spec; then
+ SPECS/$SPEC_NAME; then
# XXX - i wonder if we will need to do this ad-hoc patching enough to
# formalize a patching system. let's assume not for the time
# being.
patch -s -p0 <<"EOF" 2>&1 || \
- fatal 1 "Error while patching SPECS/kernel-2.6.spec"
---- SPECS/kernel-2.6.spec.dist 2009-03-23 20:30:55.000000000 -0400
-+++ SPECS/kernel-2.6.spec 2009-03-23 20:37:03.000000000 -0400
+ fatal 1 "Error while patching SPECS/$SPEC_NAME"
+--- SPECS/$SPEC_NAME.dist 2009-03-23 20:30:55.000000000 -0400
++++ SPECS/$SPEC_NAME 2009-03-23 20:37:03.000000000 -0400
@@ -6961,6 +6961,10 @@
cd include
cp -a acpi config keys linux math-emu media mtd net pcmcia rdma rxrpc scsi sound video asm asm-generic $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
EOF
fi
- 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
- # <multiple arches>". 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-2.6.18-$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
-
- # do we need any special rpm build options
- local rpmbuildopt="-bb"
- if $DO_SRC; then
- rpmbuildopt="-ba"
- fi
- # stupid Ubuntu's rpm doesn't do debuginfo properly
- if [ ! -f /usr/lib/rpm/debugedit ]; then
- rpmbuildopt="$rpmbuildopt --without debuginfo"
- fi
-
- # XXX - need to figure this kabichk crap out -- it fails the build
- rpmbuildopt="$rpmbuildopt --without kabichk"
-
- # now build it
- if ! $RPMBUILD $rpmbuildopt $targets --with baseonly \
- --define "_topdir $TOPDIR" \
- $TOPDIR/SPECS/kernel-2.6.spec 2>&1; then
- return 1
- fi
-
return 0
}
-devel_kernel_name() {
- local lustre=${1:-false}
-
- if $lustre; then
- echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
- else
- echo "kernel-$DEVEL_KERNEL_TYPE"
- fi
-
-}
+unpack_linux_devel_rpm-rhel5() {
+ local callers_rpm="$1"
-rpm_BUILD_kernel_dirname() {
- local rpmsmptype="$1"
- local lnxmaj="$2"
- local lnxmin="$3"
- local arch="$4"
+ unpack_linux_devel_rpm-rhel "$callers_rpm"
- local lustre=""
- if $KERNEL_LUSTRE_NAMING; then
- $lustre="-lustre"
+ if [ ! -f usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}-$TARGET_ARCH/symsets-${lnxmaj}${lnxmin}-${lnxrel}.tar.gz ]; then
+ fatal 1 "cannot build modules: the Kernel's symsets is missing."
fi
- echo kernel${lustre}${lnxmaj}${lnxmin}/linux-${lnxmaj}.$arch
-}
-
-find_linux_devel_paths() {
- local path="$1"
-
- LINUX=$path/usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}-${TARGET_ARCH}
- # RHEL doesn't have the -obj tree
- LINUXOBJ=""
- # XXX - i don't think we need this any more
- #LINUXRELEASE=$(find_linux_release "$LINUX")
- #if [ -z "$LINUXRELEASE" ]; then
- # echo "Failed to find linux release in $LINUX"
- # return 255
- #fi
return 0
+
}
-unpack_linux_devel_rpm-rhel5() {
- local callers_rpm="$1"
+find_linux_rpm-rhel5() {
+ local prefix="$1"
+ local wanted_kernel="$2"
+ local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
- # now just sanity check that everything needed to build properly versioned
- # modules is in place
- if [ ! -f usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}-$TARGET_ARCH/Module.symvers ]; then
- fatal 1 "cannot build kernel modules: the Kernel's Module.symvers is missing."
- fi
+ find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
+}
- if [ ! -f usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}-$TARGET_ARCH/symsets-${lnxmaj}${lnxmin}-${lnxrel}.tar.gz ]; then
- fatal 1 "cannot build modules: the Kernel's symsets is missing."
- fi
+kernel_srpm_location() {
- return 0
+ echo "http://mirror.centos.org/centos-5/5/updates/SRPMS/"
}
LB_INCLUDE_RULES
LB_PROG_CC
+AC_ARG_ENABLE([dist],
+ AC_HELP_STRING([--enable-dist],
+ [only configure enough for make dist]),
+ [enable_dist='yes'],[enable_dist='no'])
+AC_MSG_RESULT([$enable_dist])
+if test x$enable_dist != xno; then
+ enable_modules='no'
+fi
#
# LC_TARGET_SUPPORTED