summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-09-25 16:53:50 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-09-26 11:20:31 +0000
commit6a216934edb2423c9aa347329ea029041927a413 (patch)
tree770aa37c3104f3396dbad2336dcdb5c5b6d9ee6f
parent3d93d272079b602aefe5d3bcd660d4a3307f3aad (diff)
downloaddefinitions-6a216934edb2423c9aa347329ea029041927a413.tar.gz
Allow building with null repo/ref
-rw-r--r--morphlib/app.py8
-rw-r--r--morphlib/artifactresolver.py8
-rw-r--r--morphlib/buildcommand.py4
-rw-r--r--morphlib/morph2.py3
4 files changed, 14 insertions, 9 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 08b020ff..a0833d45 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -318,11 +318,15 @@ class Morph(cliapp.Application):
visit(reponame, ref, filename, absref, tree, morphology)
if morphology['kind'] == 'system':
- queue.extend((s['repo'], s['ref'], '%s.morph' % s['morph'])
+ queue.extend((s['repo'] or reponame,
+ s['ref'] or ref,
+ '%s.morph' % s['morph'])
for s in morphology['strata'])
elif morphology['kind'] == 'stratum':
if morphology['build-depends']:
- queue.extend((s['repo'], s['ref'], '%s.morph' % s['morph'])
+ queue.extend((s['repo'] or reponame,
+ s['ref'] or ref,
+ '%s.morph' % s['morph'])
for s in morphology['build-depends'])
queue.extend((c['repo'], c['ref'], '%s.morph' % c['morph'])
for c in morphology['chunks'])
diff --git a/morphlib/artifactresolver.py b/morphlib/artifactresolver.py
index 186d5357..17f038a2 100644
--- a/morphlib/artifactresolver.py
+++ b/morphlib/artifactresolver.py
@@ -155,8 +155,8 @@ class ArtifactResolver(object):
for info in source.morphology['strata']:
stratum_source = self._source_pool.lookup(
- info['repo'],
- info['ref'],
+ info['repo'] or source.repo_name,
+ info['ref'] or source.original_ref,
'%s.morph' % info['morph'])
stratum_name = stratum_source.morphology.builds_artifacts[0]
@@ -178,8 +178,8 @@ class ArtifactResolver(object):
if stratum.source.morphology['build-depends']:
for stratum_info in stratum.source.morphology['build-depends']:
other_source = self._source_pool.lookup(
- stratum_info['repo'],
- stratum_info['ref'],
+ stratum_info['repo'] or stratum.source.repo_name,
+ stratum_info['ref'] or stratum.source.original_ref,
'%s.morph' % stratum_info['morph'])
other_stratum = self._get_artifact(
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index d7007233..e76b7a14 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -163,8 +163,8 @@ class BuildCommand(object):
def _validate_cross_refs_for_xxx(self, src, srcpool, specs, wanted):
for spec in specs:
- repo_name = spec['repo']
- ref = spec['ref']
+ repo_name = spec['repo'] or src.repo_name
+ ref = spec['ref'] or src.original_ref
filename = '%s.morph' % spec['morph']
logging.debug(
'Validating cross ref to %s:%s:%s' %
diff --git a/morphlib/morph2.py b/morphlib/morph2.py
index a733ce77..6975e699 100644
--- a/morphlib/morph2.py
+++ b/morphlib/morph2.py
@@ -252,7 +252,8 @@ class Morphology(object):
continue
value = self._apply_changes_for_key(key, live_dict, original_dict)
- if value is not None:
+ # VILE HACK to preserve nulls in repo/ref fields
+ if value is not None or key in ('repo', 'ref'):
output_dict[key] = value
return output_dict