summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-04-11 16:12:04 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-04-15 09:20:27 +0000
commit32cfa64eb25dc515b7f53ac5557ed23f679008b3 (patch)
tree3e13d3d74227a763cde7f27e666223fca0567175
parent9ea9f7b5ae9b7a20bf34c3901fcfd059c9619319 (diff)
downloadmorph-32cfa64eb25dc515b7f53ac5557ed23f679008b3.tar.gz
Use exact filenames to refer to morphology files
Rather than repeatedly stripping and appending an optional .morph extension morphology names, instead always use the file path of the morphology relative to the definitions repository. Also, make the repo and ref of chunk morphology triplets be some branch of the definitions repository, rather than the repo/ref given in the morphology itself (which is the location of the chunk source).
-rw-r--r--morphlib/app.py8
-rw-r--r--morphlib/artifactresolver.py6
-rw-r--r--morphlib/buildcommand.py2
-rw-r--r--morphlib/morphset.py2
-rw-r--r--morphlib/plugins/build_plugin.py7
-rw-r--r--morphlib/source.py2
6 files changed, 14 insertions, 13 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index e7093698..1574a71f 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -286,7 +286,7 @@ class Morph(cliapp.Application):
while args:
assert len(args) >= 2, args
- yield args[0], args[1], args[2] + ".morph"
+ yield args[0], args[1], args[2]
args = args[3:]
def create_source_pool(self, lrc, rrc, triplet):
@@ -386,17 +386,17 @@ class Morph(cliapp.Application):
elif morphology['kind'] == 'system':
queue.extend((s.get('repo') or reponame,
s.get('ref') or ref,
- '%s.morph' % s['morph'])
+ s['morph'])
for s in morphology['strata'])
elif morphology['kind'] == 'stratum':
if morphology['build-depends']:
queue.extend((s.get('repo') or reponame,
s.get('ref') or ref,
- '%s.morph' % s['morph'])
+ s['morph'])
for s in morphology['build-depends'])
queue.extend((reponame,
ref,
- '%s.morph' % c['morph'])
+ c['morph'])
for c in morphology['chunks'])
def cache_repo_and_submodules(self, cache, url, ref, done):
diff --git a/morphlib/artifactresolver.py b/morphlib/artifactresolver.py
index 00976eb7..aab65506 100644
--- a/morphlib/artifactresolver.py
+++ b/morphlib/artifactresolver.py
@@ -142,7 +142,7 @@ class ArtifactResolver(object):
stratum_source = self._source_pool.lookup(
info.get('repo') or source.repo_name,
info.get('ref') or source.original_ref,
- '%s.morph' % info['morph'])
+ info['morph'])
stratum_name = stratum_source.morphology['name']
matches, overlaps, unmatched = source.split_rules.partition(
@@ -167,7 +167,7 @@ class ArtifactResolver(object):
other_source = self._source_pool.lookup(
stratum_info.get('repo') or source.repo_name,
stratum_info.get('ref') or source.original_ref,
- '%s.morph' % stratum_info['morph'])
+ stratum_info['morph'])
# Make every stratum artifact this stratum source produces
# depend on every stratum artifact the other stratum source
@@ -194,7 +194,7 @@ class ArtifactResolver(object):
chunk_source = self._source_pool.lookup(
info['repo'],
info['ref'],
- '%s.morph' % info['morph'])
+ info['morph'])
chunk_name = chunk_source.morphology['name']
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index 7ad7909d..d15061d6 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -231,7 +231,7 @@ class BuildCommand(object):
for spec in specs:
repo_name = spec.get('repo') or src.repo_name
ref = spec.get('ref') or src.original_ref
- filename = '%s.morph' % spec['morph']
+ filename = spec['morph']
logging.debug(
'Validating cross ref to %s:%s:%s' %
(repo_name, ref, filename))
diff --git a/morphlib/morphset.py b/morphlib/morphset.py
index dedbabd5..622e6af1 100644
--- a/morphlib/morphset.py
+++ b/morphlib/morphset.py
@@ -196,7 +196,7 @@ class MorphologySet(object):
def wanted_spec(m, kind, spec):
return (spec.get('repo') == repo_url and
spec.get('ref') == orig_ref and
- spec['morph'] + '.morph' == morph_filename)
+ spec['morph'] == morph_filename)
def process_spec(m, kind, spec):
spec['unpetrify-ref'] = spec.get('ref')
diff --git a/morphlib/plugins/build_plugin.py b/morphlib/plugins/build_plugin.py
index 62009bcd..f8b9cd2f 100644
--- a/morphlib/plugins/build_plugin.py
+++ b/morphlib/plugins/build_plugin.py
@@ -133,7 +133,7 @@ class BuildPlugin(cliapp.Plugin):
self.app.settings['cachedir'],
self.app.settings['cachedir-min-space'])
- system_name = morphlib.util.strip_morph_extension(args[0])
+ system_filename = args[0]
ws = morphlib.workspace.open('.')
sb = morphlib.sysbranchdir.open_from_within('.')
@@ -158,7 +158,8 @@ class BuildPlugin(cliapp.Plugin):
self.app.status(msg='Starting build %(uuid)s', uuid=build_uuid)
self.app.status(msg='Collecting morphologies involved in '
'building %(system)s from %(branch)s',
- system=system_name, branch=sb.system_branch_name)
+ system=system_filename,
+ branch=sb.system_branch_name)
bb = morphlib.buildbranch.BuildBranch(sb, build_ref_prefix,
push_temporary=push)
@@ -187,4 +188,4 @@ class BuildPlugin(cliapp.Plugin):
build_command.build([bb.root_repo_url,
bb.root_ref,
- system_name])
+ system_filename])
diff --git a/morphlib/source.py b/morphlib/source.py
index 75a2e4de..2dbabad1 100644
--- a/morphlib/source.py
+++ b/morphlib/source.py
@@ -55,4 +55,4 @@ class Source(object):
def __str__(self): # pragma: no cover
return '%s|%s|%s' % (self.repo_name,
self.original_ref,
- self.filename[:-len('.morph')])
+ self.filename)