636 |
mateusz.vi |
1 |
|
|
|
2 |
|
|
|
3 |
BUILD SERVER SETUP
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
=== INTRO =====================================================================
|
|
|
8 |
|
|
|
9 |
The SvarDOS build system is entirely stored in the project's svn repository.
|
|
|
10 |
This includes many components:
|
|
|
11 |
|
|
|
12 |
- SvarDOS-specific tools (install, pkg, pkgnet, localcfg, svarcom, help, ...)
|
|
|
13 |
- SvarDOS packages
|
|
|
14 |
- SvarDOS website
|
|
|
15 |
- build scripts and tools
|
|
|
16 |
|
|
|
17 |
This means that the project's svn tree contains everything that is required
|
|
|
18 |
to build SvarDOS.
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
=== SVN SERVICE ===============================================================
|
|
|
22 |
|
|
|
23 |
The server must have a subversion service installed with the SvarDOS repository
|
|
|
24 |
imported.
|
|
|
25 |
|
837 |
mateusz.vi |
26 |
The only specific configuration concerns a post-commit hook that creates a flag
|
|
|
27 |
file at /tmp/svados_repo_changed.flag whenever a commit is made to the repo and
|
|
|
28 |
another flag in /tmp/svardos_rebuilt_please.flag if the commit might impact the
|
|
|
29 |
content of installation images. Here below is the necessary post-commit hook,
|
|
|
30 |
it should be placed in the hooks/ directory of the svn server and made
|
|
|
31 |
executable (chmod +x):
|
636 |
mateusz.vi |
32 |
|
837 |
mateusz.vi |
33 |
#!/bin/sh
|
636 |
mateusz.vi |
34 |
|
837 |
mateusz.vi |
35 |
SVNLOOK=/usr/bin/svnlook
|
|
|
36 |
REPOS="$1"
|
842 |
mateusz.vi |
37 |
REV="$2"
|
636 |
mateusz.vi |
38 |
|
837 |
mateusz.vi |
39 |
# first of all, make sure to set a flag that says "svn content changed" so a
|
|
|
40 |
# cron job can update its local copy later
|
842 |
mateusz.vi |
41 |
echo `date` > /tmp/svardos_repo_changed.flag
|
837 |
mateusz.vi |
42 |
|
|
|
43 |
# check if any of the following locations have been updated during the commit:
|
|
|
44 |
# - files
|
|
|
45 |
# - packages/core/
|
|
|
46 |
# - build.sh
|
|
|
47 |
#
|
|
|
48 |
# any change to one of these locations means that the content of the
|
|
|
49 |
# installation images may have been impacted, hence a rebuild may be necessary.
|
|
|
50 |
#
|
842 |
mateusz.vi |
51 |
$SVNLOOK changed -r "$REV" "$REPOS" | grep -e ' files' -e ' build.sh' -e ' packages/core/' > /dev/null
|
837 |
mateusz.vi |
52 |
|
|
|
53 |
# if a location matched, then set a flag so a cron job rebuilds the images
|
|
|
54 |
# and send an information message back to the committer.
|
|
|
55 |
if [ $? -eq 0 ] ; then
|
842 |
mateusz.vi |
56 |
echo `date` > /tmp/svardos_rebuild_please.flag
|
873 |
mateusz.vi |
57 |
echo "" >&2
|
|
|
58 |
echo "---------------------------------------------------------" >&2
|
837 |
mateusz.vi |
59 |
echo "NOTICE: a build-impacting location has been updated." >&2
|
844 |
mateusz.vi |
60 |
echo " install images have been scheduled for a rebuild." >&2
|
873 |
mateusz.vi |
61 |
echo "---------------------------------------------------------" >&2
|
837 |
mateusz.vi |
62 |
exit 1
|
|
|
63 |
fi
|
|
|
64 |
|
842 |
mateusz.vi |
65 |
exit 0
|
837 |
mateusz.vi |
66 |
|
842 |
mateusz.vi |
67 |
|
636 |
mateusz.vi |
68 |
=== SVN CLIENT ================================================================
|
|
|
69 |
|
|
|
70 |
The SvarDOS repository should be checked out in /srv/svardos/:
|
|
|
71 |
|
|
|
72 |
$ svn co svn://127.0.0.1/svardos /srv/svardos
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
=== WEB SERVICE ===============================================================
|
|
|
76 |
|
|
|
77 |
A web server with PHP must be running (typically Apache). The PHP installation
|
|
|
78 |
needs the php-zip extension (required by buildidx), and the Apache web root
|
|
|
79 |
should point at /srv/svardos/website.
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
=== CRON ACTIONS ==============================================================
|
|
|
83 |
|
|
|
84 |
A cron job should be configured to run frequently (like every minute) and
|
|
|
85 |
execute the /srv/svardos/cron.sh script. This script is responsible for
|
|
|
86 |
checking out the local svardos repo whenever a new commit is being made, and
|
851 |
mateusz.vi |
87 |
rebuilds the index of the packages repository, and potentially (re)builds the
|
|
|
88 |
installation floppy images as well. To do so, it requires a few dependencies to
|
|
|
89 |
be present on the server:
|
|
|
90 |
- zip
|
|
|
91 |
- unzip
|
|
|
92 |
- mtools (mformat, mcopy, etc)
|
|
|
93 |
- unix2dos (usually part of a dos2unix package)
|
|
|
94 |
- mkisofs or genisoimage
|
636 |
mateusz.vi |
95 |
|
|
|
96 |
|
|
|
97 |
=== MIRRORING THE PROJECT'S SVN ===============================================
|
|
|
98 |
|
|
|
99 |
Mirroring the project's svn tree (containing all build scripts, packages, etc)
|
|
|
100 |
is the best way to make a backup copy of the entire SvarDOS build system along
|
|
|
101 |
with all its history. To achieve such mirror, one needs to create an empty
|
884 |
mateusz.vi |
102 |
svn repository:
|
636 |
mateusz.vi |
103 |
|
|
|
104 |
$ svnadmin create /srv/svardos-mirror
|
|
|
105 |
$ svnsync init file:///srv/svardos-mirror svn://svn.svardos.org/svardos
|
884 |
mateusz.vi |
106 |
|
|
|
107 |
Then make this repository to accept modifications of revision properties, this
|
|
|
108 |
is mandatory so it can import historical data:
|
|
|
109 |
|
|
|
110 |
$ echo '#!/bin/sh' > /srv/svardos-mirror/hooks/pre-revprop-change
|
|
|
111 |
$ echo 'exi 0' >> /srv/svardos-mirror/hooks/pre-revprop-change
|
|
|
112 |
|
|
|
113 |
Finally, populate your mirror using svnsync (this operation has to be performed
|
|
|
114 |
periodically to keep your mirror up to date):
|
|
|
115 |
|
636 |
mateusz.vi |
116 |
$ svn up /srv/svardos-mirror
|
|
|
117 |
|
|
|
118 |
The same procedure can be used to migrate the SvarDOS build system from one
|
|
|
119 |
server to another.
|
|
|
120 |
|
884 |
mateusz.vi |
121 |
NOTE: Such mirror server must not be used to send commits to. The only process
|
|
|
122 |
that should write to it is svnsync.
|
636 |
mateusz.vi |
123 |
|
|
|
124 |
|
|
|
125 |
======================================================================= EOF ===
|