>From 5a07e65cd38fa949294e384fd5635408df4f2fab Mon Sep 17 00:00:00 2001 From: Bernhard Voelker 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 + + 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 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