I have a Python-based SVN pre-commit script that generates an rpmbuild .spec file and runs rpmbuild -bb my.spec via subprocess. The current state is:
1) When doing an SVN commit (SVN over SSH) remotely the rpmbuild fails with...
error: failed to create directory %{_topdir}: /rpmbuild: Permission denied
2) When I rpmbuild -bb my.spec (local on the SVN server) it completes successfully
I have ~/.rpmmacros...
%_topdir /tmp/rpmbuild
When doing #2 (above) rpmbuild will create BUILD, BUILDROOT, RPMS, SOURCES, SPECS, and SRPMS under /tmp/rpmbuild and an RPM is created in RPMS.
From the command line, if I rpm --showrc the dirs are as I expect (and should be which is why the process completes successfully).
But I have different results from the process running via pre-commit...
Command line...
-14: _topdir /tmp/rpmbuild
Pre-commit...
-14: _topdir %{getenv:HOME}/rpmbuild
I suspect this is the problem and I do not know how to correct this. I also tried:
1) To set the path in my.spec... %define _topdir /tmp/rpmbuild which gave the same permission denied error.
2) To set the path in the rpmbuild command... rpmbuild --define='_topdir /tmp/rpmbuild' which resulted in error: Macro % has illegal name (%define).
Your expertise in resolving this appreciated; thanks very much!
The missing piece is the file...
I created
/etc/rpmand the filemacrospopulated with my needed%_topdir.... After doing so_topdiris available torpmbuildand my process completes successfully. This was discovered by runningrpmbuildthroughstrace.