20

I'm trying to build an RPM from binaries on a REDHAT 6 system. I have all the files included in the %files section (find /path/to/fake/install -type f >> specfile)

When I run rpmbuild -bb specfile --target x86_64 I get

Checking for unpackaged file(s): /usr/lib/rpm/check-files /path/to/rpmbuild/BUILDROOT/Package-1.0.0-1.el6.x86_64
error: Installed (but unpackaged) file(s) found:

RPM build errors:
    Installed (but unpackaged) file(s) found:

Note that no files are listed in the error message. I'm not sure what's wrong, any ideas?

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
Trevor
  • 1,369
  • 2
  • 13
  • 28

3 Answers3

26

You can ignore these kind of errors by using

%define _unpackaged_files_terminate_build 0

See also

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
Like
  • 1,470
  • 15
  • 21
  • 16
    To people coming here from google: The above answer is dangerous and should be used very carefully. Before resorting to this very carefully look at your %build and %install sections and make sure you've accounted to every file they generate in the %files section – Son of a Sailor Mar 06 '19 at 14:44
  • @SonofaSailor if your properly testing your RPM it shouldn't be an issue, but I agree this should only be used for initial development of the rpm as there is also the %ghost directive which would serve better to ignore (not include) installed files that you don't want in the package. – brookbot Jun 25 '22 at 04:21
13

I would guess your /path/to/fake/install is not correct.

The path in the %files section must be the path where the files will eventually be installed, e.g. /usr/local/bin/myprog. During the rpm build, in the %build section you need to make sure you put the files to the very same place you specify in the %files section, or you use the buildroot option of rpmbuild and use $RPM_BUILD_ROOT variable in your spec file with a sub-path matching the %files list, in this example $RPM_BUILD_ROOT/usr/local/bin/myprog. See http://www.rpm.org/max-rpm-snapshot/ch-rpm-anywhere.html for details.

Bernhard
  • 8,583
  • 4
  • 41
  • 42
  • Please note that I'm generating the RPM from existing binaries (no %build). My %files look something like: /usr/share/foo /opt/foo/bar And my dir structure is: /path/to/rpmbuild/usr/share/foo /path/to/rpmbuild/opt/foo/bar – Trevor Nov 16 '12 at 19:17
  • Doy you set the buildroot option to /pat/to/rpmbuild when running rpmbuild? – Bernhard Nov 19 '12 at 09:26
0

One example where this may happen: Supposing in the %post section there is a %install_info and in the %postun section there is an associated %install_info_delete. This requires in the %install section an explicit removal of the intermediate directory of the info-files with a command like rm -f %{buildroot}/%{_infodir}/dir.

R. J. Mathar
  • 111
  • 2