topdir macro

Jeff Johnson n3npq at mac.com
Sun May 3 17:19:19 CEST 2009


On May 3, 2009, at 6:26 AM, Elan Ruusamäe wrote:

> why not have such default macros:
>
> %_topdir        %{expand:%%global _topdir %(d=$([ -d ../../ 
> packages ] && (cd ../.. && pwd)); d=${d:-$([ -d ../packages ] &&  
> (cd ..; pwd))}; echo ${d:-$HOME/rpm})}%_topdir
> %_specdir       %{_topdir}/packages/%{name}
> %_sourcedir     %{_specdir}
>
> the %{name} seems to work too:
>
> $ /usr/bin/rpmbuild -bp jalbum.spec
> Executing(%prep):  env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/ 
> X11R6/bin:/usr/local/bin:/home/users/glen/bin:/usr/games:/home/users/ 
> glen/okas HOME=/home/users/glen
> TMP=/home/users/glen/tmp TMPDIR=/home/users/glen/tmp  /bin/sh -e / 
> home/users/glen/tmp/rpm-tmp.82586
> + umask 022
> + cd /home/users/glen/rpm/BUILD.i686-linux
>
> actually i'd see topdir = packages/ dir, i.e default ~/rpm/packages
>

The issue is gonna be side effects, like lazy mkdir's, when CWD
is incorrect for some reason. Symlinks to directories can/will
also break "../" lookups.

If you want rpm to handle a remote build tree, or with a VPATH
search, independent of CWD, then it should likely be done
by fundamentally changing the 10 or so expansions where build
paths are instantiated, not with clever and fragile hacks to
%_topdir and CWD.

It wouldn't be hard to add a VPATH hierarchy creating build paths to  
rpm.

73 de Jeff
> -- 
> glen
> _______________________________________________
> pld-devel-en mailing list
> pld-devel-en at lists.pld-linux.org
> http://lists.pld-linux.org/mailman/listinfo/pld-devel-en



More information about the pld-devel-en mailing list