!94 回合上游社区补丁

From: @jade_t 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
This commit is contained in:
openeuler-ci-bot 2024-12-12 11:56:17 +00:00 committed by Gitee
commit 6fb1965d88
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 1060 additions and 1 deletions

View File

@ -0,0 +1,178 @@
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 b46537d..1b6f469 100755
--- a/processing_func.src
+++ b/processing_func.src
@@ -405,47 +405,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 \*
- x*\**) line=$(echo "$line" | sed 's/\*/\\*/') ;;
- # replace \ by \\
- x*\\*) line=$(echo "$line" | sed 's/\\/\\\\/') ;;
- x*) ;;
- 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 "$package_flag" ]
then
# work on rpm file
# check in buildroot tar expand
- if [ -e "${BUILDROOT}/${file}" ]
+ if [ "X$spec_only" = "Xyes" ]
+ 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 3c31bc8..054bba7 100755
--- a/rpmrebuild.sh
+++ b/rpmrebuild.sh
@@ -133,7 +133,7 @@ function RpmUnpack
# create buildroot if necessary
function CreateBuildRoot
{
- Debug '(CreateBuildRoot)'
+ Debug "(CreateBuildRoot) $BUILDROOT"
if [ "x$package_flag" = "x" ]; then
# installed package
if [ "X$need_change_files" = "Xyes" ]; then
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index 15f1a88..68e0d22 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -96,20 +96,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 \*
- x*\**) file=$(echo "$file" | sed 's/\*/\\*/');;
- # replace \ by \\
- x*\\*) file=$(echo "$file" | sed 's/\\/\\\\/');;
- x*) ;;
- 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)
@@ -252,6 +239,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 0bfa551..716892b 100755
--- a/rpmrebuild_ghost.sh
+++ b/rpmrebuild_ghost.sh
@@ -58,7 +58,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 "X$file_flags" in
X*g*)
diff --git a/rpmrebuild_lib.src b/rpmrebuild_lib.src
index 919fff7..3f41d00 100755
--- a/rpmrebuild_lib.src
+++ b/rpmrebuild_lib.src
@@ -132,18 +132,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=${x//\*/\\*} ;;
--
2.46.0

View File

@ -0,0 +1,110 @@
From 8559f43fe16789fd23e620fdf4c5c0ee9584cefa Mon Sep 17 00:00:00 2001
From: Eric Gerbier <gerbier@users.sourceforge.net>
Date: Sun, 13 Oct 2024 11:07:26 +0200
Subject: [PATCH] bugfix : the comment-missing option can only apply on
installed packages
---
man/en/rpmrebuild.1.in | 1 +
man/fr_FR.UTF-8/rpmrebuild.1.in | 1 +
man/fr_FR/rpmrebuild.1.in | 1 +
rpmrebuild_files.sh | 9 ++-------
rpmrebuild_parser.src | 12 ++++++++++++
5 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/man/en/rpmrebuild.1.in b/man/en/rpmrebuild.1.in
index 3a590e6..8729d0e 100644
--- a/man/en/rpmrebuild.1.in
+++ b/man/en/rpmrebuild.1.in
@@ -31,6 +31,7 @@ set files posix capabilities as installed files
.TP
\fB\-c, \-\-comment\-missing\fP=<\fIyes\fP|\fIno\fP>
comment out in the specfile missing files. Default: \fBno\fP.
+only applies on installed rpm, not on package files
.TP
\fB\-D, \-\-define\fP=<\fIdefines\fP>
defines to be passed to rpmbuild.
diff --git a/man/fr_FR.UTF-8/rpmrebuild.1.in b/man/fr_FR.UTF-8/rpmrebuild.1.in
index aeae281..a36585f 100644
--- a/man/fr_FR.UTF-8/rpmrebuild.1.in
+++ b/man/fr_FR.UTF-8/rpmrebuild.1.in
@@ -29,6 +29,7 @@ utiliser les capacités posix des fichiers installés
.TP
\fB\-c, \-\-comment\-missing\fP=<\fIyes\fP|\fIno\fP>
commente les fichiers manquants dans le fichier specfile. Defaut: \fBno\fP (non).
+ne s'applique qu'aux packages installés, pas aux fichiers
.TP
\fB\-D, \-\-define\fP=<\fIdefines\fP>
définition(s) à passer au programme \fBrpmbuild\fP.
diff --git a/man/fr_FR/rpmrebuild.1.in b/man/fr_FR/rpmrebuild.1.in
index f8157ca..0d30327 100644
--- a/man/fr_FR/rpmrebuild.1.in
+++ b/man/fr_FR/rpmrebuild.1.in
@@ -29,6 +29,7 @@ utiliser les capacit
.TP
\fB\-c, \-\-comment\-missing\fP=<\fIyes\fP|\fIno\fP>
commente les fichiers manquants dans le fichier specfile. Defaut: \fBno\fP (non).
+ne s'applique qu'aux packages installÚs, pas aux fichiers
.TP
\fB\-D, \-\-define\fP=<\fIdefines\fP>
définition(s) à passer au programme \fBrpmbuild\fP.
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index a56b110..97d7ad3 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -102,6 +102,8 @@ while :; do
x*\\*) file=$(echo "$file" | sed 's/\\/\\\\/');;
x*) ;;
esac
+
+ # COMMENT_MISSING only applies on installed rpm
miss_str=""
if [ "X$RPMREBUILD_COMMENT_MISSING" = "Xyes" ]; then
if [ -e "$file" ]; then
@@ -117,13 +119,6 @@ while :; do
lang_str=""
else
lang_str="%lang($file_lang) "
- if [ -e "$file" ]; then
- miss_str=""
- else
- if [ ! -h "$file" ]; then
- miss_str='# MISSING: '
- fi
- fi
fi
# %dir handling
diff --git a/rpmrebuild_parser.src b/rpmrebuild_parser.src
index 86eed9e..e4e2c09 100755
--- a/rpmrebuild_parser.src
+++ b/rpmrebuild_parser.src
@@ -1454,6 +1454,7 @@ function CommandLineParsing
##############################################################################
function CheckOptions
{
+ # NOTESTINSTALL
if [ -n "$package_install" ]
then
# force package test
@@ -1463,6 +1464,17 @@ function CheckOptions
# no test if work on files (not installed)
NOTESTINSTALL="1"
fi
+
+ # RPMREBUILD_COMMENT_MISSING can not apply on rpm files
+ if [ -n "$package_flag" ]
+ then
+ if [ "X$RPMREBUILD_COMMENT_MISSING" = 'Xyes' ]
+ then
+ RPMREBUILD_COMMENT_MISSING='no'
+ Warning '(CheckOptions) COMMENT_MISSING can not be used on rpm file'
+ fi
+ fi
+
return 0
}
###############################################################################
--
2.46.0

