Merge lp:~salgado/offspring/all-python-config into lp:offspring

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: 87
Proposed branch: lp:~salgado/offspring/all-python-config
Merge into: lp:offspring
Diff against target: 559 lines (+176/-171)
10 files modified
config/offspring-builder.config (+0/-108)
config/offspring.cfg (+101/-2)
docs/INSTALL (+3/-4)
lib/offspring/build/bin/offspring-build (+22/-19)
lib/offspring/build/functions/config.sh (+0/-21)
lib/offspring/build/functions/echo.sh (+1/-1)
lib/offspring/build/scripts/archive-builds (+28/-16)
lib/offspring/builder_config.py (+15/-0)
lib/offspring/config.py (+5/-0)
setup.py (+1/-0)
To merge this branch: bzr merge lp:~salgado/offspring/all-python-config
Reviewer Review Type Date Requested Status
Cody A.W. Somerville Approve
Review via email: mp+76275@code.launchpad.net

Description of the change

This is a second attempt at trying to get these changes merged. They are a pre-requisite for another branch (lp:~salgado/offspring/path-independence) which simplify things a lot for developers.

Here's what Michael said in the original merge proposal:

This is a rebasing of my lexbuilder all-python-config-2 branch onto offspring.

It removes the shell config, moves the relevant options into offspring.cfg and adds a script that dumps out the configuration for a build in shell format. It also adds support for loading a offspring.cfg.`hostname` file.

I went to some lengths to avoid having to change the shell scripts at all, probably too far -- things like having lexbuilder-builder-config output both IBS_BINDIR and IBS_BIN_DIR are probably a bit silly. I have a follow-up branch that changes things to be more consistent here.

Please let me know what you think.

To post a comment you must log in.
29. By Guilherme Salgado

merge trunk

30. By Guilherme Salgado

Turn offspring-builder-config into a regular python module and run it using python -m to get the config

Revision history for this message
Guilherme Salgado (salgado) wrote :

PYTHONPATH doesn't seem to be set on offspring-build, so we need to set it in the eval line where we generate the builder config

31. By Guilherme Salgado

Make builder_config.py not print anything to stdout if it's imported and move the bulk of the code into a function so that it can be tested

32. By Guilherme Salgado

Change get_config_variables() to return a set of tuples instead of a set of strings

33. By Guilherme Salgado

Undo revisions 30-32, but don't uncommit because Cody wants to keep this history

