Discussion:
%{buildroot} vs $RPM_BUILD_ROOT
Konstantin Riabitsev
2002-07-16 02:18:21 UTC
Permalink
Hello:

Just a quick question -- I'm wondering which is considered "more
proper": %{buildroot} or $RPM_BUILD_ROOT? I tend to use %{buildroot} as
it is shorter and more consistent with the rest of the spec file, but
I'd like an official opinion. :)

Regards,
--
0> Konstantin ("Icon") Riabitsev
/ ) Duke University Physics Sysadmin
~ www.phy.duke.edu/~icon/pubkey.asc
Matthias Saou
2002-07-16 08:53:28 UTC
Permalink
Post by Konstantin Riabitsev
Just a quick question -- I'm wondering which is considered "more
proper": %{buildroot} or $RPM_BUILD_ROOT? I tend to use %{buildroot} as
it is shorter and more consistent with the rest of the spec file, but
I'd like an official opinion. :)
Sorry, but just an unofficial opinion here : I also tend to use
%{buildroot}, and also %{optflags} etc. instead of their $RPM_* equivalents
mostly since I find it more readable, a bit shorter, and that Red Hat guys
seemed to be doing the same too.

Matthias
--
Clean custom Red Hat Linux rpm packages : http://freshrpms.net/
Red Hat Linux release 7.3 (Valhalla) running Linux kernel 2.4.18-5
Load : 0.13 0.16 0.10, AC on-line, battery charging: 100% (9:07)
Jeff Johnson
2002-07-16 13:58:59 UTC
Permalink
Post by Konstantin Riabitsev
Just a quick question -- I'm wondering which is considered "more
proper": %{buildroot} or $RPM_BUILD_ROOT? I tend to use %{buildroot} as
it is shorter and more consistent with the rest of the spec file, but
I'd like an official opinion. :)
$RPM_BUILD_ROOT is the official, supported, mechanism for getting the
value of the configured build root in a build scriptlet.

%{buildroot} may be changed in the future w/o warning. Not that I'm planning
on that, but you've been warned.

Otherwise, the two have identical values and uses, and it really doesn't
matter at all.

73 de Jeff
--
Jeff Johnson ARS N3NPQ
***@redhat.com (***@jbj.org)
Chapel Hill, NC
Rob Nagler
2002-07-16 19:05:36 UTC
Permalink
Post by Jeff Johnson
Otherwise, the two have identical values and uses, and it really doesn't
matter at all.
Not sure this is correct. Maybe this has been fixed after 4.0.4, but
when I do:

%files -f $RPM_BUILD_ROOT/files.list

I get:

RPM build errors:
Could not open %files file ./$RPM_BUILD_ROOT/files.list: No such file or directory

When I do:

%files -f %{buildroot}/files.list

It works fine.

Rob
Jeff Johnson
2002-07-16 19:48:12 UTC
Permalink
Post by Rob Nagler
Post by Jeff Johnson
Otherwise, the two have identical values and uses, and it really doesn't
matter at all.
Not sure this is correct. Maybe this has been fixed after 4.0.4, but
Yes it is a correct statement ...
Post by Rob Nagler
%files -f $RPM_BUILD_ROOT/files.list
... but this syntax is not officially supported functionality any more
than %{buildroot} is.
Post by Rob Nagler
Could not open %files file ./$RPM_BUILD_ROOT/files.list: No such file or directory
%files -f %{buildroot}/files.list
Yup, %files is not a shell context, but rather a spec file context,
so $RPM_BUILD_ROOT is not defined but %{buildroot} is.

Again, It Really Doesn't Matter.

73 de Jeff
--
Jeff Johnson ARS N3NPQ
***@redhat.com (***@jbj.org)
Chapel Hill, NC
Tomasz Kłoczko
2002-07-16 22:14:16 UTC
Permalink
Post by Rob Nagler
Post by Jeff Johnson
Otherwise, the two have identical values and uses, and it really doesn't
matter at all.
Not sure this is correct. Maybe this has been fixed after 4.0.4, but
%files -f $RPM_BUILD_ROOT/files.list
Could not open %files file ./$RPM_BUILD_ROOT/files.list: No such file or directory
%files -f %{buildroot}/files.list
It works fine.
But in both cases can be splited to simple:

%files -f files.list

because "%files -f" if not path specufied read file by default file
located in build root.

kloczek
--
-----------------------------------------------------------
*Ludzie nie mają problemów, tylko sobie sami je stwarzają*
-----------------------------------------------------------
Tomasz Kłoczko, sys adm @zie.pg.gda.pl|*e-mail: ***@rudy.mif.pg.gda.pl*
Matthias Saou
2002-07-17 09:19:56 UTC
Permalink
Post by Tomasz Kłoczko
%files -f files.list
because "%files -f" if not path specufied read file by default file
located in build root.
Hmmm, aren't you confusing %{builddir} with %{buildroot}? Or maybe I didn't
get enough sleep, I feel my brain going slooooow this morning...

Matthias
--
Clean custom Red Hat Linux rpm packages : http://freshrpms.net/
Red Hat Linux release 7.3 (Valhalla) running Linux kernel 2.4.18-5
Load : 0.04 0.10 0.12, AC off-line, battery status high: 91% (8:22)
James Olin Oden
2002-07-17 14:31:39 UTC
Permalink
Post by Jeff Johnson
Post by Konstantin Riabitsev
Just a quick question -- I'm wondering which is considered "more
proper": %{buildroot} or $RPM_BUILD_ROOT? I tend to use %{buildroot} as
it is shorter and more consistent with the rest of the spec file, but
I'd like an official opinion. :)
$RPM_BUILD_ROOT is the official, supported, mechanism for getting the
value of the configured build root in a build scriptlet.
%{buildroot} may be changed in the future w/o warning. Not that I'm planning
on that, but you've been warned.
Otherwise, the two have identical values and uses, and it really doesn't
matter at all.
Don't the macros get evaluated before the script is ran and the value of
$RPM_BUILD_ROOT is evaluated in the script?

...james

Loading...