summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/app.py8
-rw-r--r--morphlib/artifactresolver.py8
-rw-r--r--morphlib/buildcommand.py4
-rw-r--r--morphlib/morph2.py3
-rw-r--r--morphlib/morphset.py8
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py7
6 files changed, 25 insertions, 13 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
diff --git a/morphlib/morphset.py b/morphlib/morphset.py
index 3c07d58e..9ef1e804 100644
--- a/morphlib/morphset.py
+++ b/morphlib/morphset.py
@@ -95,9 +95,11 @@ class MorphologySet(object):
repo_url, ref, morph = self._find_spec(
system_morph['strata'], stratum_name)
- if repo_url is None:
+ if (repo_url, ref, morph) == (None, None, None):
raise StratumNotInSystemError(system_morph['name'], stratum_name)
- m = self._get_morphology(repo_url, ref, '%s.morph' % morph)
+ m = self._get_morphology(repo_url or system_morph.repo_url,
+ ref or system_morph.ref,
+ '%s.morph' % morph)
if m is None:
raise StratumNotInSetError(stratum_name)
return m
@@ -118,7 +120,7 @@ class MorphologySet(object):
repo_url, ref, morph = self._find_spec(
stratum_morph['chunks'], chunk_name)
- if repo_url is None:
+ if (repo_url, ref, morph) == (None, None, None):
raise ChunkNotInStratumError(stratum_morph['name'], chunk_name)
return repo_url, ref, morph
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py
index 39552ef0..edda7d9c 100644
--- a/morphlib/plugins/branch_and_merge_new_plugin.py
+++ b/morphlib/plugins/branch_and_merge_new_plugin.py
@@ -266,7 +266,9 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
# of triplets (repo url, ref, filename).
return [
- (spec['repo'], spec['ref'], '%s.morph' % spec['morph'])
+ (spec['repo'] or morph.repo_url,
+ spec['ref'] or morph.ref,
+ '%s.morph' % spec['morph'])
for spec in specs
]
@@ -679,6 +681,9 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
#TODO: Stop using app.resolve_ref
def resolve_refs(morphs):
for repo, ref in morphs.list_refs():
+ # You can't resolve null refs, so don't attempt to.
+ if repo is None or ref is None:
+ continue
# TODO: Handle refs that are only in workspace in general
if (repo == sb.root_repository_url
and ref == sb.system_branch_name):