On Feb 1, 2008, at 7:22 AM, Stefan Westmeier wrote:
> Hi,
>
> I would like to use rpm in the following scenario and I guess I
> need some hints
> how to do with rpm / rpm 5:
>
> I fetch the sources I want to package not from a tar file but from
> a repository and
> have build them already with my normal build system I use for
> development in my
> workarea.
>
> So I would like to prevent the standard %prep and %build steps and
> start right away
> with the install and packaging steps in my workarea.
>
> Important side condition: I might have more than one instance of a
> project checked out
> in several work areas.
>
> So my first attempt was to set %_topdir so that I can have several
> workareas in parallel
> containing local rpm administrative directories ( RPMS,
> SRCS, ... ). So far I did set the macro
> in my ~/.rpmmacros file. Unfortuanetly this does not work properly,
> as I have to set a different
> _topdir for each of my workarea instances. And I want to build in
> parallel.
>
> Now my questions:
>
> 1. can I pass macros somehow to rpmbuild on the commandline ?
> I need to use a different set of macros for each of my workareas.
>
Yes, there is a --define option. However encapsulating settings per-
workarea
is likely to easier than adding gazillions of CLI options.
>
> 2. how can I direct rpm to look for files to pick up in the install
> step in my workarea ?
> I guess setting %_builddir might work?
>
I'm not sure what "files to pick up means" and so can't answer
specifically.
>
> 3. Any other hints how to do "Packaging that can build anywhere"?
> Current hints I got from MAX-RPM.
>
I have multiple work areas and multiple versions of rpm installed all
the time.
I usually uses capital letters for work areas: /X /Y /Z.
I encapsulate the work area specific configuration in, say, /X/macros.
Here's an configuration for work-area /X
%_topdir /X
%_legion %{expand:%%global ._legion %{name}}%{_legion}
%_ntopdir %{_topdir}/%{_legion}
%_builddir %{_ntopdir}
%_sourcedir %{_ntopdir}
%_specdir %{_ntopdir}
%_rpmdir %{_ntopdir}
%_srcrpmdir %{_ntopdir}
%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%_tmppath %{_topdir}/tmp
In order to relieve the tedium of adding --macros options, I have small
shell wrappers in ~/bin that configure work-area specific config.
Here is the wrapper for /X (from ~/bin/xrpm):
#!/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
-t*|-b*) rpm=/usr/bin/rpmbuild;;
*) rpm=/usr/bin/rpm;;
esac
exec $rpm --macros ${macros} $*
And my work-flow to build a package "foo" looks something like
xrpm -i foo*.src.rpm
cd /X/foo
xrpm -ba foo.spec
rpm -Uvh foo*6.rpm
cd ..
rm -rf foo
hth
73 de Jeff
Received on Fri Feb 1 13:56:09 2008