1

I installed rpmlint and rpmdevtools. I used rpmdevtools to create a template of a .spec file. I modified the spec file so it will install cfengine. I ran rpmlint on the spec file, and I saw no warnings or errors. I then tried to run the specfile for real, but it failed. Here is the command I ran:

$ rpmbuild -ba newpackage.spec

Here is what I saw:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.wNGgcV
+ umask 022
+ cd /home/ec2-user//BUILD
+ cd /home/ec2-user/BUILD
+ rm -rf Propulsion-1
+ /usr/bin/tar -xf -
+ /usr/bin/gzip -dc /home/ec2-user/SOURCES/cfengine-3.6.5.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Propulsion-1
/var/tmp/rpm-tmp.wNGgcV: line 35: cd: Propulsion-1: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.wNGgcV (%prep)


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

The file above on line 35 has this:

cd 'Propulsion-1'

The "Propulsion" name comes from the .spec file. Evidently, the single quotes, hyphen and 1 come from the rpm-build command processing.

What should I do to not have an RPM build error? I want my spec file to work for the installation of cfengine.

Here is the spec file:

Name:  Propulsion
Version: 1
Release:        1%{?dist}
Summary:  First time

License:        GNU
#URL:
Source0: http://s3.amazonaws.com/cfengine.package-repos/tarballs/cfengine-3.6.5.tar.gz

BuildRequires: gettext
# Requires:

%description
This is a test.

%prep
%setup -q


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
%make_install


%files
%doc


%changelog
Propulsion
  • 148
  • 2
  • 9

1 Answers1

2

This error is happening because %setup is actually a macro that when expanded, will try to un-tar your source and cd into the source directory.

If the source directory in the tarball differs from the name of the package, you need to set -n, like this:

%setup -n cfengine-3.6.5

In your case, this should work, because when you extract cfengine-3.6.5.tar.gz you get a directory named cfengine-3.6.5 -- and rpmbuild is expecting Propulsion-1 based on your package name and version.

You can read more about the setup macro here and here.

Joe Damato
  • 180
  • 4
  • This definitely helped me progress. I'm going to mark it as the answer because this question is getting long. Michael said that there was a lot to learn. I agree. – Propulsion Jun 07 '15 at 19:32