rpmrebuild/backport-use-RPMREBUILD_NOQUOTE-on-some-distribution-if-filenames-contains-meta-car.patch
2024-12-12 17:28:35 +08:00

129 lines
3.1 KiB
Diff

From fb7fd3d6bbaf90c46240f156cc7e52111858a5cf Mon Sep 17 00:00:00 2001
From: Eric Gerbier <gerbier@users.sourceforge.net>
Date: Sat, 2 Nov 2024 10:59:53 +0100
Subject: [PATCH] you can use RPMREBUILD_NOQUOTE on some distribution if
filenames contains meta-car
---
processing_func.src | 21 ++++++++++++++-------
rpmrebuild_files.sh | 21 ++++++++++++++-------
rpmrebuild_lib.src | 40 +++++++++++++++++++++++-----------------
3 files changed, 51 insertions(+), 31 deletions(-)
diff --git a/processing_func.src b/processing_func.src
index e106939..b46537d 100755
--- a/processing_func.src
+++ b/processing_func.src
@@ -412,13 +412,20 @@ function CheckMissing {
# quote meta characters
# see also in rpmrebuild_files.sh+
- case "$line" in
- # replace * by \*
- x*\**) line=$(echo "$line" | sed 's/\*/\\*/') ;;
- # replace \ by \\
- x*\\*) line=$(echo "$line" | sed 's/\\/\\\\/') ;;
- x*) ;;
- esac
+ #file=$( quote $file )
+ if [ -n "$RPMREBUILD_NOQUOTE" ]
+ then
+ # no quote
+ echo
+ else
+ case "$line" in
+ # replace * by \*
+ x*\**) line=$(echo "$line" | sed 's/\*/\\*/') ;;
+ # replace \ by \\
+ x*\\*) line=$(echo "$line" | sed 's/\\/\\\\/') ;;
+ x*) ;;
+ esac
+ fi
if [ -n "$is_ghost" ]
then
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index 442e7ea..15f1a88 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -96,13 +96,20 @@ while :; do
#[ -n "$wild" ] && file=$(echo "$file"|sed 's/\*/\\*/')
# quick and portable
# quote metacharacters, see also CheckMissing (processing_func.src)
- case "x$file" in
- # replace * by \*
- x*\**) file=$(echo "$file" | sed 's/\*/\\*/');;
- # replace \ by \\
- x*\\*) file=$(echo "$file" | sed 's/\\/\\\\/');;
- x*) ;;
- esac
+# file=$( quote $file )
+ if [ -n "$RPMREBUILD_NOQUOTE" ]
+ then
+ # do not quote
+ echo
+ else
+ case "$file" in
+ # replace * by \*
+ x*\**) file=$(echo "$file" | sed 's/\*/\\*/');;
+ # replace \ by \\
+ x*\\*) file=$(echo "$file" | sed 's/\\/\\\\/');;
+ x*) ;;
+ esac
+ fi
# comment missing files is now done after in CheckMissing func (processing_func.src)
# to be able to work also on rpm files (not expanded yet in this state)
diff --git a/rpmrebuild_lib.src b/rpmrebuild_lib.src
index 682daa4..919fff7 100755
--- a/rpmrebuild_lib.src
+++ b/rpmrebuild_lib.src
@@ -135,21 +135,27 @@ function TestAwk
# todo : quote meta characters is used in 2 subs
# rpmrebuild_files.sh
# processing_func.src : CheckMissing
-# function Quote
-# {
-# local x
-# x="$1"
-# case "$x" in
-# # replace * by \*
-# *\**) x=${x//\*/\\*} ;;
-#
-# # replace \ by \\
-# *\\*) x=${x//\\/\\\\} ;;
-#
-# *) ;;
-# esac
-# echo "$x"
-#
-# return
-# }
+function Quote
+{
+ local x
+ x="$1"
+ if [ -n "$RPMREBUILD_NOQUOTE" ]
+ then
+ # do not quote
+ echo
+ else
+ case "$x" in
+ # replace * by \*
+ x*\**) x=${x//\*/\\*} ;;
+
+ # replace \ by \\
+ x*\\*) x=${x//\\/\\\\} ;;
+
+ x*) ;;
+ esac
+ fi
+ echo -E "$x"
+
+ return
+}
###############################################################################
--
2.46.0