From patchwork Thu Sep 14 11:26:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 112546 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp628812qgf; Thu, 14 Sep 2017 04:27:58 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5l9/kpxO41GbiF643g/48oiLdL09oTzTEunNC80Pl/zIQHHKHa9SfUoP5EaR17TVVMuIJ2 X-Received: by 10.98.236.17 with SMTP id k17mr20297058pfh.191.1505388478534; Thu, 14 Sep 2017 04:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505388478; cv=none; d=google.com; s=arc-20160816; b=VwZE3cAf0ZlrKDR8rsMKiW89Hi5FEkjJgvvom6snB60yFGMs9ahhjzUDP/+mkRa9OJ Ugvx+Qe4B1ykOaUHI9oyBBhOlDJBfsRAUJX6DvUODLNy7M7zlE/uRY4uzUFVQ6RCFbuL U64og8jrPTISkvA16A7ggl8S60GMwPEG2hWseTt/7CHHHrp0g2iHa18knwEsYXMYAT9P 6IqTyp/LWS+oNtIME3Yv3F3YTGvBu8ohfpSudleg0OXxnkBVthG7e1wdl53KyYQGDjqf BV27XlZZuzdzkaQNlFuu4D1tULCjI2jxENjoJWgmn+CME4bRyoC/JmyHi40Es+fvAu+u fevw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=YH4cfAkeJqsvzHZ+dxYDHrs5Oxa9OJ0cP/7zoW3a55I=; b=sRVSJ03fACjH+YvSgHm7ufQwwvcAMKRnZpS5hoyi9EeWUn+ZQ67/tOVlbgDySSn6O4 DOqDR1vhGoLBWICTplV1G6KY2fR9GAp653BFD66zjavnbSGkgoJksuHy0OcatFmBQ5J5 SAOWZM6ss3fpht/JkV80iP4jdncSs4mKiCbPJGKRQa51nbHCM5ORT4F3aNO36AeqGw78 zAPXaE0cQWmOcW1xJ1+XYWqdCQQtapERgAF+JELI29GR4SaP0zIUrzTnoZssb1LsDuAj vKDFV+8FOH+BVf4HBj8x0B6K9cTFqaUKzf9RBijpWAHz61rfQQ1ZeRuRmlg9BDHNZgl3 6buQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Cg6iNrnh; 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 h7si2169298pll.139.2017.09.14.04.27.56; Thu, 14 Sep 2017 04:27:58 -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=Cg6iNrnh; 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 S1751961AbdINL1x (ORCPT + 26 others); Thu, 14 Sep 2017 07:27:53 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:44019 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845AbdINL1w (ORCPT ); Thu, 14 Sep 2017 07:27:52 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id v8EBQC2Y007151; Thu, 14 Sep 2017 20:26:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com v8EBQC2Y007151 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1505388374; bh=YH4cfAkeJqsvzHZ+dxYDHrs5Oxa9OJ0cP/7zoW3a55I=; h=From:To:Cc:Subject:Date:From; b=Cg6iNrnhwjIui5n40ZFO20Bj+yAOyDOT74j382ypgFiVyShS0kwlj/fmMa46W7Ddm k4UrFGp4PMsj4yfGNpql5mS3NsC8R04yCMBzFjTGae3uAiHpfc0ywpS74cj1Y13f+H lCywkuX/dMmjiNSk/tBrBddHs5z9Ky+pwHFmvdzngVWs1Oa9kDamHN229aIJDdKOlz khsulCczyN0l1XGPDnEPkcQ8DosO/xahOJo1ltcCsH6eCCH+dfFehAaFVzS1HrDaAI s1LzzDNRrD/gbh4ZL0XSp/ztZFtOqD9pzX/jWqD8VQwFJ8tmbL1QSdfcQnCjQ5nEKN ZwsElw18RWF3g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Riku Voipio , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2] kbuild: (bin)rpm-pkg: fix version number handling Date: Thu, 14 Sep 2017 20:26:06 +0900 Message-Id: <1505388366-4192-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "Release:" field of the spec file is determined based on the .version file. However, the .version file is not copied to the source tar file. So, when we build the kernel from the source package, the UTS_VERSION always indicates #1. This does not match with "rpm -q". The kernel UTS_VERSION and "rpm -q" do not agree for binrpm-pkg, either. Please note the kernel has already been built before the spec file is created. Currently, mkspec invokes mkversion. This script returns an incremented version. So, the "Release:" field of the spec file is greater than the version in the kernel by one. For the source package build (where .version file is missing), we can give KBUILD_BUILD_VERSION=%{release} to the build command. For the binary package build, we can simply read out the .version file because it contains the version number that was used for building the kernel image. We can remove scripts/mkversion because scripts/package/Makefile need not touch the .version file. Signed-off-by: Masahiro Yamada --- Changes in v2: - Remove bogus comment in mkspec scripts/mkversion | 6 ------ scripts/package/Makefile | 5 ----- scripts/package/mkspec | 6 ++---- 3 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 scripts/mkversion -- 2.7.4 diff --git a/scripts/mkversion b/scripts/mkversion deleted file mode 100644 index c12addc..0000000 --- a/scripts/mkversion +++ /dev/null @@ -1,6 +0,0 @@ -if [ ! -f .version ] -then - echo 1 -else - expr 0`cat .version` + 1 -fi diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 71b4a8a..73f9f31 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -50,8 +50,6 @@ rpm-pkg rpm: FORCE $(MAKE) clean $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec $(call cmd,src_tar,$(KERNELPATH),kernel.spec) - $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version - mv -f $(objtree)/.tmp_version $(objtree)/.version rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz rm $(KERNELPATH).tar.gz kernel.spec @@ -60,9 +58,6 @@ rpm-pkg rpm: FORCE binrpm-pkg: FORCE $(MAKE) KBUILD_SRC= $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec - $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version - mv -f $(objtree)/.tmp_version $(objtree)/.version - rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ $(UTS_MACHINE) -bb $(objtree)/binkernel.spec rm binkernel.spec diff --git a/scripts/package/mkspec b/scripts/package/mkspec index bb43f15..e81dafc 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -27,9 +27,7 @@ __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` echo "Name: kernel" echo "Summary: The Linux Kernel" echo "Version: $__KERNELRELEASE" -# we need to determine the NEXT version number so that uname and -# rpm -q will agree -echo "Release: `. $srctree/scripts/mkversion`" +echo "Release: $(cat .version)" echo "License: GPL" echo "Group: System Environment/Kernel" echo "Vendor: The Linux Community" @@ -77,7 +75,7 @@ fi echo "%build" if ! $PREBUILT; then -echo "make clean && make %{?_smp_mflags}" +echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}" echo "" fi