Subversion Repositories SvarDOS

Rev

Rev 884 | Blame | Compare with Previous | Last modification | View Log | RSS feed



                             BUILD SERVER SETUP



=== INTRO =====================================================================

The SvarDOS build system is entirely stored in the project's svn repository.
This includes many components:

 - SvarDOS-specific tools (install, pkg, pkgnet, localcfg, svarcom, help, ...)
 - SvarDOS packages
 - SvarDOS website
 - build scripts and tools

This means that the project's svn tree contains everything that is required
to build SvarDOS.


=== SVN SERVICE ===============================================================

The server must have a subversion service installed with the SvarDOS repository
imported.

The only specific configuration concerns a post-commit hook that creates a flag
file at /tmp/svados_repo_changed.flag whenever a commit is made to the repo and
another flag in /tmp/svardos_rebuilt_please.flag if the commit might impact the
content of installation images. Here below is the necessary post-commit hook,
it should be placed in the hooks/ directory of the svn server and made
executable (chmod +x):

#!/bin/sh

SVNLOOK=/usr/bin/svnlook
REPOS="$1"
REV="$2"

# first of all, make sure to set a flag that says "svn content changed" so a
# cron job can update its local copy later
echo `date` > /tmp/svardos_repo_changed.flag

# check if any of the following locations have been updated during the commit:
#  - files
#  - packages/core/
#  - build.sh
#
# any change to one of these locations means that the content of the
# installation images may have been impacted, hence a rebuild may be necessary.
#
$SVNLOOK changed -r "$REV" "$REPOS" | grep -e ' files' -e ' build.sh' -e ' packages/core/' > /dev/null

# if a location matched, then set a flag so a cron job rebuilds the images
# and send an information message back to the committer.
if [ $? -eq 0 ] ; then
  echo `date` > /tmp/svardos_rebuild_please.flag
  echo "" >&2
  echo "---------------------------------------------------------" >&2
  echo "NOTICE: a build-impacting location has been updated." >&2
  echo "        install images have been scheduled for a rebuild." >&2
  echo "---------------------------------------------------------" >&2
  exit 1
fi

exit 0


=== SVN CLIENT ================================================================

The SvarDOS repository should be checked out in /srv/svardos/:

$ svn co svn://127.0.0.1/svardos /srv/svardos


=== WEB SERVICE ===============================================================

A web server with PHP must be running (typically Apache). The PHP installation
needs the php-zip extension (required by buildidx), and the Apache web root
should point at /srv/svardos/website.


=== CRON ACTIONS ==============================================================

A cron job should be configured to run frequently (like every minute) and
execute the /srv/svardos/cron.sh script. This script is responsible for
checking out the local svardos repo whenever a new commit is being made, and
rebuilds the index of the packages repository, and potentially (re)builds the
installation floppy images as well. To do so, it requires a few dependencies to
be present on the server:
 - zip
 - unzip
 - mtools (mformat, mcopy, etc)
 - unix2dos (usually part of a dos2unix package)
 - mkisofs or genisoimage


=== MIRRORING THE PROJECT'S SVN ===============================================

Mirroring the project's svn tree (containing all build scripts, packages, etc)
is the best way to make a backup copy of the entire SvarDOS build system along
with all its history. To achieve such mirror, one needs to create an empty
svn repository:

$ svnadmin create /srv/svardos-mirror

Then make this repository accept modifications of revision properties, you need
to create a hook. This is mandatory so it can import historical data:

$ echo '#!/bin/sh' > /srv/svardos-mirror/hooks/pre-revprop-change
$ echo 'exit 0' >> /srv/svardos-mirror/hooks/pre-revprop-change
$ chmod +x /srv/svardos-mirror/hooks/pre-revprop-change

Now initialize your empty repository so it knows it is a SvarDOS mirror:

$ svnsync init file:///srv/svardos-mirror svn://svn.svardos.org/svardos

Finally, populate your mirror using svnsync. This operation has to be performed
periodically to keep your mirror up to date:

$ svnsync sync file:///srv/svardos-mirror

The same procedure can be used to migrate the SvarDOS build system from one
server to another.

NOTE: Such mirror server must not be used to send commits to! The only process
      that should write to it is svnsync.


======================================================================= EOF ===