Mercurial > hg > octave-nkf > gnulib-hg
changeset 17105:f8dcc5a28ca3
maint.mk: factor the validation of RELEASE_TYPE
With help from Jim Meyering.
http://lists.gnu.org/archive/html/bug-gnulib/2012-09/msg00132.html
* top/maint.mk (_empty, _sp): Move their definition earlier.
(member-check, release-type): New.
Use the latter instead of $(RELEASE_TYPE).
Remove now useless local checks.
author | Akim Demaille <akim@lrde.epita.fr> |
---|---|
date | Fri, 21 Sep 2012 14:11:18 +0200 |
parents | bcbe636cc12f |
children | e429e0d221f9 |
files | ChangeLog top/maint.mk |
diffstat | 2 files changed, 34 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-09-21 Akim Demaille <akim@lrde.epita.fr> + + maint.mk: factor the validation of RELEASE_TYPE + With help from Jim Meyering. + http://lists.gnu.org/archive/html/bug-gnulib/2012-09/msg00132.html + * top/maint.mk (_empty, _sp): Move their definition earlier. + (member-check, release-type): New. + Use the latter instead of $(RELEASE_TYPE). + Remove now useless local checks. + 2012-09-20 Akim Demaille <akim@lrde.epita.fr> maint.mk: silent rules
--- a/top/maint.mk +++ b/top/maint.mk @@ -28,6 +28,22 @@ set $$(_build-aux) relative to $$(srcdir) instead of $$(build_aux)") endif +# Helper variables. +_empty = +_sp = $(_empty) $(_empty) + +# member-check VARIABLE,VALID-VALUES +# ---------------------------------- +# Check that $(VARIABLE) is in the space-separated list of VALID-VALUES, and +# return it. Die otherwise. +member-check = \ + $(if $($(1)), \ + $(if $(findstring $(_sp),$($(1))), \ + $(error invalid $(1): '$($(1))', expected $(2)), \ + $(or $(findstring $(_sp)$($(1))$(_sp),$(_sp)$(2)(_sp)), \ + $(error invalid $(1): '$($(1))', expected $(2)))), \ + $(error $(1) undefined)) + # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. gzip_rsyncable := \ @@ -91,13 +107,17 @@ # Old releases are stored here. release_archive_dir ?= ../release +# Validate and return $(RELEASE_TYPE), or die. +RELEASE_TYPES = alpha beta stable +release-type = $(call member-check,RELEASE_TYPE,$(RELEASE_TYPES)) + # Override gnu_rel_host and url_dir_list in cfg.mk if these are not right. # Use alpha.gnu.org for alpha and beta releases. # Use ftp.gnu.org for stable releases. gnu_ftp_host-alpha = alpha.gnu.org gnu_ftp_host-beta = alpha.gnu.org gnu_ftp_host-stable = ftp.gnu.org -gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE)) +gnu_rel_host ?= $(gnu_ftp_host-$(release-type)) ifeq ($(gnu_rel_host),ftp.gnu.org) url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE) @@ -570,8 +590,6 @@ @h='c-ctype.h' re='\<c_($(ctype_re)) *\(' \ $(_sc_header_without_use) -_empty = -_sp = $(_empty) $(_empty) # The following list was generated by running: # man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \ # | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt @@ -1266,7 +1284,7 @@ translation_project_ ?= coordinator@translationproject.org # Make info-gnu the default only for a stable release. -ifeq ($(RELEASE_TYPE),stable) +ifeq ($(release-type),stable) announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT) announcement_mail_headers_ ?= \ To: info-gnu@gnu.org \ @@ -1284,7 +1302,7 @@ # annoucement message: it would start with " GEN announcement". $(AM_V_at)$(srcdir)/$(_build-aux)/announce-gen \ --mail-headers='$(announcement_mail_headers_)' \ - --release-type=$(RELEASE_TYPE) \ + --release-type=$(release-type) \ --package=$(PACKAGE) \ --prev=$(PREV_VERSION) \ --curr=$(VERSION) \ @@ -1386,9 +1404,7 @@ gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?] .PHONY: release-prep release-prep: - $(AM_V_GEN)case $$RELEASE_TYPE in alpha|beta|stable) ;; \ - *) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac - $(AM_V_at)$(MAKE) --no-print-directory -s announcement \ + $(AM_V_GEN)$(MAKE) --no-print-directory -s announcement \ > ~/announce-$(my_distdir) $(AM_V_at)if test -d $(release_archive_dir); then \ ln $(rel-files) $(release_archive_dir); \