]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool: Fix option --find in combination with option --local-dir.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 12:09:03 +0000 (14:09 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Aug 2022 21:04:16 +0000 (23:04 +0200)
* gnulib-tool (func_prefixed_modules_in_dir): New function.
(find): Use it, and filter the directory names away after the 'grep'
pass.

ChangeLog
gnulib-tool

index b052583c01dc51ce2d2570162d0891e35469179c..e259a09333ebff63aad770f0154c678ec683497e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2022-08-07  Bruno Haible  <bruno@clisp.org>
 
+       gnulib-tool: Fix option --find in combination with option --local-dir.
+       * gnulib-tool (func_prefixed_modules_in_dir): New function.
+       (find): Use it, and filter the directory names away after the 'grep'
+       pass.
+
        gnulib-tool.py: Fix some regexes.
        * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use an equivalent
        regex as gnulib-tool.
index e49d1bc8a86442e094792263d8dbda3e41771f3e..028bcf36ade3bbca22cea05735694edb6c0c80e3 100755 (executable)
@@ -7162,6 +7162,12 @@ case $mode in
 s/\[/\\[/g
 s/\^/\\^/g
 s/\([.*$]\)/[\1]/g'
+    # func_prefixed_modules_in_dir dir
+    # outputs all module files in dir to standard output, with dir as prefix.
+    func_prefixed_modules_in_dir ()
+    {
+      (test -d "$1" && cd "$1" && find modules -type f -print | sed -e "s|^|$1/|")
+    }
     for filename
     do
       if test -f "$gnulib_dir/$filename" \
@@ -7171,7 +7177,7 @@ s/\([.*$]\)/[\1]/g'
         module_candidates=`
           {
             (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
-            func_path_foreach "$local_gnulib_path" func_modules_in_dir %dir% | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^modules/,,' -e 's,\.diff$,,'
+            func_path_foreach "$local_gnulib_path" func_prefixed_modules_in_dir %dir% | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^.*/modules/,,' -e 's,\.diff$,,'
           } \
             | func_sanitize_modulelist \
             | LC_ALL=C sort -u