This commit is contained in:
parent
efa563531e
commit
a004cbc930
@ -1,219 +0,0 @@
|
||||
#
|
||||
# spec file for package kernel-@FLAVOR@ subpackage builds
|
||||
#
|
||||
# Copyright (c) @YEAR@ SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
# needssslcertforbuild
|
||||
|
||||
|
||||
%define srcversion @SRCVERSION@
|
||||
%define patchversion @PATCHVERSION@
|
||||
%define variant @VARIANT@%{nil}
|
||||
%define vanilla_only @VANILLA_ONLY@
|
||||
|
||||
%define rpm_kver %(rpm -q --qf '%%{VERSION}' kernel-%build_flavor)
|
||||
%define rpm_krel %(rpm -q --qf '%%{RELEASE}' kernel-%build_flavor)
|
||||
%define kernel_spec_release %rpm_krel
|
||||
|
||||
%include %_sourcedir/kernel-spec-macros
|
||||
|
||||
%define build_flavor @FLAVOR@
|
||||
%define build_default ("%build_flavor" == "default")
|
||||
%define build_vanilla ("%build_flavor" == "vanilla")
|
||||
|
||||
%define cpu_arch_flavor %cpu_arch/%build_flavor
|
||||
|
||||
# Force bzip2 instead of lzma compression to
|
||||
# 1) allow install on older dist versions, and
|
||||
# 2) decrease build times (bsc#962356)
|
||||
#%define _binary_payload w9.bzdio
|
||||
# Do not recompute the build-id of vmlinux in find-debuginfo.sh (bsc#964063)
|
||||
%undefine _unique_build_ids
|
||||
%define _no_recompute_build_ids 1
|
||||
# prevent usr/lib/debug/boot/vmlinux-4.12.14-11.10-default-4.12.14-11.10.ppc64le.debug
|
||||
%undefine _unique_debug_names
|
||||
|
||||
# define %extrasummary, %extradescription, and %modules
|
||||
# %extrasummary appended to package summary
|
||||
# %extradescription appended to package description
|
||||
# %modules is list of modules to include in the package (if they exist)
|
||||
%include %_sourcedir/kernel-subpackage.conf
|
||||
|
||||
Name: kernel-%build_flavor-@SUBPACKAGE@
|
||||
BuildRequires: coreutils
|
||||
BuildRequires: device-mapper
|
||||
BuildRequires: dracut
|
||||
BuildRequires: kmod
|
||||
BuildRequires: kernel-%build_flavor-srchash-@COMMIT_FULL@
|
||||
BuildRequires: kernel-%build_flavor-devel
|
||||
BuildRequires: util-linux
|
||||
ExclusiveArch: @ARCHS@
|
||||
Summary: %(rpm -q --qf '%%{SUMMARY}' kernel-%build_flavor) %extrasummary
|
||||
URL: %(rpm -q --qf '%%{URL}' kernel-%build_flavor)
|
||||
Group: %(rpm -q --qf '%%{GROUP}' kernel-%build_flavor)
|
||||
License: GPL-2.0
|
||||
Version: %rpm_kver
|
||||
Release: %rpm_krel.<RELEASE>
|
||||
Provides: %name(%_target) = %version-%rpm_krel
|
||||
@BINARY_DEPS@
|
||||
|
||||
%description
|
||||
%(rpm -q --qf '%%{DESCRIPTION}' kernel-%build_flavor)
|
||||
%extradescription
|
||||
|
||||
This is a subpackage of kernel-%build_flavor. Development files are in
|
||||
kernel-%build_flavor-devel and sources in kernel-source-%variant.
|
||||
|
||||
%prep
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
set -o pipefail
|
||||
install -d -m 0755 $RPM_BUILD_ROOT/boot
|
||||
|
||||
chmod 755 %_sourcedir/splitflist
|
||||
%_sourcedir/splitflist kernel-%build_flavor kernel.flist kernel-ghost.flist
|
||||
echo Missing files:
|
||||
cat kernel-ghost.flist
|
||||
|
||||
# The scripts need to be regenerated here. Eventually we should get rid of
|
||||
# base_package and use one script.
|
||||
%ifarch %ix86 x86_64
|
||||
image=vmlinuz
|
||||
%endif
|
||||
%ifarch ppc ppc64 ppc64le
|
||||
image=vmlinux
|
||||
%endif
|
||||
%ifarch s390 s390x
|
||||
image=image
|
||||
%endif
|
||||
%ifarch %arm
|
||||
image=zImage
|
||||
%endif
|
||||
%ifarch aarch64
|
||||
image=Image
|
||||
%endif
|
||||
|
||||
certs=($(rpm -ql kernel-%build_flavor | grep ^/etc/uefi/certs/ ||:))
|
||||
|
||||
for sub in '-@SUBPACKAGE@'; do
|
||||
base_package=1 # should use for any package name
|
||||
for script in preun postun pre post; do
|
||||
if test %build_flavor = "zfcpdump"; then
|
||||
: >%_builddir/$script.sh
|
||||
continue
|
||||
fi
|
||||
sed -e "s:@KERNELRELEASE@:%kernelrelease:g" \
|
||||
-e "s:@IMAGE@:$image:g" \
|
||||
-e "s:@FLAVOR""@:%build_flavor:g" \
|
||||
-e "s:@SUBPACKAGE""@:%name:g" \
|
||||
-e "s:@BASE_PACKAGE@:$base_package:g" \
|
||||
-e "s:@RPM_VERSION_RELEASE@:%version-%release:g" \
|
||||
-e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \
|
||||
-e "s:@SRCVARIANT@:%variant:g" \
|
||||
%_sourcedir/$script.sh > %_builddir/$script.sh
|
||||
if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then
|
||||
case "$script" in
|
||||
preun | postun | post)
|
||||
# Copy the respective scriptlet from kernel-cert-subpackage
|
||||
sed "1,/^%%$script / d; /^%%[^%%]/,\$ d; s:@CERTS@:${certs[*]}:g" \
|
||||
%_sourcedir/kernel-cert-subpackage \
|
||||
>>"%_builddir/$script.sh"
|
||||
esac
|
||||
fi
|
||||
# Do an exit 0 at the end of each scriptlet. If the last real command
|
||||
# in the scriptlet (e.g. update-bootloader call, see bnc#809617)
|
||||
# returns an error, we do not want to amplify the damage by leaving
|
||||
# the system in an inconsistent state.
|
||||
echo "exit 0" >>"%_builddir/$script.sh"
|
||||
done
|
||||
done
|
||||
|
||||
[ -z "$(rpm -q --triggers kernel-%build_flavor)" ] # not handled
|
||||
|
||||
KREL=$(cat kernel.flist | grep ^/lib/modules | { sort -r ||: ;} | head -n 1 | sed -e s,^/lib/modules/,, -e 's,/.*,,')
|
||||
|
||||
chmod 755 %_sourcedir/mergedep
|
||||
%_sourcedir/mergedep $KREL > modules.dep
|
||||
|
||||
echo "%{?modules}" | tr ', ' '\n\n' > request-modules
|
||||
|
||||
chmod 755 %_sourcedir/moddep
|
||||
%_sourcedir/moddep modules.dep request-modules modules
|
||||
|
||||
chmod 755 %_sourcedir/modflist
|
||||
%_sourcedir/modflist kernel.flist modules modules.flist
|
||||
cat kernel.flist | grep -v ^/lib/modules >> modules.flist
|
||||
[ -d /lib/modules/$KREL/vdso ] && echo /lib/modules/$KREL/vdso >> modules.flist ||:
|
||||
echo /lib/modules/$KREL/modules.* | tr ' ' '\n' >> modules.flist
|
||||
|
||||
tar -C / -cf- -T modules.flist | tar -C $RPM_BUILD_ROOT -xvf-
|
||||
|
||||
moderr="$(/usr/sbin/depmod -b $RPM_BUILD_ROOT -e -F /boot/System.map-$KREL $KREL 2>&1 > /dev/null)"
|
||||
|
||||
if [ "$moderr" ] ; then
|
||||
echo Picked modules have errors:
|
||||
echo $moderr
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "%defattr(-,root,root)" > subpackage.flist
|
||||
cat kernel.flist | grep -v ^/lib/modules >> subpackage.flist
|
||||
echo /lib/modules/$KREL >> subpackage.flist
|
||||
cat kernel-ghost.flist | sed -e 's/^/%ghost /' >> subpackage.flist
|
||||
|
||||
cat kernel-ghost.flist | while read ghost ; do
|
||||
case $ghost in
|
||||
/boot/image-%build_flavor | /boot/vmlinux-%build_flavor | /boot/vmlinuz-%build_flavor | \
|
||||
/boot/Image-%build_flavor | /boot/initrd-%build_flavor)
|
||||
ln -s $(basename $ghost -%build_flavor)-$KREL $RPM_BUILD_ROOT$ghost
|
||||
;;
|
||||
/boot/vmlinux | /boot/vmlinuz | /boot/Image | /boot/image | /boot/initrd)
|
||||
ln -s $ghost-$KREL $RPM_BUILD_ROOT$ghost
|
||||
;;
|
||||
/boot/vmlinux-$KREL)
|
||||
[ -f /boot/vmlinux-$KREL.gz ] && gunzip -dc < /boot/vmlinux-$KREL.gz > vmlinux-$KREL
|
||||
size="$(ls -l vmlinux-$KREL | sed -e 's/^\([^ ]* \)\{4\}//' -e 's/ .*//')"
|
||||
dd if=/dev/zero bs=1 count="$size" of=$RPM_BUILD_ROOT$ghost
|
||||
;;
|
||||
/boot/initrd-$KREL | /boot/initrd-$KREL-kdump)
|
||||
# Create a dummy initrd with roughly the size the real one will have.
|
||||
# That way, YaST will know that this package requires some additional
|
||||
# space in /boot.
|
||||
dd if=/dev/zero of=$RPM_BUILD_ROOT$ghost \
|
||||
bs=1024 seek=2047 count=1
|
||||
chmod 0600 $RPM_BUILD_ROOT$ghost
|
||||
;;
|
||||
/lib/modules/$KREL/modules.*)
|
||||
[ -f $RPM_BUILD_ROOT$ghost ]
|
||||
;;
|
||||
*)
|
||||
echo Missing file "$ghost" not handled.
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
%preun -f preun.sh
|
||||
|
||||
%postun -f postun.sh
|
||||
|
||||
%pre -f pre.sh
|
||||
|
||||
%post -f post.sh
|
||||
|
||||
%files -f subpackage.flist
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user