1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
3 # increment this if you have made a change that should force a new kernel
4 # to build built for this distribution (only -- if you want to force a kernel
5 # build on all distributions, update the BUILD_GEN variable in build/lbuild)
8 # This distro does not support zfs, so define WITH_ZFS
9 # use words that make the bash log readable.
10 WITH_ZFS="Zfs Not Supported"
11 SUSE_MACROS=/etc/rpm/macros.kernel-source
13 source ${LBUILD_DIR}/lbuild-sles
15 kernel_srpm_location() {
22 site="http://mgmt/cobbler/repo_mirror/updates-sles12.1-src"
26 kdir=updates-sles12.2-src
27 if [ $kminor -eq 114 -o $kminor -eq 120 ]
29 if [ ${lnxrel%%.*} -gt 92 ]
31 kdir=updates-sles12.3-src
33 elif [ $kminor -eq 103 ]
35 if [ ${lnxrel%%.*} -lt 90 ]
37 kdir=updates-sles12.3-src
39 elif [ $kminor -eq 82 -o $kminor -gt 91 ]
41 kdir=updates-sles12.3-src
43 site="http://mgmt/cobbler/repo_mirror/$kdir"
52 # edit the SPECs with our changes
54 (cd $TOPDIR/SOURCES; ./mkspec --release ${lnxrel})
55 for spec in $RPMSMPTYPE source syms; do
56 #cp $TOPDIR/SOURCES/kernel-$spec.spec{,.orig}
59 sed -i -e "s/^\(Release: *\).*$/\1${lnxrel}_${buildid}/" \
61 cp %_sourcedir/linux-4.4-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
62 ! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
63 SOURCES/kernel-${spec}.spec || \
64 fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
67 sed -i -e "s/^\(Release: *\).*$/\1${lnxrel}_${buildid}/" \
69 cp %_sourcedir/linux-3.12-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
70 ! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
71 SOURCES/kernel-${spec}.spec || \
72 fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
76 if $KERNEL_LUSTRE_NAMING; then
77 # these are all of the changes needed because we change the package names
78 # to kernel-lustre-*. these should all go away when we stop this insanity
79 sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
80 -e "/^Provides: *kernel = /a\
81 Provides: kernel-$spec = %{version}-%{release}
83 -e 's/^\([ ][ ]*-i %_builddir\/kernel-\)\(source-2.6.27.21\/\$patch; then\)/\1lustre-\2/' \
84 -e '/^%build/,/^%changelog/s/\(kernel-\)\(source\.files\)/\1lustre-\2/g' \
85 -e '/--no-backup-if-mismatch/,/fi/s/kernel-source-/kernel-lustre-source-/g' \
86 -e "s/^\(%package -n kernel-\)\(.*\)/\1lustre-\2/" \
87 -e "s/^\(%description -n kernel-\)\(.*\)/\1lustre-\2/" \
88 -e "s/^\(%files -n kernel-\)\(.*\)/\1lustre-\2/" \
89 -e "s/^\(Provides:.*kernel-\)\(.*\)/\1lustre-\2/" \
90 -e "s/^\(Requires:.*kernel-\)\(.*\)/\1lustre-\2/" \
91 -e "s/^\(Supplements:.*kernel-\)\(.*\)/\1lustre-\2/" \
92 SOURCES/kernel-${spec}.spec || \
93 fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
96 # XXX - a building-on-Ubuntu hack
97 if grep -q "Ubuntu" /etc/issue; then
98 sed -i -e '/^%_sourcedir\/install-configs %_sourcedir .*/i\
99 curl ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17/2.6.17-mm1/broken-out/i386-use-c-code-for-current_thread_info.patch | patch -p1' \
100 -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
101 -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
103 SOURCES/kernel-${spec}.spec || \
104 fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
109 unpack_linux_devel_rpm-sles12() {
110 local callers_rpm="$1"
112 local rpmdir="${callers_rpm%/*}"
115 local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}"
117 # this is a hack that should go away when the modified lustre kernel
118 # Provides kernel-default-devel vvvvvvvvv
119 if ! kernelrpm=$(find_rpm "$rpmdir" provides "^kernel-(lustre-)?default-devel = $wanted_kernel"); then
120 fatal 1 "Could not find the kernel-default-devel in $rpmdir/"
123 if ! rpm2cpio < "$rpmdir/$kernelrpm" | cpio -id > /dev/null 2>&1; then
124 fatal 1 "Unpack error for $kernelrpm"
127 if [ -d "${rpmdir}/../noarch" ]; then
128 rpmdir="${rpmdir%/*}"
129 rpmdir="${rpmdir}/noarch"
132 if ! kernelrpm=$(find_rpm "$rpmdir" provides "^kernel-(lustre-)?devel = $wanted_kernel"); then
133 fatal 1 "Could not find the kernel-devel in $rpmdir/"
136 if ! rpm2cpio < "$rpmdir/$kernelrpm" | cpio -id > /dev/null 2>&1; then
137 fatal 1 "Unpack error for $kernelrpm"
140 # SLES also needs the kernel-source together with the kernel-default-devel
141 if ! kernelrpm=$(find_rpm "$rpmdir" provides "^kernel-source = $wanted_kernel"); then
142 fatal 1 "Could not find the kernel-source in $rpmdir/"
145 if ! rpm2cpio < "$rpmdir/$kernelrpm" | cpio -id > /dev/null 2>&1; then
146 fatal 1 "Unpack error for $kernelrpm"
151 find_linux_rpm-sles12() {
153 local wanted_kernel="$2"
154 local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"}
155 local wanted_kernel_org="$wanted_kernel"
157 if [ "x$rpmfix_diff" != "x" ] && [ $wanted_kernel != "${lnxmaj}${lnxmin}-${lnxrel}${rpmfix_diff}" ]; then
158 wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}${rpmfix_diff}"
165 site="http://mgmt/cobbler/repo_mirror/updates-sles12.1-x86_64"
169 kdir=updates-sles12.2-x86_64
170 if [ $kminor -eq 114 -o $kminor -eq 120 ]
172 if [ ${lnxrel%%.*} -gt 92 ]
174 kdir=updates-sles12.3-x86_64
176 elif [ $kminor -eq 103 ]
178 if [ ${lnxrel%%.*} -lt 90 ]
180 kdir=updates-sles12.3-x86_64
182 elif [ $kminor -eq 82 -o $kminor -gt 91 ]
184 kdir=updates-sles12.3-x86_64
186 site="http://mgmt/cobbler/repo_mirror/$kdir"
189 kdir=updates-sles12.4-x86_64
190 if [ ${lnxrel%%.*} -ge 120 ]
192 kdir=updates-sles12.5-x86_64
194 site="http://mgmt/cobbler/repo_mirror/$kdir"
197 if [ ! -f $pathtorpms/kernel-default-devel-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm ]; then
198 fetch_url "$site/x86_64/kernel-default-devel-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm" $pathtorpms
200 # SLES 12 also needs kernel-devel in addition to kernel-default-devel
201 if [ ! -f $pathtorpms/kernel-devel-$wanted_kernel_org.noarch.rpm ]; then
202 fetch_url "$site/noarch/kernel-devel-$wanted_kernel_org.noarch.rpm" $pathtorpms
204 # SLES also needs the kernel-source along with kernel-devel
205 if [ ! -f $pathtorpms/kernel-source-$wanted_kernel_org.noarch.rpm ]; then
206 fetch_url "$site/noarch/kernel-source-$wanted_kernel_org.noarch.rpm" $pathtorpms
208 echo "kernel-default-devel-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm"