[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib-tool: Fix option --find in combination with option --local-dir
From: |
Bruno Haible |
Subject: |
gnulib-tool: Fix option --find in combination with option --local-dir |
Date: |
Mon, 08 Aug 2022 00:55:48 +0200 |
gnulib-tool --local-dir=... --find ...
produces error messages from 'grep'. The problem is that file names in the
local dir are passed to 'grep' without that directory. This patch fixes it.
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.
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnulib-tool: Fix option --find in combination with option --local-dir,
Bruno Haible <=