aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-29 21:10:05 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-09 05:13:19 -0400
commit5289c322ba994c7b07a4780243dca1feb610954f (patch)
tree84cca60efb31dd13aae8fd8b8aee9f23255ae0a6
parent81771ce2d1a9f9ce8739aac7af64bb03ff4b6a1a (diff)
kbuild: rpm-pkg: clean up mkspec
Clean up the mkspec without changing the behavior. - grep CONFIG_DRM=y more simply - move "EXCLUDE" out of the "%install" section because it can be computed when the spec file is generated - remove "BuildRoot:" field, which is now redundant - do not mkdir $RPM_BUILD_ROOT/lib/modules explicitly because it is automatically created by "make modules_install" - exclude "%package devel" from source package spec file because it does not make sense where "%files devel" is already excluded - exclude "%build" from source package spec file - remove unneeded "make clean" because we had already cleaned before making tar file - merge two %ifarch ia64 conditionals - replace KBUILD_IMAGE with direct use of $(make image_name) - remove trailing empty line from the spec file Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rwxr-xr-xscripts/package/mkspec44
1 files changed, 16 insertions, 28 deletions
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index a026c089d773..97feb60e6482 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -10,19 +10,21 @@
10# 10#
11 11
12# how we were called determines which rpms we build and how we build them 12# how we were called determines which rpms we build and how we build them
13if [ "$1" = "prebuilt" ]; then 13if [ "$1" = prebuilt ]; then
14 PREBUILT=true 14 PREBUILT=true
15else 15else
16 PREBUILT=false 16 PREBUILT=false
17fi 17fi
18 18
19# starting to output the spec 19if grep -q CONFIG_DRM=y .config; then
20if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
21 PROVIDES=kernel-drm 20 PROVIDES=kernel-drm
22fi 21fi
23 22
24PROVIDES="$PROVIDES kernel-$KERNELRELEASE" 23PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
25__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` 24__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g")
25EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \
26--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
27--exclude=.config.old --exclude=.missing-syscalls.d"
26 28
27echo "Name: kernel" 29echo "Name: kernel"
28echo "Summary: The Linux Kernel" 30echo "Summary: The Linux Kernel"
@@ -37,7 +39,6 @@ if ! $PREBUILT; then
37echo "Source: kernel-$__KERNELRELEASE.tar.gz" 39echo "Source: kernel-$__KERNELRELEASE.tar.gz"
38fi 40fi
39 41
40echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root"
41echo "Provides: $PROVIDES" 42echo "Provides: $PROVIDES"
42echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" 43echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
43echo "%define debug_package %{nil}" 44echo "%define debug_package %{nil}"
@@ -57,6 +58,8 @@ echo "header files define structures and constants that are needed for"
57echo "building most standard programs and are also needed for rebuilding the" 58echo "building most standard programs and are also needed for rebuilding the"
58echo "glibc package." 59echo "glibc package."
59echo "" 60echo ""
61
62if ! $PREBUILT; then
60echo "%package devel" 63echo "%package devel"
61echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel" 64echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel"
62echo "Group: System Environment/Kernel" 65echo "Group: System Environment/Kernel"
@@ -65,39 +68,26 @@ echo "%description -n kernel-devel"
65echo "This package provides kernel headers and makefiles sufficient to build modules" 68echo "This package provides kernel headers and makefiles sufficient to build modules"
66echo "against the $__KERNELRELEASE kernel package." 69echo "against the $__KERNELRELEASE kernel package."
67echo "" 70echo ""
68
69if ! $PREBUILT; then
70echo "%prep" 71echo "%prep"
71echo "%setup -q" 72echo "%setup -q"
72echo "" 73echo ""
73fi
74
75echo "%build" 74echo "%build"
76 75echo "make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}"
77if ! $PREBUILT; then
78echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}"
79echo "" 76echo ""
80fi 77fi
81 78
82echo "%install" 79echo "%install"
83echo 'KBUILD_IMAGE=$(make image_name)' 80echo 'mkdir -p $RPM_BUILD_ROOT/boot'
84echo "%ifarch ia64" 81echo "%ifarch ia64"
85echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' 82echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi'
86echo "%else" 83echo 'cp $(make image_name) $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
87echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
88echo "%endif"
89
90echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install'
91echo "%ifarch ia64"
92echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
93echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" 84echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
94echo "%else" 85echo "%else"
95echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" 86echo 'cp $(make image_name) $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
96echo "%endif" 87echo "%endif"
97 88echo 'make %{?_smp_mflags} INSTALL_MOD_PATH=$RPM_BUILD_ROOT KBUILD_SRC= modules_install'
98echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install' 89echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install'
99echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" 90echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
100
101echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" 91echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
102echo 'bzip2 -9 --keep vmlinux' 92echo 'bzip2 -9 --keep vmlinux'
103echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" 93echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
@@ -106,8 +96,7 @@ if ! $PREBUILT; then
106echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build" 96echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build"
107echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source" 97echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source"
108echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" 98echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
109echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude .config.old --exclude .missing-syscalls.d\"" 99echo "tar cf - . $EXCLUDES | tar xf - -C "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
110echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"
111echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" 100echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"
112echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" 101echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
113echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" 102echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
@@ -146,12 +135,11 @@ echo ""
146echo "%files headers" 135echo "%files headers"
147echo '%defattr (-, root, root)' 136echo '%defattr (-, root, root)'
148echo "/usr/include" 137echo "/usr/include"
149echo ""
150if ! $PREBUILT; then 138if ! $PREBUILT; then
139echo ""
151echo "%files devel" 140echo "%files devel"
152echo '%defattr (-, root, root)' 141echo '%defattr (-, root, root)'
153echo "/usr/src/kernels/$KERNELRELEASE" 142echo "/usr/src/kernels/$KERNELRELEASE"
154echo "/lib/modules/$KERNELRELEASE/build" 143echo "/lib/modules/$KERNELRELEASE/build"
155echo "/lib/modules/$KERNELRELEASE/source" 144echo "/lib/modules/$KERNELRELEASE/source"
156echo ""
157fi 145fi