From: Akim Demaille Date: Fri, 21 Sep 2012 12:11:18 +0000 (+0200) Subject: maint.mk: factor the validation of RELEASE_TYPE X-Git-Tag: v0.1~423 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=aca9380111bb5df9f12b1aa38b6c202f97df6ac7;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index ba00e87e95..0c63b76c98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-09-21 Akim Demaille + + 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 maint.mk: silent rules diff --git a/top/maint.mk b/top/maint.mk index 87bbde9ddf..1851815086 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -28,6 +28,22 @@ ifneq ($(build_aux),) 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 @@ my_distdir = $(PACKAGE)-$(VERSION) # 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 @@ sc_prohibit_c_ctype_without_use: @h='c-ctype.h' re='\&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); \