[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Building RPMs in common chroot environments (was) Re: Cross-building a binary RPM package - is it possible?
- From: Bart Whiteley <bwhiteley novell com>
- To: rpm-list redhat com, Simon J Mudd <sjmudd pobox com>
- Subject: Building RPMs in common chroot environments (was) Re: Cross-building a binary RPM package - is it possible?
- Date: Fri, 5 Sep 2003 12:32:28 -0600
You probably thought I left you hanging so long ago...
I won't share the script. It's got a bunch of hard-coded stuff
anyway that wouldn't work in your environment. I will explain
what it does. You can create your own script just as easily as
you could fix mine.
First, install a box and get it all set up the way you want
your build environment. Install onto a single partition
Then, rsync the whole partition to a directory on an NFS server.
Hint: you'll probably need to be running from a different partition
to do this. Either install on another partition, boot into that, and
mount the partition you want to rsync, or use something like
knoppix. Make sure you are root on both sides of the rsync,
and use rsync -a. Otherwise your device files won't be
properly created.
Now, in the dir containing the rsynced build system on the NFS
server...
mv root RealRoot; ln -s RealRoot/ root
cat << EOS > /etc/rpm/macros
%_topdir /root/rpm
%_tmppath %{_topdir}/tmp
EOS
Now any old linux box running any old distribution
can become a build environment. You'll need a script
that does the following:
- Create some temporary work dir like TDIR=/var/tmp/chrootBuild.<pid>
- mkdir -p $TDIR/.mounts/{local,nfs}
- Obtain a directory from the user, or use some default. This is where
the sources will live and where the building will be done. Let's call
it WDIR
- mkdir -p $WDIR/rpm/{BUILD,RPMS,SPECS,SOURCES,SRPMS,tmp}
- mount -o ro <nfs server>:<path to rsynced build env> $TDIR/.mounts/nfs
- mount <local partition contianing $WDIR> $TDIR/.mounts/local
parse the output of 'df $WDIR' to get the partition
- cd $TDIR
- ln -s .mounts/nfs/* .
- rm root tmp proc
- mkdir tmp proc
- mount -t proc proc proc
- Now you need to make root a symlink to the work area.
This is the part that's just a little tricky. You need to chop
the mount point off of $WDIR. For instance, if $WDIR is /root/code,
and /root is on it's own partition, you need to isolate "code" so you
can do 'ln -s .mounts/local/code/ root'
- now just 'chroot $TDIR'
- once the chrooted shell exits, clean up (unmount stuff in $TDIR/.mounts, etc.)
All of the filesystem is read-only except for /root and /tmp. What
was previously $WDIR is now in /root. The RPM topdir is
/root/rpm. This way many engineers can share the same build
environment. They can't hurt the build environment. They
use their own CPU cycles and disks instead of sharing one
machine. They can use their favorite distro (I prefer debian)
on their workstations instead of needing to run the distro
that they are building for.
I hope somebody finds this as useful as I have. I'd be happy to
answer any questions about it (this time in a more timely manner).
On Monday 28 July 2003 11:40 am, Simon J Mudd wrote:
> bwhiteley@novell.com ("Bart Whiteley") writes:
> > Yes. I have a script that sets up the mount points, creates
> > the symlinks, and chroots into the new virtual environment. It
> > also takes as an argument a command to execute one it is
> > chrooted into the new environment. This way you could launch
> > a build from cron or whatever.
>
> Would you mind sharing this script with us please?
>
> Thanks.
>
> Simon
>
>
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@redhat.com
> https://www.redhat.com/mailman/listinfo/rpm-list
--
Bart Whiteley <bwhiteley@novell.com>
Novell, Inc., the leading provider of information solutions
http://www.novell.com/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]