summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/app.py16
-rw-r--r--morphlib/buildcommand.py2
-rw-r--r--morphlib/builder2.py14
-rw-r--r--morphlib/morph2.py25
-rw-r--r--morphlib/morph2_tests.py36
-rw-r--r--morphlib/morphloader.py40
-rw-r--r--morphlib/morphloader_tests.py38
-rw-r--r--morphlib/morphologyfactory.py13
-rw-r--r--morphlib/morphologyfactory_tests.py8
-rw-r--r--morphlib/plugins/artifact_inspection_plugin.py5
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py12
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py3
-rw-r--r--morphlib/plugins/deploy_plugin.py2
-rw-r--r--morphlib/stagingarea.py6
-rw-r--r--morphlib/stagingarea_tests.py3
-rw-r--r--morphlib/util.py9
-rw-r--r--scripts/setup-3rd-party-strata2
-rwxr-xr-xtests.as-root/archless-system-fails.script3
-rwxr-xr-xtests.as-root/metadata-includes-morph-version.setup1
-rwxr-xr-xtests.as-root/metadata-includes-repo-alias.setup1
-rwxr-xr-xtests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script3
-rwxr-xr-xtests.as-root/setup4
-rwxr-xr-xtests.as-root/system-overlap.script2
-rwxr-xr-xtests.as-root/tarball-image-is-sensible.setup1
-rw-r--r--tests.branching.disabled/workflow-petrify.stdout6
-rw-r--r--tests.branching/edit-updates-stratum-build-depends.stdout28
-rw-r--r--tests.branching/edit-updates-stratum.stdout5
-rw-r--r--tests.branching/foreach-handles-full-urls.stdout2
-rwxr-xr-xtests.branching/setup1
-rw-r--r--tests.branching/tag-creates-commit-and-tag.stdout11
-rw-r--r--tests.branching/tag-tag-works-as-expected.stdout11
-rwxr-xr-xtests.branching/tag-works-with-multiple-morphs-repos.script2
-rw-r--r--tests.branching/tag-works-with-multiple-morphs-repos.stdout24
-rwxr-xr-xtests.build/setup2
-rwxr-xr-xtests.deploy/deploy-cluster.script12
-rwxr-xr-xtests.deploy/deploy-rawdisk.script4
-rwxr-xr-xtests.deploy/setup2
-rwxr-xr-xtests.merging/setup2
-rwxr-xr-xtests/setup2
-rwxr-xr-xtests/show-dependencies.setup1
-rw-r--r--yarns/branches-workspaces.yarn8
-rw-r--r--yarns/implementations.yarn37
42 files changed, 170 insertions, 239 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index a0833d45..f916ae17 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -20,10 +20,17 @@ import logging
import os
import sys
import time
+import urlparse
import warnings
import morphlib
+class InvalidUrlError(cliapp.AppException):
+
+ def __init__(self, parameter, url):
+ cliapp.AppException.__init__(
+ self, 'Value %s for argument %s is not a url' %
+ (url, parameter))
defaults = {
'trove-host': 'git.baserock.org',
@@ -200,6 +207,13 @@ class Morph(cliapp.Application):
tmpdir = os.path.join(tmpdir_base, 'morph_tmp')
self.settings['tempdir'] = tmpdir
+ if self.settings['tarball-server']:
+ url_split = urlparse.urlparse(self.settings['tarball-server'])
+ if not (url_split.netloc and
+ url_split.scheme in ('http', 'https', 'file')):
+ raise InvalidUrlError('tarball-server',
+ self.settings['tarball-server'])
+
if 'MORPH_DUMP_PROCESSED_CONFIG' in os.environ:
self.settings.dump_config(sys.stdout)
sys.exit(0)
@@ -417,7 +431,7 @@ class Morph(cliapp.Application):
# Log the environment.
prev = getattr(self, 'prev_env', {})
- morphlib.util.log_dict_diff(kwargs['env'], prev)
+ morphlib.util.log_dict_diff(self, kwargs['env'], prev)
self.prev_env = kwargs['env']
# run the command line
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index e76b7a14..b587aa9a 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -47,7 +47,7 @@ class BuildCommand(object):
for repo_name, ref, filename in self.app.itertriplets(args):
self.app.status(msg='Building %(repo_name)s %(ref)s %(filename)s',
repo_name=repo_name, ref=ref, filename=filename)
- self.app.status(msg='Figuring out the right build order')
+ self.app.status(msg='Deciding on task order')
srcpool = self.create_source_pool(repo_name, ref, filename)
root_artifact = self.resolve_artifacts(srcpool)
self.build_in_order(root_artifact)
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index e1eaaa86..bab89aa2 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -439,8 +439,10 @@ class ChunkBuilder(BuilderBase):
contents = morphlib.bins.chunk_contents(destdir, patterns)
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='assembling chunk %s' % artifact_name,
+ chatty=True)
+ self.app.status(msg='assembling into %s' % f.name,
+ chatty=True)
self.app.status(msg='Creating chunk artifact %(name)s',
name=artifact.name)
morphlib.bins.create_chunk(destdir, f, patterns)
@@ -700,8 +702,10 @@ class Builder(object): # pragma: no cover
self.remote_artifact_cache, artifact,
self.repo_cache, self.max_jobs,
self.setup_mounts)
- logging.debug('Builder.build: artifact %s with %s' %
- (artifact.name, repr(o)))
+ self.app.status(msg='Builder.build: artifact %s with %s' %
+ (artifact.name, repr(o)),
+ chatty=True)
built_artifacts = o.build_and_cache()
- logging.debug('Builder.build: done')
+ self.app.status(msg='Builder.build: done',
+ chatty=True)
return built_artifacts
diff --git a/morphlib/morph2.py b/morphlib/morph2.py
index 6975e699..0e0d9201 100644
--- a/morphlib/morph2.py
+++ b/morphlib/morph2.py
@@ -58,10 +58,11 @@ class Morphology(object):
('strata', []),
('description', ''),
('arch', None),
- ('system-kind', None),
('configuration-extensions', []),
],
- 'cluster': []
+ 'cluster': [
+ ('description', ''),
+ ],
}
@staticmethod
@@ -169,10 +170,6 @@ class Morphology(object):
self._set_default_value(self._dict, 'max-jobs',
int(self['max-jobs']))
- if 'disk-size' in self:
- self._set_default_value(self._dict, 'disk-size',
- self._parse_size(self['disk-size']))
-
for name, value in self.static_defaults[self['kind']]:
if name not in self._dict:
self._set_default_value(self._dict, name, value)
@@ -207,17 +204,6 @@ class Morphology(object):
'deploy',
dict())
- def _parse_size(self, size):
- if isinstance(size, basestring):
- size = size.lower()
- if size.endswith('g'):
- return int(size[:-1]) * 1024 ** 3
- elif size.endswith('m'): # pragma: no cover
- return int(size[:-1]) * 1024 ** 2
- elif size.endswith('k'): # pragma: no cover
- return int(size[:-1]) * 1024
- return int(size) # pragma: no cover
-
def lookup_child_by_name(self, name):
'''Find child reference by its name.
@@ -285,10 +271,7 @@ class Morphology(object):
# Simple values. Use original value unless it has been changed from
# the default in memmory.
if live_dict[key] == live_dict.get('_orig_' + key, None):
- if key in original_dict:
- result = original_dict[key]
- else:
- result = None
+ result = original_dict.get(key, None)
else:
result = live_dict[key]
return result
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py
index bf32d3c2..aaa1d1cc 100644
--- a/morphlib/morph2_tests.py
+++ b/morphlib/morph2_tests.py
@@ -96,29 +96,16 @@ class MorphologyTests(unittest.TestCase):
self.assertEqual(m['chunks'][0]['morph'], 'le-chunk')
self.assertEqual(m['chunks'][0]['build-depends'], None)
- def test_parses_system_disk_size(self):
- m = Morphology('''
- {
- "name": "foo",
- "kind": "system",
- "disk-size": "1g"
- }
- ''')
-
- self.assertEqual(m['disk-size'], 1024 ** 3)
-
def test_returns_dict_keys(self):
m = Morphology('''
{
"name": "foo",
"kind": "system",
- "disk-size": "1g"
}
''')
self.assertTrue('name' in m.keys())
self.assertTrue('kind' in m.keys())
- self.assertTrue('disk-size' in m.keys())
def test_system_indexes_strata(self):
m = Morphology('''
@@ -307,32 +294,9 @@ class MorphologyTests(unittest.TestCase):
system_text = '''{
"kind": "system",
- "disk-size": "1g",
"arch": "x86_64",
- "system-kind": "rootfs-tarball"
}'''
- def test_writing_preserves_disk_size(self):
- text_lines = self.system_text.splitlines()
- morphology = Morphology(self.system_text)
-
- output = StringIO.StringIO()
- morphology.update_text(self.system_text, output)
- output_lines = output.getvalue().splitlines()
- self.assertEqual(text_lines, output_lines)
-
- def test_writing_updates_disk_size(self):
- text_lines = self.system_text.splitlines()
- text_lines[2] = ' "disk-size": 512,'
-
- morphology = Morphology(self.system_text)
- morphology._dict['disk-size'] = 512
-
- output = StringIO.StringIO()
- morphology.update_text(self.system_text, output)
- output_lines = output.getvalue().splitlines()
- self.assertEqual(text_lines, output_lines)
-
def test_nested_dict(self):
# Real morphologies don't trigger this code path, so we test manually
original_dict = {
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py
index c94078f9..702a330c 100644
--- a/morphlib/morphloader.py
+++ b/morphlib/morphloader.py
@@ -54,6 +54,12 @@ class InvalidFieldError(morphlib.Error):
self.msg = (
'Field %s not allowed in morphology %s' % (field, morphology))
+class ObsoleteFieldsError(morphlib.Error):
+
+ def __init__(self, fields, morphology):
+ self.msg = (
+ 'Morphology %s uses obsolete fields: %s' %
+ (morphology, ' '.join(fields)))
class UnknownArchitectureError(morphlib.Error):
@@ -62,14 +68,6 @@ class UnknownArchitectureError(morphlib.Error):
'Unknown architecture %s in morphology %s' % (arch, morphology))
-class InvalidSystemKindError(morphlib.Error):
-
- def __init__(self, system_kind, morphology):
- self.msg = (
- 'system-kind %s not allowed (must be rootfs-tarball), in %s' %
- (system_kind, morphology))
-
-
class NoBuildDependenciesError(morphlib.Error):
def __init__(self, stratum_name, chunk_name, morphology):
@@ -115,6 +113,13 @@ class MorphologyLoader(object):
],
}
+ _obsolete_fields = {
+ 'system': [
+ 'system-kind',
+ 'disk-size',
+ ],
+ }
+
_static_defaults = {
'chunk': {
'description': '',
@@ -144,11 +149,11 @@ class MorphologyLoader(object):
'strata': [],
'description': '',
'arch': None,
- 'system-kind': 'rootfs-tarball',
'configuration-extensions': [],
- 'disk-size': '1G',
},
- 'cluster': {},
+ 'cluster': {
+ 'description': '',
+ },
}
def parse_morphology_text(self, text, whence):
@@ -229,8 +234,10 @@ class MorphologyLoader(object):
raise UnknownKindError(morph['kind'], morph.filename)
required = ['kind'] + self._required_fields[kind]
+ obsolete = self._obsolete_fields.get(kind, [])
allowed = self._static_defaults[kind].keys()
self._require_fields(required, morph)
+ self._deny_obsolete_fields(obsolete, morph)
self._deny_unknown_fields(required + allowed, morph)
if kind == 'system':
@@ -260,12 +267,6 @@ class MorphologyLoader(object):
if morph['arch'] not in morphlib.valid_archs:
raise UnknownArchitectureError(morph['arch'], morph.filename)
- # If system-kind is present, it must be rootfs-tarball.
- if 'system-kind' in morph:
- if morph['system-kind'] not in (None, 'rootfs-tarball'):
- raise InvalidSystemKindError(
- morph['system-kind'], morph.filename)
-
def _validate_stratum(self, morph):
# Require at least one chunk.
if len(morph.get('chunks', [])) == 0:
@@ -308,6 +309,11 @@ class MorphologyLoader(object):
for field in fields:
self._require_field(field, morphology)
+ def _deny_obsolete_fields(self, fields, morphology):
+ obsolete_ones = [x for x in morphology if x in fields]
+ if obsolete_ones:
+ raise ObsoleteFieldsError(obsolete_ones, morphology.filename)
+
def _deny_unknown_fields(self, allowed, morphology):
for field in morphology:
if field not in allowed:
diff --git a/morphlib/morphloader_tests.py b/morphlib/morphloader_tests.py
index ac0fef53..f38d58e8 100644
--- a/morphlib/morphloader_tests.py
+++ b/morphlib/morphloader_tests.py
@@ -94,6 +94,26 @@ build-system: dummy
self.assertRaises(
morphlib.morphloader.InvalidFieldError, self.loader.validate, m)
+ def test_fails_to_validate_system_with_obsolete_system_kind_field(self):
+ m = morphlib.morph3.Morphology({
+ 'kind': 'system',
+ 'name': 'foo',
+ 'arch': 'x86_64',
+ 'system-kind': 'foo',
+ })
+ self.assertRaises(
+ morphlib.morphloader.ObsoleteFieldsError, self.loader.validate, m)
+
+ def test_fails_to_validate_system_with_obsolete_disk_size_field(self):
+ m = morphlib.morph3.Morphology({
+ 'kind': 'system',
+ 'name': 'foo',
+ 'arch': 'x86_64',
+ 'disk-size': 'over 9000',
+ })
+ self.assertRaises(
+ morphlib.morphloader.ObsoleteFieldsError, self.loader.validate, m)
+
def test_fails_to_validate_system_with_no_fields(self):
m = morphlib.morph3.Morphology({
'kind': 'system',
@@ -182,22 +202,6 @@ build-system: dummy
self.loader.validate(m)
self.assertEqual(m['arch'], 'armv7l')
- def test_validate_requires_system_kind_to_be_tarball_if_present(self):
- m = morphlib.morph3.Morphology(
- {
- "kind": "system",
- "name": "foo",
- "arch": "armv7l",
- "strata": [],
- "system-kind": "blah",
- })
-
- self.assertRaises(
- morphlib.morphloader.InvalidSystemKindError,
- self.loader.validate, m)
- m['system-kind'] = 'rootfs-tarball'
- self.loader.validate(m)
-
def test_validate_requires_build_deps_for_chunks_in_strata(self):
m = morphlib.morph3.Morphology(
{
@@ -468,13 +472,11 @@ name: foo
dict(m),
{
'kind': 'system',
- 'system-kind': 'rootfs-tarball',
'name': 'foo',
'description': '',
'arch': 'x86_64',
'strata': [],
'configuration-extensions': [],
- 'disk-size': '1G',
})
def test_unsets_defaults_for_system(self):
diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py
index ae5a4332..5afafefb 100644
--- a/morphlib/morphologyfactory.py
+++ b/morphlib/morphologyfactory.py
@@ -140,19 +140,6 @@ class MorphologyFactory(object):
(morphology['arch'],
', '.join(morphlib.valid_archs)))
- kind = morphology['system-kind']
- if kind == 'rootfs-tarball': # pragma: no cover
- self._app.status(
- msg='WARNING: Obsolete field system-kind used in morphology '
- '(it is harmless, but should be removed)')
- elif kind:
- raise morphlib.Error(
- 'System kind %s is not supported (anymore), '
- 'the whole system-kind field is deprecated. '
- 'Please remove system-kind from your system '
- 'morphologies and morph deploy to create '
- 'the desired output format.' % kind)
-
name = morphology['name']
morphology.builds_artifacts = [name + '-rootfs']
diff --git a/morphlib/morphologyfactory_tests.py b/morphlib/morphologyfactory_tests.py
index 06489085..6e1e67d3 100644
--- a/morphlib/morphologyfactory_tests.py
+++ b/morphlib/morphologyfactory_tests.py
@@ -118,7 +118,6 @@ class FakeLocalRepo(object):
'system.morph': '''{
"name": "system",
"kind": "system",
- "system-kind": "%(system_kind)s",
"arch": "%(arch)s"
}''',
'parse-error.morph': '''{ "name"''',
@@ -130,13 +129,11 @@ class FakeLocalRepo(object):
def __init__(self):
self.arch = 'x86_64'
- self.system_kind = ''
def cat(self, sha1, filename):
if filename in self.morphologies:
values = {
'arch': self.arch,
- 'system_kind': self.system_kind,
}
return self.morphologies[filename] % values
elif filename.endswith('.morph'):
@@ -308,11 +305,6 @@ class MorphologyFactoryTests(unittest.TestCase):
morph = self.mf.get_morphology('reponame', 'sha1', 'system.morph')
self.assertEqual(morph['arch'], 'armv7l')
- def test_fails_if_system_define_system_kind_that_is_not_tarball(self):
- self.lr.system_kind = 'blahblah'
- self.assertRaises(morphlib.Error, self.mf.get_morphology,
- 'reponame', 'sha1', 'system.morph')
-
def test_fails_on_parse_error(self):
self.assertRaises(morphlib.Error, self.mf.get_morphology,
'reponame', 'sha1', 'parse-error.morph')
diff --git a/morphlib/plugins/artifact_inspection_plugin.py b/morphlib/plugins/artifact_inspection_plugin.py
index 6c321abb..9181d488 100644
--- a/morphlib/plugins/artifact_inspection_plugin.py
+++ b/morphlib/plugins/artifact_inspection_plugin.py
@@ -78,7 +78,8 @@ class AutotoolsVersionGuesser(ProjectVersionGuesser):
break
# Then, try running autoconf against the configure script
- version = self._check_autoconf_package_version(filename, data)
+ version = self._check_autoconf_package_version(
+ repo, ref, filename, data)
if version:
self.app.status(
msg='%(repo)s: Version of %(ref)s detected '
@@ -107,7 +108,7 @@ class AutotoolsVersionGuesser(ProjectVersionGuesser):
return version
return None
- def _check_autoconf_package_version(self, filename, data):
+ def _check_autoconf_package_version(self, repo, ref, filename, data):
tempdir = morphlib.tempdir.Tempdir(self.app.settings['tempdir'])
with open(tempdir.join(filename), 'w') as f:
f.write(data)
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py
index 3d0a71a5..9a0ee484 100644
--- a/morphlib/plugins/branch_and_merge_new_plugin.py
+++ b/morphlib/plugins/branch_and_merge_new_plugin.py
@@ -434,16 +434,6 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
sb = morphlib.sysbranchdir.open_from_within('.')
loader = morphlib.morphloader.MorphologyLoader()
- # FIXME: The old "morph edit" code did its own morphology validation,
- # which was much laxer than what MorphologyFactory does, or the
- # new MorphologyLoader does. This new "morph edit" uses
- # MorphologyLoader, and the stricter validation breaks the test
- # suite. However, I want to keep the test suite as untouched as
- # possible, until all the old code is gone (after which the test
- # suite will be refactored). Thus, to work around the test suite
- # breaking, we disable morphology validation for now.
- loader.validate = lambda *args: None
-
# Load the system morphology, and all stratum morphologies, including
# all the strata that are being build-depended on.
@@ -832,7 +822,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
system, metadata = self._load_system_metadata(metadata_path)
resolved_refs = dict(self._resolve_refs_from_metadata(alias_resolver,
metadata))
- logging.debug('Resolved refs: %r' % resolved_refs)
+ self.app.status(msg='Resolved refs: %r' % resolved_refs)
base_ref = system['sha1']
# The previous version would fall back to deducing this from the repo
# url and the repo alias resolver, but this does not always work, and
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index 2f8560d0..fec16415 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -333,7 +333,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
required = {
'system': [
'name',
- 'system-kind',
'arch',
'strata',
],
@@ -354,8 +353,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
'system': [
'kind',
'description',
- 'disk-size',
- '_disk-size',
'configuration-extensions',
],
'stratum': [
diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py
index dc9f5158..35bb2b6e 100644
--- a/morphlib/plugins/deploy_plugin.py
+++ b/morphlib/plugins/deploy_plugin.py
@@ -461,7 +461,7 @@ class DeployPlugin(cliapp.Plugin):
self.app.runcmd(
[ext_filename] + args,
['sh', '-c', 'while read l; do echo `date "+%F %T"` $l; done'],
- env=env, stdout=None, stderr=None)
+ cwd=repo_dir, env=env, stdout=None, stderr=None)
if delete_ext:
os.remove(ext_filename)
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py
index 7d034ff2..3cd3818c 100644
--- a/morphlib/stagingarea.py
+++ b/morphlib/stagingarea.py
@@ -156,8 +156,8 @@ class StagingArea(object):
'''
- logging.debug('Installing artifact %s' %
- getattr(handle, 'name', 'unknown name'))
+ self._app.status(msg='Installing artifact %s' %
+ getattr(handle, 'name', 'unknown name'))
chunk_cache_dir = os.path.join(self._app.settings['tempdir'], 'chunks')
unpacked_artifact = os.path.join(
@@ -296,7 +296,7 @@ class StagingArea(object):
if not self.use_chroot:
do_not_mount_dirs += [temp_dir]
- logging.debug("Not mounting dirs %r" % do_not_mount_dirs)
+ self._app.status(msg="Not mounting dirs %r" % do_not_mount_dirs)
real_argv = ['linux-user-chroot', '--chdir', cwd, '--unshare-net']
for d in morphlib.fsutils.invert_paths(os.walk(chroot_dir),
diff --git a/morphlib/stagingarea_tests.py b/morphlib/stagingarea_tests.py
index 7cd4a5c3..27f85dff 100644
--- a/morphlib/stagingarea_tests.py
+++ b/morphlib/stagingarea_tests.py
@@ -57,6 +57,9 @@ class FakeApplication(object):
def runcmd_unchecked(self, *args, **kwargs):
return cliapp.runcmd_unchecked(*args, **kwargs)
+ def status(self, msg):
+ pass
+
class StagingAreaTests(unittest.TestCase):
diff --git a/morphlib/util.py b/morphlib/util.py
index 19c0046f..3d9232d4 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -171,20 +171,21 @@ def new_repo_caches(app): # pragma: no cover
return lrc, rrc
-def log_dict_diff(cur, pre): # pragma: no cover
+def log_dict_diff(app, cur, pre): # pragma: no cover
'''Log the differences between two dicts to debug log'''
dictA = cur
dictB = pre
for key in dictA.keys():
if key not in dictB:
- logging.debug("New environment: %s = %s" % (key, dictA[key]))
+ app.status(msg="New environment: %s = %s" % (key, dictA[key]),
+ chatty=True)
elif dictA[key] != dictB[key]:
- logging.debug(
+ app.status(msg= \
"Environment changed: %(key)s = %(valA)s to %(key)s = %(valB)s"
% {"key": key, "valA": dictA[key], "valB": dictB[key]})
for key in dictB.keys():
if key not in dictA:
- logging.debug("Environment removed: %s = %s" % (key, dictB[key]))
+ app.status(msg="Environment removed: %s = %s" % (key, dictB[key]))
# This acquired from rdiff-backup which is GPLv2+ and a patch from 2011
diff --git a/scripts/setup-3rd-party-strata b/scripts/setup-3rd-party-strata
index f2ea2a4c..fc263f96 100644
--- a/scripts/setup-3rd-party-strata
+++ b/scripts/setup-3rd-party-strata
@@ -97,9 +97,7 @@ cat <<EOF > "hello-system.morph"
{
"name": "hello-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "x86_64",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
diff --git a/tests.as-root/archless-system-fails.script b/tests.as-root/archless-system-fails.script
index eda797f1..2fdeb018 100755
--- a/tests.as-root/archless-system-fails.script
+++ b/tests.as-root/archless-system-fails.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2011, 2012 Codethink Limited
+# Copyright (C) 2011-2013 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
@@ -26,7 +26,6 @@ cat <<EOF >archless-system.morph
{
"name": "archless-system",
"kind": "system",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
diff --git a/tests.as-root/metadata-includes-morph-version.setup b/tests.as-root/metadata-includes-morph-version.setup
index 2284cfb9..f0aefb3c 100755
--- a/tests.as-root/metadata-includes-morph-version.setup
+++ b/tests.as-root/metadata-includes-morph-version.setup
@@ -27,7 +27,6 @@ cat <<EOF > hello-tarball.morph
{
"name": "hello-tarball",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
"strata": [
{
diff --git a/tests.as-root/metadata-includes-repo-alias.setup b/tests.as-root/metadata-includes-repo-alias.setup
index 2284cfb9..f0aefb3c 100755
--- a/tests.as-root/metadata-includes-repo-alias.setup
+++ b/tests.as-root/metadata-includes-repo-alias.setup
@@ -27,7 +27,6 @@ cat <<EOF > hello-tarball.morph
{
"name": "hello-tarball",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
"strata": [
{
diff --git a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
index 8229127d..93cd135f 100755
--- a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
+++ b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
@@ -16,9 +16,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-## A system-kind of rootfs-tarball should build both kernel image and
-## a tarball with the root filesystem.
-
set -eu
# Disable test on versions of Python before 2.7.
diff --git a/tests.as-root/setup b/tests.as-root/setup
index eea9e061..2ab1cd94 100755
--- a/tests.as-root/setup
+++ b/tests.as-root/setup
@@ -134,9 +134,7 @@ git add tools-stratum.morph
cat <<EOF > hello-system.morph
name: hello-system
kind: system
-system-kind: rootfs-tarball
arch: `uname -m`
-disk-size: 1G
strata:
- morph: hello-stratum
repo: test:morphs
@@ -163,9 +161,7 @@ git add linux-stratum.morph
cat <<EOF > linux-system.morph
name: linux-system
kind: system
-system-kind: rootfs-tarball
arch: `uname -m`
-disk-size: 1G
strata:
- morph: hello-stratum
repo: test:morphs
diff --git a/tests.as-root/system-overlap.script b/tests.as-root/system-overlap.script
index 6e6ef2ac..41ff7536 100755
--- a/tests.as-root/system-overlap.script
+++ b/tests.as-root/system-overlap.script
@@ -31,9 +31,7 @@ cat <<EOF >overlap-system.morph
{
"name": "overlap-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
- "disk-size": "1G",
"strata": [
{
"morph": "foo-baz-stratum",
diff --git a/tests.as-root/tarball-image-is-sensible.setup b/tests.as-root/tarball-image-is-sensible.setup
index fa904c2c..5fd7b283 100755
--- a/tests.as-root/tarball-image-is-sensible.setup
+++ b/tests.as-root/tarball-image-is-sensible.setup
@@ -46,7 +46,6 @@ cat <<EOF > hello-tarball.morph
{
"name": "hello-tarball",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
"strata": [
{
diff --git a/tests.branching.disabled/workflow-petrify.stdout b/tests.branching.disabled/workflow-petrify.stdout
index 9f0cfb0c..a0ce82f4 100644
--- a/tests.branching.disabled/workflow-petrify.stdout
+++ b/tests.branching.disabled/workflow-petrify.stdout
@@ -2,9 +2,7 @@ test/petrify after petrifying:
{
"name": "hello-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "x86_64",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
@@ -56,9 +54,7 @@ test/petrify after editing a chunk:
{
"name": "hello-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "x86_64",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
@@ -109,9 +105,7 @@ test/unpetrify after unpetrifying:
{
"name": "hello-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "x86_64",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
diff --git a/tests.branching/edit-updates-stratum-build-depends.stdout b/tests.branching/edit-updates-stratum-build-depends.stdout
index 1c6eb8e3..7120ef50 100644
--- a/tests.branching/edit-updates-stratum-build-depends.stdout
+++ b/tests.branching/edit-updates-stratum-build-depends.stdout
@@ -13,10 +13,10 @@ index 73ed482..475fe0f 100644
kind: stratum
name: hello-stratum
diff --git a/hello-system.morph b/hello-system.morph
-index 721473c..1537f53 100644
+index 3f7b4d3..199c924 100644
--- a/hello-system.morph
+++ b/hello-system.morph
-@@ -3,9 +3,9 @@ kind: system
+@@ -3,5 +3,6 @@ kind: system
name: hello-system
strata:
- morph: hello-stratum
@@ -24,27 +24,3 @@ index 721473c..1537f53 100644
+ ref: newbranch
repo: test:morphs
+ unpetrify-ref: master
- - morph: xyzzy-stratum
- ref: master
- repo: test:morphs
--system-kind: rootfs-tarball
-diff --git a/xyzzy-stratum.morph b/xyzzy-stratum.morph
-index e302037..bcf5b57 100644
---- a/xyzzy-stratum.morph
-+++ b/xyzzy-stratum.morph
-@@ -1,11 +1,13 @@
- build-depends:
- - morph: hello-stratum
-- ref: master
-+ ref: newbranch
- repo: test:morphs
-+ unpetrify-ref: master
- chunks:
- - build-depends: []
- name: hello
-- ref: master
-+ ref: newbranch
- repo: test:hello
-+ unpetrify-ref: master
- kind: stratum
- name: xyzzy-stratum
diff --git a/tests.branching/edit-updates-stratum.stdout b/tests.branching/edit-updates-stratum.stdout
index 32eb820d..7120ef50 100644
--- a/tests.branching/edit-updates-stratum.stdout
+++ b/tests.branching/edit-updates-stratum.stdout
@@ -13,15 +13,14 @@ index 73ed482..475fe0f 100644
kind: stratum
name: hello-stratum
diff --git a/hello-system.morph b/hello-system.morph
-index b0fed3b..199c924 100644
+index 3f7b4d3..199c924 100644
--- a/hello-system.morph
+++ b/hello-system.morph
-@@ -3,6 +3,6 @@ kind: system
+@@ -3,5 +3,6 @@ kind: system
name: hello-system
strata:
- morph: hello-stratum
- ref: master
+ ref: newbranch
repo: test:morphs
--system-kind: rootfs-tarball
+ unpetrify-ref: master
diff --git a/tests.branching/foreach-handles-full-urls.stdout b/tests.branching/foreach-handles-full-urls.stdout
index 3abae62c..cee2f70a 100644
--- a/tests.branching/foreach-handles-full-urls.stdout
+++ b/tests.branching/foreach-handles-full-urls.stdout
@@ -1,4 +1,4 @@
file://TMP/morphs
# On branch master
-nothing to commit (working directory clean)
+nothing to commit, working directory clean
diff --git a/tests.branching/setup b/tests.branching/setup
index 589f19ed..1263e3b6 100755
--- a/tests.branching/setup
+++ b/tests.branching/setup
@@ -55,7 +55,6 @@ strata:
- morph: hello-stratum
ref: master
repo: test:morphs
-system-kind: rootfs-tarball
EOF
cat <<EOF > "$DATADIR/morphs/hello-stratum.morph"
diff --git a/tests.branching/tag-creates-commit-and-tag.stdout b/tests.branching/tag-creates-commit-and-tag.stdout
index 598e28bf..b6098eb5 100644
--- a/tests.branching/tag-creates-commit-and-tag.stdout
+++ b/tests.branching/tag-creates-commit-and-tag.stdout
@@ -5,7 +5,7 @@ Date: Tue Jul 31 16:51:54 2012 +0000
Message
-commit 9509c9c379f8ba643b2ad9a6ec50ecf96993cbb5
+commit 6895ed63425bedb3dccaea3f258c705b1600f6be
Author: developer <developer@example.com>
Date: Tue Jul 31 16:51:54 2012 +0000
@@ -26,10 +26,10 @@ index 73ed482..2218f63 100644
kind: stratum
name: hello-stratum
diff --git a/hello-system.morph b/hello-system.morph
-index b0fed3b..4c4ee3e 100644
+index 3f7b4d3..d909347 100644
--- a/hello-system.morph
+++ b/hello-system.morph
-@@ -3,6 +3,7 @@ kind: system
+@@ -3,5 +3,6 @@ kind: system
name: hello-system
strata:
- morph: hello-stratum
@@ -37,10 +37,9 @@ index b0fed3b..4c4ee3e 100644
+ ref: example-tag
repo: test:morphs
+ unpetrify-ref: master
- system-kind: rootfs-tarball
test:morphs
-commit 9509c9c379f8ba643b2ad9a6ec50ecf96993cbb5
+commit 6895ed63425bedb3dccaea3f258c705b1600f6be
Author: developer <developer@example.com>
AuthorDate: Tue Jul 31 16:51:54 2012 +0000
Commit: developer <developer@example.com>
@@ -48,7 +47,7 @@ CommitDate: Tue Jul 31 16:51:54 2012 +0000
Message
-commit 1fe013ee284724848d65096d4d88f612fae56fc6
+commit e11a36aa9e4c998c41a3ec3209324b9318e484ae
Author: developer <developer@example.com>
AuthorDate: Tue Jul 31 16:51:54 2012 +0000
Commit: developer <developer@example.com>
diff --git a/tests.branching/tag-tag-works-as-expected.stdout b/tests.branching/tag-tag-works-as-expected.stdout
index 242b2d4e..98a3be81 100644
--- a/tests.branching/tag-tag-works-as-expected.stdout
+++ b/tests.branching/tag-tag-works-as-expected.stdout
@@ -9,7 +9,7 @@ Date: Tue Jul 31 16:51:54 2012 +0000
Second
-commit ca7594f436da55bda2cfff2c6484d11aa0ea4cbc
+commit 476e4ff4b19c38eb64ad3a151b7c58a7ab95c9ee
Author: developer <developer@example.com>
Date: Tue Jul 31 16:51:54 2012 +0000
@@ -30,10 +30,10 @@ index 73ed482..2218f63 100644
kind: stratum
name: hello-stratum
diff --git a/hello-system.morph b/hello-system.morph
-index b0fed3b..875d73a 100644
+index 3f7b4d3..431e15d 100644
--- a/hello-system.morph
+++ b/hello-system.morph
-@@ -3,6 +3,7 @@ kind: system
+@@ -3,5 +3,6 @@ kind: system
name: hello-system
strata:
- morph: hello-stratum
@@ -41,10 +41,9 @@ index b0fed3b..875d73a 100644
+ ref: tagged-tag
repo: test:morphs
+ unpetrify-ref: master
- system-kind: rootfs-tarball
test:morphs
-commit ca7594f436da55bda2cfff2c6484d11aa0ea4cbc
+commit 476e4ff4b19c38eb64ad3a151b7c58a7ab95c9ee
Author: developer <developer@example.com>
AuthorDate: Tue Jul 31 16:51:54 2012 +0000
Commit: developer <developer@example.com>
@@ -52,7 +51,7 @@ CommitDate: Tue Jul 31 16:51:54 2012 +0000
Second
-commit 1fe013ee284724848d65096d4d88f612fae56fc6
+commit e11a36aa9e4c998c41a3ec3209324b9318e484ae
Author: developer <developer@example.com>
AuthorDate: Tue Jul 31 16:51:54 2012 +0000
Commit: developer <developer@example.com>
diff --git a/tests.branching/tag-works-with-multiple-morphs-repos.script b/tests.branching/tag-works-with-multiple-morphs-repos.script
index 38d73852..f6ecbf32 100755
--- a/tests.branching/tag-works-with-multiple-morphs-repos.script
+++ b/tests.branching/tag-works-with-multiple-morphs-repos.script
@@ -32,9 +32,7 @@ mkdir "$DATADIR/morphs1"
cat <<EOF > "$DATADIR/morphs1/test-system.morph"
name: test-system
kind: system
-system-kind: rootfs-tarball
arch: $(uname -m)
-disk-size: 1G
strata:
- morph: stratum1
ref: master
diff --git a/tests.branching/tag-works-with-multiple-morphs-repos.stdout b/tests.branching/tag-works-with-multiple-morphs-repos.stdout
index 938e41ff..81fbf20d 100644
--- a/tests.branching/tag-works-with-multiple-morphs-repos.stdout
+++ b/tests.branching/tag-works-with-multiple-morphs-repos.stdout
@@ -4,7 +4,7 @@ Date: Tue Jul 31 16:51:54 2012 +0000
create tag
-commit 7253f9b1471f1983e07823d2b84582dde9fb108d
+commit 7323ed5dcc47715e7303fd36d537aef98a04df9a
Author: developer <developer@example.com>
Date: Tue Jul 31 16:51:54 2012 +0000
@@ -67,11 +67,11 @@ index 0000000..610fae6
+ repo: test:hello
+ unpetrify-ref: master
diff --git a/test-system.morph b/test-system.morph
-index 44d5ae5..08f9adc 100644
+index 62d3b08..edb5745 100644
--- a/test-system.morph
+++ b/test-system.morph
-@@ -5,8 +5,11 @@ arch: x86_64
- disk-size: 1G
+@@ -3,8 +3,11 @@ kind: system
+ arch: x86_64
strata:
- morph: stratum1
- ref: master
@@ -85,7 +85,7 @@ index 44d5ae5..08f9adc 100644
+ repo: test:morphs1
+ unpetrify-ref: master
+ unpetrify-repo: test:morphs2
-commit 7253f9b1471f1983e07823d2b84582dde9fb108d
+commit 7323ed5dcc47715e7303fd36d537aef98a04df9a
Author: developer <developer@example.com>
AuthorDate: Tue Jul 31 16:51:54 2012 +0000
Commit: developer <developer@example.com>
@@ -93,10 +93,10 @@ CommitDate: Tue Jul 31 16:51:54 2012 +0000
create tag
---
- stratum1.morph | 9 ++++++---
- stratum2.morph | 14 ++++++++++++++
- stratum3.morph | 9 +++++++++
- test-system.morph | 9 ++++++---
+ stratum1.morph | 9 ++++++---
+ stratum2.morph | 14 ++++++++++++++
+ stratum3.morph | 9 +++++++++
+ test-system.morph | 9 ++++++---
4 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/stratum1.morph b/stratum1.morph
@@ -156,11 +156,11 @@ index 0000000..610fae6
+ repo: test:hello
+ unpetrify-ref: master
diff --git a/test-system.morph b/test-system.morph
-index 44d5ae5..08f9adc 100644
+index 62d3b08..edb5745 100644
--- a/test-system.morph
+++ b/test-system.morph
-@@ -5,8 +5,11 @@ arch: x86_64
- disk-size: 1G
+@@ -3,8 +3,11 @@ kind: system
+ arch: x86_64
strata:
- morph: stratum1
- ref: master
diff --git a/tests.build/setup b/tests.build/setup
index 499dbb21..563482e6 100755
--- a/tests.build/setup
+++ b/tests.build/setup
@@ -108,8 +108,6 @@ cat <<EOF > hello-system.morph
"name": "hello-system",
"kind": "system",
"arch": "$(uname -m)",
- "system-kind": "rootfs-tarball",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
diff --git a/tests.deploy/deploy-cluster.script b/tests.deploy/deploy-cluster.script
index 917ac717..0efc8d3c 100755
--- a/tests.deploy/deploy-cluster.script
+++ b/tests.deploy/deploy-cluster.script
@@ -18,7 +18,6 @@
# Test "morph deploy" by deploying the systems in cluster morphology.
-
set -eu
@@ -35,12 +34,13 @@ cd "$DATADIR/workspace/branch1"
linux-system-2.HOSTNAME="baserock-rocks-even-more" \
> /dev/null
-test -e hello-system.img
-test -e linux-system-1.tar
-test -e linux-system-2.tar
+outputdir=test:morphs
+test -e $outputdir/hello-system.img
+test -e $outputdir/linux-system-1.tar
+test -e $outputdir/linux-system-2.tar
-hostname1=$(tar -xf linux-system-1.tar ./etc/hostname -O)
-hostname2=$(tar -xf linux-system-2.tar ./etc/hostname -O)
+hostname1=$(tar -xf $outputdir/linux-system-1.tar ./etc/hostname -O)
+hostname2=$(tar -xf $outputdir/linux-system-2.tar ./etc/hostname -O)
[ "$hostname1" = baserock-rocks ]
[ "$hostname2" = baserock-rocks-even-more ]
diff --git a/tests.deploy/deploy-rawdisk.script b/tests.deploy/deploy-rawdisk.script
index ebda50c7..257ef0dd 100755
--- a/tests.deploy/deploy-rawdisk.script
+++ b/tests.deploy/deploy-rawdisk.script
@@ -27,5 +27,7 @@ cd "$DATADIR/workspace/branch1"
"$SRCDIR/scripts/test-morph" build linux-system
"$SRCDIR/scripts/test-morph" --log "$DATADIR/deploy.log" \
deploy rawdisk_test_cluster > /dev/null
-test -e disk.img
+
+outputdir="test:morphs"
+test -e $outputdir/disk.img
diff --git a/tests.deploy/setup b/tests.deploy/setup
index 88488a91..5f83747e 100755
--- a/tests.deploy/setup
+++ b/tests.deploy/setup
@@ -112,7 +112,6 @@ cat <<EOF > hello-system.morph
{
"name": "hello-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
"strata": [
{
@@ -153,7 +152,6 @@ cat <<EOF > linux-system.morph
{
"name": "linux-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
"strata": [
{
diff --git a/tests.merging/setup b/tests.merging/setup
index 11fdf0f1..2fdf9db0 100755
--- a/tests.merging/setup
+++ b/tests.merging/setup
@@ -51,9 +51,7 @@ cat <<EOF > "$DATADIR/morphs/hello-system.morph"
{
"name": "hello-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
diff --git a/tests/setup b/tests/setup
index 91a30236..07643ddc 100755
--- a/tests/setup
+++ b/tests/setup
@@ -107,8 +107,6 @@ cat <<EOF > hello-system.morph
{
"name": "hello-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
- "disk-size": "1G",
"strata": [
{
"morph": "hello-stratum",
diff --git a/tests/show-dependencies.setup b/tests/show-dependencies.setup
index 9c983d8a..edb9b6ab 100755
--- a/tests/show-dependencies.setup
+++ b/tests/show-dependencies.setup
@@ -349,7 +349,6 @@ cat <<EOF > xfce-system.morph
{
"name": "xfce-system",
"kind": "system",
- "system-kind": "rootfs-tarball",
"arch": "$(uname -m)",
"strata": [
{
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn
index f523ebcd..cd3f7a0e 100644
--- a/yarns/branches-workspaces.yarn
+++ b/yarns/branches-workspaces.yarn
@@ -352,3 +352,11 @@ Petrifying also leaves null refs unmolested
AND remembering all refs in foo
AND petrifying foo
THEN in branch foo, system test-system refs test-stratum in None
+
+Generating a manifest works
+
+ SCENARIO morph generates a manifest
+ GIVEN a workspace
+ AND a system artifact
+ WHEN morph generates a manifest
+ THEN the manifest is generated
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index e35e4219..6e1fae18 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -382,3 +382,40 @@ Tagging.
assert_morphologies_are_petrified "$MATCH_1" temptemptemp
done
+Generating a manifest.
+
+ IMPLEMENTS GIVEN a system artifact
+ mkdir "$DATADIR/hello_world"
+
+ git init "$DATADIR/hello_world"
+ touch "$DATADIR/hello_world/configure.ac"
+ run_in "$DATADIR/hello_world" git add configure.ac
+ run_in "$DATADIR/hello_world" git commit -m 'Add configure.ac'
+
+ mkdir "$DATADIR/baserock"
+ run_in "$DATADIR/hello_world" cat << EOF \
+ > "$DATADIR/baserock/hello_world.meta"
+ {
+ "artifact-name": "hello_world",
+ "cache-key":
+ "ab8d00a80298a842446ce23507cea6b4d0e34c7ddfa05c67f460318b04d21308",
+ "kind": "chunk",
+ "morphology": "hello_world.morph",
+ "original_ref": "$(run_in "$DATADIR/hello_world" git rev-parse HEAD)",
+ "repo": "file://$DATADIR/hello_world",
+ "repo-alias": "upstream:hello_world",
+ "sha1": "$(run_in "$DATADIR/hello_world" git rev-parse HEAD)",
+ "source-name": "hello_world"
+ }
+ EOF
+ run_in "$DATADIR" tar -c baserock > "$DATADIR/artifact.tar"
+
+ IMPLEMENTS WHEN morph generates a manifest
+ run_morph generate-manifest "$DATADIR/artifact.tar" > "$DATADIR/manifest"
+
+ IMPLEMENTS THEN the manifest is generated
+
+ # Generated manifest should contain the name of the repository
+ if ! grep -q hello_world "$DATADIR/manifest"; then
+ die "Output isn't what we expect"
+ fi