Hebron George Hebron George - 3 months ago 13
Linux Question

RPM Build Error: File must begin with "/"

Here is my spec file: http://pastebin.com/MtzxC1kv

When I try to run

rpmbuild -ba myfile.spec
, I get the following errors:

+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: PA_Connector-1.0-1.0
error: File must begin with "/": %{_initddir}/pa_connector
error: File must begin with "/": attr(755,impulse,impulse)
error: File must begin with "/": attr(644,impulse,impulse)
error: File must begin with "/": attr(644,impulse,impulse)
error: File must begin with "/": attr(644,impulse,impulse)
error: File must begin with "/": attr(644,impulse,impulse)
error: File must begin with "/": attr(644,impulse,impulse)
error: File must begin with "/": attr(644,impulse,impulse)
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/PA_Connector-1.0-1.0-root
error: Installed (but unpackaged) file(s) found:
/%{_initddir}/pa_connector
/opt/pa_connector/config.xml
/opt/pa_connector/lib/commons-logging-1.1.1.jar
/opt/pa_connector/lib/log4j-1.2.17.jar
/opt/pa_connector/lib/pa_connector.jar
/opt/pa_connector/log4j.properties
/opt/pa_connector/pa_connector.sh


RPM build errors:
File must begin with "/": %{_initddir}/pa_connector
File must begin with "/": attr(755,impulse,impulse)
File must begin with "/": attr(644,impulse,impulse)
File must begin with "/": attr(644,impulse,impulse)
File must begin with "/": attr(644,impulse,impulse)
File must begin with "/": attr(644,impulse,impulse)
File must begin with "/": attr(644,impulse,impulse)
File must begin with "/": attr(644,impulse,impulse)
Installed (but unpackaged) file(s) found:
/%{_initddir}/pa_connector
/opt/pa_connector/config.xml
/opt/pa_connector/lib/commons-logging-1.1.1.jar
/opt/pa_connector/lib/log4j-1.2.17.jar
/opt/pa_connector/lib/pa_connector.jar
/opt/pa_connector/log4j.properties
/opt/pa_connector/pa_connector.sh


I've read a few posts on SO about correct what BuildRoot should be, and fixed it, but it still doesn't work.

Answer

It looks like _initddir is not defined, or it would be expanded out in the final filename, and you seem to have a file named "/%{_initddir}/pa_connector" .

Also, you need a % in front of attr to use the %attr macro.

Comments