RPM Community Forums

Mailing List Message of <rpm-users>

Re: How do I set the _topdir ?

From: Jeff Johnson <n3npq@mac.com>
Date: Sat 01 Jan 2011 - 19:31:40 CET
Message-id: <629B2C3B-6686-43BC-9309-1497C621340C@mac.com>

On Jan 1, 2011, at 1:10 PM, Sriram Narayanan wrote:
> 
> Thanks Jeff, that worked !
> 

Instead of the usual {RPMS,SRPMS,BUILD,SOURCES,SPECS}
hierarchy, you might try building like I do.

I tend to have multiple versions of both rpm and distro
packaging lying around always, and need to flip between
versions/distros at a dead-run.

So I work in tree's like /X, /Y, /Z.

I have private configuration as (say) /X/macros:
================================================
%_topdir        /X
%_ntopdir       %{_topdir}/%{name}
%_builddir      %{_ntopdir}
%_sourcedir     %{_ntopdir}
%_specdir       %{_ntopdir}
%_rpmdir        %{_ntopdir}
%_srcrpmdir     %{_ntopdir}
%_rpmfilename   %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm

%_tmppath       %{_topdir}/tmp
================================================

I have a wrapper in ~/bin/xxxrpm to reconfigure:
================================================
#!/bin/sh

macros="/usr/lib/rpm/macros:/usr/lib/rpm/%{_target}/macros:/etc/rpm/macros.specspo:/etc/rpm/macros.sqlite:/etc/rpm/macros.cdb:/etc/rpm/macros:/etc/rpm/%{_target}/macros:~/.rpmmacros:/X/macros"

case $1 in
-b*)    rpm=/usr/bin/rpmbuild;;
*)      rpm=/usr/bin/rpm;;
esac

exec $vg $rpm --macros ${macros} $*
================================================

When I need to use a different version of rpm, or
add valgrind/time/strace/whatever, I edit the ~/bin/xxxrpm wrapper.
Similarly if/when I need to adjust to different macros to
be loaded, I edit the macros path.

In each tree, packages are installed/built into /X/%{name}.

So my packaging workflow goes something like:

	xxxrpm -i foo*.src.rpm
	cd /X/foo
	xxxrpm -ba foo.spec
	rpm -Uvh *.i386.rpm
	cd ..
	rm -rf foo

I find having everything in one directory far more
convenient than having to chdir all over the place
just to build a package.

(aside)
FYI: I'm very likely to change to the above as default
hierarchy in rpm-5.4.x, largely because @rpm.org changes with
~/rpmbuild/* already have changed RPM's default behavior,
and I see no reason to maintain consistency with, say,
RPM documentation going "forward". I have in fact been
building as above for years but haven't changed the RPM default
because of a "Principle of Least Surprise" and doco consistency
that simply does not matter any more.

YMMV.

hth

73 de Jeff
Received on Sat Jan 1 19:32:12 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.