Simon Josefsson [2025-11-12 22:36 +0100] wrote: > "Basil L. Contovounesios" <[email protected]> writes: > >> It should work with these changes. They were motivated by trying to use >> only a NEWS.md with the following cfg.mk: > > Is it possible to just make things work by default? Is there any > problem to simply have logic that checks for NEWS.md and prefers that, > if it exists, otherwise fall back to NEWS? Having to put things in > cfg.mk for a common setup like using NEWS.md seems unnecessary to me.
+1 from me, I was just erring on the side of being conservative. I attach some patches which should make this possible. Again I conservatively gave NEWS precedence over NEWS.md (in line with what Automake does), but it's easy to flip that around in the absence of objections. > I will be happy to test this with some packages as soon as this lands in > gnulib. Will recent automake be required, or merely opt-in? None of these changes in Gnulib depend on Automake, so it shouldn't be needed. It is only when a project is already using Automake at a strictness level other than 'foreign' that a recent version (>= 1.16.4) is needed in order to have NEWS.md accepted without complaint over NEWS. IOW, recent Automake is needed only to pacify its own strictness levels. > My trick > with README -> README.md symlink works with ancient tooling, and if at > all possible, it would be nice to use a NEWS -> NEWS.md symlink, or just > rename to NEWS.md. What would you recommend? Personally I would prefer to not need an alias within my own project, and just have a single accepted file name. If we stick with NEWS taking precedence over NEWS.md, but a project is limited to using NEWS yet desires Markdown syntax, then either that project needs to modify several variables in cfg.mk, or we can add a new variable indicating the desired syntax irrespective of the NEWS file name. IOW, my preference is to use .md only, without symlinks, when Markdown is desirable (e.g. when the forge's page renders it nicely). Thanks, -- Basil
>From bb74a30b1baefce8abb3a4400ba742caf9dc9f8a Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <[email protected]> Date: Fri, 14 Nov 2025 19:10:11 +0100 Subject: [PATCH 1/4] announce-gen: Pacify POD errors. * build-aux/announce-gen: Wrap all =items within =over..=back. Terminate all C< formatting codes with >, not EOL. (sizes): Format assignment operator like surrounding code. (print_locations): Add missing C formatting code. --- ChangeLog | 8 ++++++++ build-aux/announce-gen | 17 +++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b22002bf3e..9ca403b7e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-11-14 Basil L. Contovounesios <[email protected]> + + announce-gen: Pacify POD errors. + * build-aux/announce-gen: Wrap all =items within =over..=back. + Terminate all C< formatting codes with >, not EOL. + (sizes): Format assignment operator like surrounding code. + (print_locations): Add missing C formatting code. + 2025-11-13 Bruno Haible <[email protected]> file-remote: Tweaks. diff --git a/build-aux/announce-gen b/build-aux/announce-gen index c90a33e3b2..8d02f4f5c8 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -35,7 +35,7 @@ eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2025-07-30 01:47'; # UTC +my $VERSION = '2025-11-14 18:29'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -111,8 +111,9 @@ EOF exit $exit_code; } +=over -=item C<%size> = C<sizes (@file)> +=item C<%size = sizes (@file)> Compute the sizes of the C<@file> and return them as a hash. Return C<undef> if one of the computation failed. @@ -139,9 +140,9 @@ sub sizes (@) return $fail ? undef : %res; } -=item C<print_locations ($title, \@url, \%size, @file) +=item C<print_locations ($title, \@url, \%size, @file)> -Print a section C<$title> dedicated to the list of <@file>, which +Print a section C<$title> dedicated to the list of C<@file>, which sizes are stored in C<%size>, and which are available from the C<@url>. =cut @@ -163,7 +164,7 @@ sub print_locations ($\@\%@) print "\n"; } -=item C<print_checksums (@file) +=item C<print_checksums (@file)> Print the SHA1 and SHA256 signature section for each C<@file>. @@ -214,7 +215,7 @@ sub print_checksums ($@) } } -=item C<print_news_deltas ($news_file, $prev_version, $curr_version) +=item C<print_news_deltas ($news_file, $prev_version, $curr_version)> Print the section of the NEWS file C<$news_file> addressing changes between versions C<$prev_version> and C<$curr_version>. @@ -720,6 +721,10 @@ EOF exit 0; } +=back + +=cut + ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: ## mode: perl -- 2.51.0
>From 6ccfa0923384a44e4562c4940f03eeae94ee9c33 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <[email protected]> Date: Wed, 12 Nov 2025 14:49:46 +0100 Subject: [PATCH 2/4] announce-gen: Accommodate alternative NEWS formats. * build-aux/announce-gen: Allow overriding NEWS section heading prefix via new option --news-prefix. (print_news_deltas): Use it in place of hard-coded '*'. Allow multiple repetitions of the prefix. (usage): Document --news-prefix. --- ChangeLog | 7 +++++++ build-aux/announce-gen | 19 ++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ca403b7e7..a82fd2ecb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2025-11-14 Basil L. Contovounesios <[email protected]> + announce-gen: Accommodate alternative NEWS formats. + * build-aux/announce-gen: Allow overriding NEWS section + heading prefix via new option --news-prefix. + (print_news_deltas): Use it in place of hard-coded '*'. + Allow multiple repetitions of the prefix. + (usage): Document --news-prefix. + announce-gen: Pacify POD errors. * build-aux/announce-gen: Wrap all =items within =over..=back. Terminate all C< formatting codes with >, not EOL. diff --git a/build-aux/announce-gen b/build-aux/announce-gen index 8d02f4f5c8..ff943690cc 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -35,7 +35,7 @@ eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2025-11-14 18:29'; # UTC +my $VERSION = '2025-11-14 18:30'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -84,6 +84,8 @@ The following are optional: --news=NEWS_FILE include the NEWS section about this release from this NEWS_FILE; accumulates. + --news-prefix=PRE string identifying the start of a NEWS section + heading --srcdir=DIR where to find the NEWS_FILEs (default: $srcdir) --bootstrap-tools=TOOL_LIST a comma-separated list of tools, e.g., autoconf,automake,bison,gnulib @@ -215,16 +217,17 @@ sub print_checksums ($@) } } -=item C<print_news_deltas ($news_file, $prev_version, $curr_version)> +=item C<print_news_deltas ($news_file, $news_pre, $prev_version, $curr_version)> Print the section of the NEWS file C<$news_file> addressing changes -between versions C<$prev_version> and C<$curr_version>. +between versions C<$prev_version> and C<$curr_version>. Expects the +corresponding section headings to start with C<$news_pre>. =cut -sub print_news_deltas ($$$) +sub print_news_deltas ($$$$) { - my ($news_file, $prev_version, $curr_version) = @_; + my ($news_file, $news_pre, $prev_version, $curr_version) = @_; my $news_name = $news_file; $news_name =~ s|^\Q$srcdir\E/||; @@ -236,7 +239,7 @@ sub print_news_deltas ($$$) # the first occurrence of $prev_version. my $in_items; - my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/; + my $re_prefix = qr/(?:\Q$news_pre\E+ )?(?:Noteworthy c|Major c|C)(?i:hanges)/; my $found_news; open NEWS, '<', $news_file @@ -442,6 +445,7 @@ sub readable_interval($) my $gpg_key_id; my @url_dir_list; my @news_file; + my $news_prefix = '*'; my $bootstrap_tools; my $gnulib_version; my $print_checksums_p = 1; @@ -470,6 +474,7 @@ sub readable_interval($) 'gpg-keyring-url=s' => \$gpg_keyring_url, 'url-directory=s' => \@url_dir_list, 'news=s' => \@news_file, + 'news-prefix=s' => \$news_prefix, 'srcdir=s' => \$srcdir, 'bootstrap-tools=s' => \$bootstrap_tools, 'gnulib-version=s' => \$gnulib_version, @@ -712,7 +717,7 @@ EOF and print "\nThis release was bootstrapped with the following tools:", join ('', map {"\n $_"} @tool_versions), "\n"; - print_news_deltas ($_, $prev_version, $curr_version) + print_news_deltas ($_, $news_prefix, $prev_version, $curr_version) foreach @news_file; $release_type eq 'stable' -- 2.51.0
>From 0808902314eff0dc1bcdb2d25b932e161bb56fae Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <[email protected]> Date: Fri, 14 Nov 2025 23:38:38 +0100 Subject: [PATCH 3/4] maintainer-makefile: Avoid recursive $(shell) expansion. * top/maint.mk (gnulib_dir): Define as simply expanded, to avoid recursive expansion of $(shell) invocation. --- ChangeLog | 6 ++++++ top/maint.mk | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a82fd2ecb3..1943aa8717 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-11-15 Basil L. Contovounesios <[email protected]> + + maintainer-makefile: Avoid recursive $(shell) expansion. + * top/maint.mk (gnulib_dir): Define as simply expanded, to avoid + recursive expansion of $(shell) invocation. + 2025-11-14 Basil L. Contovounesios <[email protected]> announce-gen: Accommodate alternative NEWS formats. diff --git a/top/maint.mk b/top/maint.mk index 815a23a13e..c0eda134dd 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -64,11 +64,14 @@ VC_LIST = # You can override this variable in cfg.mk if your gnulib submodule lives # in a different location. -gnulib_dir ?= $(shell if test -n "$(GNULIB_SRCDIR)" && test -f "$(GNULIB_SRCDIR)/gnulib-tool"; then \ - echo "$(GNULIB_SRCDIR)"; \ - else \ - echo $(srcdir)/gnulib; \ - fi) +ifeq ($(origin gnulib_dir),undefined) + gnulib_dir := $(shell if test -n "$(GNULIB_SRCDIR)" \ + && test -f "$(GNULIB_SRCDIR)/gnulib-tool"; then \ + echo "$(GNULIB_SRCDIR)"; \ + else \ + echo $(srcdir)/gnulib; \ + fi) +endif # You can override this variable in cfg.mk to set your own regexp # matching files to ignore. -- 2.51.0
>From 1dc6d38819d3e02a9e6ffdc56fb6feaf42a84713 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <[email protected]> Date: Fri, 14 Nov 2025 23:42:10 +0100 Subject: [PATCH 4/4] maintainer-makefile: Auto-detect NEWS.md. Suggested by Simon Josefsson <[email protected]> in: <https://lists.gnu.org/r/bug-gnulib/2025-11/msg00127.html>. * top/maint.mk (NEWS_file): Detect NEWS.md in absence of NEWS. (news-check-regexp, news-check-regexp-prev, announcement) (gl_noteworthy_news_): Default to #-headings in place of *-headings when NEWS_file name implies Markdown. (release-prep): Consistently prefer test over [. --- ChangeLog | 9 +++++++++ top/maint.mk | 21 ++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1943aa8717..3629cb2156 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2025-11-15 Basil L. Contovounesios <[email protected]> + maintainer-makefile: Auto-detect NEWS.md. + Suggested by Simon Josefsson <[email protected]> in: + <https://lists.gnu.org/r/bug-gnulib/2025-11/msg00127.html>. + * top/maint.mk (NEWS_file): Detect NEWS.md in absence of NEWS. + (news-check-regexp, news-check-regexp-prev, announcement) + (gl_noteworthy_news_): Default to #-headings in place of *-headings + when NEWS_file name implies Markdown. + (release-prep): Consistently prefer test over [. + maintainer-makefile: Avoid recursive $(shell) expansion. * top/maint.mk (gnulib_dir): Define as simply expanded, to avoid recursive expansion of $(shell) invocation. diff --git a/top/maint.mk b/top/maint.mk index c0eda134dd..27ef680042 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -149,6 +149,13 @@ url_dir_list ?= https://ftpmirror.gnu.org/$(PACKAGE), \ https://$(gnu_rel_host)/gnu/$(PACKAGE)) +# NEWS takes precedence over NEWS.md. +# Override this in cfg.mk if you use a different file name. +ifeq ($(origin NEWS_file),undefined) + NEWS_file := NEWS$(if $(wildcard $(srcdir)/NEWS),,$\ + $(and $(wildcard $(srcdir)/NEWS.md),.md)) +endif + # An ERE matching the release date (typically today, but not necessarily). # Override this in cfg.mk if you are using a different format in your # NEWS file. @@ -161,10 +168,12 @@ today = news-check-lines-spec ?= 1,10 # An ERE quoted for the shell, for matching a version+date line prefix. -news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)' +news-check-regexp ?= \ + '^$(if $(filter %.md,$(NEWS_file)),#,\*).* $(VERSION_REGEXP) \($(today)\)' # Like news-check-regexp, but as an unquoted BRE for .prev-version. -news-check-regexp-prev ?= ^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*) +news-check-regexp-prev ?= \ + ^$(if $(filter %.md,$(NEWS_file)),#,\*).* $(PREV_VERSION_REGEXP) ([0-9-]*) # Prevent programs like 'sort' from considering distinct strings to be equal. # Doing it here saves us from having to set LC_ALL elsewhere in this file. @@ -1263,7 +1272,6 @@ sc_const_long_option: halt='add "const" to the above declarations' \ $(_sc_search_regexp) -NEWS_file ?= NEWS NEWS_hash = \ $$($(SED) -n '/$(news-check-regexp-prev)/,$$p' $(srcdir)/$(NEWS_file) \ | perl -0777 -pe \ @@ -1589,6 +1597,7 @@ announcement: echo --gpg-keyring-url="$(gpg_keyring_url)") \ --srcdir=$(srcdir) \ --news=$(srcdir)/$(NEWS_file) \ + $$(case $(NEWS_file) in (*.md) echo --news-prefix=#;; esac) \ --bootstrap-tools=$(bootstrap-tools) \ "$$(case ,$(bootstrap-tools), in (*,gnulib,*) \ echo --gnulib-version=$(gnulib-version);; esac)" \ @@ -1701,7 +1710,9 @@ release: release-prep-hook ?= release-prep # Keep consistent with news-check-regexp and news-check-regexp-prev. -gl_noteworthy_news_ ?= * Noteworthy changes in release ?.? (????-??-??) [?] +gl_noteworthy_news_ ?= \ + $(if $(filter %.md,$(NEWS_file)),#,*) \ + Noteworthy changes in release ?.? (????-??-??) [?] .PHONY: release-prep release-prep: $(AM_V_GEN)$(MAKE) --no-print-directory -s announcement \ @@ -1714,7 +1725,7 @@ release-prep: $(AM_V_at)$(MAKE) update-NEWS-hash $(AM_V_at)n=$$($(SED) -n -E \ '$(news-check-lines-spec){/'$(news-check-regexp)'/=}' \ - $(srcdir)/$(NEWS_file)); [ -n "$$n" ] \ + $(srcdir)/$(NEWS_file)); test -n "$$n" \ && env gl_n=$$n gl_s='$(gl_noteworthy_news_)' \ perl -pi -e '$$. == $$ENV{gl_n} ' \ -e ' and print "$$ENV{gl_s}\n\n\n"' \ -- 2.51.0
