Hebron George
Hebron George

Reputation: 349

rpmbuild error in temp file

I'm completely new to RPMs and RPM building.

Here's the error I get:

[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)

I'm not sure how or when that temp file gets created or what it is used for. If someone can clarify that for me also, I would appreciate it!

Here is my spec file:

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

The tarball has the following contents:

[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

Any help would be greatly appreciated!

Upvotes: 1

Views: 2324

Answers (1)

Hebron George
Hebron George

Reputation: 349

I was able to fix it. The reason this error kept coming up was because I had initially created my spec file on a Windows text editor which inserted those carriage return characters. I remade the file on the CentOS box and it works fine now. Hope that helps anyone else who gets this issue!

Upvotes: 3

Related Questions