summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-02-27 05:55:21 +0100
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-02-27 11:43:16 +0000
commit623aa819e5e3d097277219e287355da073985f25 (patch)
tree81c70d64145c9ef751c4f14781f8d9f3ebcf89c9
parent9e7e9c2890746528eba6ff7d1cdffcf2e518393c (diff)
downloadbuildstream-623aa819e5e3d097277219e287355da073985f25.tar.gz
_ostree.py: Use list of refs as commit parameter
-rw-r--r--buildstream/_artifactcache/ostreecache.py2
-rw-r--r--buildstream/_ostree.py16
2 files changed, 7 insertions, 11 deletions
diff --git a/buildstream/_artifactcache/ostreecache.py b/buildstream/_artifactcache/ostreecache.py
index cae4f7269..60591d077 100644
--- a/buildstream/_artifactcache/ostreecache.py
+++ b/buildstream/_artifactcache/ostreecache.py
@@ -273,7 +273,7 @@ class OSTreeCache(ArtifactCache):
weak_ref = buildref(element, element._get_cache_key(strength=_KeyStrength.WEAK))
try:
- _ostree.commit(self.repo, content, ref, weak_ref)
+ _ostree.commit(self.repo, content, [ref, weak_ref])
except OSTreeError as e:
raise ArtifactError("Failed to commit artifact: {}".format(e)) from e
diff --git a/buildstream/_ostree.py b/buildstream/_ostree.py
index e3457dc35..9a9e44998 100644
--- a/buildstream/_ostree.py
+++ b/buildstream/_ostree.py
@@ -118,10 +118,9 @@ def checkout(repo, path, commit, user=False):
# Args:
# repo (OSTree.Repo): The repo
# dir (str): The source directory to commit to the repo
-# ref (str): A symbolic reference (tag) for the commit
-# branch (str): Optional branch for the commit
+# refs (list): A list of symbolic references (tag) for the commit
#
-def commit(repo, dir, ref, branch=None):
+def commit(repo, dir, refs):
def commit_filter(repo, path, file_info):
@@ -147,14 +146,11 @@ def commit(repo, dir, ref, branch=None):
_, root = repo.write_mtree(mtree)
# create root commit object, no parent, no branch
- _, rev = repo.write_commit(None, ref, None, None, root)
-
- # create tag
- repo.transaction_set_ref(None, ref, rev)
+ _, rev = repo.write_commit(None, None, None, None, root)
- # optionally create/update branch (without parent commit for now)
- if branch:
- repo.transaction_set_ref(None, branch, rev)
+ # create refs
+ for ref in refs:
+ repo.transaction_set_ref(None, ref, rev)
# complete repo transaction
repo.commit_transaction(None)