bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: gnulib-tool.sh: Remove './' prefix from file names to update or remove
Date: Thu, 11 Apr 2024 13:44:44 +0200	[thread overview]
Message-ID: <13115989.58fs7uQEbH@nimes> (raw)

In the 'gnuit' and 'acct' packages, I see that gnulib-tool.sh and gnulib-tool.py
provide slightly different outputs. Namely, gnulib-tool.sh shows file names
that start with './' if
  - a module contains a file 'build-aux/...' and
  - the configure.ac does not contain an AC_CONFIG_AUX_DIR invocation,
while gnulib-tool.py trims this './'.

How to reproduce:

$ export GNULIB_TOOL_IMPL=sh+py
$ git clone https://git.savannah.gnu.org/git/gnuit.git
$ cd gnuit
Bump AC_PREREQ line in configure.ac.
$ $GNULIB_SRCDIR/gnulib-tool --update
.../gnulib-tool: *** gnulib-tool.py produced different output than gnulib-tool.sh! Compare .../glpy2wHy4c-sh-out and .../glpy2wHy4c-py-out.
.../gnulib-tool: *** Stop.
$ diff -u ../glpy2wHy4c-sh-out ../glpy2wHy4c-py-out
--- ../glpy2wHy4c-sh-out        2024-04-11 13:09:22.611985846 +0200
+++ ../glpy2wHy4c-py-out        2024-04-11 13:08:58.767830287 +0200
@@ -946,7 +946,6 @@
 Creating directory ./lib/unicase
 Creating directory ./lib/unictype
 Creating directory ./lib/unistr
-Removing file ./link-warning.h (backup in ./link-warning.h~)
 Removing file lib/alignof.h (backup in lib/alignof.h~)
 Removing file lib/close-hook.c (backup in lib/close-hook.c~)
 Removing file lib/close-hook.h (backup in lib/close-hook.h~)
@@ -980,6 +979,7 @@
 Removing file lib/xgetcwd.c (backup in lib/xgetcwd.c~)
 Removing file lib/xgetcwd.h (backup in lib/xgetcwd.h~)
 Removing file lib/xstrtol-error.c (backup in lib/xstrtol-error.c~)
+Removing file link-warning.h (backup in link-warning.h~)
 Removing file m4/argmatch.m4 (backup in m4/argmatch.m4~)
 Removing file m4/ctype.m4 (backup in m4/ctype.m4~)
 Removing file m4/dirname.m4 (backup in m4/dirname.m4~)
@@ -1648,7 +1648,7 @@
 Updating m4/gnulib-cache.m4 (backup in m4/gnulib-cache.m4~)
 Updating m4/gnulib-comp.m4 (backup in m4/gnulib-comp.m4~)
 Updating lib/Makefile.am (backup in lib/Makefile.am~)
-Updating ./.gitignore (backup in ./.gitignore~)
+Updating .gitignore (backup in .gitignore~)
 Creating lib/.gitignore
 Creating lib/glthread/.gitignore
 Creating lib/malloc/.gitignore

This patch fixes it, without breaking the test suite.


2024-04-11  Bruno Haible  <bruno@clisp.org>

	gnulib-tool.sh: Remove './' prefix from file names to update or remove.
	* gnulib-tool.sh (func_import): Don't let rewritten file names start
	with './'.

diff --git a/gnulib-tool.sh b/gnulib-tool.sh
index e99b8fff79..6335228c46 100755
--- a/gnulib-tool.sh
+++ b/gnulib-tool.sh
@@ -5394,22 +5394,67 @@ s,^\(.................................................[^ ]*\) *,
   fi
 
   rewritten='%REWRITTEN%'
+  if test "$auxdir" = '.'; then
+    auxdir_prefix=
+  else
+    auxdir_prefix="$auxdir/"
+  fi
+  if test "$cached_docbase" = '.'; then
+    cached_docbase_prefix=
+  else
+    cached_docbase_prefix="$cached_docbase/"
+  fi
+  if test "$cached_sourcebase" = '.'; then
+    cached_sourcebase_prefix=
+  else
+    cached_sourcebase_prefix="$cached_sourcebase/"
+  fi
+  if test "$cached_m4base" = '.'; then
+    cached_m4base_prefix=
+  else
+    cached_m4base_prefix="$cached_m4base/"
+  fi
+  if test "$cached_testsbase" = '.'; then
+    cached_testsbase_prefix=
+  else
+    cached_testsbase_prefix="$cached_testsbase/"
+  fi
+  if test "$docbase" = '.'; then
+    docbase_prefix=
+  else
+    docbase_prefix="$docbase/"
+  fi
+  if test "$sourcebase" = '.'; then
+    sourcebase_prefix=
+  else
+    sourcebase_prefix="$sourcebase/"
+  fi
+  if test "$m4base" = '.'; then
+    m4base_prefix=
+  else
+    m4base_prefix="$m4base/"
+  fi
+  if test "$testsbase" = '.'; then
+    testsbase_prefix=
+  else
+    testsbase_prefix="$testsbase/"
+  fi
   sed_rewrite_old_files="\
-    s,^build-aux/,$rewritten$auxdir/,
-    s,^doc/,$rewritten$cached_docbase/,
-    s,^lib/,$rewritten$cached_sourcebase/,
-    s,^m4/,$rewritten$cached_m4base/,
-    s,^tests/,$rewritten$cached_testsbase/,
-    s,^tests=lib/,$rewritten$cached_testsbase/,
+    s,^build-aux/,$rewritten$auxdir_prefix,
+    s,^doc/,$rewritten$cached_docbase_prefix,
+    s,^lib/,$rewritten$cached_sourcebase_prefix,
+    s,^m4/,$rewritten$cached_m4base_prefix,
+    s,^tests/,$rewritten$cached_testsbase_prefix,
+    s,^tests=lib/,$rewritten$cached_testsbase_prefix,
     s,^top/,$rewritten,
     s,^$rewritten,,"
   sed_rewrite_new_files="\
-    s,^build-aux/,$rewritten$auxdir/,
-    s,^doc/,$rewritten$docbase/,
-    s,^lib/,$rewritten$sourcebase/,
-    s,^m4/,$rewritten$m4base/,
-    s,^tests/,$rewritten$testsbase/,
-    s,^tests=lib/,$rewritten$testsbase/,
+    s,^build-aux/,$rewritten$auxdir_prefix,
+    s,^doc/,$rewritten$docbase_prefix,
+    s,^lib/,$rewritten$sourcebase_prefix,
+    s,^m4/,$rewritten$m4base_prefix,
+    s,^tests/,$rewritten$testsbase_prefix,
+    s,^tests=lib/,$rewritten$testsbase_prefix,
     s,^top/,$rewritten,
     s,^$rewritten,,"
 





                 reply	other threads:[~2024-04-11 11:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=13115989.58fs7uQEbH@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /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.
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).