安装:无法统计`%{sourcedir} / inventory':无此类文件或目录:通过OpenBuildService构建RPM

时间:2018-10-05 00:48:28

标签: rpm packaging specifications opensuse

我正在尝试使用https://build.opensuse.org构建软件包,这是我第一次编译RPM,因此我对白话不是很熟悉,因此专门搜索我在Google上需要做的事情有点麻烦为了我。

我有一个小项目,其中有一个python脚本和一个从/usr/bin初始化所述python脚本的shell脚本。

我的文件结构如下:

.
├── inventory
├── Inventory.py
├── inventory.spec
└── inventory.tar.xz

0 directories, 4 files

inventory是可执行脚本,Inventory.pyinventory运行的文件。我的spec文件与其他两个文件位于同一目录,因为我认为这会有所帮助。

我的规格文件如下:

#
# Spec file for the Inventory Script to be run for the lab
#
Summary: A script that will keep the inventory for the lab up-to-date
Name: inventory
Version: 1.0
Release: 1
License: ---
Group: Unspecified
Source: inventory.tar.xz
Requires: dmidecode, util-linux, ethtool, usbutils, gptfdisk, numactl

%description
This is a simple script that returns certain system values from host machine
as to more easily maintain the inventory in the lab.


%install
mkdir -p %{buildroot}%{_bindir}
install -m 755 inventory %{buildroot}%{_bindir}/inventory
mkdir -p %{_datadir}/inventory
install -m 755 Inventory.py %{_datadir}/inventory/Inventory.py

%files
%{_bindir}/inventory
%{_datadir}/inventory/Inventory.py

在obs的多个平台上运行此命令后,我在每个日志中都收到此错误:

[  111s] -----------------------------------------------------------------
[  111s] ----- building inventory.spec (user abuild)
[  111s] -----------------------------------------------------------------
[  111s] -----------------------------------------------------------------
[  112s] + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --define 'disturl obs://build.opensuse.org/home:christopolise/SLE_11_SP4/a8f22f7f4c3b917b370ac5079138d983-inventory' /usr/src/packages/SOURCES/inventory.spec
[  112s] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.6528
[  112s] + umask 022
[  112s] + cd /usr/src/packages/BUILD
[  112s] + mkdir -p '%{buildroot}/usr/bin'
[  112s] + install -m 755 '%{sourcedir}/inventory' '%{buildroot}/usr/bin/inventory'
[  112s] install: cannot stat `%{sourcedir}/inventory': No such file or directory
[  112s] error: Bad exit status from /var/tmp/rpm-tmp.6528 (%install)
[  112s] 
[  112s] 
[  112s] RPM build errors:
[  112s]     Bad exit status from /var/tmp/rpm-tmp.6528 (%install)
[  112s] 
[  112s] cloud115 failed "build inventory.spec" at Thu Oct  4 23:02:44 UTC 2018.
[  112s] 
[  112s] ### VM INTERACTION START ###
[  117s] [   91.042376] reboot: Power down
[  117s] [   91.042376] reboot: Power down
[  128s] ### VM INTERACTION END ###
[  128s] 
[  128s] cloud115 failed "build inventory.spec" at Thu Oct  4 23:03:01 UTC 2018.
[  128s] 
[  128s] ### VM INTERACTION END ###
[  128s] 
[  128s] cloud115 failed "build inventory.spec" at Thu Oct  4 23:03:01 UTC 2018.
[  128s] 

我不知道为什么找不到源文件。有人有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您需要解压缩Source:指令中提到的tar归档文件。

这通常在%prep部分中完成,通常使用%setup。