- # assume we are just rebuilding the SRPM
- local BUILD_TYPE=${BUILD_TYPE:-"--rebuild"}
- local SOURCE="${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm"
-
- # but switch to building from the SPEC if we need to apply patches
- if ls ${TOPDIR}/lustre/build/patches/ofed/* >/dev/null; then
- BUILD_TYPE="-bb"
- rpm --define "_topdir ${TOPDIR}" -ivh $SOURCE
- SOURCE="${TOPDIR}/SPECS/ofa_kernel.spec"
- local file ed_fragment1 ed_fragment2 n=1
- for file in ${TOPDIR}/lustre/build/patches/ofed/*; do
- ed_fragment1="$ed_fragment1
-Patch$n: ${file%%*/}"
- ed_fragment2="$ed_fragment2
-%patch$n -p0"
- cp $file ${TOPDIR}/SOURCES
- let n=$n+1
- done
-
- ed $SOURCE <<EOF
-/^Source: /a
-$ed_fragment1
-.
-/^%setup /a
-$ed_fragment2
-.
-wq
-EOF
- fi
-