diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-09-29 21:10:05 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-10-09 05:13:19 -0400 |
commit | 5289c322ba994c7b07a4780243dca1feb610954f (patch) | |
tree | 84cca60efb31dd13aae8fd8b8aee9f23255ae0a6 | |
parent | 81771ce2d1a9f9ce8739aac7af64bb03ff4b6a1a (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-x | scripts/package/mkspec | 44 |
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 |
13 | if [ "$1" = "prebuilt" ]; then | 13 | if [ "$1" = prebuilt ]; then |
14 | PREBUILT=true | 14 | PREBUILT=true |
15 | else | 15 | else |
16 | PREBUILT=false | 16 | PREBUILT=false |
17 | fi | 17 | fi |
18 | 18 | ||
19 | # starting to output the spec | 19 | if grep -q CONFIG_DRM=y .config; then |
20 | if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then | ||
21 | PROVIDES=kernel-drm | 20 | PROVIDES=kernel-drm |
22 | fi | 21 | fi |
23 | 22 | ||
24 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" | 23 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" |
25 | __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` | 24 | __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") |
25 | EXCLUDES="$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 | ||
27 | echo "Name: kernel" | 29 | echo "Name: kernel" |
28 | echo "Summary: The Linux Kernel" | 30 | echo "Summary: The Linux Kernel" |
@@ -37,7 +39,6 @@ if ! $PREBUILT; then | |||
37 | echo "Source: kernel-$__KERNELRELEASE.tar.gz" | 39 | echo "Source: kernel-$__KERNELRELEASE.tar.gz" |
38 | fi | 40 | fi |
39 | 41 | ||
40 | echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root" | ||
41 | echo "Provides: $PROVIDES" | 42 | echo "Provides: $PROVIDES" |
42 | echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" | 43 | echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" |
43 | echo "%define debug_package %{nil}" | 44 | echo "%define debug_package %{nil}" |
@@ -57,6 +58,8 @@ echo "header files define structures and constants that are needed for" | |||
57 | echo "building most standard programs and are also needed for rebuilding the" | 58 | echo "building most standard programs and are also needed for rebuilding the" |
58 | echo "glibc package." | 59 | echo "glibc package." |
59 | echo "" | 60 | echo "" |
61 | |||
62 | if ! $PREBUILT; then | ||
60 | echo "%package devel" | 63 | echo "%package devel" |
61 | echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel" | 64 | echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel" |
62 | echo "Group: System Environment/Kernel" | 65 | echo "Group: System Environment/Kernel" |
@@ -65,39 +68,26 @@ echo "%description -n kernel-devel" | |||
65 | echo "This package provides kernel headers and makefiles sufficient to build modules" | 68 | echo "This package provides kernel headers and makefiles sufficient to build modules" |
66 | echo "against the $__KERNELRELEASE kernel package." | 69 | echo "against the $__KERNELRELEASE kernel package." |
67 | echo "" | 70 | echo "" |
68 | |||
69 | if ! $PREBUILT; then | ||
70 | echo "%prep" | 71 | echo "%prep" |
71 | echo "%setup -q" | 72 | echo "%setup -q" |
72 | echo "" | 73 | echo "" |
73 | fi | ||
74 | |||
75 | echo "%build" | 74 | echo "%build" |
76 | 75 | echo "make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}" | |
77 | if ! $PREBUILT; then | ||
78 | echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}" | ||
79 | echo "" | 76 | echo "" |
80 | fi | 77 | fi |
81 | 78 | ||
82 | echo "%install" | 79 | echo "%install" |
83 | echo 'KBUILD_IMAGE=$(make image_name)' | 80 | echo 'mkdir -p $RPM_BUILD_ROOT/boot' |
84 | echo "%ifarch ia64" | 81 | echo "%ifarch ia64" |
85 | echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' | 82 | echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi' |
86 | echo "%else" | 83 | echo 'cp $(make image_name) $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" |
87 | echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' | ||
88 | echo "%endif" | ||
89 | |||
90 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install' | ||
91 | echo "%ifarch ia64" | ||
92 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | ||
93 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | 84 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" |
94 | echo "%else" | 85 | echo "%else" |
95 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | 86 | echo 'cp $(make image_name) $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" |
96 | echo "%endif" | 87 | echo "%endif" |
97 | 88 | echo 'make %{?_smp_mflags} INSTALL_MOD_PATH=$RPM_BUILD_ROOT KBUILD_SRC= modules_install' | |
98 | echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install' | 89 | echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install' |
99 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 90 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
100 | |||
101 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | 91 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" |
102 | echo 'bzip2 -9 --keep vmlinux' | 92 | echo 'bzip2 -9 --keep vmlinux' |
103 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" | 93 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" |
@@ -106,8 +96,7 @@ if ! $PREBUILT; then | |||
106 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build" | 96 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build" |
107 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source" | 97 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source" |
108 | echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" | 98 | echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" |
109 | echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude .config.old --exclude .missing-syscalls.d\"" | 99 | echo "tar cf - . $EXCLUDES | tar xf - -C "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" |
110 | echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)" | ||
111 | echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" | 100 | echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" |
112 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" | 101 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" |
113 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" | 102 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" |
@@ -146,12 +135,11 @@ echo "" | |||
146 | echo "%files headers" | 135 | echo "%files headers" |
147 | echo '%defattr (-, root, root)' | 136 | echo '%defattr (-, root, root)' |
148 | echo "/usr/include" | 137 | echo "/usr/include" |
149 | echo "" | ||
150 | if ! $PREBUILT; then | 138 | if ! $PREBUILT; then |
139 | echo "" | ||
151 | echo "%files devel" | 140 | echo "%files devel" |
152 | echo '%defattr (-, root, root)' | 141 | echo '%defattr (-, root, root)' |
153 | echo "/usr/src/kernels/$KERNELRELEASE" | 142 | echo "/usr/src/kernels/$KERNELRELEASE" |
154 | echo "/lib/modules/$KERNELRELEASE/build" | 143 | echo "/lib/modules/$KERNELRELEASE/build" |
155 | echo "/lib/modules/$KERNELRELEASE/source" | 144 | echo "/lib/modules/$KERNELRELEASE/source" |
156 | echo "" | ||
157 | fi | 145 | fi |