Linux RPM规范修补程序失败
我有一个spec文件,在没有补丁的情况下编译得很好:Linux RPM规范修补程序失败,linux,patch,rpmbuild,Linux,Patch,Rpmbuild,我有一个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:
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)
我的源代码目录有test1.patch和*.tar.gz
build@SLES11SP4-185:~/rpmbuild/SOURCES> ls
testSoftware.tar.gz
test1.patch testSoftware-1.0
这是test1.0补丁
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,shell将%
解释为试图引用后台作业控制过程。这是因为%patch
是%build
步骤,并且位于specfile的错误部分(您在%install
中有它)
将它移动到
%build
,您应该会没事。如果我们在%setup-q
之后应用它,它就会工作。
以下是有效的修改过的等级库文件:
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
%patch -p0
%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
%clean
rm -rf $RPM_BUILD_ROOT
仍然是相同的错误,即使我将
%patch
移动到%build
下,或者即使我将%patch-p0
移动到相同的下。这很奇怪。确保上面有空格;我看到RPM有时会将事物误解为描述的一部分。可能将补丁:
字段大写,以防万一(现在抓住救命稻草)?我将补丁0:test1.Patch
大写,并在%build
和%Patch
之间添加了一个空格,仍然是同一问题。在这段时间里,我总是以rpmbuild-bb testSoftware\u patch.spec
(试过%patch
作为%patch
,也没有运气。我补充了我的答案,如果我们把它放在安装部分,而不是构建LOL oops,它就会工作。我说对了一半-%install
不是放它的地方。