Linux 即使路径中有文件,也找不到rpmbuild错误文件

Linux 即使路径中有文件,也找不到rpmbuild错误文件,linux,build,redhat,rpm,rpmbuild,Linux,Build,Redhat,Rpm,Rpmbuild,我执行了以下操作,但在运行rpmbuild时出错 文件在路径中 任何帮助或暗示都将不胜感激 谢谢 rpmbuild -vv --buildroot $PWD/root --target x86_64 -bb bin-show.spec Building target platforms: x86_64 Building for target x86_64 Processing files: helloworld-1.0-1.x86_64 error: File not found: /nobac

我执行了以下操作,但在运行rpmbuild时出错

文件在路径中

任何帮助或暗示都将不胜感激

谢谢

rpmbuild -vv --buildroot $PWD/root --target x86_64 -bb bin-show.spec
Building target platforms: x86_64
Building for target x86_64
Processing files: helloworld-1.0-1.x86_64
error: File not found: /nobackup/username/prod/packaging/redhat/bin-show/root/etc/testpackage.conf


RPM build errors:
    File not found: /nobackup/username/prod/packaging/redhat/bin-show/root/etc/testpackage.conf
bin-show.spec在哪里

#
# Hello World Spec File
#
Summary: Hello world!
Name: helloworld
Version: 1.0
Release: 1
License: Proprietary
Group: Applications/Utilities

%description
This is my first RPM test package!

%files
/etc/testpackage.conf
以及文件结构

pwd
/nobackup/username/prod/packaging/redhat/bin-show

find . -name \*

./bin-show.spec
./root
./root/etc
./root/etc/testpackage.conf

来自
rpmbuild
的消息可能不清楚。它可能在抱怨

  • 并不是说您的文件系统缺少该文件
  • 而是相应的路径名不存在于
    BUILDROOT
    目录下
它通常期望您的spec文件将在
~/rpmbuild/BUILDROOT
下构建一组文件和目录,并将其收集到一个包中。您可以覆盖
BUILDROOT
目录的位置(看起来已经这样做了)。但你的包裹要求

/etc/testpackage.conf
并且(考虑到
BUILDROOT
目录的明显位置)您已经给出了它

/root/etc/testpackage.conf

来自
rpmbuild
的消息可能不清楚。它可能在抱怨

  • 并不是说您的文件系统缺少该文件
  • 而是相应的路径名不存在于
    BUILDROOT
    目录下
它通常期望您的spec文件将在
~/rpmbuild/BUILDROOT
下构建一组文件和目录,并将其收集到一个包中。您可以覆盖
BUILDROOT
目录的位置(看起来已经这样做了)。但你的包裹要求

/etc/testpackage.conf
并且(考虑到
BUILDROOT
目录的明显位置)您已经给出了它

/root/etc/testpackage.conf

托马斯关于错误的起源几乎是正确的

但是,rpmbuild希望该文件存在于

%{buildroot}/%{_sysconfdir}/testpackage.conf
您应该在
%install
部分中创建它:

%install
echo some content > %{buildroot}/%{_sysconfdir}/testpackage.conf
或作为SourceX提供:

Source1:  testpackage.conf

%install
cp -a %{SOURCE1} %{buildroot}/%{_sysconfdir}/

%files
%{_sysconfdir}/testpackage.conf

托马斯关于错误的起源几乎是正确的

但是,rpmbuild希望该文件存在于

%{buildroot}/%{_sysconfdir}/testpackage.conf
您应该在
%install
部分中创建它:

%install
echo some content > %{buildroot}/%{_sysconfdir}/testpackage.conf
或作为SourceX提供:

Source1:  testpackage.conf

%install
cp -a %{SOURCE1} %{buildroot}/%{_sysconfdir}/

%files
%{_sysconfdir}/testpackage.conf