Revision history for this message
Cody A.W. Somerville (cody-somerville) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'config/offspring-builder.config'
2--- config/offspring-builder.config 2010-12-02 16:24:39 +0000
3+++ config/offspring-builder.config 1970-01-01 00:00:00 +0000
4@@ -1,108 +0,0 @@
5-#!/bin/bash
6-
7-################################################################################
8-#
9-# Builder configuration settings
10-#
11-################################################################################
12-
13-# IBS_BASEDIR - Base directory for build system.
14-# IBS_BINDIR - Directory containing scripts and binaries.
15-# IBS_FINALDESTDIR - Base directory of final destination of build output.
16-# IBS_CONFIGDIR - Directory for project configuration files.
17-# IBS_WORKDIR - Directory where we perform the actual builds in.
18-# IBS_PROJECTCONFIGDIR - Directory where we keep mirror of project config branches.
19-
20-IBS_BASEDIR="/srv"
21-IBS_BINDIR="${IBS_BASEDIR}/bin"
22-IBS_SCRIPTDIR="${IBS_BASEDIR}/scripts/"
23-IBS_FUNCDIR="${IBS_BASEDIR}/lib/offspring/build/functions/"
24-IBS_WRAPPERDIR="${IBS_BASEDIR}/lib/offspring/build/wrappers/"
25-IBS_RESULTDIR="${IBS_BASEDIR}/builds"
26-IBS_CONFIGDIR="${IBS_BASEDIR}/config"
27-IBS_WORKDIR="/var/tmp/offspring"
28-IBS_PROJECTCONFIG_CACHEDIR="/var/tmp/offspring-projects"
29-
30-# Results directory names
31-# IBS_RESULT_IMAGEDIR - Name of directory to place images in, inside resultdir.
32-# IBS_RESULT_CONFIGDIR - Name of directory to place build config in, inside resultdir.
33-# IBS_RESULT_LOGDIR - Directory to place log files in, inside resultdir.
34-# IBS_RESULT_PROJDIR - Directory to place project files in, inside resultdir.
35-# IBS_RESULT_SRCDIR - Directory to place source files in, inside resultdir.
36-
37-IBS_RESULT_IMAGEDIR="images"
38-IBS_RESULT_CONFIGDIR="config"
39-IBS_RESULT_LOGDIR=""
40-IBS_RESULT_REPORTSDIR="reports"
41-IBS_RESULT_PROJDIR="project"
42-IBS_RESULT_SRCDIR="source"
43-
44-# IBS_LAUNCHPAD_BOT_ID - ID for launchpad account used to fetch bzr branches.
45-
46-IBS_LAUNCHPAD_BOT_ID="${USERNAME}"
47-
48-# DEBUG - Toggle debug mode: enabled or disabled.
49-
50-DEBUG="disabled"
51-
52-# IBS_SANITY_HOST - Force script to only run on specified host.
53-# IBS_SANITY_USER - Force script to only run as specified user.
54-# IBS_SANITY_OVERRIDE - Toggle sanity override: enabled or disabled.
55-
56-IBS_SANITY_HOST="`hostname`"
57-IBS_SANITY_USER="${USERNAME}"
58-IBS_SANITY_OVERRIDE="disabled"
59-
60-# IBS_BUILDER_STATEFILE - Lockfile containing info about the current build.
61-
62-IBS_BUILDER_STATEFILE="${IBS_BINDIR}/.offspring-build.lock"
63-
64-# IBS_CHECKSUM_TYPES - List of checksums to use for computing hashes of results
65-
66-IBS_CHECKSUM_TYPES="sha1 md5"
67-
68-# IBS_KEEP_BUILDFAILURES - Keep workdir of build failures?: enabled or disabled.
69-# IBS_TRACE_ERRORS - Print execute trace on error?: enabled or disabled.
70-
71-IBS_KEEP_BUILDFAILURES="disabled"
72-IBS_TRACE_ERRORS="disabled"
73-
74-# IBS_SIGN_BUILDS - Toggle the signing of build hashsum files using GPG.
75-# IBS_GPG_KEYRING - Path to keyring containing secret keys.
76-
77-IBS_SIGN_BUILDS="enabled"
78-IBS_GPG_KEYRING="${IBS_CONFIGDIR}/keyring.gpg"
79-
80-# IBS_DISTRIBUTION_CHANNEL_DESCRIPTOR_PREFIX - The prefix of the
81-# ubuntu channel descriptor that will be generated. See
82-# https://wiki.ubuntu.com/DistributionChannelDescriptor for more.
83-IBS_DISTRIBUTION_CHANNEL_DESCRIPTOR_PREFIX="offspring-${HOSTNAME}"
84-
85-# ARCHIVE_MODE - 0: delete only; 1: delete and rsync to remote host.
86-# ARCHIVE_THRESHOLD - The age before any archiving actions can occur.
87-
88-ARCHIVE_MODE=0
89-ARCHIVE_THRESHOLD=7
90-
91-# ARCHIVE_HOST - Host name of machine to archive to.
92-# ARCHIVE_USER - User to authenticate as to archive build.
93-# ARCHIVE_DESTINATION - Path to archive build to on remote host.
94-
95-# These options can be left blank if in mode 0.
96-
97-ARCHIVE_HOST=
98-ARCHIVE_USER=
99-ARCHIVE_DESTINATION=
100-
101-# PURGE_IMAGE_AGE - The age of images before they're deleted.
102-# PURGE_PROJ_AGE - The age of saved projects before they're deleted.
103-# SHELVE_DIR_AGE - The age before the directory is moved in an archive dir.
104-
105-# Warning: If SHELVE_DIR_AGE is younger than PURGE_* then the directory will
106-# be moved into the archive directory *WITH* the undeleted, large files and they
107-# will not automatically be deleted.
108-#
109-
110-PURGE_IMAGE_AGE=7
111-PURGE_PROJ_AGE=9
112-SHELVE_DIR_AGE=365
113
114=== modified file 'config/offspring.cfg'
115--- config/offspring.cfg 2011-05-30 22:18:12 +0000
116+++ config/offspring.cfg 2011-11-04 21:07:25 +0000
117@@ -20,6 +20,7 @@
118 # instance_name: A friendly name for the installation, used in emails.
119 # instance_email: Mail will be sent from this address (in the sense of
120 # both envelope sender and the From: header)
121+# build_statefile: Path to the offspring statefile.
122 #
123 #===============================================================================
124
125@@ -33,6 +34,7 @@
126 discussion_email:
127 instance_name: Offspring Image Build System
128 instance_email: offspring@localhost
129+build_statefile: %(bin_dir)s/.offspring-build.lock
130
131 #===============================================================================
132 # Offspring Web
133@@ -52,10 +54,108 @@
134 releases_uri_base: https://offspring-share/releases
135
136 #===============================================================================
137+# Offspring Builder
138+#
139+# builder_statefile: Path to the offspring statefile (renamed from build_statefile)
140+# basedir: Renamed from base_dir
141+# configdir: Renamed from config_dir
142+# bindir: Renamed from bin_dir
143+# wrapperdir: XXX
144+# funcdir: XXX
145+# scriptdir: XXX
146+# keep_buildfailures: Keep workdir of build failures?: enabled or disabled
147+# launchpad_bot_id: ID for launchpad account used to fetch bzr branches.
148+# projectconfig_cachedir: Directory where we keep mirror of project config branches.
149+# proxy: HTTP proxy to use for the build steps.
150+# resultdir: Base directory of final destination of build output.
151+# sanity_override: Toggle sanity override: enabled or disabled.
152+# sanity_host: Force script to only run on specified host.
153+# sanity_user: Force script to only run as specified user.
154+# sign_builds: Toggle the signing of build hashsum files using GPG. enabled or disabled
155+# gpg_keyring: Path to keyring containing secret keys.
156+# trace_errors: Print execute trace on error?: enabled or disabled
157+# workdir: Directory where we perform the actual builds in.
158+# debug: Toggle debug mode: enabled or disabled.
159+# result_imagedir: Name of directory to place images in, inside resultdir.
160+# result_srcdir: Directory to place source files in, inside resultdir.
161+# result_configdir: Name of directory to place build config in, inside resultdir.
162+# result_projdir: Directory to place project files in, inside resultdir.
163+# result_reportsdir: Directory to place reports in, inside resultdir.
164+# result_logdir: Directory to place log files in, inside resultdir.
165+# checksum_types: List of checksums to use for computing hashes of results.
166+# distribution_channel_prefix: The prefix of the ubuntu channel
167+# descriptor that will be generated. See
168+# https://wiki.ubuntu.com/DistributionChannelDescriptor for more.
169+# ===============================================================================
170+
171+[builder]
172+builder_statefile: %(build_statefile)s
173+basedir: %(base_dir)s
174+configdir: %(config_dir)s
175+bindir: %(bin_dir)s
176+wrapperdir: %(base_dir)s/lib/offspring/build/wrappers/
177+funcdir: %(base_dir)s/lib/offspring/build/functions/
178+scriptdir: %(base_dir)s/scripts/
179+keep_buildfailures: disabled
180+launchpad_bot_id: %(username)s
181+projectconfig_cachedir: /var/tmp/offspring-projects
182+proxy:
183+resultdir: %(base_dir)s/builds
184+sanity_override: disabled
185+sanity_host: %(hostname)s
186+sanity_user: %(username)s
187+sign_builds: enabled
188+gpg_keyring: %(config_dir)s/keyring.gpg
189+trace_errors: disabled
190+workdir: /var/tmp/offspring
191+debug: disabled
192+result_imagedir: images
193+result_srcdir: source
194+result_configdir: config
195+result_projdir: project
196+result_reportsdir: reports
197+result_logdir:
198+checksum_types: sha1 md5
199+distribution_channel_descriptor_prefix: offspring-%(hostname)s
200+
201+#===============================================================================
202+# Offspring Build Archiver
203+#
204+# archive_mode: 0: delete only; 1: delete and rsync to remote host.
205+# archive_threshold: The age before any archiving actions can occur.
206+#
207+# archive_host: Host name of machine to archive to.
208+# archive_user: User to authenticate as to archive build.
209+# archive_destination: Path to archive build to on remote host.
210+#
211+# These options can be left blank if in mode 0.
212+#
213+# purge_image_age: The age of images before they're deleted.
214+# purge_proj_age: The age of saved projects before they're deleted.
215+# shelve_dir_age: The age before the directory is moved in an archive dir.
216+#
217+# Warning: If shelve_dir_age is younger than PURGE_* then the
218+# directory will be moved into the archive directory *WITH* the
219+# undeleted, large files and they will not automatically be
220+# deleted.
221+#
222+#===============================================================================
223+
224+[archiver]
225+archive_mode: 0
226+archive_threshold: 7
227+archive_host:
228+archive_user:
229+archive_destination:
230+purge_image_age: 7
231+purge_proj_age: 9
232+shelve_dir_age: 365
233+
234+
235+#===============================================================================
236 # Offspring Slave
237 #
238 # build_command: Command to execute to build a project
239-# build_statefile: Path to the offspring statefile.
240 # child_wait_timeout: Seconds to give a shutting down build before terminating
241 # xmlrpc_server_auth: Authentication details for slave via xmlrpc
242 # logfile: Path to file where slave will log to
243@@ -65,7 +165,6 @@
244
245 [slave]
246 build_command: %(bin_dir)s/offspring-build
247-build_statefile: %(bin_dir)s/.offspring-build.lock
248 child_wait_timeout: 5
249 xmlrpc_server_auth: admin:password
250 request_timeout: 60.0
251
252=== modified file 'docs/INSTALL'
253--- docs/INSTALL 2011-08-31 16:33:29 +0000
254+++ docs/INSTALL 2011-11-04 21:07:25 +0000
255@@ -27,8 +27,7 @@
256 /usr/bin/lb *, \
257 /usr/sbin/chroot /var/tmp/offspring/*
258
259- 3. Update config/offspring.cfg and config/offspring-builder.config as
260- required.
261+ 3. Update config/offspring.cfg as required.
262
263 4. In the root of the installation (where the Makefile resides), execute
264 'make slave'.
265@@ -44,8 +43,8 @@
266 * If you have multiple slaves, you'll want to mount an NFS share or similar
267 on the build results directory.
268 * If you wish to sign your build results, export the private key to the file
269- configured in config/offspring-builder.config and ensure the account
270- running the build process has the public key in its keyring.
271+ configured in config/offspring.cfg and ensure the account running the build
272+ process has the public key in its keyring.
273
274 == Web ==
275
276
277=== modified file 'lib/offspring/build/bin/offspring-build'
278--- lib/offspring/build/bin/offspring-build 2011-01-22 03:13:06 +0000
279+++ lib/offspring/build/bin/offspring-build 2011-11-04 21:07:25 +0000
280@@ -6,12 +6,21 @@
281 set -e
282
283 _Initialize() {
284- if [ -z "${OFFSPRING_CONFIGSCRIPT}" ]
285- then
286- OFFSPRING_CONFIGSCRIPT="/srv/config/offspring-builder.config"
287- fi
288-
289- source "${OFFSPRING_CONFIGSCRIPT}"
290+ if [ -z "${OFFSPRING_CONFIGSCRIPT}" ]; then
291+ OFFSPRING_CONFIGSCRIPT="/srv/bin/offspring-builder-config"
292+ fi
293+
294+ if [ \! -x "${OFFSPRING_CONFIGSCRIPT}" ]; then
295+ printf "Could not find config script at $OFFSPRING_CONFIGSCRIPT\n" >& 2
296+ exit 1
297+ fi
298+
299+ eval `"${OFFSPRING_CONFIGSCRIPT}"`
300+
301+ if [ $? -ne 0 ]; then
302+ printf "Executing config script at $OFFSPRING_CONFIGSCRIPT failed.\n" >& 2
303+ exit 1
304+ fi
305
306 # Load build system components
307 source "${IBS_FUNCDIR}/echo.sh"
308@@ -21,10 +30,7 @@
309 source "${IBS_FUNCDIR}/logging.sh"
310 source "${IBS_FUNCDIR}/files.sh"
311
312- # Reload config script to load host overrides
313- Load_script_configfile "${OFFSPRING_CONFIGSCRIPT}"
314-
315- [ -n "${PROXY}" ] && export http_proxy="${PROXY}"
316+ [ -n "${IBS_PROXY}" ] && export http_proxy="${IBS_PROXY}"
317
318 umask 022
319
320@@ -73,7 +79,7 @@
321 Error "Unable to create result logfile directory '%s'." "${RESULTDIR_LOGFILE}"
322 exit 1
323 fi
324-
325+
326 Catch_faults enable
327
328 Print "START: %s build %s started at '%s'." "${PROJECT}" "${BUILDNAME}" "`date`"
329@@ -99,11 +105,11 @@
330 if [ -L ${IBS_RESULTDIR}/${PROJECT}/previous ]; then
331 cp -d ${IBS_RESULTDIR}/${PROJECT}/previous ${IBS_RESULTDIR}/${PROJECT}/current/previous
332 fi
333-
334+
335 # Set up working dir
336 mkdir -p ${IBS_WORKDIR}/${PROJECT}
337 pushd ${IBS_WORKDIR}/${PROJECT} > /dev/null 2>&1
338-
339+
340 }
341
342 _Build() {
343@@ -113,7 +119,7 @@
344 Export_project_config "${PROJECT}" "${RESULTDIR_CONFIGFILES}/"
345
346 Buildtool_build
347-
348+
349 Catch_faults permit_errors
350 if [ "${IBS_SIGN_BUILDS}" = "enabled" ]
351 then
352@@ -137,7 +143,7 @@
353 Info "Build result signing is disabled."
354 fi
355 Catch_faults disallow_errors
356-
357+
358 Info "Build stage completed at %s" "`date`"
359 }
360
361@@ -179,13 +185,10 @@
362 exit 1
363 fi
364
365-# Initialize core
366+# Initialize core & load settings
367 echo "Performing initialization..."
368 _Initialize
369
370-# Load builder settings
371-Load_defaults
372-
373 # Setup and start logging
374 _Setup
375
376
377=== modified file 'lib/offspring/build/functions/config.sh'
378--- lib/offspring/build/functions/config.sh 2010-11-29 08:27:24 +0000
379+++ lib/offspring/build/functions/config.sh 2011-11-04 21:07:25 +0000
380@@ -91,27 +91,6 @@
381 dpkg-query -W > "${_DESTINATION}/${HOSTNAME}.manifest"
382 }
383
384-Load_defaults() {
385- IBS_BASEDIR="${IBS_BASEDIR:-/srv}"
386- IBS_BINDIR="${IBS_BINDIR:-${IBS_BASEDIR}/bin}"
387- IBS_RESULTDIR="${IBS_RESULTDIR:-${IBS_BASEDIR}/builds}"
388- IBS_WORKDIR="${IBS_WORKDIR:-/var/tmp/offspring}"
389- IBS_CONFIGDIR="${IBS_CONFIGDIR:-${IBS_BASEDIR}/config}"
390- IBS_PROJECTCONFIG_CACHEDIR="${IBS_PROJECTCONFIG_CACHEDIR:-/var/tmp/offspring-project-config}"
391-
392- IBS_BUILDTOOL="${IBS_BUILDTOOL:-mic}"
393-
394- IBS_RESULT_IMAGEDIR="${IBS_RESULT_IMAGEDIR:-images}"
395- IBS_RESULT_CONFIGDIR="${IBS_RESULT_CONFIGDIR:-config}"
396- IBS_RESULT_LOGDIR="${IBS_RESULT_LOGDIR:-}"
397- IBS_RESULT_REPORTSDIR="${IBS_RESULT_REPORTSDIR:-reports}"
398- IBS_RESULT_PROJDIR="${IBS_RESULT_PROJDIR:-project}"
399- IBS_RESULT_SRCDIR="${IBS_RESULT_SRCDIR:-source}"
400-
401- IBS_SANITY_USER="${IBS_SANITY_USER:-`whoami`}"
402- IBS_SANITY_HOST="${IBS_SANITY_HOST:-${HOSTNAME}}"
403-}
404-
405 Check_sanity() {
406 if [ "${IBS_SANITY_OVERRIDE}" != "enabled" ]; then
407 Action "Performing sanity check"
408
409=== modified file 'lib/offspring/build/functions/echo.sh'
410--- lib/offspring/build/functions/echo.sh 2010-11-29 08:27:24 +0000
411+++ lib/offspring/build/functions/echo.sh 2011-11-04 21:07:25 +0000
412@@ -10,7 +10,7 @@
413 }
414
415 Debug() {
416- if [ "${DEBUG}" = "enabled" ]; then
417+ if [ "${IBS_DEBUG}" = "enabled" ]; then
418 STRING="D: ${1}"
419 shift || true
420 Print "${STRING}" "$@" >&2
421
422=== modified file 'lib/offspring/build/scripts/archive-builds'
423--- lib/offspring/build/scripts/archive-builds 2010-12-03 04:35:48 +0000
424+++ lib/offspring/build/scripts/archive-builds 2011-11-04 21:07:25 +0000
425@@ -8,11 +8,23 @@
426 # XXX: This script needs to be rewritten to use new framework.
427 #
428
429-if [ -z $OFFSPRING_CONFIGSCRIPT ]; then
430- OFFSPRING_CONFIGSCRIPT="/srv/config/offspring-builder.config"
431-fi
432-
433-source "$OFFSPRING_CONFIGSCRIPT"
434+if [ -z "${OFFSPRING_CONFIGSCRIPT}" ]; then
435+ OFFSPRING_CONFIGSCRIPT="/srv/bin/offspring-builder-config"
436+fi
437+
438+if [ \! -x "${OFFSPRING_CONFIGSCRIPT}" ]; then
439+ printf "Could not find config script at $OFFSPRING_CONFIGSCRIPT\n" >& 2
440+ exit 1
441+fi
442+
443+eval `"${OFFSPRING_CONFIGSCRIPT}"`
444+
445+if [ $? -ne 0 ]; then
446+ printf "Executing config script at $OFFSPRING_CONFIGSCRIPT failed.\n" >& 2
447+ exit 1
448+fi
449+
450+source "$CONFIGSCRIPT"
451
452 # calculateBuildAge DATE
453 calculateBuildAge() {
454@@ -99,30 +111,30 @@
455 echo "===== $project ====="
456 echo
457 echo "Now Processing project: $project"
458- echo " Archive Age Threshold: $ARCHIVE_THRESHOLD"
459- echo " Image Purge Age: $PURGE_IMAGE_AGE"
460- echo " Saved Project Purge Age: $PURGE_PROJ_AGE"
461- echo " Shelve Directory Age: $SHELVE_DIR_AGE"
462+ echo " Archive Age Threshold: $IBS_ARCHIVE_THRESHOLD"
463+ echo " Image Purge Age: $IBS_PURGE_IMAGE_AGE"
464+ echo " Saved Project Purge Age: $IBS_PURGE_PROJ_AGE"
465+ echo " Shelve Directory Age: $IBS_SHELVE_DIR_AGE"
466 echo
467
468 for day in `ls $IBS_RESULTDIR/$project/`; do
469 if [ ! -L $IBS_RESULTDIR/$project/$day -a "$day" != "archive" ]; then
470 declare -i age=$(calculateBuildAge $day)
471
472- if [ $age -gt $ARCHIVE_THRESHOLD ]; then
473+ if [ $age -gt $IBS_ARCHIVE_THRESHOLD ]; then
474 declare -i ACTION_TAKEN=0
475 echo "I: $project/$day meets the archive threshold at $age day(s) old (`du -hs $IBS_RESULTDIR/$project/$day | cut -f 1`)"
476
477- if [ $ARCHIVE_MODE -eq 1 -a ! -f "$IBS_RESULTDIR/$project/$day/.archived" ]; then
478- echo " I: Archiving $project builds from $day to $ARCHIVE_USER@$ARCHIVE_HOST/$ARCHIVE_DESTINATION/"
479+ if [ $IBS_ARCHIVE_MODE -eq 1 -a ! -f "$IBS_RESULTDIR/$project/$day/.archived" ]; then
480+ echo " I: Archiving $project builds from $day to $IBS_ARCHIVE_USER@$IBS_ARCHIVE_HOST/$IBS_ARCHIVE_DESTINATION/"
481 ACTION_TAKEN=1
482 if [ 1 -ne $SIMULATION ]; then
483- rsync -av --progress $IBS_RESULTDIR/$project/$day/ "$ARCHIVE_USER@$ARCHIVE_HOST/$ARCHIVE_DESTINATION/$project-$day/"
484+ rsync -av --progress $IBS_RESULTDIR/$project/$day/ "$IBS_ARCHIVE_USER@$IBS_ARCHIVE_HOST/$IBS_ARCHIVE_DESTINATION/$project-$day/"
485 touch $IBS_RESULTDIR/$project/$day/.archived
486 fi
487 fi
488
489- if [ $age -gt $PURGE_IMAGE_AGE ]; then
490+ if [ $age -gt $IBS_PURGE_IMAGE_AGE ]; then
491 if [ -n "`find $IBS_RESULTDIR/$project/$day -name *.img -type f -print`" ]; then
492 echo " I: Deleting images for $project builds from $day"
493 ACTION_TAKEN=1
494@@ -168,7 +180,7 @@
495 fi
496 fi
497
498- if [ $age -gt $PURGE_PROJ_AGE ]; then
499+ if [ $age -gt $IBS_PURGE_PROJ_AGE ]; then
500 if [ -n "`find $IBS_RESULTDIR/$project/$day -name *.mic.tar.bz2 -type f -print`" ]; then
501 echo " I: Deleting saved project for $project builds from $day"
502 ACTION_TAKEN=1
503@@ -178,7 +190,7 @@
504 fi
505 fi
506
507- if [ $age -gt $SHELVE_DIR_AGE ]; then
508+ if [ $age -gt $IBS_SHELVE_DIR_AGE ]; then
509 echo " I: Shelving directory for $project builds from $day"
510 ACTION_TAKEN=1
511 if [ 1 -ne $SIMULATION ]; then
512
513=== added file 'lib/offspring/builder_config.py'
514--- lib/offspring/builder_config.py 1970-01-01 00:00:00 +0000
515+++ lib/offspring/builder_config.py 2011-11-04 21:07:25 +0000
516@@ -0,0 +1,15 @@
517+#!/usr/bin/python
518+
519+# Copyright 2010 Canonical Ltd. This software is licensed under the
520+# GNU Affero General Public License version 3 (see the file LICENSE).
521+
522+from offspring import config
523+
524+if __name__ == '__main__':
525+ printed = set()
526+ for key, value in config.config.items('builder'):
527+ print 'IBS_%s="%s"' % (key.upper(), value)
528+ printed.add(key)
529+ for key, value in config.config.items('archiver'):
530+ if key not in printed:
531+ print 'IBS_%s="%s"' % (key.upper(), value)
532
533=== modified file 'lib/offspring/config.py'
534--- lib/offspring/config.py 2010-11-29 08:27:24 +0000
535+++ lib/offspring/config.py 2011-11-04 21:07:25 +0000
536@@ -26,6 +26,11 @@
537 sys.stderr.write("Fatal Error: Unable to parse configuration file '%s'. (%s)\n" \
538 % (CONFIGFILE_PATH, e) )
539 sys.exit(1)
540+ else:
541+ hostname = os.popen('hostname').read().strip()
542+ config.set('DEFAULT', 'hostname', hostname)
543+ config.set('DEFAULT', 'username', os.environ['USERNAME'])
544+ config.read([CONFIGFILE_PATH + '.' + hostname])
545 finally:
546 if configFile is not None:
547 configFile.close()
548
549=== modified file 'setup.py'
550--- setup.py 2010-12-01 19:15:54 +0000
551+++ setup.py 2011-11-04 21:07:25 +0000
552@@ -10,6 +10,7 @@
553 package_dir={'': 'lib'},
554 packages=find_packages('lib'),
555 scripts = [
556+ 'lib/offspring/build/bin/offspring-builder-config',
557 'lib/offspring/slave/bin/offspring-slave',
558 'lib/offspring/master/bin/offspring-master',
559 'lib/offspring/web/bin/offspring-web',

Subscribers

People subscribed via source and target branches