On 3/3/19 7:03 PM, Bruno Haible wrote: > 2) A submodule has to be upgraded occasionally. bootstrap/autogen.sh does > not help doing this. I have to keep a command in a cheat-sheet: > $ (cd gnulib && git fetch && git merge origin/master); git add gnulib
Additionally to updating gnulib, often some projects need to sync additional files from the freshly updated gnulib subdirectory, like e.g. bootstrap or COPYING. In December, I've suggested [1] the new makefile target 'update-gnulib-to-lates' (alias 'gnulib-sync') which allows to specify a hook to perform such additional tasks - see attached. In coreutils, the hook for copying the extra files boils down to (in cfg.mk): +# Override gnulib to copy some files from there during 'make gnulib-sync'. +cu_GNULIB_SYNC_HOOK: + @{ cd $(srcdir) \ + && set -x \ + && cp gnulib/doc/COPYINGv3 COPYING \ + && cp gnulib/build-aux/bootstrap bootstrap \ + && cp gnulib/tests/init.sh tests/init.sh \ + ; } +export _gl_GNULIB_SYNC_HOOK = cu_GNULIB_SYNC_HOOK [1] http://lists.gnu.org/archive/html/coreutils/2018-12/msg00007.html WDYT? Have a nice day, Berny
>From 5a07e65cd38fa949294e384fd5635408df4f2fab Mon Sep 17 00:00:00 2001 From: Bernhard Voelker <m...@bernhard-voelker.de> Date: Thu, 13 Dec 2018 00:35:23 +0100 Subject: [PATCH] maintainer-makefile: provide make target to update gnulib to latest * top/maint.mk (gnulib-sync, update-gnulib-to-latest): Add targets, using the following hook variable to optionally e.g copy some files from gnulib into the own package after pulling. (_gl_GNULIB_SYNC_HOOK): Add hook variable to be optionally overridden in 'cfg.mk'. Default to ... (_gl_GNULIB_SYNC_HOOK_empty): ... this empty target. --- ChangeLog | 10 ++++++++++ top/maint.mk | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index e3c929b52..313eb2a83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-10-28 Bernhard Voelker <m...@bernhard-voelker.de> + + maintainer-makefile: provide make target to update gnulib to latest + * top/maint.mk (gnulib-sync, update-gnulib-to-latest): Add targets, + using the following hook variable to optionally e.g copy some files + from gnulib into the own package after pulling. + (_gl_GNULIB_SYNC_HOOK): Add hook variable to be + optionally overridden in 'cfg.mk'. Default to ... + (_gl_GNULIB_SYNC_HOOK_empty): ... this empty target. + 2018-12-13 Bruno Haible <br...@clisp.org> select tests: Avoid test failure on Cygwin. diff --git a/top/maint.mk b/top/maint.mk index 4889ebacc..b90a776dc 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1571,6 +1571,42 @@ update-copyright: $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \ | $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@ +# 'gnulib-sync': Update gnulib to latest. +# Prerequisite: the working tree of both your package and gnulib are clean +# (which is checked first). +# To optionally copy some additional files from there right after the pull, +# override the '_gl_GNULIB_SYNC_HOOK' make variable in your 'cfg.mk' with +# the name of the make target which is then actually taking over the files. +# This can be useful for files you need to have physically in your repository, +# like e.g. 'COPYING' (for legal reasons) or 'bootstrap'. +# Example: +# my_GNULIB_SYNC_HOOK: +# @{ cd $(srcdir) \ +# && cp gnulib/doc/COPYINGv3 COPYING \ +# && cp gnulib/build-aux/bootstrap bootstrap \ +# ; } +# export _gl_GNULIB_SYNC_HOOK = my_GNULIB_SYNC_HOOK +# +# Declare the default hook target (empty). +.PHONY: _gl_GNULIB_SYNC_HOOK_empty +_gl_GNULIB_SYNC_HOOK ?= _gl_GNULIB_SYNC_HOOK_empty +_gl_GNULIB_SYNC_HOOK_empty: + +.PHONY: gnulib-sync update-gnulib-to-latest +gnulib-sync update-gnulib-to-latest: + @{ cd $(srcdir) \ + && { printf 'gnulib: ' && git -C gnulib describe --always --dirty \ + && printf 'your package: ' && git describe --always --dirty \ + || echo dirty; \ + } | grep 'dirty$$' \ + && { echo "$@: error: tree is dirty" >&2; exit 1; } \ + || : \ + && set -x \ + && git -C gnulib pull origin master \ + && $(MAKE) $(_gl_GNULIB_SYNC_HOOK) \ + && git status --short --untracked-files=no \ + ; } + # This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not # overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS. -- 2.19.2