Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
b4c42d8ca7
!86 回合上游社区补丁
From: @jade_t 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
2024-11-22 01:48:58 +00:00
dongyuzhen
7e66e7494e backport some patches from upstream 2024-11-21 17:01:36 +08:00
openeuler-ci-bot
7d36022b81
!80 【openEuler-24.03-LTS】Fix missing trailer space, and don't treat backslash as escape char
From: @yixiangzhike 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
2024-08-23 02:51:01 +00:00
yixiangzhike
c83aaa8efe fix missing trailer space, and don't treat backslash as escape char 2024-08-20 14:58:34 +08:00
openeuler-ci-bot
b784063332
!74 【openEuler-24.03-LTS】revert "avoid truncate trailer space and do not escape backslash when read filename"
From: @yixiangzhike 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
2024-08-01 12:13:12 +00:00
yixiangzhike
4e6e0cbf73 revert "avoid truncate trailer space and do not escape backslash when read filename" 2024-08-01 20:02:52 +08:00
openeuler-ci-bot
b008ffa262
!66 [sync] PR-65: 【Mainline】Avoid truncate trailer space and do not escape backslash when read filename
From: @openeuler-sync-bot 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
2024-07-25 06:13:01 +00:00
yixiangzhike
5088b0890c Avoid truncate trailer space and do not escape backslash when read filename
(cherry picked from commit c35543d75fa27b2e37a9e271d9b6a81e0511165e)
2024-07-25 13:06:23 +08:00
openeuler-ci-bot
688219136e
!64 revert: remove the require to rpm-build.For consistency with other community-released dependencies
From: @dongyuzhen 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
2024-01-20 01:30:38 +00:00
dongyuzhen
3090257c59 revert: remove the require to rpm-build.For consistency with other community-released dependencies 2024-01-19 18:49:57 +08:00
9 changed files with 1070 additions and 64 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 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

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 535f46d..197325d 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 a991a27..e72cb71 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 1a02194..663f8f1 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 3655234..af9c3f3 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -107,6 +107,8 @@ while :; do
*\\*) file=${file//\\/\\\\} ;;
*) ;;
esac
+
+ # COMMENT_MISSING only applies on installed rpm
miss_str=""
if [ "$RPMREBUILD_COMMENT_MISSING" = "yes" ]; then
if [ -e "$file" ]; then
@@ -122,13 +124,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 46c640b..3357840 100755
--- a/rpmrebuild_parser.src
+++ b/rpmrebuild_parser.src
@@ -1473,6 +1473,7 @@ function CommandLineParsing
##############################################################################
function CheckOptions
{
+ # RPMREBUILD_NOTESTINSTALL
if [ -n "$RPMREBUILD_package_install" ]
then
# force package test
@@ -1482,6 +1483,17 @@ function CheckOptions
# no test if work on files (not installed)
RPMREBUILD_NOTESTINSTALL="1"
fi
+
+ # RPMREBUILD_COMMENT_MISSING can not apply on rpm files
+ if [ -n "$RPMREBUILD_package_flag" ]
+ then
+ if [ "$RPMREBUILD_COMMENT_MISSING" = 'yes' ]
+ 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,261 @@
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 197325d..535f46d 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 e72cb71..a991a27 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 663f8f1..1a02194 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 4785f9c..a7016cc 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"
if [ $# -ne 1 ] || [ -z "$1" ]
then
@@ -302,6 +304,7 @@ function processing_spec_change
function processing_fini
{
+ Debug "(processing_fini)"
local cmd
if [ "$spec_concatenated" = "yes" ]; then
case "$RPMREBUILD_specfile" in
@@ -343,6 +346,7 @@ function processing_fini
function CreateProcessing
{
+ Debug "(CreateProcessing)"
if [ $# -ne 1 ] || [ -z "$1" ]
then
Error "(CreateProcessing) <operation>"
@@ -390,3 +394,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 [ "$RPMREBUILD_COMMENT_MISSING" = "yes" ]; 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 \*
+ *\**) line=${line//\*/\\*} ;;
+ # replace \ by \\
+ *\\*) line=${line//\\/\\\\} ;;
+ *) ;;
+ esac
+
+ if [ -n "$is_ghost" ]
+ then
+ # ghost file may be missing
+ echo $line
+ elif [ -n "$RPMREBUILD_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 545b348..cdba61d 100755
--- a/rpmrebuild.sh
+++ b/rpmrebuild.sh
@@ -639,11 +639,13 @@ function Main
if [ "$RPMREBUILD_spec_only" = "yes" ]; then
BUILDROOT="/"
SpecGeneration || Error "SpecGeneration" || return
+ CheckMissing || Error "CheckMissing" || return
Processing || Error "Processing" || return
Echo "specfile: $RPMREBUILD_specfile"
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 af9c3f3..71274d8 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -100,6 +100,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 "$file" in
# replace * by \*
*\**) file=${file//\*/\\*} ;;
@@ -108,15 +109,8 @@ while :; do
*) ;;
esac
- # COMMENT_MISSING only applies on installed rpm
- miss_str=""
- if [ "$RPMREBUILD_COMMENT_MISSING" = "yes" ]; 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
[ "$file_lang" = "(none)" ] && file_lang=""
@@ -259,6 +253,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 5cbd026..811acac 100755
--- a/rpmrebuild_lib.src
+++ b/rpmrebuild_lib.src
@@ -136,3 +136,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 3357840..c6b162c 100755
--- a/rpmrebuild_parser.src
+++ b/rpmrebuild_parser.src
@@ -1484,16 +1484,6 @@ function CheckOptions
RPMREBUILD_NOTESTINSTALL="1"
fi
- # RPMREBUILD_COMMENT_MISSING can not apply on rpm files
- if [ -n "$RPMREBUILD_package_flag" ]
- then
- if [ "$RPMREBUILD_COMMENT_MISSING" = 'yes' ]
- 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 8c2f29c..3655234 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -101,7 +101,10 @@ while :; do
#[ -n "$wild" ] && file=$(echo "$file"|sed 's/\*/\\*/')
# quick and portable
case "$file" in
+ # replace * by \*
*\**) file=${file//\*/\\*} ;;
+ # replace \ by \\
+ *\\*) file=${file//\\/\\\\} ;;
*) ;;
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 30955c0..8c2f29c 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"
# on fedora 33, centos 7, 8, the root directory "/" is owned by filesystem package
# but for rpmrebuild, BUILDROOT is juste a symlink, not a directory (cf RpmBuild in rpmrebuild.sh)
--
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 d377f7b..fcafbbb 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 eb8beaa..4785f9c 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
}
@@ -224,6 +228,20 @@ function processing_spec_change
SPEC_OUT=$SPEC_TRIGGERS.$si_triggers
;;
+ change-spec-filetriggers | \
+ edit-filetriggers)
+ SPEC_IN=$SPEC_FILETRIGGERS.$si_filetriggers
+ si_filetriggers=$(( si_filetriggers + 1 ))
+ SPEC_OUT=$SPEC_FILETRIGGERS.$si_filetriggers
+ ;;
+
+ change-spec-transfiletriggers | \
+ edit-transfiletriggers)
+ SPEC_IN=$SPEC_TRANSFILETRIGGERS.$si_transfiletriggers
+ si_transfiletriggers=$(( si_transfiletriggers + 1 ))
+ SPEC_OUT=$SPEC_TRANSFILETRIGGERS.$si_transfiletriggers
+ ;;
+
change-spec-verifyscript | \
edit-verifyscript)
SPEC_IN=$SPEC_VERIFYSCRIPT.$si_verifyscript
diff --git a/rpmrebuild_parser.src b/rpmrebuild_parser.src
index f0261fe..46c640b 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
@@ -358,11 +362,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 | \
@@ -475,7 +494,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 | \
@@ -619,11 +659,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 | \
@@ -749,7 +805,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 | \
@@ -1038,6 +1115,7 @@ function ProcessLongOptions
change-spec-description | \
change-spec-enhances | \
change-spec-files | \
+ change-spec-filetriggers | \
change-spec-obsoletes | \
change-spec-pre | \
change-spec-pretrans | \
@@ -1051,6 +1129,7 @@ function ProcessLongOptions
change-spec-recommends | \
change-spec-suggests | \
change-spec-supplements | \
+ change-spec-transfiletriggers | \
change-spec-triggers | \
change-spec-verifyscript | \
change-spec-whole)
@@ -1095,6 +1174,7 @@ function ProcessLongOptions
edit-description | \
edit-enhances | \
edit-files | \
+ edit-filetriggers | \
edit-obsoletes | \
edit-pre | \
edit-pretrans | \
@@ -1108,6 +1188,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 04d62ea..5f4c574 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 6a9bff8..f919bd7 100755
--- a/spec_func.src
+++ b/spec_func.src
@@ -172,6 +172,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
@@ -242,6 +244,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.
@@ -251,11 +255,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 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

