fix failure to recompile with rpmrebuild and file conflicts between rpmrebuild and rpm-build
This commit is contained in:
parent
a992c10f57
commit
dbd36e98b9
50
Add-macros-_binaries_in_noarch_packages_terminate_bu.patch
Normal file
50
Add-macros-_binaries_in_noarch_packages_terminate_bu.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From b1ef9afb58b2a2ba2224d777a57ffbf0666eff3f Mon Sep 17 00:00:00 2001
|
||||
From: lirui <lirui130@huawei.com>
|
||||
Date: Thu, 28 Jan 2021 10:09:57 +0800
|
||||
Subject: [PATCH] Add macros _binaries_in_noarch_packages_terminate_build and
|
||||
_build_id_links
|
||||
|
||||
Some noarch packages use macro _binaries_in_noarch_packages_terminate_build to
|
||||
package binary files. But when rpmrebuild can't read macro
|
||||
_binaries_in_noarch_packages_terminate_build, it causes a problem, so add macro
|
||||
_binaries_in_noarch_packages_terminate_build to the noarch package.
|
||||
|
||||
On the compilation environment, the macro _build_id_links is compat,and the
|
||||
compiled package does not contain build-id. But during rpmrebuild, build-id
|
||||
will be generated, but the buildroot directory is read-only, causing failure,
|
||||
so set macro _build_id_links to none
|
||||
---
|
||||
rpmrebuild.sh | 17 +++++++++++++----
|
||||
1 file changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/rpmrebuild.sh b/rpmrebuild.sh
|
||||
index df48362..545b348 100755
|
||||
--- a/rpmrebuild.sh
|
||||
+++ b/rpmrebuild.sh
|
||||
@@ -226,10 +226,19 @@ function RpmBuild
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
- eval "$change_arch" $BUILDCMD --define "'buildroot $BUILDROOT'" "$RPMREBUILD_rpm_defines" -bb "$RPMREBUILD_rpm_verbose" "$RPMREBUILD_additional" "${FIC_SPEC}" || {
|
||||
- Error "(RpmBuild) package '${RPMREBUILD_PAQUET}' $BuildFailed"
|
||||
- return 1
|
||||
- }
|
||||
+
|
||||
+ # Add macros %_binaries_in_noarch_packages_terminate_build to the noarch architecture
|
||||
+ if [ "$pac_arch" = "noarch" ]; then
|
||||
+ eval "$change_arch" $BUILDCMD --define "'buildroot $BUILDROOT'" --define "'_build_id_links none'" --define "'%_binaries_in_noarch_packages_terminate_build 0'" "$RPMREBUILD_rpm_defines" -bb "$RPMREBUILD_rpm_verbose" "$RPMREBUILD_additional" "${FIC_SPEC}" || {
|
||||
+ Error "package '${RPMREBUILD_PAQUET}' $BuildFailed"
|
||||
+ return 1
|
||||
+ }
|
||||
+ else
|
||||
+ eval "$change_arch" $BUILDCMD --define "'buildroot $BUILDROOT'" --define "'_build_id_links none'" "$RPMREBUILD_rpm_defines" -bb "$RPMREBUILD_rpm_verbose" "$RPMREBUILD_additional" "${FIC_SPEC}" || {
|
||||
+ Error "package '${RPMREBUILD_PAQUET}' $BuildFailed"
|
||||
+ return 1
|
||||
+ }
|
||||
+ fi
|
||||
|
||||
return 0
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: rpmrebuild
|
||||
Version: 2.18
|
||||
Release: 3
|
||||
Release: 4
|
||||
Summary: A tool to build a rpm file from the rpm database
|
||||
License: GPLv2+
|
||||
URL: http://rpmrebuild.sourceforge.net
|
||||
@ -8,9 +8,15 @@ Source0: https://downloads.sourceforge.net/rpmrebuild/%{name}-%{version}.
|
||||
|
||||
Patch6000: backport-Set-the-directory-mode-to-instead-of-omit.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
|
||||
Requires: rpm grep bash cpio textutils rpm-build
|
||||
BuildRequires: rpm-build
|
||||
Requires: grep bash cpio textutils
|
||||
|
||||
%define _binaries_in_noarch_packages_terminate_build 0
|
||||
|
||||
%description
|
||||
%{name} allows to build an rpm file from an installed rpm, or from
|
||||
@ -36,6 +42,8 @@ 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)
|
||||
@ -49,6 +57,8 @@ rm -rf $RPM_BUILD_ROOT%{_mandir}/fr_FR.UTF-8/man1/
|
||||
%{_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)
|
||||
@ -58,6 +68,9 @@ rm -rf $RPM_BUILD_ROOT%{_mandir}/fr_FR.UTF-8/man1/
|
||||
%{_mandir}/fr/man1/*.gz
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
* Mon Feb 13 2023 dongyuzhen <dongyuzhen@h-partners.com> - 2.18-3
|
||||
- backport the patch from upstream
|
||||
|
||||
|
||||
54
use-backups-of-rpmbuild-and-rpmspec-to-avoid-conflicts.patch
Normal file
54
use-backups-of-rpmbuild-and-rpmspec-to-avoid-conflicts.patch
Normal file
@ -0,0 +1,54 @@
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user