[packagers] Setting up an rpmforge/rpmrepo dev environment
Tom G. Christensen
tgc at statsbiblioteket.dk
Fri Nov 30 09:24:01 CET 2007
J Robinson wrote:
> Hello, Dag and everyone:
>
> OK I'm going to document my steps to set up an rpmforge dev
> environment. I'm especially interested in what is conventionally done,
> ie, what the directories are called, and what other conventions
> packagers typically follow. My understanding is that I should work with
> rpmforge, which will become rpmrepo later.
>
> This is what I've done so far:
>
> 1) Mirror the rpmforge, FC6 and Centos5 yum repos onto my local
> machines. (I wrote perl scripts that use rsync to do this and can share
> them if there's interest) Then set up the webserver on the mirrror
> machine so that I can access the mirrors via
> http://mirror.mydomainhere.com/[centos|fedora|rpmforge]
>
I'd recommend using mrepo to maintain these types of mirrors.
> 2) fetch the rpmforge spec files (what Dag called the repository) into
> ~/src/rpms_local/rpms by issuing:
> mkdir ~/src/rpms_local/; cd ~/src/rpms_local; svn co
> http://svn.rpmforge.net/svn/trunk/rpms/
>
> 3) Make a mock configuration file for my target system. I did this by:
> 3A) in /etc/mock, copying centos-5-x86_64.cfg to
> centos-5-x86_64-rpmforge.cfg
> 3B) making default.cfg a symlink to centos-5-x86_64-rpmforge.cfg
> 3C) adding the following lines to centos-5-x86_64-rpmforge.cfg:
>
> [rpmforge]
> name=rpmforge
> baseurl=http://freshrpms.mirrors.lug.ro/freshrpms/dag/redhat/el5/en/x86_64/dag
>
> I also changed the baseurls for [os] and [updates] to use my local yum
> repos mirror (from step 1).
>
If you mirrored rpmforge, why not use your local mirror?
> 4) This is where I get stuck.
>
> Now, suppose I wanted to build RPMs for swish-e, which does provide a
> .spec file? I know I need to start with either the swish-e tarball and
> the right spec file, or an existing swish-e .src.rpm. In this case I
> have a tarball and the .spec file it contains. But here are my questions:
>
> a) Where should I place the tarball to make the .src.rpm from? Where
> should I place the .spec file?
>
Whereever you like. I keep it under git control since I use git(-svn) to
manage my local checkout of rpmforge.
> b) Also, I want to alter the .spec file to add large file support to
> swish-e (which means I need to add "-D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64" to the build, which I know how to do using
> swish-e's configure script, but not via the spec file. Tips?
>
If you need to modify the configure script then create patches and apply
them in the %prep section.
You should also run any aclocal/automake/autoconf etc. commands needed
in %prep.
> c) Then it seems like I'm supposed to make a .src.rpm file and pass it
> to mock to rebuild. From other posts, it seems like I should keep the
> .spec file in my source code tree (IE cvs or svn), and have the tarball
> somewhere else, and create a temporary .src.rpm with rpmbuild to pass to
> mock. Can someone provide guidance here? I'll summarize and repost the
> results if there's interest.
>
I normally keep the tarball in the same directory as the specfile.
It keeps things together and makes it easy to create a src.rpm.
I use this script to create a src.rpm in this setup:
--------
#!/bin/sh
#
# Build a src.rpm ready for the buildsystem
#
# Set topdir to be where the spec file is
TOPDIR=$(dirname $(readlink -f $1))
# Put src.rpms here
SRPMDIR=/tmp/srpms-${USER:-unknown}
mkdir -p $SRPMDIR
rpmbuild -bs --nodeps --define "_topdir $TOPDIR" \
--define "_rpmtopdir %{_topdir}" --define "_srcrpmdir $SRPMDIR" $1
------------
.rpmmacros has further settings like %packager, %vendor etc.
I'm not sure it's possible to build an rpmforge package in a mock setup
without modifying the specfile.
Some will work but those that have short style distro conditions like
%{?el3:blah blah} will not do the right thing. The src.rpm needs to be
built with rpmbuild --define 'dtag el3' for those to work.
(%{?dtag: %{expand: %%define %dtag 1}} then does the magic).
RPMforge specfiles also lack a disttag by default since this is added by
a script that modifies the specfile at buildtime in Dags buildsystem.
My current solution is a set of macros that run inside the mock
buildroot and defines the correct settings on the fly depending on what
dist is being built for.
For disttagging I keep a seperate branch with %{?dist} added to the
Release field in the specfile. My macros then also defines %{dist}.
Dag, if you're listening I'd strongly prefer rpmforge/rpmrepo to include
%{?dist} in the specfiles directly :)
I'd also prefer that you only used %dtag to create a disttag ie. now you
have (from mplayer.spec):
%{?dtag: %{expand: %%define %dtag 1}}
%{?fedora: %{expand: %%define fc%{fedora} 1}}
I'd prefer that you just used %dtag to expand to fcX/fX as appropriate
aswell as elX instead of what seems to be an extra unecessary step.
Most of all though, I'd prefer documentation on how to setup an
rpmforge/rpmrepo compatible buildsystem in just a few easy steps :)
-tgc
More information about the packagers
mailing list