rpmrebuild/backport-bugfix-comment-missing-with-spec-only-on-rpm-file-and-bugfix-file-with-space.patch

179 lines
4.5 KiB
Diff
Raw Normal View History

2024-11-21 17:01:36 +08:00
From 0336b36fa5ae1620b7d490cbad1c1420749d5bb7 Mon Sep 17 00:00:00 2001
From: Eric Gerbier <gerbier@users.sourceforge.net>
Date: Sat, 2 Nov 2024 17:42:33 +0100
Subject: [PATCH] - bugfix comment missing with spec-only on rpm file - bugfix
file with space
---
processing_func.src | 42 ++++++++++++++++++++----------------------
rpmrebuild.sh | 2 +-
rpmrebuild_files.sh | 17 ++---------------
rpmrebuild_ghost.sh | 6 +++++-
rpmrebuild_lib.src | 9 ++-------
5 files changed, 30 insertions(+), 46 deletions(-)
diff --git a/processing_func.src b/processing_func.src
index 09f8a0f..00e95b8 100755
--- a/processing_func.src
+++ b/processing_func.src
@@ -411,47 +411,45 @@ function CheckMissing {
# %dir %attr(0755, root, root) "/usr/lib/rpmrebuild"
while :; do
- read line
+ local line
+ local OLD_IFS
+ OLD_IFS="$IFS"
+ IFS=""
+ read -r line
+ IFS="$OLD_IFS"
+ # test end of input
[ -z "$line" ] && break
+ local file
+ local is_ghost
file=$( echo $line | cut -d\" -f2 )
is_ghost=$( echo $line | grep '%ghost')
- # quote meta characters
- # see also in rpmrebuild_files.sh
- #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
+ # test real file
+ tst_file=$( echo -e "$file" )
if [ -n "$is_ghost" ]
then
# ghost file may be missing
- echo $line
+ echo "$line"
elif [ -n "$RPMREBUILD_package_flag" ]
then
# work on rpm file
# check in buildroot tar expand
- if [ -e "${BUILDROOT}/${file}" ]
+ if [ "$RPMREBUILD_spec_only" = "yes" ]
+ then
+ # no way to check because no buildroot, no file extracted
+ echo -E "$line"
+ elif [ -e "${BUILDROOT}/${tst_file}" ]
then
- echo $line
+ echo -E "$line"
else
echo "# MISSING: $line"
fi
else
# work on installed package
- if [ -e "${file}" ]
+ if [ -e "${tst_file}" ]
then
- echo $line
+ echo -E "$line"
else
echo "# MISSING: $line"
fi
diff --git a/rpmrebuild.sh b/rpmrebuild.sh
index cdba61d..e4c2790 100755
--- a/rpmrebuild.sh
+++ b/rpmrebuild.sh
@@ -142,7 +142,7 @@ function RpmUnpack
# create buildroot if necessary
function CreateBuildRoot
{
- Debug '(CreateBuildRoot)'
+ Debug "(CreateBuildRoot) $BUILDROOT"
if [ -z "$RPMREBUILD_package_flag" ]; then
# installed package
if [ "$need_change_files" = "yes" ]; then
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index 4a4b6eb..9f844ba 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -101,20 +101,7 @@ while :; do
#[ -n "$wild" ] && file=$(echo "$file"|sed 's/\*/\\*/')
# quick and portable
# quote metacharacters, see also CheckMissing (processing_func.src)
-# 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
+ file=$( Quote "$file" )
# 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)
@@ -260,6 +247,6 @@ while :; do
esac
fi
- echo "${lang_str}${dir_str}${fflags_str}${attr_str}${caps_str}${verify_str}\"${file}\""
+ echo -E "${lang_str}${dir_str}${fflags_str}${attr_str}${caps_str}${verify_str}\"${file}\""
done || Critical "$MY_BASENAME done"
exit 0
diff --git a/rpmrebuild_ghost.sh b/rpmrebuild_ghost.sh
index dded292..4d6f388 100755
--- a/rpmrebuild_ghost.sh
+++ b/rpmrebuild_ghost.sh
@@ -59,7 +59,11 @@ while :; do
read file_verify
read file_lang
read file_cap
- read file
+ # Trailer space may be part of filename.
+ OLD_IFS="$IFS"
+ IFS=""
+ read -r file
+ IFS="$OLD_IFS"
case "$file_flags" in
*g*)
diff --git a/rpmrebuild_lib.src b/rpmrebuild_lib.src
index e1021e1..72fd1c4 100755
--- a/rpmrebuild_lib.src
+++ b/rpmrebuild_lib.src
@@ -136,18 +136,13 @@ function TestAwk
fi
}
###############################################################################
-# todo : quote meta characters is used in 2 subs
-# rpmrebuild_files.sh
-# processing_func.src : CheckMissing
+# quote meta characters is used in rpmrebuild_files.sh
function Quote
{
local x
x="$1"
- if [ -n "$RPMREBUILD_NOQUOTE" ]
+ if [ -z "$RPMREBUILD_NOQUOTE" ]
then
- # do not quote
- echo
- else
case "$x" in
# replace * by \*
*\**) x=${x//\*/\\*} ;;
--
2.46.0