54 lines
2.0 KiB
Diff
54 lines
2.0 KiB
Diff
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 2da043e..5800cca 100755
|
|
--- a/rpmrebuild.sh
|
|
+++ b/rpmrebuild.sh
|
|
@@ -192,6 +192,9 @@ function RpmBuild
|
|
if [ -x /usr/bin/rpmbuild ]
|
|
then
|
|
local BUILDCMD=/usr/bin/rpmbuild
|
|
+ elif [ -x /usr/bin/rpmbuild-rebuild ]
|
|
+ then
|
|
+ local BUILDCMD=/usr/bin/rpmbuild-rebuild
|
|
else
|
|
|
|
local BUILDCMD=rpm
|
|
@@ -231,10 +234,19 @@ function RpmFileName
|
|
local QF_RPMFILENAME=$(eval $change_arch rpm $rpm_defines --eval %_rpmfilename) || return
|
|
#Debug " QF_RPMFILENAME=$QF_RPMFILENAME"
|
|
# from generated specfile
|
|
- RPMFILENAME=$(eval $change_arch rpm $rpm_defines --specfile --query --queryformat "${QF_RPMFILENAME}" ${FIC_SPEC}) || return
|
|
-
|
|
+ if [ -x /usr/bin/rpmspec ]
|
|
+ then
|
|
+ RPMFILENAME=$(eval $change_arch rpm $rpm_defines --specfile --query --queryformat "${QF_RPMFILENAME}" ${FIC_SPEC}) || return
|
|
+ else
|
|
+ RPMFILENAME=$(eval $change_arch rpmspec-rebuild $rpm_defines --query --queryformat "${QF_RPMFILENAME}" ${FIC_SPEC}) || return
|
|
+ fi
|
|
# workaround for redhat 6.x / rpm 3.x
|
|
- local arch=$(eval $change_arch rpm $rpm_defines --specfile --query --queryformat "%{ARCH}" ${FIC_SPEC})
|
|
+ if [ -x /usr/bin/rpmspec ]
|
|
+ then
|
|
+ local arch=$(eval $change_arch rpm $rpm_defines --specfile --query --queryformat "%{ARCH}" ${FIC_SPEC})
|
|
+ else
|
|
+ local arch=$(eval $change_arch rpmspec-rebuild $rpm_defines --query --queryformat "%{ARCH}" ${FIC_SPEC})
|
|
+ fi
|
|
if [ "$arch" = "(none)" ]
|
|
then
|
|
Debug ' workaround for rpm 3.x'
|
|
--
|
|
2.33.0
|
|
|