diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-02-28 09:55:42 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-02-28 09:55:42 +0000 |
commit | c13d497e04ef3f57f1b619b1dcf927128d5b2422 (patch) | |
tree | 4f70a06e87abc466d3b2dfa204be6e6b741575e7 | |
parent | 9f4d21489bf4c54fe9ab3f67384676f0ce4df546 (diff) | |
download | morph-c13d497e04ef3f57f1b619b1dcf927128d5b2422.tar.gz |
blix the cat
-rw-r--r-- | distbuild/serialise.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/distbuild/serialise.py b/distbuild/serialise.py index caf8398b..a4d1cd99 100644 --- a/distbuild/serialise.py +++ b/distbuild/serialise.py @@ -40,15 +40,16 @@ def serialise_artifact(artifact): def encode_artifact(artifact): artifact_dic = { - # source? - that will be constructed during deserialisation 'name': artifact.name, 'cache_id': artifact.cache_id, 'cache_key': artifact.cache_key, 'dependencies': artifact.dependencies, - 'dependants': artifact.dependants, + 'dependents': artifact.dependents, 'metadata_version': artifact.metadata_version, } + return artifact_dic + def encode_artifacts(artifacts): return {name: encode_artifact(artifact) for (name, artifact) in artifacts.iteritems()} @@ -62,8 +63,12 @@ def serialise_artifact(artifact): 'tree': source.tree, 'morphology': encode_morphology(source.morphology), 'filename': source.filename, - 'artifacts': encode_artifacts(source.artifacts), + 'artifacts': 'Blix the cat' + #'artifacts': encode_artifacts(source.artifacts), } + + logging.debug('source_dic: %s' % source_dic) + if source.morphology['kind'] == 'chunk': source_dic['build_mode'] = source.build_mode source_dic['prefix'] = source.prefix @@ -100,6 +105,9 @@ def serialise_artifact(artifact): encoded[a.cache_key] = encode_single_artifact(a, encoded) encoded['_root'] = artifact.cache_key + + logging.debug('encoded: %s' % encoded) + return json.dumps(encoded) @@ -152,6 +160,8 @@ def deserialise_artifact(encoded): def unserialise_source(le_dict): '''Convert a dict into a Source object.''' + logging.debug('unserialise_source: le_dict: %s' % le_dict) + morphology = unserialise_morphology(le_dict['morphology']) source = morphlib.source.Source(le_dict['repo_name'], le_dict['original_ref'], @@ -185,6 +195,8 @@ def deserialise_artifact(encoded): with open('/tmp/%s', 'w') as f: f.write(encoded) + logging.debug('encoded: %s' % encoded) + le_dicts = json.loads(encoded) cache_keys = [k for k in le_dicts.keys() if k != '_root'] artifacts = {} |