summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-07-03 13:42:57 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-07-03 17:59:14 +0000
commit63751d06e6d7fd240c69f127fa06d811f3dd438d (patch)
treefbcb2279d01711cc4cdb338e723c1b211f88427e
parent11b97b7ba9be3389511740306971a9498d3e3bf7 (diff)
downloadmorph-63751d06e6d7fd240c69f127fa06d811f3dd438d.tar.gz
Add information about the whereabouts of the morphology to Sources
In order to maintain the ability to keep chunk morphologies in the source repository as well as in the definitions repository the Source object for a chunk needs to be able to know about two different repositories, one for the morphology and one for the chunk source.
-rw-r--r--morphlib/artifactresolver.py5
-rw-r--r--morphlib/plugins/update_gits_plugin.py5
-rw-r--r--morphlib/source.py6
3 files changed, 10 insertions, 6 deletions
diff --git a/morphlib/artifactresolver.py b/morphlib/artifactresolver.py
index c18042a3..7f21336f 100644
--- a/morphlib/artifactresolver.py
+++ b/morphlib/artifactresolver.py
@@ -191,10 +191,9 @@ class ArtifactResolver(object):
name_to_processed_artifacts = {}
for info in source.morphology['chunks']:
+ filename = morphlib.util.sanitise_morphology_path(info['morph'])
chunk_source = self._source_pool.lookup(
- info['repo'],
- info['ref'],
- morphlib.util.sanitise_morphology_path(info['morph']))
+ info['repo'], info['ref'], filename)
chunk_name = chunk_source.morphology['name']
diff --git a/morphlib/plugins/update_gits_plugin.py b/morphlib/plugins/update_gits_plugin.py
index 46686391..fa530698 100644
--- a/morphlib/plugins/update_gits_plugin.py
+++ b/morphlib/plugins/update_gits_plugin.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 Codethink Limited
+# Copyright (C) 2012-2014 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
@@ -60,7 +60,8 @@ class UpdateGitsPlugin(cliapp.Plugin):
subs_to_process = set()
- def visit(reponame, ref, filename, absref, tree, morphology):
+ def visit(reponame, ref, filename, absref, tree, morphology,
+ morphology_repo, morphology_ref):
app.status(msg='Updating %(repo_name)s %(ref)s %(filename)s',
repo_name=reponame, ref=ref, filename=filename)
assert cache.has_repo(reponame)
diff --git a/morphlib/source.py b/morphlib/source.py
index 2dbabad1..335aedf0 100644
--- a/morphlib/source.py
+++ b/morphlib/source.py
@@ -29,6 +29,8 @@ class Source(object):
* ``sha1`` -- the absolute git commit id for the revision we use
* ``tree`` -- the SHA1 of the tree corresponding to the commit
* ``morphology`` -- the in-memory representation of the morphology we use
+ * ``morphology_repo`` -- the repo containing the morphology
+ * ``morphology_ref`` -- the ref in the repo containing the morphology
* ``filename`` -- basename of the morphology filename
* ``artifacts`` -- the set of artifacts this source produces.
* ``split_rules`` -- rules for splitting the source's produced artifacts
@@ -36,13 +38,15 @@ class Source(object):
'''
def __init__(self, repo_name, original_ref, sha1, tree, morphology,
- filename):
+ morphology_repo, morphology_ref, filename):
self.repo = None
self.repo_name = repo_name
self.original_ref = original_ref
self.sha1 = sha1
self.tree = tree
self.morphology = morphology
+ self.morphology_repo = morphology_repo
+ self.morphology_ref = morphology_ref
self.filename = filename
kind = morphology['kind']