gpt4 book ai didi

linux - RPM 规范补丁应用程序失败

转载 作者:太空狗 更新时间:2023-10-29 12:42:08 25 4
gpt4 key购买 nike

我有一个 spec 文件,它可以在没有补丁的情况下正常编译:

build@SLES11SP4-185:~/rpmbuild/SPECS> cat testSoftware.spec
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# norootforbuild

Name: testSoftware
Version: 1.0
Release: 2
Summary: Demo - patch
Group: Deployment
License: GPLv2
Url: www.dell.com
#PreReq:
#Provides:
#BuildRequires:
Source: testSoftware.tar.gz
patch0: test1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: on

%description

Authors:
--------
Raj Kumar
%prep
%setup -q

%build

%install
mkdir -p $RPM_BUILD_ROOT/opt/testSoftware

install test1.sh $RPM_BUILD_ROOT/opt/testSoftware
install test2.sh $RPM_BUILD_ROOT/opt/testSoftware

%patch -P 0
%clean
rm -rf $RPM_BUILD_ROOT


%post
%postun

%files
/opt/testSoftware/test1.sh
/opt/testSoftware/test2.sh
%defattr(-,root,root,0755)

我的 SOURCES 目录有 test1.patch 和 *.tar.gz

build@SLES11SP4-185:~/rpmbuild/SOURCES> ls
testSoftware.tar.gz
test1.patch testSoftware-1.0

这是test1.patch

build@SLES11SP4-185:~/rpmbuild/SOURCES> cat test1.patch
--- testSoftware-1.0/test1.sh 2016-08-20 04:49:19.000000000 -0400
+++ test1.sh 2016-08-20 05:33:45.000000000 -0400
@@ -1 +1 @@
-Hello - Test1
+Test1 - Test1 - patch

当我运行规范文件时,它失败了:

build@SLES11SP4-185:~/rpmbuild/SPECS> rpmbuild -bb testSoftware.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.10960
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ cd /home/build/rpmbuild/BUILD
+ rm -rf testSoftware-1.0
+ /usr/bin/gzip -dc /home/build/rpmbuild/SOURCES/testSoftware.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd testSoftware-1.0
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.10960
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ /bin/rm -rf /var/tmp/testSoftware-1.0-build
++ dirname /var/tmp/testSoftware-1.0-build
+ /bin/mkdir -p /var/tmp
+ /bin/mkdir /var/tmp/testSoftware-1.0-build
+ cd testSoftware-1.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.10960
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ cd testSoftware-1.0
+ mkdir -p /var/tmp/testSoftware-1.0-build/opt/testSoftware
+ install test1.sh /var/tmp/testSoftware-1.0-build/opt/testSoftware
+ install test2.sh /var/tmp/testSoftware-1.0-build/opt/testSoftware
+ %patch -P 0
/var/tmp/rpm-tmp.10960: line 28: fg: no job control
error: Bad exit status from /var/tmp/rpm-tmp.10960 (%install)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.10960 (%install)

谁能告诉我这是什么问题?

最佳答案

您可以看到它没有识别 %patch 宏并将该文本准确地发送到 shell,后者将 % 解释为试图引用后台作业 -控制过程。这是因为 %patch 是一个 %build 步骤,并且位于规范文件的错误部分(您在 %install 中有它)。

将它移动到 %build,你应该没问题。

关于linux - RPM 规范补丁应用程序失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39052950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com