Hi Bruno, On 3/23/24 3:49 AM, Bruno Haible wrote: > What's still missing, is the handling of 'files_removed'. > GLImport.py lines 804..820 ought to match gnulib-tool.sh lines 6253..6273.
Sorry I haven't fixed this yet. I'm pretty sure I have been overthinking this issue for the past hour or two hahaha. 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 Which uses sed expressions to create sed expressions right? Like this: # No anchor abc -> /^abc$/d # Anchor /abc -> /^\/abc$/d I think something about using sed to create sed expressions broke my brain a bit. I'm not used to it. Would this diff be correct or am I missing something? It seems that it makes the .gitignores in the test suite correct. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 85ec0a61db..7736a95389 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -809,7 +809,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix if filename.strip() } srcdata = lines_to_multiline(sorted(dirs_ignore)) dirs_ignore = [ '%s%s' % (anchor, d) - for d in set(files_added).difference(dirs_ignore) ] + for d in set(files_added).difference(dirs_ignore).difference(files_removed) ] destdata = lines_to_multiline(sorted(dirs_ignore)) if srcdata != destdata: if not self.config['dryrun']: > No, no. This would be wrong. The principle is: Each time gnulib-tool > modifies a file that is/was not entirely autogenerated, a backup copy > is created. (We do *not* assume that the developer had used version control.) > '.gitignore' files obviously are owned by the developer, so must be backed up > when modified. Ah, yes that makes sense, thanks. I am very used to version control so I wrongly assumed. There seems to be an issue with the .gitignore~ backups I still need to fix. Using the wget2 test: Files ./test-wget2-1.result/.gitignore~ and tmp53401-result/.gitignore~ differ Only in tmp53401-result/build-aux: .gitignore~ Only in tmp53401-result/lib: .gitignore~ Only in tmp53401-result/lib/glthread: .gitignore~ Only in tmp53401-result/lib/malloc: .gitignore~ Only in tmp53401-result/lib/unicase: .gitignore~ Only in tmp53401-result/lib/unictype: .gitignore~ Only in tmp53401-result/lib/unistr: .gitignore~ Only in tmp53401-result/lib/uniwidth: .gitignore~ Only in tmp53401-result/m4: .gitignore~ >From these logs it looks like maybe gnulib-tool.py creates the gitignore twice? Then the backup would really just be a copy of the original. That is just a guess though... Collin