rpm build error: invalid predicate

时间:2022-05-05 19:11:00

rpm build error

error message:
/usr/lib/rpm/find-debuginfo.sh /usr/src/redhat/BUILD/RPMS
find: invalid predicate `' error: Bad exit status from /var/tmp/rpm-tmp.86590 (%install)

The error appears to be caused by an empty RPM_BUILD_ROOT variable. Below is one offending line:

 find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \
                  \( -perm - -or -perm - -or -perm - \) \
                  -print |

If RPM_BUILD_ROOT hasn't been defined, then the first argument to find is an empty string "", which causes this error. Interestingly enough, if you remove the quotes from around $RPM_BUILD_ROOT, then command works fine since the first argument would become the "!". Since it's not required to define a "BuildRoot:" in the spec file, this certainly looks like a bug to me.

Solutions:
1. Try defining the BuildRoot variable in the spec file.
The find-debuginfo script looks in to that directory several times, and will die without it.
This will usually look something like: BuildRoot: %{_tmpdir}/%{name}-%{version}-%{release}

2. %define debug_package %{nil}

references: http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece76310579135480ddd276b97844b22918448e435061e5a25a4ec66644b598f8461640baa4259ebf62b32755c37b7ed98cf1183ed852859df67742d5c92044f934fa08c0765d620e104b2ff0ee7cbb070ccb9d2a28b0f0f9c44040a97f0fd4d01649c38a05364f4a7e913490b4dadec4072ff2e6028ef621aa14788bb6e2a54dfad8b4b4cb268903647ccfe66f669&p=9a39de16d9c11be54bbd9b7d0c1c81&newp=9970c00497934eac59e7df2d021494231610db2151d4d11f34&user=baidu&fm=sc&query=/usr/lib/rpm/find-debuginfo.sh+invalid+predicate&qid=&p1=2