aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-20 09:01:26 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-20 11:06:03 -0400
commit25b080bd53f2873785fa049f570ac1b361c11d72 (patch)
tree9787008d10d9cdd076ace1dbbd8f68dcaac50be8
parentcc18abbe449aafc013831a8e0440afc336ae1cba (diff)
kbuild: rpm-pkg: fix version number handling
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 <yamada.masahiro@socionext.com>
-rw-r--r--scripts/mkversion6
-rw-r--r--scripts/package/Makefile5
-rwxr-xr-xscripts/package/mkspec6
3 files changed, 2 insertions, 15 deletions
diff --git a/scripts/mkversion b/scripts/mkversion
deleted file mode 100644
index c12addc9c7ef..000000000000
--- a/scripts/mkversion
+++ /dev/null
@@ -1,6 +0,0 @@
1if [ ! -f .version ]
2then
3 echo 1
4else
5 expr 0`cat .version` + 1
6fi
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 71b4a8af9d4d..73f9f3192b9f 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -50,8 +50,6 @@ rpm-pkg rpm: FORCE
50 $(MAKE) clean 50 $(MAKE) clean
51 $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec 51 $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
52 $(call cmd,src_tar,$(KERNELPATH),kernel.spec) 52 $(call cmd,src_tar,$(KERNELPATH),kernel.spec)
53 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
54 mv -f $(objtree)/.tmp_version $(objtree)/.version
55 rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz 53 rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
56 rm $(KERNELPATH).tar.gz kernel.spec 54 rm $(KERNELPATH).tar.gz kernel.spec
57 55
@@ -60,9 +58,6 @@ rpm-pkg rpm: FORCE
60binrpm-pkg: FORCE 58binrpm-pkg: FORCE
61 $(MAKE) KBUILD_SRC= 59 $(MAKE) KBUILD_SRC=
62 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec 60 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
63 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
64 mv -f $(objtree)/.tmp_version $(objtree)/.version
65
66 rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ 61 rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
67 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec 62 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec
68 rm binkernel.spec 63 rm binkernel.spec
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index bf3e9abb2846..f47f17aae135 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -27,9 +27,7 @@ __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
27echo "Name: kernel" 27echo "Name: kernel"
28echo "Summary: The Linux Kernel" 28echo "Summary: The Linux Kernel"
29echo "Version: $__KERNELRELEASE" 29echo "Version: $__KERNELRELEASE"
30# we need to determine the NEXT version number so that uname and 30echo "Release: $(cat .version 2>/dev/null || echo 1)"
31# rpm -q will agree
32echo "Release: `. $srctree/scripts/mkversion`"
33echo "License: GPL" 31echo "License: GPL"
34echo "Group: System Environment/Kernel" 32echo "Group: System Environment/Kernel"
35echo "Vendor: The Linux Community" 33echo "Vendor: The Linux Community"
@@ -77,7 +75,7 @@ fi
77echo "%build" 75echo "%build"
78 76
79if ! $PREBUILT; then 77if ! $PREBUILT; then
80echo "make clean && make %{?_smp_mflags}" 78echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}"
81echo "" 79echo ""
82fi 80fi
83 81