View File

@ -0,0 +1,260 @@
From 2904311f19ca1299a0efcfcea80cd389f2b0f0d4 Mon Sep 17 00:00:00 2001
From: Eric Gerbier <gerbier@users.sourceforge.net>
Date: Sat, 19 Oct 2024 14:41:53 +0200
Subject: [PATCH] bugfix : the comment-missing option was not working on rpm
files
---
man/en/rpmrebuild.1.in | 1 -
man/fr_FR.UTF-8/rpmrebuild.1.in | 1 -
man/fr_FR/rpmrebuild.1.in | 1 -
processing_func.src | 63 +++++++++++++++++++++++++++++++++
rpmrebuild.sh | 2 ++
rpmrebuild_files.sh | 14 +++-----
rpmrebuild_lib.src | 21 +++++++++++
rpmrebuild_parser.src | 10 ------
8 files changed, 90 insertions(+), 23 deletions(-)
diff --git a/man/en/rpmrebuild.1.in b/man/en/rpmrebuild.1.in
index 8729d0e..3a590e6 100644
--- a/man/en/rpmrebuild.1.in
+++ b/man/en/rpmrebuild.1.in
@@ -31,7 +31,6 @@ set files posix capabilities as installed files
.TP
\fB\-c, \-\-comment\-missing\fP=<\fIyes\fP|\fIno\fP>
comment out in the specfile missing files. Default: \fBno\fP.
-only applies on installed rpm, not on package files
.TP
\fB\-D, \-\-define\fP=<\fIdefines\fP>
defines to be passed to rpmbuild.
diff --git a/man/fr_FR.UTF-8/rpmrebuild.1.in b/man/fr_FR.UTF-8/rpmrebuild.1.in
index a36585f..aeae281 100644
--- a/man/fr_FR.UTF-8/rpmrebuild.1.in
+++ b/man/fr_FR.UTF-8/rpmrebuild.1.in
@@ -29,7 +29,6 @@ utiliser les capacités posix des fichiers installés
.TP
\fB\-c, \-\-comment\-missing\fP=<\fIyes\fP|\fIno\fP>
commente les fichiers manquants dans le fichier specfile. Defaut: \fBno\fP (non).
-ne s'applique qu'aux packages installés, pas aux fichiers
.TP
\fB\-D, \-\-define\fP=<\fIdefines\fP>
définition(s) à passer au programme \fBrpmbuild\fP.
diff --git a/man/fr_FR/rpmrebuild.1.in b/man/fr_FR/rpmrebuild.1.in
index 0d30327..f8157ca 100644
--- a/man/fr_FR/rpmrebuild.1.in
+++ b/man/fr_FR/rpmrebuild.1.in
@@ -29,7 +29,6 @@ utiliser les capacit
.TP
\fB\-c, \-\-comment\-missing\fP=<\fIyes\fP|\fIno\fP>
commente les fichiers manquants dans le fichier specfile. Defaut: \fBno\fP (non).
-ne s'applique qu'aux packages installÚs, pas aux fichiers
.TP
\fB\-D, \-\-define\fP=<\fIdefines\fP>
définition(s) à passer au programme \fBrpmbuild\fP.
diff --git a/processing_func.src b/processing_func.src
index 51b5a57..e106939 100755
--- a/processing_func.src
+++ b/processing_func.src
@@ -18,6 +18,7 @@
function processing_init
{
+ Debug "(processing_init)"
spec_concatenated="no"
local SPEC_DIR=$TMPDIR_WORK
@@ -74,6 +75,7 @@ function processing_init
function processing_spec_change
{
+ Debug "(processing_spec_change)"
local Func="processing_spec_change"
[ $# -ne 1 -o "x$1" = "x" ] && {
Error "(processing_spec_change) Usage: $0 $Func <operation>"
@@ -297,6 +299,7 @@ function processing_spec_change
function processing_fini
{
+ Debug "(processing_fini)"
local cmd
if [ "X$spec_concatenated" = "Xyes" ]; then
case "x$specfile" in
@@ -338,6 +341,7 @@ function processing_fini
function CreateProcessing
{
+ Debug "(CreateProcessing)"
[ $# -ne 1 -o "x$1" = "x" ] && {
Error "(CreateProcessing) <operation>"
return 1
@@ -384,3 +388,62 @@ function CreateProcessing
esac || Error "(CreateProcessing) esac" || return
return 0
}
+
+# used to comment missing files in file section
+# write a new files.x
+function CheckMissing {
+
+ Debug "(CheckMissing) BUILDROOT=$BUILDROOT"
+
+ if [ "X$RPMREBUILD_COMMENT_MISSING" = "Xyes" ]; then
+ local SPEC_IN=$SPEC_FILES.$si_files
+ si_files=$(( si_files + 1 ))
+ local SPEC_OUT=$SPEC_FILES.$si_files
+
+ # ex
+ # %attr(0555, root, root) "/usr/bin/rpmrebuild"
+ # %dir %attr(0755, root, root) "/usr/lib/rpmrebuild"
+
+ while :; do
+ read line
+ [ -z "$line" ] && break
+ file=$( echo $line | cut -d\" -f2 )
+ is_ghost=$( echo $line | grep '%ghost')
+
+ # 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
+
+ if [ -n "$is_ghost" ]
+ then
+ # ghost file may be missing
+ echo $line
+ elif [ -n "$package_flag" ]
+ then
+ # work on rpm file
+ # check in buildroot tar expand
+ if [ -e "${BUILDROOT}/${file}" ]
+ then
+ echo $line
+ else
+ echo "# MISSING: $line"
+ fi
+ else
+ # work on installed package
+ if [ -e "${file}" ]
+ then
+ echo $line
+ else
+ echo "# MISSING: $line"
+ fi
+ fi
+ done < $SPEC_IN > $SPEC_OUT || return
+
+ fi
+}
diff --git a/rpmrebuild.sh b/rpmrebuild.sh
index 0f87963..3c31bc8 100755
--- a/rpmrebuild.sh
+++ b/rpmrebuild.sh
@@ -547,10 +547,12 @@ function Main
if [ "X$spec_only" = "Xyes" ]; then
BUILDROOT="/"
SpecGeneration || Error "SpecGeneration" || return
+ CheckMissing || Error "CheckMissing" || return
Processing || Error "Processing" || return
else
SpecGeneration || Error "SpecGeneration" || return
CreateBuildRoot || Error "CreateBuildRoot" || return
+ CheckMissing || Error "CheckMissing" || return
Processing || Error "Processing" || return
CheckArch || Error "CheckArch" || return
RpmBuild || Error "RpmBuild" || return
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index 97d7ad3..442e7ea 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -95,6 +95,7 @@ while :; do
#wild=$(echo $file | grep "\*")
#[ -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/\*/\\*/');;
@@ -103,15 +104,8 @@ while :; do
x*) ;;
esac
- # COMMENT_MISSING only applies on installed rpm
- miss_str=""
- if [ "X$RPMREBUILD_COMMENT_MISSING" = "Xyes" ]; then
- if [ -e "$file" ]; then
- miss_str=""
- else
- miss_str='# MISSING: '
- fi
- 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)
# language handling
[ "X$file_lang" = "X(none)" ] && file_lang=""
@@ -251,6 +245,6 @@ while :; do
esac
fi
- echo "${miss_str}${lang_str}${dir_str}${fflags_str}${attr_str}${caps_str}${verify_str}\"${file}\""
+ echo "${lang_str}${dir_str}${fflags_str}${attr_str}${caps_str}${verify_str}\"${file}\""
done || Critical "$MY_BASENAME done"
exit 0
diff --git a/rpmrebuild_lib.src b/rpmrebuild_lib.src
index 9b26f04..682daa4 100755
--- a/rpmrebuild_lib.src
+++ b/rpmrebuild_lib.src
@@ -132,3 +132,24 @@ function TestAwk
fi
}
###############################################################################
+# 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
+# }
+###############################################################################
diff --git a/rpmrebuild_parser.src b/rpmrebuild_parser.src
index e4e2c09..2bd16b7 100755
--- a/rpmrebuild_parser.src
+++ b/rpmrebuild_parser.src
@@ -1465,16 +1465,6 @@ function CheckOptions
NOTESTINSTALL="1"
fi
- # RPMREBUILD_COMMENT_MISSING can not apply on rpm files
- if [ -n "$package_flag" ]
- then
- if [ "X$RPMREBUILD_COMMENT_MISSING" = 'Xyes' ]
- then
- RPMREBUILD_COMMENT_MISSING='no'
- Warning '(CheckOptions) COMMENT_MISSING can not be used on rpm file'
- fi
- fi
-
return 0
}
###############################################################################
--
2.46.0

View File

@ -0,0 +1,27 @@
From 44f346694bbcce7769f014c91d4330b7103e7cb1 Mon Sep 17 00:00:00 2001
From: Eric Gerbier <gerbier@users.sourceforge.net>
Date: Mon, 9 Sep 2024 08:01:32 +0200
Subject: [PATCH] fix backslash in filename
---
rpmrebuild_files.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index 89f145a..a56b110 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -96,7 +96,10 @@ while :; do
#[ -n "$wild" ] && file=$(echo "$file"|sed 's/\*/\\*/')
# quick and portable
case "x$file" in
+ # replace * by \*
x*\**) file=$(echo "$file" | sed 's/\*/\\*/');;
+ # replace \ by \\
+ x*\\*) file=$(echo "$file" | sed 's/\\/\\\\/');;
x*) ;;
esac
miss_str=""
--
2.46.0

