summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-02-28 13:40:08 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-02-28 13:40:08 +0000
commitf3a30a2f3412b3528b2e7e05ecc57cdbc8c6e449 (patch)
tree151f5e350ea9d0b6440e7d2d0a191bd779351b4e
parent10bbea27a2b86dea661ead782557a4921b0b92e5 (diff)
downloadmorph-f3a30a2f3412b3528b2e7e05ecc57cdbc8c6e449.tar.gz
Set sensible defaults for git-base-url, bundle-server, cachedir, max-jobs
Also, change builder.py to always obey the --max-jobs setting, unless a morphology has a max-jobs field. The defaults have been chosen so that they work for everyone equally well. It may be useful to have a local mirror and then set the options to point there, but it's not reasonable to try to guess such things, so the defaults can be adapated to that. Collect the defaults into one place so they're easier to overview. The cliapp interface for adding settings is verbose enough that the defaults were getting buried.
-rwxr-xr-xmorph27
-rw-r--r--morphlib/builder.py5
2 files changed, 22 insertions, 10 deletions
diff --git a/morph b/morph
index c053753e..1876c7cb 100755
--- a/morph
+++ b/morph
@@ -27,22 +27,37 @@ from morphlib.morphologyloader import MorphologyLoader
from morphlib.builddependencygraph import BuildDependencyGraph
+defaults = {
+ 'git-base-url': [
+ 'git://gitorious.org/baserock-morphs/',
+ 'git://gitorious.org/baserock/',
+ ],
+ 'bundle-server': 'http://roadtrain.codethink.co.uk/bundles/',
+ 'cachedir': os.path.expanduser('~/.cache/morph'),
+ 'max-jobs': morphlib.util.make_concurrency(),
+}
+
+
class Morph(cliapp.Application):
def add_settings(self):
self.settings.boolean(['verbose', 'v'], 'show what is happening')
self.settings.string_list(['git-base-url'],
'prepend URL to git repos that are not URLs',
- metavar='URL')
+ metavar='URL',
+ default=defaults['git-base-url'])
self.settings.string(['bundle-server'],
'base URL to download bundles',
- metavar='URL')
+ metavar='URL',
+ default=defaults['bundle-server'])
self.settings.string(['cachedir'],
- 'put build results in DIR (default: %default)',
- metavar='DIR', default='.')
+ 'put build results in DIR',
+ metavar='DIR',
+ default=defaults['cachedir'])
self.settings.string(['tempdir'],
'temporary directory to use for builds',
- metavar='DIR', default=os.environ.get('TMPDIR'))
+ metavar='DIR',
+ default=os.environ.get('TMPDIR'))
self.settings.boolean(['no-ccache'], 'do not use ccache')
self.settings.boolean(['no-distcc'], 'do not use distcc')
self.settings.integer(['max-jobs'],
@@ -50,7 +65,7 @@ class Morph(cliapp.Application):
'is to a value based on the number of CPUs '
'in the machine running morph',
metavar='N',
- default=0)
+ default=defaults['max-jobs'])
self.settings.boolean(['keep-path'],
'do not touch the PATH environment variable '
'(use with tests ONLY)')
diff --git a/morphlib/builder.py b/morphlib/builder.py
index 9b55e01f..79d2ef50 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -301,12 +301,9 @@ class ChunkBuilder(BlobBuilder):
if self.blob.morph.max_jobs:
max_jobs = int(self.blob.morph.max_jobs)
logging.debug('max_jobs from morph: %s' % max_jobs)
- elif self.settings['max-jobs']:
+ else:
max_jobs = self.settings['max-jobs']
logging.debug('max_jobs from settings: %s' % max_jobs)
- else:
- max_jobs = morphlib.util.make_concurrency()
- logging.debug('max_jobs from cpu count: %s' % max_jobs)
self.ex.env['MAKEFLAGS'] = '-j%d' % max_jobs
if not self.settings['no-ccache']: