I'm working with a very macro-heavy RPM spec file, and when building it's producing an error I can't seem to track down:
File not found: /var/tmp/pkgnamehere/mockbuild/usr/com/pgsql
(I've replaced the full package buildroot path with "pkgnamehere" above, but it's otherwise unedited).
There's no /usr/com/pgsql
anywhere in %files, nor in fact any /com/
at all.
Presumably this is the result of macro expansion. The trouble is ... how does one find out which %files
line corresponds to a given missing file? It doesn't say "File from %files on line 554 not found: " or anything useful like that.
The many of the actual %files
lines look like:
%config(noreplace) %{_initrddir}/%{oname}-%{majorversion}
so a simple text search isn't useful here.
It's possible to rpm --eval
each line, but that's pretty painful with over 300 files lines and the need to define all the input macros.
Tips?
$ rpm --version
RPM version 4.11.2
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-ia32:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-ia32:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-ia32:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 20 (Heisenbug)
Release: 20
Codename: Heisenbug
$ mock --version
1.1.41
Courtesy of this SO answer, rpmspec -P
will expand and print out a spec. However, it hasn't shed any light:
$ rpmspec -P unified-rpm/postgresql94.spec | grep '/com/'
$
in that there seems to be a mystery file here.
Courtesy of this SO answer, rpmspec -P
will expand and print out a spec.
It looked fine on the build machine - then I figured out it was actually an issue within the CentOS 5 mock
sandbox.
There there's no rpmspec
, so it's not easy to tell what's up. However I stumbled over this bug which suggests that it's an issue with RPM on RHEL5. Sure enough, in the sandbox:
<mock-chroot>[root@ayaki BUILD]# rpm --eval '%_sharedstatedir'
/usr/com
to which I say .... what!?
So the immediate issue can be worked around with:
%if 0%{rhel5}
%define _sharedstatedir /var/lib
%endif
or perhaps:
%if "%{_sharedstatedir}" == "/usr/com"
# See https://bugzilla.redhat.com/show_bug.cgi?id=894903
%define _sharedstatedir /var/lib
%endif
... but anyway, the underlying question remains: How do you get RPM to tell you which %files
line corresponds to a missing file?