Commit 25b080bd authored by Masahiro Yamada's avatar Masahiro Yamada

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent cc18abbe
if [ ! -f .version ]
then
echo 1
else
expr 0`cat .version` + 1
fi
...@@ -50,8 +50,6 @@ rpm-pkg rpm: FORCE ...@@ -50,8 +50,6 @@ rpm-pkg rpm: FORCE
$(MAKE) clean $(MAKE) clean
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
$(call cmd,src_tar,$(KERNELPATH),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 rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
rm $(KERNELPATH).tar.gz kernel.spec rm $(KERNELPATH).tar.gz kernel.spec
...@@ -60,9 +58,6 @@ rpm-pkg rpm: FORCE ...@@ -60,9 +58,6 @@ rpm-pkg rpm: FORCE
binrpm-pkg: FORCE binrpm-pkg: FORCE
$(MAKE) KBUILD_SRC= $(MAKE) KBUILD_SRC=
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec $(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 \ rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
$(UTS_MACHINE) -bb $(objtree)/binkernel.spec $(UTS_MACHINE) -bb $(objtree)/binkernel.spec
rm binkernel.spec rm binkernel.spec
......
...@@ -27,9 +27,7 @@ __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` ...@@ -27,9 +27,7 @@ __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
echo "Name: kernel" echo "Name: kernel"
echo "Summary: The Linux Kernel" echo "Summary: The Linux Kernel"
echo "Version: $__KERNELRELEASE" echo "Version: $__KERNELRELEASE"
# we need to determine the NEXT version number so that uname and echo "Release: $(cat .version 2>/dev/null || echo 1)"
# rpm -q will agree
echo "Release: `. $srctree/scripts/mkversion`"
echo "License: GPL" echo "License: GPL"
echo "Group: System Environment/Kernel" echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community" echo "Vendor: The Linux Community"
...@@ -77,7 +75,7 @@ fi ...@@ -77,7 +75,7 @@ fi
echo "%build" echo "%build"
if ! $PREBUILT; then if ! $PREBUILT; then
echo "make clean && make %{?_smp_mflags}" echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}"
echo "" echo ""
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment