Re: [PATCH 1/2] scripts/package/Makefile: make revision update a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8 September 2017 at 18:40, Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
> 2017-09-08 2:04 GMT+09:00 Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>:
>> Hi Riku,
>>
>>
>> 2017-08-16 20:08 GMT+09:00  <riku.voipio@xxxxxxxxxx>:
>>> From: Riku Voipio <riku.voipio@xxxxxxxxxx>
>>>
>>> The updated deb-pkg and bindeb-pkg will use the same snippet,
>>> so make it reusable.
>>>
>>> Signed-off-by: Riku Voipio <riku.voipio@xxxxxxxxxx>
>>> ---
>>>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux