]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool: In the VC files messages, omit the destination directory.
authorBruno Haible <bruno@clisp.org>
Sat, 6 Aug 2022 21:22:26 +0000 (23:22 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 6 Aug 2022 21:22:26 +0000 (23:22 +0200)
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.

ChangeLog
gnulib-tool
pygnulib/GLImport.py

index e5af4e34c0285589717213cc8a971a04d140a474..5396f935a357db5f78aee4a76e6dd1239e91e309 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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.
+
        gnulib-tool.py: Fix output in --dry-run mode.
        * pygnulib/GLImport.py (GLImport._update_ignorelist_): In dry-run mode,
        say "Update", not "Updating".
index ac53480dbf33365608fc9074740240047bf1983d..e49d1bc8a86442e094792263d8dbda3e41771f3e 100755 (executable)
@@ -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
index 13418400af1bf539d496f5e97a56552d2f19fa42..935a6625938d5e67f64eccf9515c8d8c0f0f1b25 100644 (file)
@@ -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']