diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-05-02 10:57:55 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-05-03 12:51:24 +0000 |
commit | 5b7f918f66df140ff38a9955f841c8aeeab6089d (patch) | |
tree | 1deff981f67277913c7ecf440de931e908b5e12b | |
parent | dc7f4153ae6f74fe747117154e02a2198be6e8c2 (diff) | |
download | morph-5b7f918f66df140ff38a9955f841c8aeeab6089d.tar.gz |
Use dedicated <cachedir>/artficats directory for local artifact cache.
Make sure that this directory is actually created before trying
to save artifacts to it. Also adjust all tests to use this new
directory for looking up artifacts.
-rwxr-xr-x | morph | 10 | ||||
-rw-r--r-- | morphlib/builder2_tests.py | 5 | ||||
-rwxr-xr-x | tests.as-root/make-patch.script | 6 | ||||
-rwxr-xr-x | tests/build-chunk.script | 2 | ||||
-rwxr-xr-x | tests/build-stratum-with-submodules.script | 3 | ||||
-rwxr-xr-x | tests/build-stratum.script | 3 | ||||
-rwxr-xr-x | tests/build-system-autotools.script | 2 | ||||
-rwxr-xr-x | tests/build-system-cpan.script | 2 | ||||
-rwxr-xr-x | tests/build-system-python-distutils.script | 2 | ||||
-rwxr-xr-x | tests/morphless-chunks.script | 2 | ||||
-rwxr-xr-x | tests/name-clash.script | 2 | ||||
-rwxr-xr-x | tests/rebuild-cached-stratum.script | 2 |
12 files changed, 25 insertions, 16 deletions
@@ -179,9 +179,14 @@ class Morph(cliapp.Application): if not os.path.exists(cachedir): os.mkdir(cachedir) + artifact_cachedir = os.path.join(self.settings['cachedir'], 'artifacts') + if not os.path.exists(artifact_cachedir): + os.mkdir(artifact_cachedir) + build_env = morphlib.buildenvironment.BuildEnvironment(self.settings) ckc = morphlib.cachekeycomputer.CacheKeyComputer(build_env) - lac = morphlib.localartifactcache.LocalArtifactCache(cachedir) + lac = morphlib.localartifactcache.LocalArtifactCache( + os.path.join(cachedir, 'artifacts')) lrc = morphlib.localrepocache.LocalRepoCache( os.path.join(cachedir, 'gits'), self.settings['git-base-url'], @@ -449,7 +454,8 @@ class Morph(cliapp.Application): cachedir = self.settings['cachedir'] build_env = morphlib.buildenvironment.BuildEnvironment(self.settings) ckc = morphlib.cachekeycomputer.CacheKeyComputer(build_env) - lac = morphlib.localartifactcache.LocalArtifactCache(cachedir) + lac = morphlib.localartifactcache.LocalArtifactCache( + os.path.join(cachedir, 'artifacts')) lrc = morphlib.localrepocache.LocalRepoCache( os.path.join(cachedir, 'gits'), self.settings['git-base-url'], diff --git a/morphlib/builder2_tests.py b/morphlib/builder2_tests.py index 8c08c551..93a2f8b7 100644 --- a/morphlib/builder2_tests.py +++ b/morphlib/builder2_tests.py @@ -139,6 +139,7 @@ class BuilderBaseTests(unittest.TestCase): self.max_jobs = 1 self.builder = morphlib.builder2.BuilderBase(self.staging_area, self.artifact_cache, + None, self.artifact, self.repo_cache, self.build_env, @@ -205,8 +206,8 @@ class BuilderBaseTests(unittest.TestCase): class ChunkBuilderTests(unittest.TestCase): def setUp(self): - self.build = morphlib.builder2.ChunkBuilder(None, None, None, None, - None, 1, False) + self.build = morphlib.builder2.ChunkBuilder(None, None, None, None, + None, None, 1, False) def test_uses_morphology_commands_when_given(self): m = { 'build-commands': ['build-it'] } diff --git a/tests.as-root/make-patch.script b/tests.as-root/make-patch.script index 5c7083ae..873aa049 100755 --- a/tests.as-root/make-patch.script +++ b/tests.as-root/make-patch.script @@ -62,8 +62,8 @@ EOF # Build first image. Remember the stratum. "$SRCDIR/scripts/test-morph" build morphs-repo master hello-system.morph -img1=$(find "$DATADIR/cache" -maxdepth 1 -name '*.system.*') -stratum1=$(find "$DATADIR/cache" -maxdepth 1 -name '*.stratum.*') +img1=$(find "$DATADIR/cache/artifacts" -maxdepth 1 -name '*.system.*') +stratum1=$(find "$DATADIR/cache/artifacts" -maxdepth 1 -name '*.stratum.*') # Modify the chunk, in a new branch. "$SRCDIR/scripts/run-git-in" "$DATADIR/chunk-repo" checkout --quiet farrokh @@ -81,7 +81,7 @@ sed -i 's/farrokh/alfred/' "$DATADIR/morphs-repo/hello-stratum.morph" # Build second image. "$SRCDIR/scripts/test-morph" build morphs-repo alfred hello-system.morph -img2=$(find "$DATADIR/cache" -maxdepth 1 -name '*.system.*' \ +img2=$(find "$DATADIR/cache/artifacts" -maxdepth 1 -name '*.system.*' \ ! -name $(basename "$img1")) # Make the patch. diff --git a/tests/build-chunk.script b/tests/build-chunk.script index ba8b227f..1ec23479 100755 --- a/tests/build-chunk.script +++ b/tests/build-chunk.script @@ -21,7 +21,7 @@ set -eu "$SRCDIR/scripts/test-morph" build chunk-repo farrokh hello.morph -for chunk in "$DATADIR/cache/"*.chunk.* +for chunk in "$DATADIR/cache/artifacts/"*.chunk.* do echo "$chunk:" | sed 's/[^.]*//' tar -tf "$chunk" | LC_ALL=C sort | sed '/^\.\/./s:^\./::' diff --git a/tests/build-stratum-with-submodules.script b/tests/build-stratum-with-submodules.script index a152e5e1..80ebf1d0 100755 --- a/tests/build-stratum-with-submodules.script +++ b/tests/build-stratum-with-submodules.script @@ -65,4 +65,5 @@ EOF # No build and verify we got a stratum. "$SRCDIR/scripts/test-morph" build morphs-repo master submod-stratum.morph -tar -tf "$DATADIR/cache/"*.stratum.* | LC_ALL=C sort | sed '/^\.\/./s:^\./::' +tar -tf "$DATADIR/cache/artifacts/"*.stratum.* | LC_ALL=C sort \ + | sed '/^\.\/./s:^\./::' diff --git a/tests/build-stratum.script b/tests/build-stratum.script index fbc61629..8460c1e1 100755 --- a/tests/build-stratum.script +++ b/tests/build-stratum.script @@ -20,4 +20,5 @@ set -eu "$SRCDIR/scripts/test-morph" build morphs-repo master hello-stratum.morph -tar -tf "$DATADIR/cache/"*.stratum.* | LC_ALL=C sort | sed '/^\.\/./s:^\./::' +tar -tf "$DATADIR/cache/artifacts/"*.stratum.* | LC_ALL=C sort \ + | sed '/^\.\/./s:^\./::' diff --git a/tests/build-system-autotools.script b/tests/build-system-autotools.script index edee7adb..8d33ac0e 100755 --- a/tests/build-system-autotools.script +++ b/tests/build-system-autotools.script @@ -49,7 +49,7 @@ git commit --quiet -m "Convert hello to an autotools project" "$SRCDIR/scripts/test-morph" build chunk-repo farrokh hello.morph -for chunk in "$DATADIR/cache/"*.chunk.* +for chunk in "$DATADIR/cache/artifacts/"*.chunk.* do echo "$chunk:" | sed 's/[^.]*//' tar -tf "$chunk" | LC_ALL=C sort | sed '/^\.\/./s:^\./::' diff --git a/tests/build-system-cpan.script b/tests/build-system-cpan.script index 49582a96..ba1cf73e 100755 --- a/tests/build-system-cpan.script +++ b/tests/build-system-cpan.script @@ -55,7 +55,7 @@ git commit --quiet -m 'convert hello into a perl cpan project' "$SRCDIR/scripts/test-morph" build --prefix=/ chunk-repo farrokh hello.morph -for chunk in "$DATADIR/cache/"*.chunk.* +for chunk in "$DATADIR/cache/artifacts/"*.chunk.* do echo "$chunk:" | sed 's/[^.]*//' tar -tf "$chunk" | LC_ALL=C sort | diff --git a/tests/build-system-python-distutils.script b/tests/build-system-python-distutils.script index 1c79a6c1..cfe5d7d2 100755 --- a/tests/build-system-python-distutils.script +++ b/tests/build-system-python-distutils.script @@ -53,7 +53,7 @@ git commit --quiet -m 'convert hello into a python project' "$SRCDIR/scripts/test-morph" build --prefix= chunk-repo farrokh hello.morph -for chunk in "$DATADIR/cache/"*.chunk.* +for chunk in "$DATADIR/cache/artifacts/"*.chunk.* do echo "$chunk:" | sed 's/[^.]*//' tar -tf "$chunk" | LC_ALL=C sort | sed '/^\.\/./s:^\./::' diff --git a/tests/morphless-chunks.script b/tests/morphless-chunks.script index 7dc7b7d5..50dddb89 100755 --- a/tests/morphless-chunks.script +++ b/tests/morphless-chunks.script @@ -58,7 +58,7 @@ git commit --quiet -m initial "$SRCDIR/scripts/test-morph" build stratum master alfred.morph -for chunk in "$DATADIR/cache/"*.chunk.* +for chunk in "$DATADIR/cache/artifacts/"*.chunk.* do echo "$chunk:" | sed 's/[^.]*//' tar -tf "$chunk" | LC_ALL=C sort | sed '/^\.\/./s:^\./::' diff --git a/tests/name-clash.script b/tests/name-clash.script index d4be1233..316a9ddc 100755 --- a/tests/name-clash.script +++ b/tests/name-clash.script @@ -56,5 +56,5 @@ EOF # unpack it and check the contents INSTDIR="$DATADIR"/unpack mkdir -p "$INSTDIR" -tar -C "$INSTDIR" -xhf "$DATADIR/cache/"*hello-stratum* +tar -C "$INSTDIR" -xhf "$DATADIR/cache/artifacts/"*hello-stratum* test "$("$INSTDIR"/bin/hello)" = "hello, world" diff --git a/tests/rebuild-cached-stratum.script b/tests/rebuild-cached-stratum.script index 31b3f587..efe821ee 100755 --- a/tests/rebuild-cached-stratum.script +++ b/tests/rebuild-cached-stratum.script @@ -22,7 +22,7 @@ set -eu -cache="$DATADIR/cache" +cache="$DATADIR/cache/artifacts" # Make a branch in the chunk repo where we can make our own modifications. (cd "$DATADIR/chunk-repo" && |