View File

@ -0,0 +1,29 @@
From f628deaa9ef3e1b9933b937b7a66caebc0142c8f Mon Sep 17 00:00:00 2001
From: Eric Gerbier <gerbier@users.sourceforge.net>
Date: Sun, 8 Sep 2024 17:22:05 +0200
Subject: [PATCH] fix trailing space (yixiangzhike)
---
rpmrebuild_files.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index 2088743..89f145a 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -83,7 +83,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"
# bash 2 syntaxe
#[[ $file = *\** ]] && file=$(echo "$file"|sed 's/\*/\\*/')
--
2.46.0

View File

@ -0,0 +1,313 @@
From 74a3d654ce30ec83453f12a5939a91fdb94e8bb0 Mon Sep 17 00:00:00 2001
From: Eric Gerbier <gerbier@users.sourceforge.net>
Date: Fri, 6 Sep 2024 16:42:29 +0200
Subject: [PATCH] support filetrigger (merged from github repo)
---
optional_tags.cfg | 2 +
plugins/demo.plug | 2 +
processing_func.src | 18 +++++++++
rpmrebuild_parser.src | 89 +++++++++++++++++++++++++++++++++++++++++--
rpmrebuild_rpmqf.src | 10 +++++
spec_func.src | 8 ++++
6 files changed, 125 insertions(+), 4 deletions(-)
diff --git a/optional_tags.cfg b/optional_tags.cfg
index fe90209..fc69433 100644
--- a/optional_tags.cfg
+++ b/optional_tags.cfg
@@ -33,3 +33,5 @@ SUPPLEMENTVERSION d_line
# only in rpm 5
TRIGGERCONDS d_word
TRIGGERTYPE d_word
+FILETRIGGERCONDS d_line
+TRANSFILETRIGGERCONDS d_line
diff --git a/plugins/demo.plug b/plugins/demo.plug
index 8716d52..ac67b79 100644
--- a/plugins/demo.plug
+++ b/plugins/demo.plug
@@ -30,6 +30,8 @@ change-spec-requires demo.sh
change-spec-description demo.sh
change-spec-files demo.sh
change-spec-triggers demo.sh
+change-spec-filetriggers demo.sh
+change-spec-transfiletriggers demo.sh
change-spec-pre demo.sh
change-spec-pretrans demo.sh
change-spec-post demo.sh
diff --git a/processing_func.src b/processing_func.src
index b0a4105..51b5a57 100755
--- a/processing_func.src
+++ b/processing_func.src
@@ -41,6 +41,8 @@ function processing_init
SPEC_RECOMMENDS=$SPEC_DIR/recommends
SPEC_SUPPLEMENTS=$SPEC_DIR/supplements
SPEC_TRIGGERS=$SPEC_DIR/triggers
+ SPEC_FILETRIGGERS=$SPEC_DIR/filetriggers
+ SPEC_TRANSFILETRIGGERS=$SPEC_DIR/transfiletriggers
SPEC_VERIFYSCRIPT=$SPEC_DIR/verifyscript
spec_index=1
@@ -64,6 +66,8 @@ function processing_init
si_recommends=1
si_supplements=1
si_triggers=1
+ si_filetriggers=1
+ si_transfiletriggers=1
si_verifyscript=1
si_rpmqf=1
}
@@ -223,6 +227,20 @@ function processing_spec_change
SPEC_OUT=$SPEC_TRIGGERS.$si_triggers
;;
+ Xchange-spec-filetriggers | \
+ Xedit-filetriggers)
+ SPEC_IN=$SPEC_FILETRIGGERS.$si_filetriggers
+ si_filetriggers=$(( si_filetriggers + 1 ))
+ SPEC_OUT=$SPEC_FILETRIGGERS.$si_filetriggers
+ ;;
+
+ Xchange-spec-transfiletriggers | \
+ Xedit-transfiletriggers)
+ SPEC_IN=$SPEC_TRANSFILETRIGGERS.$si_transfiletriggers
+ si_transfiletriggers=$(( si_transfiletriggers + 1 ))
+ SPEC_OUT=$SPEC_TRANSFILETRIGGERS.$si_transfiletriggers
+ ;;
+
Xchange-spec-verifyscript | \
Xedit-verifyscript)
SPEC_IN=$SPEC_VERIFYSCRIPT.$si_verifyscript
diff --git a/rpmrebuild_parser.src b/rpmrebuild_parser.src
index 4765c57..86eed9e 100755
--- a/rpmrebuild_parser.src
+++ b/rpmrebuild_parser.src
@@ -81,6 +81,8 @@ options:
--change-spec-description=<command>
--change-spec-files=<command>
--change-spec-triggers=<command>
+ --change-spec-filetriggers=<command>
+ --change-spec-transfiletriggers=<command>
--change-spec-pre=<command>
--change-spec-pretrans=<command>
--change-spec-post=<command>
@@ -105,6 +107,8 @@ options:
--edit-description
--edit-files
--edit-triggers
+ --edit-filetriggers
+ --edit-transfiletriggers
--edit-pre
--edit-pretrans
--edit-post
@@ -354,11 +358,26 @@ function ProcessLongOptions
change-spec-f | \
change-spec-fi | \
change-spec-fil | \
- change-spec-file | \
+ change-spec-file)
+ AmbiguousOption
+ return 1
+ ;;
+
change-spec-files)
LONG_OPTION="change-spec-files"
;;
+ change-spec-filet | \
+ change-spec-filetr | \
+ change-spec-filetri | \
+ change-spec-filetrig | \
+ change-spec-filetrigg | \
+ change-spec-filetrigge | \
+ change-spec-filetrigger | \
+ change-spec-filetriggers)
+ LONG_OPTION="change-spec-filetriggers"
+ ;;
+
change-spec-o | \
change-spec-ob | \
change-spec-obs | \
@@ -471,7 +490,28 @@ function ProcessLongOptions
;;
change-spec-t | \
- change-spec-tr | \
+ change-spec-tr)
+ AmbiguousOption
+ return 1
+ ;;
+
+ change-spec-tra | \
+ change-spec-tran | \
+ change-spec-trans | \
+ change-spec-transf | \
+ change-spec-transfi | \
+ change-spec-transfile | \
+ change-spec-transfilet | \
+ change-spec-transfiletr | \
+ change-spec-transfiletri | \
+ change-spec-transfiletrig | \
+ change-spec-transfiletrigg | \
+ change-spec-transfiletrigge | \
+ change-spec-transfiletrigger | \
+ change-spec-transfiletriggers)
+ LONG_OPTION="change-spec-transfiletriggers"
+ ;;
+
change-spec-tri | \
change-spec-trig | \
change-spec-trigg | \
@@ -615,11 +655,27 @@ function ProcessLongOptions
edit-f | \
edit-fi | \
edit-fil | \
- edit-file | \
+ edit-file)
+ AmbiguousOption
+ return 1
+ ;;
+
edit-files)
LONG_OPTION='edit-files'
;;
+ edit-filet | \
+ edit-filetr | \
+ edit-filetri | \
+ edit-filetri | \
+ edit-filetrig | \
+ edit-filetrigg | \
+ edit-filetrigge | \
+ edit-filetrigger | \
+ edit-filetriggers)
+ LONG_OPTION='edit-filetriggers'
+ ;;
+
edit-o | \
edit-ob | \
edit-obs | \
@@ -745,7 +801,28 @@ function ProcessLongOptions
;;
edit-t | \
- edit-tr | \
+ edit-tr)
+ AmbiguousOption
+ return 1
+ ;;
+
+ edit-tra | \
+ edit-tran | \
+ edit-trans | \
+ edit-transf | \
+ edit-transfi | \
+ edit-transfile | \
+ edit-transfilet | \
+ edit-transfiletr | \
+ edit-transfiletri | \
+ edit-transfiletrig | \
+ edit-transfiletrigg | \
+ edit-transfiletrigge | \
+ edit-transfiletrigger | \
+ edit-transfiletriggers)
+ LONG_OPTION='edit-transfiletriggers'
+ ;;
+
edit-tri | \
edit-trig | \
edit-trigg | \
@@ -1034,6 +1111,7 @@ function ProcessLongOptions
change-spec-description | \
change-spec-enhances | \
change-spec-files | \
+ change-spec-filetriggers | \
change-spec-obsoletes | \
change-spec-pre | \
change-spec-pretrans | \
@@ -1047,6 +1125,7 @@ function ProcessLongOptions
change-spec-recommends | \
change-spec-suggests | \
change-spec-supplements | \
+ change-spec-transfiletriggers | \
change-spec-triggers | \
change-spec-verifyscript | \
change-spec-whole)
@@ -1088,6 +1167,7 @@ function ProcessLongOptions
edit-description | \
edit-enhances | \
edit-files | \
+ edit-filetriggers | \
edit-obsoletes | \
edit-pre | \
edit-pretrans | \
@@ -1101,6 +1181,7 @@ function ProcessLongOptions
edit-suggests | \
edit-recommends | \
edit-supplements | \
+ edit-transfiletriggers | \
edit-triggers | \
edit-verifyscript | \
edit-whole)
diff --git a/rpmrebuild_rpmqf.src b/rpmrebuild_rpmqf.src
index 2e5db9a..53f5874 100755
--- a/rpmrebuild_rpmqf.src
+++ b/rpmrebuild_rpmqf.src
@@ -146,6 +146,16 @@ echo
echo '[%%trigger%{TRIGGERTYPE} -p %{TRIGGERSCRIPTPROG} -- %{TRIGGERCONDS}\n%|TRIGGERSCRIPTS?{%{TRIGGERSCRIPTS}\n}|]'
}
+function qf_spec_filetriggers {
+echo
+echo '[%%filetrigger%{FILETRIGGERTYPE} -p %{FILETRIGGERSCRIPTPROG} -P %{FILETRIGGERPRIORITIES} -- %{FILETRIGGERCONDS}\n%|FILETRIGGERSCRIPTS?{%{FILETRIGGERSCRIPTS}\n}|]'
+}
+
+function qf_spec_transfiletriggers {
+echo
+echo '[%%transfiletrigger%{TRANSFILETRIGGERTYPE} -p %{TRANSFILETRIGGERSCRIPTPROG} -P %{TRANSFILETRIGGERPRIORITIES} -- %{TRANSFILETRIGGERCONDS}\n%|TRANSFILETRIGGERSCRIPTS?{%{TRANSFILETRIGGERSCRIPTS}\n}|]'
+}
+
function qf_spec_pre {
echo
echo '%|PREINPROG?{%%pre -p %{PREINPROG}\n%|PREIN?{[%{PREIN}\n]}|}:{%|PREIN?{\n%%pre\n[%{PREIN}\n]}|}|'
diff --git a/spec_func.src b/spec_func.src
index 10b85ac..3ab14e2 100755
--- a/spec_func.src
+++ b/spec_func.src
@@ -170,6 +170,8 @@ function SpecGeneration
spec_query qf_spec_description > $SPEC_DESCRIPTION.$i || Error "(SpecGeneration) qf_spec_description" || return
spec_files > $SPEC_FILES.$i || Error "(SpecGeneration) spec_files" || return
spec_query qf_spec_triggers > $SPEC_TRIGGERS.$i || Error "(SpecGeneration) qf_spec_triggers" || return
+ spec_query qf_spec_filetriggers > $SPEC_FILETRIGGERS.$i || Error "(SpecGeneration) qf_spec_filetriggers" || return
+ spec_query qf_spec_transfiletriggers > $SPEC_TRANSFILETRIGGERS.$i || Error "(SpecGeneration) qf_spec_transfiletriggers" || return
spec_query qf_spec_pre > $SPEC_PRE.$i || Error "(SpecGeneration) qf_spec_pre" || return
spec_query qf_spec_pretrans > $SPEC_PRETRANS.$i || Error "(SpecGeneration) qf_spec_pretrans" || return
spec_query qf_spec_post > $SPEC_POST.$i || Error "(SpecGeneration) qf_spec_post" || return
@@ -237,6 +239,8 @@ function spec_concatenate
# %%triger -> %trigger (in begin of line)
local sed_trigger="/^%%trigger/s/^%%/%/1"
+ local sed_filetrigger="/^%%filetrigger/s/^%%/%/1"
+ local sed_transfiletrigger="/^%%transfiletrigger/s/^%%/%/1"
# %%pre -> %pre (in begin of line) It'll work for %%preun too.
local sed_pre="/^%%pre/s/^%%/%/1"
# %%post -> %post (in begin of line) It'll work for %%postun too.
@@ -248,11 +252,15 @@ function spec_concatenate
sed \
-e "$sed_double_percent" \
-e "$sed_trigger" \
+ -e "$sed_filetrigger" \
+ -e "$sed_transfiletrigger" \
-e "$sed_pre" \
-e "$sed_post" \
-e "$sed_verifyscript" \
-e "$sed_global" \
$SPEC_TRIGGERS.$si_triggers \
+ $SPEC_FILETRIGGERS.$si_filetriggers \
+ $SPEC_TRANSFILETRIGGERS.$si_transfiletriggers \
$SPEC_PRE.$si_pre \
$SPEC_PRETRANS.$si_pretrans \
$SPEC_POST.$si_post \
--
2.46.0

View File

@ -0,0 +1,128 @@
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

View File

@ -1,11 +1,19 @@
Name: rpmrebuild
Version: 2.15
Release: 6
Release: 7
Summary: A tool to build a rpm file from the rpm database
License: GPLv2+
URL: http://rpmrebuild.sourceforge.net
Source0: https://downloads.sourceforge.net/rpmrebuild/%{name}-%{version}.tar.gz
Patch6000: backport-support-filetrigger.patch
Patch6001: backport-fix-trailing-space.patch
Patch6002: backport-fix-backslash-in-filename.patch
Patch6003: backport-bugfix-the-comment-missing-option-can-only-apply-on-installed-packages.patch
Patch6004: backport-bugfix-the-comment-missing-option-was-not-working-on.patch
Patch6005: backport-use-RPMREBUILD_NOQUOTE-on-some-distribution-if-filenames-contains-meta-car.patch
Patch6006: backport-bugfix-comment-missing-with-spec-only-on-rpm-file-and-bugfix-file-with-space.patch
Patch9000: bugfix-reset-defattr-when-users-want-to-keep-files-permissi.patch
Patch9001: fix-k-may-not-keep-uid-or-gid.patch
Patch9002: fix-errors-found-from-shellcheck-scan.patch
@ -60,6 +68,12 @@ rm -rf $RPM_BUILD_ROOT%{_mandir}/fr_FR.UTF-8/man1/
%{_mandir}/fr/man1/*.gz
%changelog
* Thu Dec 12 2024 dongyuzhen <dongyuzhen@h-partners.com> - 2.15-7
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:backport some patches from upstream
* Thu Aug 1 2024 yixiangzhike <yixiangzhike007@163.com> - 2.15-6
- Type:bugfix
- CVE:NA