From patchwork Wed Sep 20 13:01:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 113118 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp739134qgf; Wed, 20 Sep 2017 06:01:58 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBdecExrty+9RXREooiuQM6mfSeFaOeX7Qn3EU1ESvZLkwQy+SL6LhSwnUaqdJyAz/aOzJJ X-Received: by 10.159.198.11 with SMTP id f11mr2016066plo.290.1505912518025; Wed, 20 Sep 2017 06:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505912518; cv=none; d=google.com; s=arc-20160816; b=WTYgUXTLYMCfAFOY+2kCnuAVtdY5qmIFpKLndb2j9KAlmQ0jFgKYGKI3s1sE+uRBK7 B9m48Mg+abmFD2lPTjMEPc2oY6p7WNPDHKsjOKC1UXl73mF2+R4XjG3PYwfNRZk1KGTY /5Pxek4bw6B5OBu91V3b1dT7+LOp20dEK+nHLmipVDnogukEV78J0pIdWQkoIHdZOcdZ LlTOmJ7pipICwjL7mdeoVeoWOFrFgekVozZHQM//kAYzbgw73p5ZC4yF1v1JCw3lPHKX 7IYvN15Wb3DweaD2cx5yUa5RwsDsHHucfN2QhVcL0+uLaFy/yiaKFumqGydYoIbWcFny WZkQ== 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=xtTH/YAnc7n/fZYj0xOKkQNK9ocABPMRMZ/iONNqxDE=; b=cOq8tbAkdYkv1qS8/U4dxTHZJD2LX5okxbg70eJIEhHkx+vZtJ5VdbcFOTjejUcwwv J6/ZkIT2kHGbtVE58a/KM2b59sPC2sgbXTqKgqjhYm5IbPYxEE1O6aARa8dzya2qfOHK RWmKnvSKyOHfxH2oUer0Fi9+RC13yU1P4sA7A2J2zmgCRHJqL4anVLjNhxVUKYf0Zv+u S984HF4hwo5h1PUCAROp7KBq6ppUJJqliSIrKYYRIuUwVVZcUJ3dg/8qXl5Fr0XUIdPz b/qUpYyLSyQP6BJI/tzg2ckTOI2BkA/ce93ZtNUzWObaZDpsN3e+jgUw1WHs3U7rq9rR 5hOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=WiCvxToM; 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 z131si3138704pgz.239.2017.09.20.06.01.57; Wed, 20 Sep 2017 06:01:57 -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=WiCvxToM; 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 S1751964AbdITNBy (ORCPT + 26 others); Wed, 20 Sep 2017 09:01:54 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17665 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbdITNBx (ORCPT ); Wed, 20 Sep 2017 09:01:53 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v8KD1T8U011685; Wed, 20 Sep 2017 22:01:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v8KD1T8U011685 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1505912490; bh=xtTH/YAnc7n/fZYj0xOKkQNK9ocABPMRMZ/iONNqxDE=; h=From:To:Cc:Subject:Date:From; b=WiCvxToMDStRhpPvt4VTCMYyqAHVr9hBGmtCNXqvzSbNrRzZS5frC/uaU+1sgkut7 t46Jf67IaUYN1wHbVYg5wRZF8DdKYWttu7MvjR3Dj6BJ1V83bFn1AWLWqkxP6EVB5N Q+53ukg+qVrhH1FlFjLNi9BMYpBGN5DZ7W8Edwu1XJARPkrjv/jNu89Ob/otr+YncW RDbf2ly0Uopmr+j3paF1bUvl35OG2Io2xVAUMy29tzd/FrwoHZAvlB92Pxi5DDJ8OG bo2WbNCiWY980mRIsk7WE9VNa8E5AcBDMEDy5S3Zlaoe8Ls5POoFnAJKXnDRueXpiI gH8spUHyAkw1A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Riku Voipio , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3] kbuild: (bin)rpm-pkg: fix version number handling Date: Wed, 20 Sep 2017 22:01:26 +0900 Message-Id: <1505912486-30251-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 v3: - add ' 2>/dev/null || echo 1' in case .config is missing for rpm-pkg 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 bf3e9ab..f47f17a 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 2>/dev/null || echo 1)" 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