summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-02-25 07:59:23 +0100
committerJürg Billeter <j@bitron.ch>2019-02-28 12:12:38 +0100
commit581b7f992ca0ff0f546493512afed83ff1487712 (patch)
tree294f96e8d3f3b3f67f26c23c980325aa9f26123c
parent7e88f2e60d6ee00e2572be2f952b207b314d5db9 (diff)
downloadbuildstream-581b7f992ca0ff0f546493512afed83ff1487712.tar.gz
element.py: Use virtual artifact directory for metadata
-rw-r--r--buildstream/element.py43
1 files changed, 23 insertions, 20 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 1094141e7..35475a6b6 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -2742,7 +2742,7 @@ class Element(Plugin):
def __get_artifact_metadata_keys(self, key=None):
# Now extract it and possibly derive the key
- artifact_base, key = self.__extract(key)
+ artifact_vdir, key = self.__get_artifact_directory(key)
# Now try the cache, once we're sure about the key
if key in self.__metadata_keys:
@@ -2750,8 +2750,8 @@ class Element(Plugin):
self.__metadata_keys[key]['weak'])
# Parse the expensive yaml now and cache the result
- meta_file = os.path.join(artifact_base, 'meta', 'keys.yaml')
- meta = _yaml.load(meta_file)
+ meta_file = artifact_vdir._objpath(['meta', 'keys.yaml'])
+ meta = _yaml.load(meta_file, shortname='meta/keys.yaml')
strong_key = meta['strong']
weak_key = meta['weak']
@@ -2774,15 +2774,15 @@ class Element(Plugin):
def __get_artifact_metadata_dependencies(self, key=None):
# Extract it and possibly derive the key
- artifact_base, key = self.__extract(key)
+ artifact_vdir, key = self.__get_artifact_directory(key)
# Now try the cache, once we're sure about the key
if key in self.__metadata_dependencies:
return self.__metadata_dependencies[key]
# Parse the expensive yaml now and cache the result
- meta_file = os.path.join(artifact_base, 'meta', 'dependencies.yaml')
- meta = _yaml.load(meta_file)
+ meta_file = artifact_vdir._objpath(['meta', 'dependencies.yaml'])
+ meta = _yaml.load(meta_file, shortname='meta/dependencies.yaml')
# Cache it under both strong and weak keys
strong_key, weak_key = self.__get_artifact_metadata_keys(key)
@@ -2803,15 +2803,15 @@ class Element(Plugin):
def __get_artifact_metadata_workspaced(self, key=None):
# Extract it and possibly derive the key
- artifact_base, key = self.__extract(key)
+ artifact_vdir, key = self.__get_artifact_directory(key)
# Now try the cache, once we're sure about the key
if key in self.__metadata_workspaced:
return self.__metadata_workspaced[key]
# Parse the expensive yaml now and cache the result
- meta_file = os.path.join(artifact_base, 'meta', 'workspaced.yaml')
- meta = _yaml.load(meta_file)
+ meta_file = artifact_vdir._objpath(['meta', 'workspaced.yaml'])
+ meta = _yaml.load(meta_file, shortname='meta/workspaced.yaml')
workspaced = meta['workspaced']
# Cache it under both strong and weak keys
@@ -2833,15 +2833,15 @@ class Element(Plugin):
def __get_artifact_metadata_workspaced_dependencies(self, key=None):
# Extract it and possibly derive the key
- artifact_base, key = self.__extract(key)
+ artifact_vdir, key = self.__get_artifact_directory(key)
# Now try the cache, once we're sure about the key
if key in self.__metadata_workspaced_dependencies:
return self.__metadata_workspaced_dependencies[key]
# Parse the expensive yaml now and cache the result
- meta_file = os.path.join(artifact_base, 'meta', 'workspaced-dependencies.yaml')
- meta = _yaml.load(meta_file)
+ meta_file = artifact_vdir._objpath(['meta', 'workspaced-dependencies.yaml'])
+ meta = _yaml.load(meta_file, shortname='meta/workspaced-dependencies.yaml')
workspaced = meta['workspaced-dependencies']
# Cache it under both strong and weak keys
@@ -2859,23 +2859,26 @@ class Element(Plugin):
assert self.__dynamic_public is None
# Load the public data from the artifact
- artifact_base, _ = self.__extract()
- metadir = os.path.join(artifact_base, 'meta')
- self.__dynamic_public = _yaml.load(os.path.join(metadir, 'public.yaml'))
+ artifact_vdir, _ = self.__get_artifact_directory()
+ meta_file = artifact_vdir._objpath(['meta', 'public.yaml'])
+ self.__dynamic_public = _yaml.load(meta_file, shortname='meta/public.yaml')
def __load_build_result(self, keystrength):
self.__assert_cached(keystrength=keystrength)
assert self.__build_result is None
- artifact_base, _ = self.__extract(key=self.__weak_cache_key if keystrength is _KeyStrength.WEAK
- else self.__strict_cache_key)
+ if keystrength is _KeyStrength.WEAK:
+ key = self.__weak_cache_key
+ else:
+ key = self.__strict_cache_key
+
+ artifact_vdir, _ = self.__get_artifact_directory(key)
- metadir = os.path.join(artifact_base, 'meta')
- result_path = os.path.join(metadir, 'build-result.yaml')
- if not os.path.exists(result_path):
+ if not artifact_vdir._exists(['meta', 'build-result.yaml']):
self.__build_result = (True, "succeeded", None)
return
+ result_path = artifact_vdir._objpath(['meta', 'build-result.yaml'])
data = _yaml.load(result_path)
self.__build_result = (data["success"], data.get("description"), data.get("detail"))