From 8a113747fc9aef15592f8ae0cabd027575e97caa Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Thu, 23 May 2013 14:18:36 +0100 Subject: Add contents list to chunk and stratum metadata --- morphlib/artifact.py | 2 ++ morphlib/bins.py | 55 ++++++++++++++++++++++++++++++++++++++-------------- morphlib/builder2.py | 19 ++++++++++++------ 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/morphlib/artifact.py b/morphlib/artifact.py index 82680709..2f9c65df 100644 --- a/morphlib/artifact.py +++ b/morphlib/artifact.py @@ -24,6 +24,7 @@ class Artifact(object): * ``name`` -- the name of the artifact * ``cache_key`` -- a cache key to uniquely identify the artifact * ``cache_id`` -- a dict describing the components of the cache key + * ``contents`` -- a list of the installed files or chunks in the artifact * ``dependencies`` -- list of Artifacts that need to be built beforehand * ``dependents`` -- list of Artifacts that need this Artifact to be built @@ -39,6 +40,7 @@ class Artifact(object): self.cache_key = None self.dependencies = [] self.dependents = [] + self.contents = [] def add_dependency(self, artifact): '''Add ``artifact`` to the dependency list.''' diff --git a/morphlib/bins.py b/morphlib/bins.py index 0374c117..1721c69a 100644 --- a/morphlib/bins.py +++ b/morphlib/bins.py @@ -50,26 +50,19 @@ def safe_makefile(self, tarinfo, targetpath): tarfile.TarFile.makefile = safe_makefile -def create_chunk(rootdir, f, regexps, dump_memory_profile=None): - '''Create a chunk from the contents of a directory. +def chunk_filenames(rootdir, regexps, dump_memory_profile=None): + + '''Return the filenames for a chunk from the contents of a directory. Only files and directories that match at least one of the regular expressions are accepted. The regular expressions are implicitly anchored to the beginning of the string, but not the end. The filenames are relative to rootdir. - ``f`` is an open file handle, to which the tar file is written. - ''' dump_memory_profile = dump_memory_profile or (lambda msg: None) - # This timestamp is used to normalize the mtime for every file in - # chunk artifact. This is useful to avoid problems from smallish - # clock skew. It needs to be recent enough, however, that GNU tar - # does not complain about an implausibly old timestamp. - normalized_timestamp = 683074800 - def matches(filename): return any(x.match(filename) for x in compiled) @@ -79,10 +72,7 @@ def create_chunk(rootdir, f, regexps, dump_memory_profile=None): filename = os.path.dirname(filename) yield filename - logging.debug('Creating chunk file %s from %s with regexps %s' % - (getattr(f, 'name', 'UNNAMED'), rootdir, regexps)) - dump_memory_profile('at beginning of create_chunk') - + logging.debug('regexps: %s' % repr(regexps)) compiled = [re.compile(x) for x in regexps] include = set() for dirname, subdirs, basenames in os.walk(rootdir): @@ -99,7 +89,42 @@ def create_chunk(rootdir, f, regexps, dump_memory_profile=None): logging.debug('regexp MISMATCH: %s' % filename) dump_memory_profile('after walking') - include = sorted(include) # get dirs before contents + return sorted(include) # get dirs before contents + + +def chunk_contents(rootdir, regexps): + ''' Return the list of files in a chunk, with the rootdir + stripped off. + + ''' + + filenames = chunk_filenames(rootdir, regexps) + # The first entry is the rootdir directory, which we don't need + filenames.pop(0) + contents = [str[len(rootdir):] for str in filenames] + return contents + + +def create_chunk(rootdir, f, regexps, dump_memory_profile=None): + '''Create a chunk from the contents of a directory. + + ``f`` is an open file handle, to which the tar file is written. + + ''' + + dump_memory_profile = dump_memory_profile or (lambda msg: None) + + # This timestamp is used to normalize the mtime for every file in + # chunk artifact. This is useful to avoid problems from smallish + # clock skew. It needs to be recent enough, however, that GNU tar + # does not complain about an implausibly old timestamp. + normalized_timestamp = 683074800 + + include = chunk_filenames(rootdir, regexps, dump_memory_profile) + logging.debug('Creating chunk file %s from %s with regexps %s' % + (getattr(f, 'name', 'UNNAMED'), rootdir, regexps)) + dump_memory_profile('at beginning of create_chunk') + tar = tarfile.open(fileobj=f, mode='w') for filename in include: # Normalize mtime for everything. diff --git a/morphlib/builder2.py b/morphlib/builder2.py index b8026612..cff74a8e 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -186,7 +186,7 @@ class BuilderBase(object): json.dump(meta, f, indent=4, sort_keys=True) f.write('\n') - def create_metadata(self, artifact_name): + def create_metadata(self, artifact_name, contents = []): '''Create metadata to artifact to allow it to be reproduced later. The metadata is represented as a dict, which later on will be @@ -214,6 +214,8 @@ class BuilderBase(object): 'commit': morphlib.gitversion.commit, 'version': morphlib.gitversion.version, }, + 'contents': contents, + 'metadata-version': 1, } return meta @@ -225,7 +227,7 @@ class BuilderBase(object): os.makedirs(dirname) return open(filename, mode) - def write_metadata(self, instdir, artifact_name): + def write_metadata(self, instdir, artifact_name, contents = []): '''Write the metadata for an artifact. The file will be located under the ``baserock`` directory under @@ -234,7 +236,7 @@ class BuilderBase(object): ''' - meta = self.create_metadata(artifact_name) + meta = self.create_metadata(artifact_name, contents) basename = '%s.meta' % artifact_name filename = os.path.join(instdir, 'baserock', basename) @@ -428,6 +430,7 @@ class ChunkBuilder(BuilderBase): def assemble_chunk_artifacts(self, destdir): # pragma: no cover built_artifacts = [] + filenames = [] with self.build_watch('create-chunks'): specs = self.artifact.source.morphology['chunks'] if len(specs) == 0: @@ -437,12 +440,15 @@ class ChunkBuilder(BuilderBase): names = specs.keys() names.sort(key=lambda name: [ord(c) for c in name]) for artifact_name in names: - self.write_metadata(destdir, artifact_name) + artifact = self.new_artifact(artifact_name) patterns = specs[artifact_name] patterns += [r'baserock/%s\.' % artifact_name] - artifact = self.new_artifact(artifact_name) with self.local_artifact_cache.put(artifact) as f: + contents = morphlib.bins.chunk_contents(destdir, patterns) + logging.debug('metadata contents: %s' % contents) + self.write_metadata(destdir, artifact_name, contents) + logging.debug('assembling chunk %s' % artifact_name) logging.debug('assembling into %s' % f.name) self.app.status(msg='Creating chunk artifact %(name)s', @@ -498,7 +504,8 @@ class StratumBuilder(BuilderBase): lac = self.local_artifact_cache artifact_name = self.artifact.source.morphology['name'] artifact = self.new_artifact(artifact_name) - meta = self.create_metadata(artifact_name) + contents = [x.name for x in constituents] + meta = self.create_metadata(artifact_name, contents) with lac.put_artifact_metadata(artifact, 'meta') as f: json.dump(meta, f, indent=4, sort_keys=True) with self.local_artifact_cache.put(artifact) as f: -- cgit v1.2.1 From 54bc976b363bd34dfd39ba343530b8bc42cb0715 Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Thu, 23 May 2013 16:52:20 +0100 Subject: Include the artifact metadata-version in the cache id key --- morphlib/artifact.py | 6 ++++-- morphlib/builder2.py | 1 - morphlib/cachekeycomputer.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/morphlib/artifact.py b/morphlib/artifact.py index 2f9c65df..20fdb185 100644 --- a/morphlib/artifact.py +++ b/morphlib/artifact.py @@ -24,9 +24,11 @@ class Artifact(object): * ``name`` -- the name of the artifact * ``cache_key`` -- a cache key to uniquely identify the artifact * ``cache_id`` -- a dict describing the components of the cache key - * ``contents`` -- a list of the installed files or chunks in the artifact * ``dependencies`` -- list of Artifacts that need to be built beforehand * ``dependents`` -- list of Artifacts that need this Artifact to be built + * ``metadata_version`` -- When the format of the artifact metadata + changes, this version number is raised causing + any existing cached artifacts to be invalidated The ``dependencies`` and ``dependents`` lists MUST be modified by the ``add_dependencies`` and ``add_dependent`` methods only. @@ -40,7 +42,7 @@ class Artifact(object): self.cache_key = None self.dependencies = [] self.dependents = [] - self.contents = [] + self.metadata_version = 1 def add_dependency(self, artifact): '''Add ``artifact`` to the dependency list.''' diff --git a/morphlib/builder2.py b/morphlib/builder2.py index cff74a8e..086b3033 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -215,7 +215,6 @@ class BuilderBase(object): 'version': morphlib.gitversion.version, }, 'contents': contents, - 'metadata-version': 1, } return meta diff --git a/morphlib/cachekeycomputer.py b/morphlib/cachekeycomputer.py index 6acf654b..d7e2e3b1 100644 --- a/morphlib/cachekeycomputer.py +++ b/morphlib/cachekeycomputer.py @@ -81,7 +81,8 @@ class CacheKeyComputer(object): keys = { 'env': self._filterenv(self._build_env.env), 'filename': artifact.source.filename, - 'kids': [self.compute_key(x) for x in artifact.dependencies] + 'kids': [self.compute_key(x) for x in artifact.dependencies], + 'metadata-version': artifact.metadata_version } kind = artifact.source.morphology['kind'] -- cgit v1.2.1 From 182cae2a1a3e743d031cd35ba3f77b5a280cd63b Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Thu, 23 May 2013 17:00:16 +0100 Subject: Remove excessive debugging messages --- morphlib/bins.py | 4 ---- morphlib/builder2.py | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/morphlib/bins.py b/morphlib/bins.py index 1721c69a..3c6f2c88 100644 --- a/morphlib/bins.py +++ b/morphlib/bins.py @@ -72,7 +72,6 @@ def chunk_filenames(rootdir, regexps, dump_memory_profile=None): filename = os.path.dirname(filename) yield filename - logging.debug('regexps: %s' % repr(regexps)) compiled = [re.compile(x) for x in regexps] include = set() for dirname, subdirs, basenames in os.walk(rootdir): @@ -83,7 +82,6 @@ def chunk_filenames(rootdir, regexps, dump_memory_profile=None): if matches(os.path.relpath(filename, rootdir)): for name in names_to_root(filename): if name not in include: - logging.debug('regexp match: %s' % name) include.add(name) else: logging.debug('regexp MISMATCH: %s' % filename) @@ -121,8 +119,6 @@ def create_chunk(rootdir, f, regexps, dump_memory_profile=None): normalized_timestamp = 683074800 include = chunk_filenames(rootdir, regexps, dump_memory_profile) - logging.debug('Creating chunk file %s from %s with regexps %s' % - (getattr(f, 'name', 'UNNAMED'), rootdir, regexps)) dump_memory_profile('at beginning of create_chunk') tar = tarfile.open(fileobj=f, mode='w') diff --git a/morphlib/builder2.py b/morphlib/builder2.py index 086b3033..9aefabb6 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -186,7 +186,7 @@ class BuilderBase(object): json.dump(meta, f, indent=4, sort_keys=True) f.write('\n') - def create_metadata(self, artifact_name, contents = []): + def create_metadata(self, artifact_name, contents=[]): '''Create metadata to artifact to allow it to be reproduced later. The metadata is represented as a dict, which later on will be @@ -226,7 +226,7 @@ class BuilderBase(object): os.makedirs(dirname) return open(filename, mode) - def write_metadata(self, instdir, artifact_name, contents = []): + def write_metadata(self, instdir, artifact_name, contents=[]): '''Write the metadata for an artifact. The file will be located under the ``baserock`` directory under @@ -445,7 +445,6 @@ class ChunkBuilder(BuilderBase): with self.local_artifact_cache.put(artifact) as f: contents = morphlib.bins.chunk_contents(destdir, patterns) - logging.debug('metadata contents: %s' % contents) self.write_metadata(destdir, artifact_name, contents) logging.debug('assembling chunk %s' % artifact_name) -- cgit v1.2.1 From a4bfe0c3c760d116a38a442762192f9751f1164e Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Thu, 23 May 2013 17:46:13 +0100 Subject: Make morphlib.bins.chunk_filenames() a private method --- morphlib/bins.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphlib/bins.py b/morphlib/bins.py index 3c6f2c88..6fb7dc5a 100644 --- a/morphlib/bins.py +++ b/morphlib/bins.py @@ -50,7 +50,7 @@ def safe_makefile(self, tarinfo, targetpath): tarfile.TarFile.makefile = safe_makefile -def chunk_filenames(rootdir, regexps, dump_memory_profile=None): +def _chunk_filenames(rootdir, regexps, dump_memory_profile=None): '''Return the filenames for a chunk from the contents of a directory. @@ -96,7 +96,7 @@ def chunk_contents(rootdir, regexps): ''' - filenames = chunk_filenames(rootdir, regexps) + filenames = _chunk_filenames(rootdir, regexps) # The first entry is the rootdir directory, which we don't need filenames.pop(0) contents = [str[len(rootdir):] for str in filenames] @@ -118,7 +118,7 @@ def create_chunk(rootdir, f, regexps, dump_memory_profile=None): # does not complain about an implausibly old timestamp. normalized_timestamp = 683074800 - include = chunk_filenames(rootdir, regexps, dump_memory_profile) + include = _chunk_filenames(rootdir, regexps, dump_memory_profile) dump_memory_profile('at beginning of create_chunk') tar = tarfile.open(fileobj=f, mode='w') -- cgit v1.2.1 From 953c15a8a60993293dddbcebf595b05c5f062e3a Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Fri, 24 May 2013 11:02:05 +0100 Subject: Add tests for listing a chunk's contents --- morphlib/bins_tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py index edefb092..a9a94a44 100644 --- a/morphlib/bins_tests.py +++ b/morphlib/bins_tests.py @@ -112,6 +112,10 @@ class ChunkTests(BinsTest): morphlib.bins.create_chunk(self.instdir, self.chunk_f, regexps) self.chunk_f.flush() + def chunk_contents(self, regexps): + self.populate_instdir() + return morphlib.bins.chunk_contents(self.instdir, regexps) + def unpack_chunk(self): os.mkdir(self.unpacked) morphlib.bins.unpack_binary(self.chunk_file, self.unpacked) @@ -135,6 +139,11 @@ class ChunkTests(BinsTest): self.assertEqual([x for x, y in self.recursive_lstat(self.instdir)], ['.', 'lib', 'lib/libfoo.so']) + def test_list_chunk_contents(self): + contents = self.chunk_contents(['.']) + self.assertEqual(contents, + ['/bin', '/bin/foo', '/lib', '/lib/libfoo.so']) + def test_does_not_compress_artifact(self): self.create_chunk(['bin']) f = gzip.open(self.chunk_file) -- cgit v1.2.1 From 30657568182727b78636131ed90f3874c5d3e786 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Sat, 13 Apr 2013 20:09:22 +0000 Subject: rename trove-prefix and trove_prefix to trove_id --- morphlib/app.py | 6 +-- morphlib/util.py | 18 ++++----- tests/trove-id.script | 100 ++++++++++++++++++++++++++++++++++++++++++++++ tests/trove-prefix.script | 100 ---------------------------------------------- 4 files changed, 112 insertions(+), 112 deletions(-) create mode 100755 tests/trove-id.script delete mode 100755 tests/trove-prefix.script diff --git a/morphlib/app.py b/morphlib/app.py index 859019f9..88eff8db 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -27,7 +27,7 @@ import morphlib defaults = { 'trove-host': 'git.baserock.org', - 'trove-prefix': [ ], + 'trove-id': [ ], 'repo-alias': [ ('freedesktop=' 'git://anongit.freedesktop.org/#' @@ -70,11 +70,11 @@ class Morph(cliapp.Application): 'hostname of Trove instance', metavar='TROVEHOST', default=defaults['trove-host']) - self.settings.string_list(['trove-prefix'], + self.settings.string_list(['trove-id'], 'list of URL prefixes that should be ' 'resolved to Trove', metavar='PREFIX, ...', - default=defaults['trove-prefix']) + default=defaults['trove-id']) group_advanced = 'Advanced Options' self.settings.boolean(['no-git-update'], diff --git a/morphlib/util.py b/morphlib/util.py index c77ac8d3..b509f0b0 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -105,7 +105,7 @@ def new_artifact_caches(settings): # pragma: no cover def combine_aliases(app): # pragma: no cover '''Create a full repo-alias set from the app's settings.''' trove_host = app.settings['trove-host'] - trove_prefixes = app.settings['trove-prefix'] + trove_ids = app.settings['trove-id'] repo_aliases = app.settings['repo-alias'] repo_pat = r'^(?P[a-z0-9]+)=(?P[^#]+)#(?P[^#]+)$' trove_pat = (r'^(?P[a-z0-9]+)=(?P[^#]+)#' @@ -118,7 +118,7 @@ def combine_aliases(app): # pragma: no cover return "ssh://git@%s/%s/%%s" % (trove_host, path) else: raise cliapp.AppException( - 'Unknown protocol in trove_prefix: %s' % protocol) + 'Unknown protocol in trove_id: %s' % protocol) if trove_host: alias_map['baserock'] = "baserock=%s#%s" % ( @@ -127,18 +127,18 @@ def combine_aliases(app): # pragma: no cover alias_map['upstream'] = "upstream=%s#%s" % ( _expand('git', 'delta'), _expand('ssh', 'delta')) - for trove_prefix in trove_prefixes: - m = re.match(trove_pat, trove_prefix) + for trove_id in trove_ids: + m = re.match(trove_pat, trove_id) if m: alias_map[m.group('prefix')] = "%s=%s#%s" % ( m.group('prefix'), _expand(m.group('pull'), m.group('path')), _expand(m.group('push'), m.group('path'))) - elif '=' not in trove_prefix: - alias_map[trove_prefix] = "%s=%s#%s" % ( - trove_prefix, - _expand('ssh', trove_prefix), - _expand('ssh', trove_prefix)) + elif '=' not in trove_id: + alias_map[trove_id] = "%s=%s#%s" % ( + trove_id, + _expand('ssh', trove_id), + _expand('ssh', trove_id)) for repo_alias in repo_aliases: m = re.match(repo_pat, repo_alias) if m: diff --git a/tests/trove-id.script b/tests/trove-id.script new file mode 100755 index 00000000..7157559b --- /dev/null +++ b/tests/trove-id.script @@ -0,0 +1,100 @@ +#!/bin/sh +# +# Copyright (C) 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +## Verify that trove-id (and by corollary trove-host) work properly. + +set -eu + +RAWDUMP="$DATADIR/raw-configdump" +PROCESSEDDUMP="$DATADIR/processed-configdump" + +# Step 1, gather all the raw and processed repo-alias entries + +"$SRCDIR/scripts/test-morph" \ + --trove-host="TROVEHOST" \ + --trove-id="fudge" \ + --trove-id="github" \ + --dump-config > "$RAWDUMP" +env MORPH_DUMP_PROCESSED_CONFIG=1 "$SRCDIR/scripts/test-morph" \ + --trove-host="TROVEHOST" \ + --trove-id="fudge" \ + --trove-id="github" \ + > "$PROCESSEDDUMP" + +RAW_ALIAS=$(grep repo-alias "$RAWDUMP" | cut -d\ -f3-) +PROCESSED_ALIAS=$(grep repo-alias "$PROCESSEDDUMP" | cut -d\ -f3-) + +find_alias () { + ALIASES="$1" + WHICH="$2" + for alias in $ALIASES; do + alias=$(echo $alias | sed -e's/,$//') + prefix=$(echo $alias | cut -d= -f1) + if test "x$WHICH" = "x$prefix"; then + echo $alias + exit 0 + fi + done +} + +# Step 2, all raw aliases should be in processed aliases unchanged. As part of +# this, we're also validating that the 'github' prefix we pass in does not +# affect the alias output since it is overridden by repo-alias. + +for raw_alias in $RAW_ALIAS; do + raw_alias=$(echo $raw_alias | sed -e's/,$//') + raw_prefix=$(echo $raw_alias | cut -d= -f1) + processed_alias=$(find_alias "$PROCESSED_ALIAS" "$raw_prefix") + if test "x$raw_alias" != "x$processed_alias"; then + echo >&2 "Raw $raw_alias not in processed aliases" + fi +done + +# Step 3, all aliases in the processed aliases which do not come from the raw +# aliases should contain the trove host. + +for processed_alias in $PROCESSED_ALIAS; do + processed_alias=$(echo $processed_alias | sed -e's/,$//') + processed_prefix=$(echo $processed_alias | cut -d= -f1) + raw_alias=$(find_alias "$RAW_ALIAS" "$processed_prefix") + if test "x$raw_alias" = "x"; then + grep_out=$(echo "$processed_alias" | grep TROVEHOST) + if test "x$grep_out" = "x"; then + echo >&2 "Processed $processed_alias does not mention TROVEHOST" + fi + fi +done + +# Step 4, validate that the processed aliases do contain a baserock and an +# upstream alias since those are implicit in morph's behaviour. + +for prefix in baserock upstream; do + processed_alias=$(find_alias "$PROCESSED_ALIAS" "$prefix") + if test "x$processed_alias" = "x"; then + echo >&2 "Processed aliases lack $prefix prefix" + fi +done + +# Step 5, validate that the fudge prefix has been correctly expanded as though +# it were fudge=fudge#ssh#ssh + +fudge_alias=$(find_alias "$PROCESSED_ALIAS" "fudge") +desired_fudge="fudge=ssh://git@TROVEHOST/fudge/%s#ssh://git@TROVEHOST/fudge/%s" +if test "x$fudge_alias" != "x$desired_fudge"; then + echo >&2 "Fudge alias was '$fudge_alias' where we wanted '$desired_fudge'" +fi diff --git a/tests/trove-prefix.script b/tests/trove-prefix.script deleted file mode 100755 index 0f8cee3f..00000000 --- a/tests/trove-prefix.script +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012 Codethink Limited -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## Verify that trove-prefix (and by corollary trove-host) work properly. - -set -eu - -RAWDUMP="$DATADIR/raw-configdump" -PROCESSEDDUMP="$DATADIR/processed-configdump" - -# Step 1, gather all the raw and processed repo-alias entries - -"$SRCDIR/scripts/test-morph" \ - --trove-host="TROVEHOST" \ - --trove-prefix="fudge" \ - --trove-prefix="github" \ - --dump-config > "$RAWDUMP" -env MORPH_DUMP_PROCESSED_CONFIG=1 "$SRCDIR/scripts/test-morph" \ - --trove-host="TROVEHOST" \ - --trove-prefix="fudge" \ - --trove-prefix="github" \ - > "$PROCESSEDDUMP" - -RAW_ALIAS=$(grep repo-alias "$RAWDUMP" | cut -d\ -f3-) -PROCESSED_ALIAS=$(grep repo-alias "$PROCESSEDDUMP" | cut -d\ -f3-) - -find_alias () { - ALIASES="$1" - WHICH="$2" - for alias in $ALIASES; do - alias=$(echo $alias | sed -e's/,$//') - prefix=$(echo $alias | cut -d= -f1) - if test "x$WHICH" = "x$prefix"; then - echo $alias - exit 0 - fi - done -} - -# Step 2, all raw aliases should be in processed aliases unchanged. As part of -# this, we're also validating that the 'github' prefix we pass in does not -# affect the alias output since it is overridden by repo-alias. - -for raw_alias in $RAW_ALIAS; do - raw_alias=$(echo $raw_alias | sed -e's/,$//') - raw_prefix=$(echo $raw_alias | cut -d= -f1) - processed_alias=$(find_alias "$PROCESSED_ALIAS" "$raw_prefix") - if test "x$raw_alias" != "x$processed_alias"; then - echo >&2 "Raw $raw_alias not in processed aliases" - fi -done - -# Step 3, all aliases in the processed aliases which do not come from the raw -# aliases should contain the trove host. - -for processed_alias in $PROCESSED_ALIAS; do - processed_alias=$(echo $processed_alias | sed -e's/,$//') - processed_prefix=$(echo $processed_alias | cut -d= -f1) - raw_alias=$(find_alias "$RAW_ALIAS" "$processed_prefix") - if test "x$raw_alias" = "x"; then - grep_out=$(echo "$processed_alias" | grep TROVEHOST) - if test "x$grep_out" = "x"; then - echo >&2 "Processed $processed_alias does not mention TROVEHOST" - fi - fi -done - -# Step 4, validate that the processed aliases do contain a baserock and an -# upstream alias since those are implicit in morph's behaviour. - -for prefix in baserock upstream; do - processed_alias=$(find_alias "$PROCESSED_ALIAS" "$prefix") - if test "x$processed_alias" = "x"; then - echo >&2 "Processed aliases lack $prefix prefix" - fi -done - -# Step 5, validate that the fudge prefix has been correctly expanded as though -# it were fudge=fudge#ssh#ssh - -fudge_alias=$(find_alias "$PROCESSED_ALIAS" "fudge") -desired_fudge="fudge=ssh://git@TROVEHOST/fudge/%s#ssh://git@TROVEHOST/fudge/%s" -if test "x$fudge_alias" != "x$desired_fudge"; then - echo >&2 "Fudge alias was '$fudge_alias' where we wanted '$desired_fudge'" -fi -- cgit v1.2.1 From 45c8f205456131b1c5ea055e12acc9cad8aba981 Mon Sep 17 00:00:00 2001 From: Jonathan Maw Date: Fri, 24 May 2013 17:02:04 +0000 Subject: Fix kvm working without autostart --- morphlib/exts/kvm.write | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphlib/exts/kvm.write b/morphlib/exts/kvm.write index e2f7435c..ae287fe5 100755 --- a/morphlib/exts/kvm.write +++ b/morphlib/exts/kvm.write @@ -113,7 +113,7 @@ class KvmPlusSshWriteExtension(morphlib.writeexts.WriteExtension): '--name', vm_name, '--vnc', '--ram=%s' % ram_mebibytes, '--disk path=%s,bus=ide' % vm_path] + attach_opts if not autostart: - cmdline += '--noreboot' + cmdline += ['--noreboot'] cliapp.runcmd(cmdline) -- cgit v1.2.1 From 75f8ac3925b2073fc94b543bad8a9a4e2500c715 Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Tue, 28 May 2013 16:00:32 +0100 Subject: Fix the expected hash key value in the run-in-artifact-with-different-artifacts test --- tests.as-root/run-in-artifact-with-different-artifacts.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.as-root/run-in-artifact-with-different-artifacts.stderr b/tests.as-root/run-in-artifact-with-different-artifacts.stderr index b37e8f88..5fc4fb0f 100644 --- a/tests.as-root/run-in-artifact-with-different-artifacts.stderr +++ b/tests.as-root/run-in-artifact-with-different-artifacts.stderr @@ -1 +1 @@ -ERROR: Artifact TMP/cache/artifacts/cb886f5b5aa3c4f4a36b5f763b8330077b38681573a1edcbed3554aef0489b37.stratum.linux-stratum cannot be extracted or mounted +ERROR: Artifact TMP/cache/artifacts/67596ea97123eeb66afce92675dbb63eb8fd840d01f38902d4bf6f573b609499.stratum.linux-stratum cannot be extracted or mounted -- cgit v1.2.1