aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mandriva.org>2007-09-08 15:34:39 +0000
committerAnssi Hannula <anssi@mandriva.org>2007-09-08 15:34:39 +0000
commit19fa30c27fa1424b3f4bc937ed57c159fbd5745f (patch)
tree2124466456f6f844c371b2f156f8a109d106be1c
parent292c72d0ec1ce7086401a5bafaf4965f822158cc (diff)
downloadrpm-setup-19fa30c27fa1424b3f4bc937ed57c159fbd5745f.tar
rpm-setup-19fa30c27fa1424b3f4bc937ed57c159fbd5745f.tar.gz
rpm-setup-19fa30c27fa1424b3f4bc937ed57c159fbd5745f.tar.bz2
rpm-setup-19fa30c27fa1424b3f4bc937ed57c159fbd5745f.tar.xz
rpm-setup-19fa30c27fa1424b3f4bc937ed57c159fbd5745f.zip
Handle double slashes in buildroot in filter.sh in new file exception macros,
in case tmppath contains a trailing slash as in iurt. This also fixes handling of exception macros that contain spaces, which has been broken for a while.
-rwxr-xr-xfilter.sh26
-rw-r--r--macros.in4
2 files changed, 18 insertions, 12 deletions
diff --git a/filter.sh b/filter.sh
index 0ecea90..8ff38f2 100755
--- a/filter.sh
+++ b/filter.sh
@@ -12,19 +12,25 @@
GREP_ARG="$1"
FILE_GREP_ARG="$2"
-PROG="$3"
-shift 3
-
-GREP_PROG="cat"
-FILE_GREP_PROG="cat"
+BUILDROOT="$3"
+PROG="$4"
+shift 4
# use ' ' to signify no arg as rpm filter empty strings from
# command line :(
-[ "$GREP_ARG" = ' ' ] || GREP_PROG="grep -v $GREP_ARG"
-[ "$FILE_GREP_ARG" = ' ' ] || FILE_GREP_PROG="grep -v $FILE_GREP_ARG"
-
-$FILE_GREP_PROG | $PROG "$@" | $GREP_PROG
-
+if [ "$FILE_GREP_ARG" != ' ' ]; then
+ # get rid of double and trailing slashes
+ BUILDROOT="$(echo "$BUILDROOT" | perl -pe 's,/+,/,g;s,/$,,')"
+ perl -pe "s,^$BUILDROOT,," | grep -v "$FILE_GREP_ARG" | perl -pe "s,^,$BUILDROOT,"
+else
+ cat
+fi | \
+$PROG "$@" | \
+if [ "$GREP_ARG" != ' ' ]; then
+ grep -v "$GREP_ARG"
+else
+ cat
+fi
exit 0
# filter.sh ends here
diff --git a/macros.in b/macros.in
index ee53095..d676ad9 100644
--- a/macros.in
+++ b/macros.in
@@ -156,8 +156,8 @@ Group: %{group}\
# Use internal dependency generator rather than external helpers?
%_use_internal_dependency_generator 0
-%__find_provides @RPMVENDORDIR@/filter.sh '%{?_provides_exceptions:%{_provides_exceptions}}%{!?_provides_exceptions: }' '%{?_exclude_files_from_autoprov:%{?buildroot:%{buildroot}}%{_exclude_files_from_autoprov}}%{!?_exclude_files_from_autoprov: }' @RPMVENDORDIR@/find-provides
-%__find_requires @RPMVENDORDIR@/filter.sh '%{?_requires_exceptions:%{_requires_exceptions}}%{!?_requires_exceptions: }' '%{?_exclude_files_from_autoreq:%{?buildroot:%{buildroot}}%{_exclude_files_from_autoreq}}%{!?_exclude_files_from_autoreq: }' @RPMVENDORDIR@/find-requires %{?buildroot:%{buildroot}} %{?_target_cpu:%{_target_cpu}}
+%__find_provides @RPMVENDORDIR@/filter.sh '%{?_provides_exceptions:%{_provides_exceptions}}%{!?_provides_exceptions: }' '%{?_exclude_files_from_autoprov:%{_exclude_files_from_autoprov}}%{!?_exclude_files_from_autoprov: }' '%{buildroot}' @RPMVENDORDIR@/find-provides
+%__find_requires @RPMVENDORDIR@/filter.sh '%{?_requires_exceptions:%{_requires_exceptions}}%{!?_requires_exceptions: }' '%{?_exclude_files_from_autoreq:%{_exclude_files_from_autoreq}}%{!?_exclude_files_from_autoreq: }' '%{buildroot}' @RPMVENDORDIR@/find-requires %{?buildroot:%{buildroot}} %{?_target_cpu:%{_target_cpu}}
%find_lang @RPMVENDORDIR@/find-lang.pl %{buildroot}