Re: portable build environment?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



William Francis wrote:

What is the best way to build at portable RPM build environment? The problem I'm trying to solve is that we have our build trees checked into something CVS-like, and people are able to check out branches at arbitrary places on their filesystem. I'd like to make a wrapper for rpmbuild that will make it possible to build RPMS and check them (and their source) back into the content control system.


From reading the docs, it seems like the best thing to do is have the wrapper script figure out where the top of the tree is and find a copy of rpmrc. The problem then seems to be that rpmrc needs to point to the macrofile, which will then set %_topdir, which is what I believe needs to be set to the root of my RPM build tree.

I realize that it's possible to generate these files on the fly, but that seems awkward and it's likely somone has solved this problem in a more graceful way.

Any pointers are appreciated.

Will

Here is what I use for just that purpose:

zrpmbuild script
----------------------- 8< --------------------------
#!/bin/sh
# zrpmbuild -- build RPMs in local tree
#
# Note that we generate 'rpmrc' and 'rmpmacros' from templates
# if they don't already exist.
#
scriptdir=`dirname $0`
base=`cd $scriptdir; pwd`

if [ ! -f $base/rpmrc ]; then
    sed -e "s;<<BASE>>;$base;" < $base/rpmrc.in > $base/rpmrc
fi

if [ ! -f $base/rpmmacros ]; then
    sed -e "s;<<BASE>>;$base;" < $base/rpmmacros.in > $base/rpmmacros
fi

rpmbuild \
    --rcfile=$base/rpmrc \
    --macros=$base/rpmmacros $*
----------------------- 8< --------------------------

rpmrc.in
----------------------- 8< --------------------------
include: /usr/lib/rpm/rpmrc
macrofiles: /usr/lib/rpm/macros:/usr/lib/rpm/%{_target}/macros:/etc/rpm/macros.specspo:/etc/rpm/macros:/etc/rpm/%{_target}/macros:<<BASE>>/rpmmacros
----------------------- 8< --------------------------


rpmmacros.in
----------------------- 8< --------------------------
%_topdir        <<BASE>>
%_sourcedir     %{_topdir}/%{name}
%_specdir       %{_sourcedir}
%_tmppath       %{_topdir}/tmp
%_builddir      %{_topdir}/BUILD
%_buildroot     %{_tmppath}/%{name}-root
%_rpmdir        %{_topdir}/RPMS
%_srcrpmdir     %{_topdir}/SRPMS
%_rpmfilename   %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%packager       Tres Seaver <tseaver@xxxxxxxx>
%distribution   Zope Corp. Custom
----------------------- 8< --------------------------

Notes

 - I prefer to keep each specfile in a package-specific directory with
   its tarball;  you may prefer something else.

 - I have these three files in CVS, along with "empty" BUILD, tmp, RPMS,
   and SRPMS directories, so I can check the whole thing out on any
   machine (and in any directory) and be ready to go.

Tres.
--
===============================================================
Tres Seaver                                tseaver@xxxxxxxx
Zope Corporation      "Zope Dealers"       http://www.zope.com


_______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux