Message ID | 20170816110855.6021-1-riku.voipio@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Riku, 2017-08-16 20:08 GMT+09:00 <riku.voipio@linaro.org>: > From: Riku Voipio <riku.voipio@linaro.org> > > The updated deb-pkg and bindeb-pkg will use the same snippet, > so make it reusable. > > Signed-off-by: Riku Voipio <riku.voipio@linaro.org> > --- > scripts/package/Makefile | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/scripts/package/Makefile b/scripts/package/Makefile > index 71b4a8af9d4d..9867638896ad 100644 > --- a/scripts/package/Makefile > +++ b/scripts/package/Makefile > @@ -44,14 +44,18 @@ tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ > $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ > rm -f $(2) $(objtree)/.scmversion > > +quiet_cmd_updateversion = UPDATEVERSION > + cmd_updateversion = \ > + $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version; \ > + mv -f $(objtree)/.tmp_version $(objtree)/.version > + > # rpm-pkg > # --------------------------------------------------------------------------- > 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 > + $(call cmd,updateversion) > rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz > rm $(KERNELPATH).tar.gz kernel.spec > > @@ -60,9 +64,7 @@ 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 > - > + $(call cmd,updateversion) > rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ > $(UTS_MACHINE) -bb $(objtree)/binkernel.spec > rm binkernel.spec scripts/mkversion is pretty small. I think scripts/mkversion can also update .version For example, if [ ! -f .version ] then version=1 else version=$(expr 0$(cat .version) + 1) fi echo $version > .version echo $version Then, remove the duplicated code from the Makefile.
2017-09-08 2:04 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: > Hi Riku, > > > 2017-08-16 20:08 GMT+09:00 <riku.voipio@linaro.org>: >> From: Riku Voipio <riku.voipio@linaro.org> >> >> The updated deb-pkg and bindeb-pkg will use the same snippet, >> so make it reusable. >> >> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> >> --- >> scripts/package/Makefile | 12 +++++++----- >> 1 file changed, 7 insertions(+), 5 deletions(-) >> >> diff --git a/scripts/package/Makefile b/scripts/package/Makefile >> index 71b4a8af9d4d..9867638896ad 100644 >> --- a/scripts/package/Makefile >> +++ b/scripts/package/Makefile >> @@ -44,14 +44,18 @@ tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ >> $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ >> rm -f $(2) $(objtree)/.scmversion >> >> +quiet_cmd_updateversion = UPDATEVERSION >> + cmd_updateversion = \ >> + $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version; \ >> + mv -f $(objtree)/.tmp_version $(objtree)/.version >> + >> # rpm-pkg >> # --------------------------------------------------------------------------- >> 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 >> + $(call cmd,updateversion) >> rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz >> rm $(KERNELPATH).tar.gz kernel.spec >> >> @@ -60,9 +64,7 @@ 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 >> - >> + $(call cmd,updateversion) >> rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ >> $(UTS_MACHINE) -bb $(objtree)/binkernel.spec >> rm binkernel.spec > > > > scripts/mkversion is pretty small. > I think scripts/mkversion can also update .version > > For example, > > > > > if [ ! -f .version ] > then > version=1 > else > version=$(expr 0$(cat .version) + 1) > fi > > echo $version > .version > echo $version > > > > > Then, remove the duplicated code from the Makefile. Sorry, please let me think about this carefully. We have simliar code in scripts/link-vmlinux.sh and scripts/mkversion
On 8 September 2017 at 18:40, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > 2017-09-08 2:04 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: >> Hi Riku, >> >> >> 2017-08-16 20:08 GMT+09:00 <riku.voipio@linaro.org>: >>> From: Riku Voipio <riku.voipio@linaro.org> >>> >>> The updated deb-pkg and bindeb-pkg will use the same snippet, >>> so make it reusable. >>> >>> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> >>> --- >>> scripts/package/Makefile | 12 +++++++----- >>> 1 file changed, 7 insertions(+), 5 deletions(-) >>> >>> diff --git a/scripts/package/Makefile b/scripts/package/Makefile >>> index 71b4a8af9d4d..9867638896ad 100644 >>> --- a/scripts/package/Makefile >>> +++ b/scripts/package/Makefile >>> @@ -44,14 +44,18 @@ tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ >>> $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ >>> rm -f $(2) $(objtree)/.scmversion >>> >>> +quiet_cmd_updateversion = UPDATEVERSION >>> + cmd_updateversion = \ >>> + $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version; \ >>> + mv -f $(objtree)/.tmp_version $(objtree)/.version >>> + >>> # rpm-pkg >>> # --------------------------------------------------------------------------- >>> 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 >>> + $(call cmd,updateversion) >>> rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz >>> rm $(KERNELPATH).tar.gz kernel.spec >>> >>> @@ -60,9 +64,7 @@ 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 >>> - >>> + $(call cmd,updateversion) >>> rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ >>> $(UTS_MACHINE) -bb $(objtree)/binkernel.spec >>> rm binkernel.spec >> >> >> >> scripts/mkversion is pretty small. >> I think scripts/mkversion can also update .version >> >> For example, >> >> >> >> >> if [ ! -f .version ] >> then >> version=1 >> else >> version=$(expr 0$(cat .version) + 1) >> fi >> >> echo $version > .version >> echo $version >> >> >> >> >> Then, remove the duplicated code from the Makefile. > > > > Sorry, please let me think about this carefully. > > We have simliar code in > scripts/link-vmlinux.sh and scripts/mkversion Oh. Looking deeper, running "make binrpm" twice in a row incrediments the .version with two. I think we can leave updating version to link-mklinux and drop updating .version from scripts/packaging/Makefile. The actual use of mkversion is then to predict the next version, and we can stop using .version directly in builddeb since the build will outdate it. Riku -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2017-09-11 19:48 GMT+09:00 Riku Voipio <riku.voipio@linaro.org>: > On 8 September 2017 at 18:40, Masahiro Yamada > <yamada.masahiro@socionext.com> wrote: >> 2017-09-08 2:04 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: >>> Hi Riku, >>> >>> >>> 2017-08-16 20:08 GMT+09:00 <riku.voipio@linaro.org>: >>>> From: Riku Voipio <riku.voipio@linaro.org> >>>> >>>> The updated deb-pkg and bindeb-pkg will use the same snippet, >>>> so make it reusable. >>>> >>>> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> >>>> --- >>>> scripts/package/Makefile | 12 +++++++----- >>>> 1 file changed, 7 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/scripts/package/Makefile b/scripts/package/Makefile >>>> index 71b4a8af9d4d..9867638896ad 100644 >>>> --- a/scripts/package/Makefile >>>> +++ b/scripts/package/Makefile >>>> @@ -44,14 +44,18 @@ tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ >>>> $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ >>>> rm -f $(2) $(objtree)/.scmversion >>>> >>>> +quiet_cmd_updateversion = UPDATEVERSION >>>> + cmd_updateversion = \ >>>> + $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version; \ >>>> + mv -f $(objtree)/.tmp_version $(objtree)/.version >>>> + >>>> # rpm-pkg >>>> # --------------------------------------------------------------------------- >>>> 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 >>>> + $(call cmd,updateversion) >>>> rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz >>>> rm $(KERNELPATH).tar.gz kernel.spec >>>> >>>> @@ -60,9 +64,7 @@ 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 >>>> - >>>> + $(call cmd,updateversion) >>>> rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ >>>> $(UTS_MACHINE) -bb $(objtree)/binkernel.spec >>>> rm binkernel.spec >>> >>> >>> >>> scripts/mkversion is pretty small. >>> I think scripts/mkversion can also update .version >>> >>> For example, >>> >>> >>> >>> >>> if [ ! -f .version ] >>> then >>> version=1 >>> else >>> version=$(expr 0$(cat .version) + 1) >>> fi >>> >>> echo $version > .version >>> echo $version >>> >>> >>> >>> >>> Then, remove the duplicated code from the Makefile. >> >> >> >> Sorry, please let me think about this carefully. >> >> We have simliar code in >> scripts/link-vmlinux.sh and scripts/mkversion > > Oh. Looking deeper, running "make binrpm" twice in a row incrediments > the .version with two. I think we can leave updating version to > link-mklinux and drop updating .version from > scripts/packaging/Makefile. The actual use of mkversion is then to > predict the next version, and we can stop using .version directly in > builddeb since the build will outdate it. > Even worse, the spec file claims a different number from the one embedded in the kernel image (for both rpm-pkg and binrpm-pkg). I sent a patch. Seems working as far as I tested.
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 71b4a8af9d4d..9867638896ad 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -44,14 +44,18 @@ tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ rm -f $(2) $(objtree)/.scmversion +quiet_cmd_updateversion = UPDATEVERSION + cmd_updateversion = \ + $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version; \ + mv -f $(objtree)/.tmp_version $(objtree)/.version + # rpm-pkg # --------------------------------------------------------------------------- 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 + $(call cmd,updateversion) rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz rm $(KERNELPATH).tar.gz kernel.spec @@ -60,9 +64,7 @@ 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 - + $(call cmd,updateversion) rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ $(UTS_MACHINE) -bb $(objtree)/binkernel.spec rm binkernel.spec