diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-09-30 10:10:05 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-10-09 18:13:19 +0900 |
commit | 5289c322ba994c7b07a4780243dca1feb610954f (patch) | |
tree | 84cca60efb31dd13aae8fd8b8aee9f23255ae0a6 /scripts | |
parent | 81771ce2d1a9f9ce8739aac7af64bb03ff4b6a1a (diff) | |
download | linux-5289c322ba994c7b07a4780243dca1feb610954f.tar.gz linux-5289c322ba994c7b07a4780243dca1feb610954f.tar.bz2 linux-5289c322ba994c7b07a4780243dca1feb610954f.zip |
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>
Diffstat (limited to 'scripts')
-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 @@ # # how we were called determines which rpms we build and how we build them -if [ "$1" = "prebuilt" ]; then +if [ "$1" = prebuilt ]; then PREBUILT=true else PREBUILT=false fi -# starting to output the spec -if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then +if grep -q CONFIG_DRM=y .config; then PROVIDES=kernel-drm fi PROVIDES="$PROVIDES kernel-$KERNELRELEASE" -__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` +__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") +EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ +--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ +--exclude=.config.old --exclude=.missing-syscalls.d" echo "Name: kernel" echo "Summary: The Linux Kernel" @@ -37,7 +39,6 @@ if ! $PREBUILT; then echo "Source: kernel-$__KERNELRELEASE.tar.gz" fi -echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root" echo "Provides: $PROVIDES" echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" echo "%define debug_package %{nil}" @@ -57,6 +58,8 @@ echo "header files define structures and constants that are needed for" echo "building most standard programs and are also needed for rebuilding the" echo "glibc package." echo "" + +if ! $PREBUILT; then echo "%package devel" echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel" echo "Group: System Environment/Kernel" @@ -65,39 +68,26 @@ echo "%description -n kernel-devel" echo "This package provides kernel headers and makefiles sufficient to build modules" echo "against the $__KERNELRELEASE kernel package." echo "" - -if ! $PREBUILT; then echo "%prep" echo "%setup -q" echo "" -fi - echo "%build" - -if ! $PREBUILT; then -echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}" +echo "make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}" echo "" fi echo "%install" -echo 'KBUILD_IMAGE=$(make image_name)' +echo 'mkdir -p $RPM_BUILD_ROOT/boot' echo "%ifarch ia64" -echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' -echo "%else" -echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' -echo "%endif" - -echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install' -echo "%ifarch ia64" -echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" +echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi' +echo 'cp $(make image_name) $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" echo "%else" -echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" +echo 'cp $(make image_name) $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" echo "%endif" - +echo 'make %{?_smp_mflags} INSTALL_MOD_PATH=$RPM_BUILD_ROOT KBUILD_SRC= modules_install' echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install' echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" - echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" echo 'bzip2 -9 --keep vmlinux' echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" @@ -106,8 +96,7 @@ if ! $PREBUILT; then echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build" echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source" echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" -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\"" -echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)" +echo "tar cf - . $EXCLUDES | tar xf - -C "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" @@ -146,12 +135,11 @@ echo "" echo "%files headers" echo '%defattr (-, root, root)' echo "/usr/include" -echo "" if ! $PREBUILT; then +echo "" echo "%files devel" echo '%defattr (-, root, root)' echo "/usr/src/kernels/$KERNELRELEASE" echo "/lib/modules/$KERNELRELEASE/build" echo "/lib/modules/$KERNELRELEASE/source" -echo "" fi |