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 a7016cc..09f8a0f 100755 --- a/processing_func.src +++ b/processing_func.src @@ -418,13 +418,20 @@ function CheckMissing { # quote meta characters # see also in rpmrebuild_files.sh - case "$line" in - # replace * by \* - *\**) line=${line//\*/\\*} ;; - # replace \ by \\ - *\\*) line=${line//\\/\\\\} ;; - *) ;; - esac + #file=$( quote $file ) + if [ -n "$RPMREBUILD_NOQUOTE" ] + then + # no quote + echo + else + case "$line" in + # replace * by \* + *\**) line=${line//\*/\\*} ;; + # replace \ by \\ + *\\*) line=${line//\\/\\\\} ;; + *) ;; + esac + fi if [ -n "$is_ghost" ] then diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh index 71274d8..4a4b6eb 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 "$file" in - # replace * by \* - *\**) file=${file//\*/\\*} ;; - # replace \ by \\ - *\\*) file=${file//\\/\\\\} ;; - *) ;; - esac +# file=$( quote $file ) + if [ -n "$RPMREBUILD_NOQUOTE" ] + then + # do not quote + echo + else + case "$file" in + # replace * by \* + *\**) file=${file//\*/\\*} ;; + # replace \ by \\ + *\\*) file=${file//\\/\\\\} ;; + *) ;; + 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 811acac..e1021e1 100755 --- a/rpmrebuild_lib.src +++ b/rpmrebuild_lib.src @@ -139,21 +139,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//\*/\\*} ;; + + # replace \ by \\ + *\\*) x=${x//\\/\\\\} ;; + + *) ;; + esac + fi + echo -E "$x" + + return +} ############################################################################### -- 2.46.0