bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool: In the VC files messages, omit the destination directory


From: Bruno Haible
Subject: gnulib-tool: In the VC files messages, omit the destination directory
Date: Mon, 08 Aug 2022 00:53:01 +0200

gnulib-tool --import ...
reports most files through "Creating ...", "Updating ...", with file
names that are implicitly understood to be in the destination directory.

Only for .gitignore files it reports "Creating ...", "Updating ..."
with the destination directory explicitly shown. This is inconsistent.

This patch fixes it.


2022-08-06  Bruno Haible  <bruno@clisp.org>

        gnulib-tool: In the VC files messages, omit the destination directory.
        This makes these messages consistent with the other "Copying ..." and
        "Creating ..." messages.
        * gnulib-tool (func_import): Omit $destdir/ from the "Updating"/
        "Creating" messages regarding .gitignore files.
        * pygnulib/GLImport.py (GLImport._update_ignorelist_): Likewise.

diff --git a/gnulib-tool b/gnulib-tool
index ac53480dbf..e49d1bc8a8 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -6221,7 +6221,7 @@ s,//*$,/,'
             )
             if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; 
then
               if $doit; then
-                echo "Updating $destdir/$dir$ignore (backup in 
$destdir/$dir${ignore}~)"
+                echo "Updating $dir$ignore (backup in $dir${ignore}~)"
                 mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
                 { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < 
"$tmp"/ignore-removed
                   if test -n "$anchor"; then sed -e 's,/,\\/,g' -e 
"s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi
@@ -6231,14 +6231,14 @@ s,//*$,/,'
                 } | sed -f "$tmp"/sed-ignore-removed \
                   > "$destdir/$dir$ignore"
               else
-                echo "Update $destdir/$dir$ignore (backup in 
$destdir/$dir${ignore}~)"
+                echo "Update $dir$ignore (backup in $dir${ignore}~)"
               fi
             fi
           fi
         else
           if test -n "$dir_added"; then
             if $doit; then
-              echo "Creating $destdir/$dir$ignore"
+              echo "Creating $dir$ignore"
               {
                 if test "$ignore" = .cvsignore; then
                   echo ".deps"
@@ -6248,7 +6248,7 @@ s,//*$,/,'
                 echo "$dir_added" | sed -e '/^$/d' -e "s|^|$anchor|" | 
LC_ALL=C sort -u
               } > "$destdir/$dir$ignore"
             else
-              echo "Create $destdir/$dir$ignore"
+              echo "Create $dir$ignore"
             fi
           fi
         fi
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 13418400af..935a662593 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -710,11 +710,11 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
             anchor = '/'
         else:
             anchor = ''
-        srcpath = joinpath(destdir, directory, ignore)
+        srcpath = joinpath(directory, ignore)
         backupname = '%s~' % srcpath
-        if isfile(srcpath):
+        if isfile(joinpath(destdir, srcpath)):
             if dirs_added or dirs_removed:
-                with codecs.open(srcpath, 'rb', 'UTF-8') as file:
+                with codecs.open(joinpath(destdir, srcpath), 'rb', 'UTF-8') as 
file:
                     srcdata = file.read()
                 dirs_ignore = sorted(set(srcdata.split('\n')))
                 dirs_ignore = [ line
@@ -734,13 +734,13 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                 if srcdata != destdata:
                     if not self.config['dryrun']:
                         print('Updating %s (backup in %s)' % (srcpath, 
backupname))
-                        copyfile2(srcpath, backupname)
+                        copyfile2(joinpath(destdir, srcpath), 
joinpath(destdir, backupname))
                         result = ''
-                        with codecs.open(srcpath, 'ab', 'UTF-8') as file:
+                        with codecs.open(joinpath(destdir, srcpath), 'ab', 
'UTF-8') as file:
                             file.write(destdata)
                     else:  # if self.config['dryrun']
                         print('Update %s (backup in %s)' % (srcpath, 
backupname))
-        else:  # if not isfile(srcpath)
+        else:  # if not isfile(joinpath(destdir, srcpath))
             if dirs_added:
                 if not self.config['dryrun']:
                     print('Creating %s' % srcpath)
@@ -749,7 +749,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                                    for d in dirs_added ]
                     if ignore == '.cvsignore':
                         dirs_added = ['.deps', '.dirstamp'] + dirs_added
-                    with codecs.open(srcpath, 'wb', 'UTF-8') as file:
+                    with codecs.open(joinpath(destdir, srcpath), 'wb', 
'UTF-8') as file:
                         file.write('\n'.join(dirs_added))
                         file.write('\n')
                 else:  # if self.config['dryrun']






reply via email to

[Prev in Thread] Current Thread [Next in Thread]