临时文件中的rpmbuild错误

时间:2013-04-08 13:11:38

标签: linux centos redhat rpm rpmbuild

我对RPM和RPM构建完全陌生。

这是我得到的错误:

[impulse@localhost SPECS]$ rpmbuild -bp pa_connector.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.71097
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ $'\r'
: command not found097: line 27:
error: Bad exit status from /var/tmp/rpm-tmp.71097 (%prep)


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

我不确定如何或何时创建临时文件或用于什么。如果有人能为我澄清这一点,我将不胜感激!

这是我的spec文件:

Summary:  PA_Connector
Name:   PA_Connector
Provides:   PA_Connector
Version:    1.0
Release: 1.0
License: GPLv2+ and LGPLv2+
Group: System Environment/Daemons
URL: http://www.impulse.com/

Source: pa_connector.tar.gz

%define initddir %{?_initddir:%{_initddir}}%{!?_initddir:%{_initrddir}}
%define scriptdir ./script\\\ src
%define installdir $RPM_BUILD_ROOT/opt/pa_connector
%define libdir %{installdir}/lib
%define builddir %{installdir}/build
%define configdir config


#BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

#BuildRequires:  ant

%description
Testing PA building   

%prep
%setup -q -n PA_Connector -c PA_Connector pa_connector

%build
# Right now no build is really taking place, the build.xml file is executed first.
/usr/bin/ant -Djava.io.tmpdir=/tmp/PA_CONNECTOR-CORE-JOB1 -f build.xml jar

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p %{installdir}
install -D -m 755 %{scriptdir}/pa_connector $RPM_BUILD_ROOT/%{initddir}/pa_connector
install -D -m 755 %{scriptdir}/pa_connector.sh %{installdir}/pa_connector.sh
install -D -m 644 %{configdir}/config.xml %{installdir}/config.xml
install -D -m 644 %{configdir}/log4j.properties %{installdir}/log4j.properties
install -D -d lib   %{libdir}
install -D -m 644 pa_connector.jar %{libdir}/pa_connector.jar
install -D -m 644 lib/commons-logging-1.1.1.jar %{libdir}/commons-logging-1.1.1.jar
install -D -m 644 lib/log4j-1.2.17.jar %{libdir}/log4j-1.2.17.jar


%clean
rm -rf $RPM_BUILD_ROOT

# Make sure our user/group is present prior to any package or subpackage installation
%pre
if [ $1 -eq 1 ];then #Install
    getent group  impulse >/dev/null || /usr/sbin/groupadd -r -g 500 impulse > /dev/null 2>&1
    getent passwd impulse >/dev/null || /usr/sbin/useradd  -r -g impulse -u 500 -c "impulse user" -s /sbin/nologin impulse > /dev/null 2>&1
elif [ $1 -eq 2 ];then  #Upgrade
    # Stop the service before upgrading
    /sbin/service pa_connector stop &> /dev/null
fi
exit 0

%files
%defattr(-,root,root)
%{initddir}/pa_connector
%dir %attr(755,impulse,impulse) /opt/pa_connector
attr(755,impulse,impulse) /opt/pa_connector/pa_connector.sh
%dir %attr(755,impulse,impulse) /opt/pa_connector/lib
attr(644,impulse,impulse) /opt/pa_connector/lib/pa_connector.jar
attr(644,impulse,impulse) /opt/pa_connector/lib/commons-logging-1.1.1.jar
attr(644,impulse,impulse) /opt/pa_connector/lib/log4j-1.2.17.jar
attr(644,impulse,impulse) /opt/pa_connector/log4j.properties
attr(644,impulse,impulse) /opt/pa_connector/config.xml

tarball具有以下内容:

[impulse@localhost SPECS]$ tar -tvf ../SOURCES/pa_connector.tar.gz
drwxr-xr-x root/root         0 2013-04-05 16:24:52 pa_connector/
drwxr-xr-x root/root         0 2013-03-29 14:22:33 pa_connector/lib/
-rwxr-xr-x root/root    489883 2013-03-29 14:22:33 pa_connector/lib/log4j-1.2.17.jar
-rwxr-xr-x root/root     60841 2013-03-29 14:22:33 pa_connector/lib/commons-logging-1.1.1.jar
drwxr-xr-x root/root         0 2013-03-29 14:22:33 pa_connector/src/
drwxr-xr-x root/root         0 2013-03-29 14:22:33 pa_connector/src/com/
drwxr-xr-x root/root         0 2013-03-29 14:22:33 pa_connector/src/com/impulse/
drwxr-xr-x root/root         0 2013-03-29 14:22:33 pa_connector/src/com/impulse/connector/
drwxr-xr-x root/root         0 2013-03-29 14:22:34 pa_connector/src/com/impulse/connector/paloalto/
-rw-r--r-- root/root      2389 2013-03-29 14:22:34 pa_connector/src/com/impulse/connector/paloalto/AuthDeltaBroker.java
... etc

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:3)

我能够解决它。这个错误不断出现的原因是因为我最初在Windows文本编辑器上创建了我的spec文件,该文件编辑器插入了那些回车字符。我在CentOS盒子上重新制作文件,现在工作正常。希望能帮助其他人解决这个问题!