]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
gnulib-tool.py: Follow gnulib-tool changes, part 69.
authorCollin Funk <collin.funk1@gmail.com>
Sat, 23 Mar 2024 02:43:41 +0000 (19:43 -0700)
committerBruno Haible <bruno@clisp.org>
Sat, 23 Mar 2024 10:09:12 +0000 (11:09 +0100)
Follow gnulib-tool change
2012-08-19  Bruno Haible  <bruno@clisp.org>
gnulib-tool: Remove old file names from .cvsignore, .gitignore.

* pygnulib/GLImport.py (GLImport._update_ignorelist_): Add
gnulib-comp.m4 to the added file list.
(GLImport.execute): Remove unused variables. Use sets to match the
'join' invocations in gnulib-tool.sh.

ChangeLog
gnulib-tool.py.TODO
pygnulib/GLImport.py

index c8f4063444401eb3fd3ac438460b4ab0e38aebcb..2d291427fa6010d3962b1cb606b3a9a339339a7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-03-23  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Follow gnulib-tool changes, part 69.
+       Follow gnulib-tool change
+       2012-08-19  Bruno Haible  <bruno@clisp.org>
+       gnulib-tool: Remove old file names from .cvsignore, .gitignore.
+       * pygnulib/GLImport.py (GLImport._update_ignorelist_): Add
+       gnulib-comp.m4 to the added file list.
+       (GLImport.execute): Remove unused variables. Use sets to match the
+       'join' invocations in gnulib-tool.sh.
+
 2024-03-22  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Don't remove newlines in testdir's Automake snippets.
index b3d83eeeb4cbfeb20132d471b4b2f8cfec08dadb..83d13eb1cb4fa16e952a7f8752bc7295d0aa440d 100644 (file)
@@ -65,15 +65,4 @@ Date:   Sat May 20 13:24:37 2017 +0200
 
 --------------------------------------------------------------------------------
 
-commit 9bdf6c8a0cdeb13c12e4b65dee9538c5468dbe1d
-Author: Bruno Haible <bruno@clisp.org>
-Date:   Sun Aug 19 14:06:50 2012 +0200
-
-    gnulib-tool: Remove old file names from .cvsignore, .gitignore.
-
-    * gnulib-tool (func_update_ignorelist): Don't use 'join -v 1' command
-    on the list of removed files.
-
---------------------------------------------------------------------------------
-
 ================================================================================
index 66b63ef08e39139f7d57b64959d68ceefe6eff69..ca266242e2d2cac9ccbc1fb1c1d852d911b4c5c5 100644 (file)
@@ -790,7 +790,6 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         '''GLImport._update_ignorelist_(directory, ignore, dirs_added, dirs_removed)
 
         Update .gitignore or .cvsignore files.'''
-        result = ''
         destdir = self.config['destdir']
         if ignore == '.gitignore':
             anchor = '/'
@@ -802,26 +801,18 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
             if dirs_added or dirs_removed:
                 with codecs.open(joinpath(destdir, srcpath), 'rb', 'UTF-8') as file:
                     srcdata = file.read()
-                dirs_ignore = sorted(set(srcdata.split('\n')))
-                dirs_ignore = [ line
-                                for line in dirs_ignore
-                                if line.strip() ]
-                srcdata = lines_to_multiline(sorted(set(dirs_ignore)))
-                dirs_ignore += [ d
-                                 for d in dirs_added
-                                 if d not in dirs_ignore ]
-                dirs_ignore = [ d
-                                for d in dirs_ignore
-                                if d in dirs_removed ]
+                dirs_ignore = { filename
+                                if not filename.startswith(anchor) else filename[len(anchor):]
+                                for filename in srcdata.split('\n')
+                                if filename.strip() }
+                srcdata = lines_to_multiline(sorted(dirs_ignore))
                 dirs_ignore = [ '%s%s' % (anchor, d)
-                                for d in dirs_ignore ]
-                dirs_ignore = sorted(set(dirs_ignore))
-                destdata = lines_to_multiline(sorted(set(dirs_ignore)))
+                                for d in set(dirs_added).difference(dirs_ignore) ]
+                destdata = lines_to_multiline(sorted(dirs_ignore))
                 if srcdata != destdata:
                     if not self.config['dryrun']:
                         print('Updating %s (backup in %s)' % (srcpath, backupname))
                         copyfile2(joinpath(destdir, srcpath), joinpath(destdir, backupname))
-                        result = ''
                         with codecs.open(joinpath(destdir, srcpath), 'ab', 'UTF-8') as file:
                             file.write(destdata)
                     else:  # if self.config['dryrun']
@@ -1396,6 +1387,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         if vc_files != False:
             # Update the .cvsignore and .gitignore files.
             ignorelist = list()
+            # Treat gnulib-comp.m4 like an added file, even if it already existed.
+            filetable['added'] += [joinpath(m4base, 'gnulib-comp.m4')]
             filetable['added'] = sorted(set(filetable['added']))
             filetable['removed'] = sorted(set(filetable['added']))
             for file in filetable['added']: