summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmorph3
-rw-r--r--morphlib/builder.py2
-rwxr-xr-xtests/hello-chunk.script5
-rwxr-xr-xtests/hello-stratum.script3
4 files changed, 9 insertions, 4 deletions
diff --git a/morph b/morph
index 84423944..bf45bb12 100755
--- a/morph
+++ b/morph
@@ -40,6 +40,9 @@ class Morph(cliapp.Application):
'repository to use for a chunk morphology')
self.settings.string(['chunk-ref'],
'commit reference to use for a chunk morphology')
+ self.settings.string(['cachedir'],
+ 'put build results in DIR (default: %default)',
+ metavar='DIR', default='.')
def cmd_build(self, morph_filenames):
tempdir = morphlib.tempdir.Tempdir()
diff --git a/morphlib/builder.py b/morphlib/builder.py
index cafe3915..f28ccca0 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -75,7 +75,7 @@ class Builder(object):
'''
- dirname = os.path.dirname(morph.filename)
+ dirname = self.settings['cachedir']
filename = os.path.join(dirname, '%s.chunk' % morph.name)
logging.debug('Creating chunk %s at %s' % (morph.name, filename))
self.ex.runv(['tar', '-C', self._inst, '-czf', filename, '.'])
diff --git a/tests/hello-chunk.script b/tests/hello-chunk.script
index 1dd99e99..60839abb 100755
--- a/tests/hello-chunk.script
+++ b/tests/hello-chunk.script
@@ -21,5 +21,6 @@ set -e
tar -C "$DATADIR" -xf tests/hello-chunk.tar.gz
./morph build "$DATADIR/hello/hello.morph" \
- --chunk-repo="file://$DATADIR/hello" --chunk-ref=master
-tar -tf "$DATADIR/hello/hello.chunk" | LC_ALL=C sort
+ --chunk-repo="file://$DATADIR/hello" --chunk-ref=master \
+ --cachedir="$DATADIR"
+tar -tf "$DATADIR/hello.chunk" | LC_ALL=C sort
diff --git a/tests/hello-stratum.script b/tests/hello-stratum.script
index 16ecdded..76055ba9 100755
--- a/tests/hello-stratum.script
+++ b/tests/hello-stratum.script
@@ -21,7 +21,8 @@ set -e
tar -C "$DATADIR" -xf tests/hello-chunk.tar.gz
./morph build "$DATADIR/hello/hello.morph" \
- --chunk-repo="file://$DATADIR/hello" --chunk-ref=master
+ --chunk-repo="file://$DATADIR/hello" --chunk-ref=master \
+ --cachedir="$DATADIR"
cp tests/hello-stratum.morph "$DATADIR"
./morph build "$DATADIR/hello-stratum.morph" --git-base-url "file://$DATADIR/"