netthing
netthing

Reputation: 47

Build rpm with scripts, spec %prep error, build failed

I am trying to build the rpm that has two scripts, installed to /usr/libexec. This is my spec that has build errors.

Name: test-scripts
Version: 1.0.0
Summary: two test scripts
Release: 1%{?dist}
License: MyCompany
Group: Applications/System
Source0: script1.py
Source1: script2.py
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
#BuildRequires:
#Requires:

%description
RPM description goes here
Git: %{git_sha1} (%{git_describe})

%prep
%setup -q

%build
rm -rf %{buildroot}

%install
mkdir -p -m 0755 %{buildroot}%{_bindir}
install -p -m 0755 script1.py %{buildroot}%{_exec_prefix}
install -p -m 0755 script2.py %{buildroot}%{_exec_prefix}

%files
%defattr(-, root, root, -)
%{_exec_prefix}/libexec/script1.py
%{_exec_prefix}/libexec/script2.py

What did I do wrong on this spec? This is the error I got.

$ mkrpm localbuild
#=> Cleaning build directory
#=> Prepping source
#=> Locally building RPMs
/usr/bin/tar: This does not look like a tar archive
/usr/bin/tar: Skipping to next header
/usr/bin/tar: Exiting with failure status due to previous errors
error: Bad exit status from /var/tmp/rpm-tmp.6F01UM (%prep)
    Bad exit status from /var/tmp/rpm-tmp.6F01UM (%prep)
make: *** [localbuild] Error 1

Upvotes: 0

Views: 691

Answers (1)

Aaron D. Marasco
Aaron D. Marasco

Reputation: 6748

Don't use the %setup macro at all. Get it out (don't try to comment it out). Your %prep phase should just be empty since it's only copying the two python scripts.

%setup tells it to do a bunch of stuff like untar, cd, etc. None of these apply here.

Upvotes: 2

Related Questions