diff options
-rw-r--r-- | morphlib/app.py | 5 | ||||
-rw-r--r-- | morphlib/artifactsplitrule.py | 2 | ||||
-rw-r--r-- | morphlib/gitdir.py | 3 | ||||
-rw-r--r-- | morphlib/gitdir_tests.py | 8 | ||||
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 4 | ||||
-rwxr-xr-x | tests.deploy/deploy-cluster.script | 10 | ||||
-rw-r--r-- | tests.deploy/deploy-cluster.stdout | 2 |
7 files changed, 19 insertions, 15 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 9ceca9a8..409e0a12 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -359,7 +359,10 @@ class Morph(cliapp.Application): morphology = resolved_morphologies[reference] visit(reponame, ref, filename, absref, tree, morphology) - if morphology['kind'] == 'system': + if morphology['kind'] == 'cluster': + raise cliapp.AppException( + "Cannot build a morphology of type 'cluster'.") + elif morphology['kind'] == 'system': queue.extend((s.get('repo') or reponame, s.get('ref') or ref, '%s.morph' % s['morph']) diff --git a/morphlib/artifactsplitrule.py b/morphlib/artifactsplitrule.py index 246691d8..bc92e5fb 100644 --- a/morphlib/artifactsplitrule.py +++ b/morphlib/artifactsplitrule.py @@ -300,4 +300,4 @@ def unify_system_matches(morphology): def unify_cluster_matches(_): - return None + return SplitRules() diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py index f5ef0061..15079231 100644 --- a/morphlib/gitdir.py +++ b/morphlib/gitdir.py @@ -478,7 +478,8 @@ class GitDirectory(object): if dirpath == self.dirname and '.git' in subdirs: subdirs.remove('.git') for filename in filenames: - yield os.path.join(dirpath, filename)[len(self.dirname)+1:] + filepath = os.path.join(dirpath, filename) + yield os.path.relpath(filepath, start=self.dirname) def _list_files_in_ref(self, ref): tree = self.resolve_ref_to_tree(ref) diff --git a/morphlib/gitdir_tests.py b/morphlib/gitdir_tests.py index 8c312c1b..14b2a57a 100644 --- a/morphlib/gitdir_tests.py +++ b/morphlib/gitdir_tests.py @@ -82,9 +82,13 @@ class GitDirectoryContentsTests(unittest.TestCase): shutil.rmtree(self.tempdir) def test_lists_files_in_work_tree(self): + expected = ['bar.morph', 'baz.morph', 'foo.morph', 'quux'] + gd = morphlib.gitdir.GitDirectory(self.dirname) - self.assertEqual(sorted(gd.list_files()), - ['bar.morph', 'baz.morph', 'foo.morph', 'quux']) + self.assertEqual(sorted(gd.list_files()), expected) + + gd = morphlib.gitdir.GitDirectory(self.dirname + '/') + self.assertEqual(sorted(gd.list_files()), expected) def test_read_file_in_work_tree(self): gd = morphlib.gitdir.GitDirectory(self.dirname) diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 94b2381c..8c8a98e9 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -191,7 +191,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): ws, root_url, system_branch, cached_repo, base_ref) as (sb, gd): if not self._checkout_has_systems(gd): - raise BranchRootHasNoSystemsError(base_ref) + raise BranchRootHasNoSystemsError(root_url, base_ref) def branch(self, args): @@ -252,7 +252,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): gd.checkout(system_branch) if not self._checkout_has_systems(gd): - raise BranchRootHasNoSystemsError(base_ref) + raise BranchRootHasNoSystemsError(root_url, base_ref) def _save_dirty_morphologies(self, loader, sb, morphs): logging.debug('Saving dirty morphologies: start') diff --git a/tests.deploy/deploy-cluster.script b/tests.deploy/deploy-cluster.script index 0659ad21..acc65a54 100755 --- a/tests.deploy/deploy-cluster.script +++ b/tests.deploy/deploy-cluster.script @@ -20,12 +20,6 @@ set -eu -# DISABLED TEST: This does not seem to have been tested at merge time, -# in a clean repository. The tests produces output (see below for -# definitions-version), but the expected output is empty. -# FIXME: This should be fixed. -exit - . "$SRCDIR/tests.deploy/setup-build" cd "$DATADIR/workspace/branch1" @@ -34,7 +28,7 @@ cd "$DATADIR/workspace/branch1" "$SRCDIR/scripts/test-morph" build linux-system -GIT_DIR=test:morphs/.git git tag -a my-test-tag -m "Example tag" HEAD +GIT_DIR=test/morphs/.git git tag -a my-test-tag -m "Example tag" HEAD "$SRCDIR/scripts/test-morph" --log "$DATADIR/deploy.log" \ deploy test_cluster \ @@ -42,7 +36,7 @@ GIT_DIR=test:morphs/.git git tag -a my-test-tag -m "Example tag" HEAD linux-system-2.HOSTNAME="baserock-rocks-even-more" \ > /dev/null -outputdir=test:morphs +outputdir=test/morphs test -e $outputdir/hello-system.img test -e $outputdir/linux-system-1.tar test -e $outputdir/linux-system-2.tar diff --git a/tests.deploy/deploy-cluster.stdout b/tests.deploy/deploy-cluster.stdout new file mode 100644 index 00000000..16b78015 --- /dev/null +++ b/tests.deploy/deploy-cluster.stdout @@ -0,0 +1,2 @@ +definitions-version: {'describe': 'my-test-tag-unreproducible'} +configuration.HOSTNAME: baserock-rocks-even-more |