使用脚本构建 rpm,规范 %prep 错误,构建失败

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

我正在尝试构建具有两个脚本的 rpm,安装到 /usr/libexec。这是我的规范,存在构建错误。

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

我在这个规范上做错了什么? 这是我得到的错误。

$ 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

根本不要使用 %setup 宏。把它弄出来(不要试图把它注释掉)。您的 %prep 阶段应该是空的,因为它只复制两个 python 脚本。

%setup 告诉它做一堆事情,比如解压,cd,等等。None 这里适用。