Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have a tcl script which 'exec' rpmbuild. When doing so, the 'topdir' used by rpmbuild is wrong. I have a .rpmmacros file in my home directory and if I call manually rpmbuild, it works fine, ie. the 'topdir' is not the default one.
I added a
[exec rpmbuild "--showrc" ]
in the tcl script to check the value of
topdir
and it says '-14: _topdir %{_usrsrc}/redhat' which is the default value.
Can someone explain me why is that situation and how to solve it ?
I would prefer not to have to specify it with --define because it is actually done in a makefile and I don't want to touch it (if no other choice, I will do it).
Per-User: By configuring the RPM topdir in $HOME/.rpmmacros
%_topdir %{getenv:HOME}/rpmbuild
Per-Project: By configuring the RPM topdir in the Makefile or on the command line
rpmbuild --define '_topdir build' -ba package.spec
Note: in both cases, you will need to make sure your topdir directory has the appropriate directories (BUILD, SRPM, RPM, SPECS and SOURCES)
–
–
To see what are the paths being used !
Make this change (my topdir was NOT set to /usr/src/
):
vi /usr/lib/rpm/macros
# Path to top of build area.
#%_topdir %{getenv:HOME}/rpmbuild
%_topdir %{_usrsrc}/redhat
rpm --showrc|grep topdir now shows /usr/src/redhat/ as its BUILD dir
TCL will exec in the current directory by default. You can change the current directory by using the TCL command http://www.tcl.tk/man/tcl8.4/TclCmd/cd.htm cd, for example:
cd ~username
If topdir is an environment variable, you might be able to set it http://www.tcl.tk/man/tcl8.4/TclCmd/tclvars.htm#M4 like this:
set env(topdir) whatever/you/want
My first check would be to make sure you execute the same thing.
Do these two on the command line to make sure aliases or paths
do not disturb anything.
which rpmbuild
echo 'puts [auto_execok rpmbuild]' | tclsh
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.