Discussion:
Where is %build's cd to build subdir setup come from?
Toralf Lund
2007-06-20 10:23:03 UTC
Permalink
When doing rpm build with a common rpm spec file containing %setup etc,
the "build" execution will start off with something like:

Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.84274
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd mypackage-1.0


- where mypackage-1.0 is typically "root" of the Source0: filename,
although it may also be specified via %setup -n or whatever.

Where exactly does the command "cd mypackage-1.0" come from? I mean, by
what mechanism does "setup" communicate to "build" that it needs to
change to this directory before starting the actual build?

I'm experimenting with a advanced (or possibly unnecessarily complex
;-)) build configuration involving a redefinition of "setup", so I
really need to know how exactly everything is done by default. Or
differently put, if I redefine setup, I always end up loosing the "cd"
command in question....

- Toralf
Frank Cusack
2007-06-20 19:45:35 UTC
Permalink
Post by Toralf Lund
When doing rpm build with a common rpm spec file containing %setup etc,
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.84274
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd mypackage-1.0
- where mypackage-1.0 is typically "root" of the Source0: filename,
although it may also be specified via %setup -n or whatever.
Where exactly does the command "cd mypackage-1.0" come from? I mean, by
what mechanism does "setup" communicate to "build" that it needs to
change to this directory before starting the actual build?
I'm experimenting with a advanced (or possibly unnecessarily complex ;-))
build configuration involving a redefinition of "setup", so I really need
to know how exactly everything is done by default. Or differently put, if
I redefine setup, I always end up loosing the "cd" command in question....
%setup defines %buildsubdir, which triggers the cd, however you can't set
%buildsubdir yourself and have it work. It's a magic (unfortunate) part
of rpm.

Redefining %setup is a bad idea.

-frank

Loading...