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

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

 



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.




-- 
Best Regards
Masahiro Yamada
--
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