From fb7fd3d6bbaf90c46240f156cc7e52111858a5cf Mon Sep 17 00:00:00 2001 From: Eric Gerbier 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 032c950..84a44b5 100755 --- a/processing_func.src +++ b/processing_func.src @@ -414,13 +414,20 @@ function CheckMissing { # quote meta characters # see also in rpmrebuild_files.sh - case "$line" in - # replace * by \* - x*\**) line=${line//\*/\\*} ;; - # replace \ by \\ - x*\\*) line=${line//\\/\\\\} ;; - x*) ;; - esac + #file=$( quote $file ) + if [ -n "$RPMREBUILD_NOQUOTE" ] + then + # no quote + echo + else + case "$line" in + # replace * by \* + x*\**) line=${line//\*/\\*} ;; + # replace \ by \\ + x*\\*) line=${line//\\/\\\\} ;; + x*) ;; + esac + fi if [ -n "$is_ghost" ] then diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh index bb9032b..32e3198 100755 --- a/rpmrebuild_files.sh +++ b/rpmrebuild_files.sh @@ -101,13 +101,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=${file//\*/\\*} ;; - # replace \ by \\ - x*\\*) file=${file//\\/\\\\} ;; - x*) ;; - esac +# file=$( quote $file ) + if [ -n "$RPMREBUILD_NOQUOTE" ] + then + # do not quote + echo + else + case "$file" in + # replace * by \* + x*\**) file=${file//\*/\\*} ;; + # replace \ by \\ + x*\\*) file=${file//\\/\\\\} ;; + 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 24a66a0..70fe923 100755 --- a/rpmrebuild_lib.src +++ b/rpmrebuild_lib.src @@ -137,21 +137,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