Whamcloud - gitweb
LU-5710 all: second batch of corrected typos and grammar errors
[fs/lustre-release.git] / contrib / lbuild / lbuild-rhel5
1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
2
3 # increment this if you have made a change that should force a new kernel
4 # to be built for this release of this distribution (only -- if you want to
5 # force a kernel build on all releases of this distribution, update the BUILD_GEN
6 # variable in build/lbuild-rhel and if you want to force kernel bulid for all
7 # distributions, update the BUILD_GEN variable in build/lbuild)
8 BUILD_GEN+=".0"
9
10 # This distro does not support zfs, so define WITH_ZFS
11 # use words that make the bash log readable.
12 WITH_ZFS="Zfs Not Supported"
13
14 source ${LBUILD_DIR}/lbuild-rhel
15
16 SPEC_NAME="kernel-2.6.spec"
17
18 patch_spec() {
19     local buildid="$1"
20
21     # edit the SPEC with our changes
22     patch_spec_common "$buildid"
23     sed -i -e '/^# empty final patch file to facilitate testing of kernel patches/i\
24 # adds Lustre patches\
25 Patch99995: linux-%{kversion}-lustre.patch' \
26            -e '/^# conditionally applied test patch for debugging convenience/i\
27 # lustre patch\
28 %patch99995 -p1\
29 ' \
30            -e '/-e $RPM_SOURCE_DIR\/kabi_whitelist_/i\
31     rm -f $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
32            -e '/_sourcedir\/kabitool -b \./a\
33     cp $RPM_BUILD_ROOT/kabi_whitelist $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
34            -e '/^%prep$/,/^# END OF PATCH APPLICATIONS$/s/kernel-%{kversion}/%{name}-%{kversion}/g' \
35     -e 's/^\(%define signmodules \).*/\10/' \
36           SPECS/$SPEC_NAME 2>&1 || \
37         fatal 1 "Error while editing SPECS/$SPEC_NAME"
38
39     if $KERNEL_LUSTRE_NAMING; then
40         # these are all of the changes needed because we change the package names
41         # to kernel-lustre-*.  these should all go away when we stop this insanity
42         sed -i -e 's/^\(Name:.*kernel\)/\1-lustre/' \
43                -e '/^Provides: glibc-kernheaders = /a\
44 Provides: kernel-headers = %{rpmversion}-%{release}
45 Obsoletes: kernel-headers
46 ' \
47                -e '/^Provides: kernel-%{_target_cpu} = %{rpmversion}-%{release}$/a\
48 Provides: kernel = %{rpmversion}-%{release}
49 ' \
50                -e '/^Provides: kernel-devel-%{_target_cpu} = %{rpmversion}-%{release}$/a\
51 Provides: kernel-devel = %{rpmversion}-%{release}
52 Obsoletes: kernel-devel
53 ' \
54                -e '/^Provides: %{name}-debuginfo-common-%{_target_cpu} = %{KVERREL}$/a\
55 Provides: kernel-debuginfo-common = %{KVERREL}
56 Obsoletes: kernel-debuginfo-common
57 ' \
58                -e '/^Provides: %{name}-debuginfo-%{_target_cpu} = %{KVERREL}$/a\
59 Provides: kernel-debuginfo = %{KVERREL}
60 Obsoletes: kernel-debuginfo
61 ' \
62               SPECS/$SPEC_NAME 2>&1 || \
63             fatal 1 "Error while editing SPECS/$SPEC_NAME"
64     fi
65
66     # finally, work around RH bug 491775, if needed
67     if ! grep -q "cp -a asm-x86_64 \$RPM_BUILD_ROOT/lib/modules/\$KernelVer/build/include" \
68               SPECS/$SPEC_NAME; then
69         # XXX - i wonder if we will need to do this ad-hoc patching enough to
70         #       formalize a patching system.  let's assume not for the time
71         #       being.
72         patch -s -p0 <<"EOF" 2>&1 || \
73             fatal 1 "Error while patching SPECS/$SPEC_NAME"
74 --- SPECS/$SPEC_NAME.dist       2009-03-23 20:30:55.000000000 -0400
75 +++ SPECS/$SPEC_NAME    2009-03-23 20:37:03.000000000 -0400
76 @@ -6961,6 +6961,10 @@
77      cd include
78      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
79      cp -a `readlink asm` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
80 +    if [ "$Arch" = "i386" ]; then
81 +      mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-x86_64
82 +      cp -a asm-x86_64/{stacktrace,k8,pci-direct}.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-x86_64
83 +    fi
84      if [ "$Arch" = "x86_64" ]; then
85        cp -a asm-i386 $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
86      fi
87 EOF
88     fi
89
90     return 0
91
92 }
93
94 unpack_linux_devel_rpm-rhel5() {
95     local callers_rpm="$1"
96
97     unpack_linux_devel_rpm-rhel "$callers_rpm"
98
99     if $USE_KABI; then
100         if [ ! -f usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}-$TARGET_ARCH/symsets-${lnxmaj}${lnxmin}-${lnxrel}.tar.gz ]; then
101             fatal 1 "cannot build modules: the Kernel's symsets is missing."
102         fi
103     fi
104
105     return 0
106
107 }
108
109 find_linux_rpm-rhel5() {
110     local prefix="$1"
111     local wanted_kernel="$2"
112     local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"}
113
114     find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
115 }
116
117 kernel_srpm_location() {
118
119     echo "http://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/"
120
121 }