unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: master bdb13a0e5c5 1/2: Adjust to Gnulib’s recent module renaming
Date: Thu, 2 Jan 2025 11:38:34 -0800	[thread overview]
Message-ID: <6414b78b-ff06-4d51-9bc4-b36799343fe1@cs.ucla.edu> (raw)
In-Reply-To: <CADwFkmmsSsVEy-znYqEGqmZ4ZVRKzqrqO_8zrXuWERcQERc2Xg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

On 2025-01-02 09:57, Stefan Kangas wrote:
> I'd find a "warning: new modules added, notify emacs-devel for
> possible w32 adaption" message more useful than something that blindly
> pipes things to mail(1).

Thanks for the suggestion; I installed the attached.

I don't see a nontrivial way to update nt/gnulib-cfg.mk automatically, 
even just for module renames as Eli suggested, as there are too many 
possibilities for screwups.

The "right" way to fix this would be to adjust Emacs and Gnulib so that 
builds would work the same way on MS-Windows that they do everywhere 
else (i.e., nt/gnulib-cfg.mk would become unnecessary). However, as I 
understand it this would be nontrivial and anyway it would require 
MS-Windows expertise that I lack.

In the meantime, module renames are rare enough that doing things by 
hand should take less work overall. Besides, the main problem here is 
changes to modules and/or adding modules, which I don't think 
admin/merge-gnulib can handle by itself.

[-- Attachment #2: 0001-admin-merge-gnulib-now-warns-if-module-lists-change.patch --]
[-- Type: text/x-patch, Size: 3317 bytes --]

From f65520cad46273967da2343feeb2201363c190e0 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 2 Jan 2025 11:29:26 -0800
Subject: [PATCH] admin/merge-gnulib now warns if module lists change
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From suggestions by Eli Zaretski and Stefan Kangas in:
https://lists.gnu.org/r/emacs-devel/2025-01/msg00036.html
https://lists.gnu.org/r/emacs-devel/2025-01/msg00037.html
* admin/merge-gnulib: For style consistency,
prefer ‘[ EXPR ]’ to ‘test EXPR’ and prefer -e to -f.
Fix bug that forgot to clean lib directory if it’s ./lib.
Check for lib/gnulib.mk.in, which we used directly, not ‘configure’.
(LC_ALL): Set to C.
(autogen): New function, to make it clearer to user when
commands are operating in some other directory.
(get_module_list): New function.
(old_modules, new_modules): New vars.
If they differ, issue a warning.
---
 admin/merge-gnulib | 41 +++++++++++++++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 458a2c325e3..2eab5ab8b9c 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -23,6 +23,9 @@
 
 # written by Paul Eggert
 
+# It is unclear whether module list sorting depends on locale; play it safe.
+export LC_ALL=C
+
 GNULIB_URL=https://git.savannah.gnu.org/git/gnulib.git
 
 GNULIB_MODULES='
@@ -92,22 +95,38 @@ gnulib_srcdir=
     exit 1 ;;
 esac
 
-test -x "$src"autogen.sh || {
+[ -x "$src"autogen.sh ] || {
   printf '%s\n' >&2 "$0: '${src:-.}' is not an Emacs source directory."
   exit 1
 }
 
-test -d "$gnulib_srcdir" ||
+[ -d "$gnulib_srcdir" ] ||
 git clone -- "$GNULIB_URL" "$gnulib_srcdir" ||
 exit
 
-test -x "$gnulib_srcdir"/gnulib-tool || {
+[ -x "$gnulib_srcdir"/gnulib-tool ] || {
   printf '%s\n' >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory."
   exit 1
 }
 
+autogen() {
+  if [ "$src" ]; then
+    printf "$0: entering $src ..." &&
+    (cd "$src" && ./autogen.sh) &&
+    printf "$0: leaving $src ..."
+  else
+    ./autogen.sh
+  fi
+}
+
 # gnulib-tool has problems with a bare checkout (Bug#32452#65).
-test -f configure || ./autogen.sh || exit
+# Also, we need gnulib.mk.in to get the old module list.
+[ -e "$src"lib/gnulib.mk.in ] || autogen || exit
+
+get_module_list() {
+  sed -n 's/## begin gnulib module //p' "$src"lib/gnulib.mk.in
+}
+old_modules=$(get_module_list) || exit
 
 avoided_flags=
 for module in $AVOIDED_MODULES; do
@@ -115,8 +134,8 @@ avoided_flags=
 done
 
 # Clean the lib directory as well.
-if [ -e "$src"/lib/Makefile ]; then
-   make -C "$src"/lib maintainer-clean
+if [ -e "$src"lib/Makefile ]; then
+   make -C "$src"lib maintainer-clean || exit
 fi
 
 "$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS \
@@ -140,5 +159,11 @@ avoided_flags=
    "$src"lib &&
 cp -- "$gnulib_srcdir"/m4/codeset.m4 \
    "$src"m4 &&
-{ test -z "$src" || cd "$src"; } &&
-./autogen.sh
+autogen &&
+new_modules=$(get_module_list) || exit
+
+test "$old_modules" = "$new_modules" ||
+  printf >&2 '%s\n' \
+    "$0: warning: module list changed; fix ../nt/gnulib-cfg.mk ..." \
+    "$0: warning: ... or notify emacs-devel for w32 adaption." \
+    "$0: warning: For more, run 'git diff ${src}lib/gnulib.mk.in'."
-- 
2.45.2


  reply	other threads:[~2025-01-02 19:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2001.1735773573.32144.emacs-diffs@gnu.org>
2025-01-02 17:30 ` master bdb13a0e5c5 1/2: Adjust to Gnulib’s recent module renaming Eli Zaretskii
2025-01-02 17:57   ` Stefan Kangas
2025-01-02 19:38     ` Paul Eggert [this message]
2025-01-02 20:30       ` Eli Zaretskii
2025-01-02 21:15         ` Paul Eggert
2025-01-03  6:42           ` Eli Zaretskii
2025-01-03 19:06             ` Paul Eggert
2025-01-03 20:01               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6414b78b-ff06-4d51-9bc4-b36799343fe1@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).