From patchwork Sat Sep 30 01:10:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 114530 Delivered-To: patch@linaro.org Received: by 10.140.104.133 with SMTP id a5csp1415302qgf; Fri, 29 Sep 2017 18:12:04 -0700 (PDT) X-Google-Smtp-Source: AOwi7QC856VSRMS2GWxKHNVQ5+ithmPycSfOtxImEaW1OnQu7/5N0y3cd5rhghk7mdc66NG7/szL X-Received: by 10.98.204.157 with SMTP id j29mr9437627pfk.100.1506733924484; Fri, 29 Sep 2017 18:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506733924; cv=none; d=google.com; s=arc-20160816; b=byk5tgAMdxogzlwiNiW7aa+rg6TDK8asrMAs86DcOVTFnaS2PFV9Xal+oN21zn+ABu KbvM3jcBLmIq0T+UnTTrJwK2fZApxso88Fc0jft/BitrDqOYpNid798Glxw9VJ7g01mg 3pqpEd+IGA8Rs69b9d6wH7rwB4iLcn/31wXq9OSIt6D7RStXGCYNX05rsmTOVcxH/Xov 2d7IiPDQbB19UWPVgAceGnkn4NzdBPcXEPUwAh/LHKk2FAvvHNRqOD7zFFWZjDKnHd1O fVv0qk9M8/Vj54vCaRFKy22AMyDXBoBaNFB9mwHBIOQprDyYUIKuycp9BlAF3SGGbFBe O+Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=7y6SYGQyVyohvLkfWG7dhfkBMn/pCsMWpkE07ip23VM=; b=lSda3oQjiJJ0djV7+trAuGnBETnFhVfyLmCGGL7FNRxbETc7l3P8o60M7WDrigeODe m5Fnd3P6kr/eXac8c3+1PU8kygt1llRxD5zNwdnFodFcNK+btPIjqW1mBEGhzGdM0wlB bir7V+cM7pT+P8DAzL1q9pUSY/8epqqGjIOqQGkAzRuSe2fjm87W8ib2qYVdG59VTBcy qCNZOGPd6Hrr1v8HYuHG4NBeXiZPG54whI1I+MxtmfbRTBBR3BUXSskp/rRurHAXNqbC WCztLoOTIbXcstpb1bkzrKKkUs5sbMVQwkDr2T+pY8J/sscrZKEOwic3nv+5MrQw/qbq Oqyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JW46DLIt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si4208362pls.503.2017.09.29.18.12.04; Fri, 29 Sep 2017 18:12:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JW46DLIt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752866AbdI3BMC (ORCPT + 26 others); Fri, 29 Sep 2017 21:12:02 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:25305 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752627AbdI3BKf (ORCPT ); Fri, 29 Sep 2017 21:10:35 -0400 Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-07.nifty.com with ESMTP id v8U1AOK7030198; Sat, 30 Sep 2017 10:10:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v8U1AOK7030198 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1506733825; bh=7y6SYGQyVyohvLkfWG7dhfkBMn/pCsMWpkE07ip23VM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JW46DLIthJusLyVczVMWS4wpzJ+Tv8sipvAiPHOw0QOzWODcYckB01eREgUtnFU7r Uk9hYEKFXOR3EA/+YVQwiq8HrycuuSSf4+7yK4QJxLT26RLcwzQK3Hu0eFRSxPsPd5 HT7C06tzWtUuROZfFVY6Jsly4XwMqG1a/YEK2ZVonSUCDzmlF5TYPp9c19309XS1FM Y4/YI1lPPAR2WVk28Wd3cU1Xc/fmm2posjclE+aEMk9OkOZYFLFtne2G7+ZVVuSPXf MgphhGhU/3+U5V5kXB3B/4U8o3fzuF5d97PnTb/lKvtLEuZhaULHyPdWqq+3X2LcOL CapD2ooJte8bw== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 3/9] kbuild: rpm-pkg: clean up mkspec Date: Sat, 30 Sep 2017 10:10:05 +0900 Message-Id: <1506733811-24636-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506733811-24636-1-git-send-email-yamada.masahiro@socionext.com> References: <1506733811-24636-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- scripts/package/mkspec | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) -- 2.7.4 diff --git a/scripts/package/mkspec b/scripts/package/mkspec index a026c08..97feb60 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