Michelle Jun Lee February 2016

rpmbuild error file not found even though files are in the path

i did the following but gotten error when running rpmbuild

Files are there in path

Any help or hint are appreciated

Thanks

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

where 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

and the files structure

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

find . -name \*

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

Answers


Thomas Dickey February 2016

The messages from rpmbuild can be obscure. It is probably complaining

  • not that your filesystem lacks the file,
  • but rather that the corresponding pathname does not exist under the BUILDROOT directory.

It normally expects that your spec-file will construct a set of files and directories under ~/rpmbuild/BUILDROOT which it will collect into a package. You can override the location of the BUILDROOT directory (and appear to have done this). But your package expects

/etc/testpackage.conf

and (allowing for the apparent location of the BUILDROOT directory) you have given it

/root/etc/testpackage.conf


msuchy February 2016

Thomas is nearly correct about the origin of the error.

However rpmbuild expect that the file is present in

%{buildroot}/%{_sysconfdir}/testpackage.conf

You should either create it in %install section:

%install
echo some content > %{buildroot}/%{_sysconfdir}/testpackage.conf

or provide as SourceX:

Source1:  testpackage.conf

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

%files
%{_sysconfdir}/testpackage.conf

Post Status

Asked in February 2016
Viewed 3,569 times
Voted 6
Answered 2 times

Search




Leave an answer