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?

Coder1
  • 13,139
  • 15
  • 59
  • 89

1 Answers1

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)

Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39
  • 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. – Coder1 Dec 28 '12 at 11:21
  • 6
    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.) – Aaron D. Marasco Dec 28 '12 at 15:22
  • 1
    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! – Coder1 Dec 28 '12 at 19:15
  • One source link is down, [Fedora's wiki](https://fedoraproject.org/wiki/How_to_create_an_RPM_package#SPEC_file_sections_explained) has some helpful content but possibly not applicable to your packaging or target environment –  Jun 14 '17 at 20:59
  • @efx Thanks I added a mirror link too. – Aaron D. Marasco Jun 14 '17 at 23:04