From 858467abd14f2f513d407dbdc5a5093dc0147096 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 7 Aug 2022 14:09:03 +0200 Subject: [PATCH] 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. --- ChangeLog | 5 +++++ gnulib-tool | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b052583c01..e259a09333 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2022-08-07 Bruno Haible + 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. diff --git a/gnulib-tool b/gnulib-tool index e49d1bc8a8..028bcf36ad 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -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 -- 2.39.5