View File

@ -1,22 +1,25 @@
Name: rpmrebuild
Version: 2.18
Release: 4
Release: 9
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-Set-the-directory-mode-to-instead-of-omit.patch
Patch6001: backport-support-filetrigger.patch
Patch6002: backport-fix-trailing-space.patch
Patch6003: backport-fix-backslash-in-filename.patch
Patch6004: backport-bugfix-the-comment-missing-option-can-only-apply-on-installed-packages.patch
Patch6005: backport-bugfix-the-comment-missing-option-was-not-working-on.patch
Patch6006: backport-use-RPMREBUILD_NOQUOTE-on-some-distribution-if-filenames-contains-meta-car.patch
Patch6007: backport-bugfix-comment-missing-with-spec-only-on-rpm-file-and-bugfix-file-with-space.patch
Patch9000: Add-macros-_binaries_in_noarch_packages_terminate_bu.patch
Patch9001: use-backups-of-rpmbuild-and-rpmspec-to-avoid-conflicts.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: rpm-build
Requires: grep bash cpio textutils
%define _binaries_in_noarch_packages_terminate_build 0
Requires: rpm grep bash cpio textutils rpm-build
%description
%{name} allows to build an rpm file from an installed rpm, or from
@ -42,8 +45,6 @@ install -d -p $RPM_BUILD_ROOT%{_mandir}/fr/man1/
mv $RPM_BUILD_ROOT%{_mandir}/fr_FR.UTF-8/man1/* $RPM_BUILD_ROOT%{_mandir}/fr/man1/
rm -rf $RPM_BUILD_ROOT%{_mandir}/fr_FR.UTF-8/man1/
cp /usr/bin/rpmbuild $RPM_BUILD_ROOT%{_bindir}/rpmbuild-rebuild
cp /usr/bin/rpmspec $RPM_BUILD_ROOT%{_bindir}/rpmspec-rebuild
%files
%defattr(-,root,root)
@ -57,8 +58,6 @@ cp /usr/bin/rpmspec $RPM_BUILD_ROOT%{_bindir}/rpmspec-rebuild
%{_prefix}/lib/rpmrebuild/plugins/*.plug
%{_prefix}/lib/rpmrebuild/locale/*
%{_prefix}/lib/rpmrebuild/optional_tags.cfg
%{_bindir}/rpmbuild-rebuild
%{_bindir}/rpmspec-rebuild
%files help
%defattr(-,root,root)
@ -68,6 +67,21 @@ cp /usr/bin/rpmspec $RPM_BUILD_ROOT%{_bindir}/rpmspec-rebuild
%{_mandir}/fr/man1/*.gz
%changelog
* Thu Nov 21 2024 dongyuzhen <dongyuzhen@h-partners.com> - 2.18-9
- backport some patches from upstream
* Tue Aug 20 2024 yixiangzhike <yixiangzhike007@163.com> - 2.18-8
- fix missing trailer space, and don't treat backslash as escape char
* Thu Aug 1 2024 yixiangzhike <yixiangzhike007@163.com> - 2.18-7
- revert "avoid truncate trailer space and do not escape backslash when read filename"
* Wed Jul 24 2024 yixiangzhike <yixiangzhike007@163.com> - 2.18-6
- avoid truncate trailer space and do not escape backslash when read filename
* Fri Jan 19 2024 dongyuzhen <dongyuzhen@h-partners.com> - 2.18-5
- revert: remove the require to rpm-build.For consistency with other community-released dependencies
* Mon Jan 15 2024 dongyuzhen <dongyuzhen@h-partners.com> - 2.18-4
- fix failure when recompiling noarch rpm and remove the require to rpm-build

View File

@ -1,54 +0,0 @@
From 407ceacb5f5b987db692b48be9adc97d41f7544a Mon Sep 17 00:00:00 2001
From: lirui <lirui130@huawei.com>
Date: Mon, 26 Apr 2021 09:36:10 +0800
Subject: [PATCH] Use backups of rpmbuild and rpmspec to avoid conflicts
Because the rpmrebuild package contains the rpmbuild and rpmspec commands,
when you install the rpmrebuild and RPM -build packages at the same time,
the upgrade of one of the packages will fail due to the same name file conflict.
So rename the rpmbuild and rpmspec commands and package them.
---
rpmrebuild.sh | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/rpmrebuild.sh b/rpmrebuild.sh
index 545b348..efa6074 100755
--- a/rpmrebuild.sh
+++ b/rpmrebuild.sh
@@ -202,6 +202,9 @@ function RpmBuild
if [ -x /usr/bin/rpmbuild ]
then
BUILDCMD=/usr/bin/rpmbuild
+ elif [ -x /usr/bin/rpmbuild-rebuild ]
+ then
+ BUILDCMD=/usr/bin/rpmbuild-rebuild
else
BUILDCMD=rpm
@@ -251,11 +254,20 @@ function RpmFileName
QF_RPMFILENAME=$(eval "$change_arch" rpm "$RPMREBUILD_rpm_defines" --eval %_rpmfilename) || return
#Debug " QF_RPMFILENAME=$QF_RPMFILENAME"
# from generated specfile
- RPMFILENAME=$(eval "$change_arch" rpm "$RPMREBUILD_rpm_defines" --specfile --query --queryformat "${QF_RPMFILENAME}" "${FIC_SPEC}") || return
-
+ if [ -x /usr/bin/rpmspec ]
+ then
+ RPMFILENAME=$(eval $change_arch rpm "$RPMREBUILD_rpm_defines" --specfile --query --queryformat "${QF_RPMFILENAME}" "${FIC_SPEC}") || return
+ else
+ RPMFILENAME=$(eval $change_arch rpmspec-rebuild "$RPMREBUILD_rpm_defines" --query --queryformat "${QF_RPMFILENAME}" "${FIC_SPEC}") || return
+ fi
# workaround for redhat 6.x / rpm 3.x
local arch
- arch=$(eval "$change_arch" rpm "$RPMREBUILD_rpm_defines" --specfile --query --queryformat "%{ARCH}" "${FIC_SPEC}")
+ if [ -x /usr/bin/rpmspec ]
+ then
+ arch=$(eval $change_arch rpm "$RPMREBUILD_rpm_defines" --specfile --query --queryformat "%{ARCH}" "${FIC_SPEC}")
+ else
+ arch=$(eval $change_arch rpmspec-rebuild "$RPMREBUILD_rpm_defines" --query --queryformat "%{ARCH}" "${FIC_SPEC}")
+ fi
if [ "$arch" = "(none)" ]
then
Debug ' workaround for rpm 3.x'
--
2.33.0