rpmbuild issues on CentOS - Bad exit status from /home/me/rpmbuild/tmp/rpm-tmp.58942
Asked Answered
O

1

10

I'm trying to create a package that only updates files on the system, but I keep getting errors when rpmbuild is run. The error indicates a file is missing.

I've tried this on CentOS 5 and 6 with the same results.

I used rpmdev-setuptree to setup the file system, which also setup ~/.rpmmacros file. I then used rpmdev-newspec to initialize the spec file.

I am running as a non-root user.

I have the spec file in ~/rpmbuild/SPECS/test.spec and my source is: ~/rpmbuild/SOURCES/test-1.tar.gz . Extracting this file creates a directory named test-1 with 2 files inside of it. I've confirmed that it does get extracted to ~/rpmbuild/BUILD/test-1 when I try to build the package.

I run: rpmbuild -ba ~/rpmbuild/SPECS/test.spec

Then I get this error:

  • ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info /home/me/rpmbuild/tmp/rpm-tmp.58942: line 37: ./configure: No such file or directory error: Bad exit status from /home/me/rpmbuild/tmp/rpm-tmp.58942 (%build)

RPM build errors: Bad exit status from /home/me/rpmbuild/tmp/rpm-tmp.58942 (%build)

Here is my spec file:

Name:           test
Version:        1
Release:        1%{?dist}
Summary:        Test

Group:          Test
License:        GPL
URL:            http://example.com 
Source0:        test-1.tar.gz 
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

#BuildRequires:  
#Requires:       

%description
This is a test to push files.

%prep
%setup -q

%build
#%configure
#make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
#make install DESTDIR=$RPM_BUILD_ROOT
install -m 0755 -d $RPM_BUILD_ROOT/opt/test

%clean
rm -rf $RPM_BUILD_ROOT

%files
%dir /opt/test
%defattr(-,root,root,-)
%doc

Any ideas on what I might be doing wrong?

Observable answered 28/12, 2012 at 0:1 Comment(0)
C
9

Looks like the default GNU "./configure" script isn't there, so you can't use the default %setup macro in the spec file and will need a custom %prep section... (One source) (mirror)

Curate answered 28/12, 2012 at 2:49 Comment(5)
I couldn't figure out how to override the macro to stop it from executing ./configure, but I put an empty config file in the root of the source and it allowed me to complete the build. Thanks for putting me on the right track.Observable
Sorry - I should've looked closer! A well-known PITA "feature" of RPM is that you cannot comment out a macro like you did above. You have to put #%%configure or it only comments out the first line of the macro! (The first % escapes the second one.)Curate
Confirmed I can build the rpm without the configure file now with the additional % in the comment, or by completely removing that line. I was thinking my comment was effectively working. Thanks!Observable
One source link is down, Fedora's wiki has some helpful content but possibly not applicable to your packaging or target environmentAngus
@efx Thanks I added a mirror link too.Curate

© 2022 - 2024 — McMap. All rights reserved.