diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-10 17:03:01 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-10 20:38:48 +0900 |
commit | 1a94040648b50f087ef133eeccf8e30a37bad7b7 (patch) | |
tree | 874b995694ad7bffa63103b3e7c370de4407a42b | |
parent | f9cb0f09a4549c64621e0a35b7cc0784adf61ba4 (diff) | |
download | buildstream-1a94040648b50f087ef133eeccf8e30a37bad7b7.tar.gz |
_ostree.py: Removed push() API
We're going to do this a bit differently.
-rw-r--r-- | buildstream/_ostree.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/buildstream/_ostree.py b/buildstream/_ostree.py index 9f4a9130f..81663b791 100644 --- a/buildstream/_ostree.py +++ b/buildstream/_ostree.py @@ -293,69 +293,6 @@ def fetch(repo, remote="origin", ref=None, progress=None): raise OSTreeError("Failed to fetch from '{}': {}".format(remote, e.message)) from e -# get_ostree_push() -# -# Fetch the host ostree-push host tool required for pushing -# to remote ostree repositories. -def get_ostree_push(): - if not get_ostree_push.ostree_push_checked: - try: - get_ostree_push.ostree_push = utils.get_host_tool('ostree-push') - except ProgramNotFoundError: - pass - get_ostree_push.ostree_push_checked = True - return get_ostree_push.ostree_push - - -# Some static variables for get_ostree_push() -get_ostree_push.ostree_push_checked = False -get_ostree_push.ostree_push = None - - -# push() -# -# Pushes a ref to a remote repository -# -# Args: -# repo (OSTree.Repo): The repo -# workdir (str): A directory to work in and create temp dirs inside of -# remote (str): The url of the remote ostree repo -# ref (str): A ref to push -# output_file (file): An optional file handle for capturing the output of ostree-push -# -def push(repo, workdir, remote, ref, output_file=None): - - if remote.startswith("/"): - # local repository - push_repo = ensure(remote, True) - fetch(push_repo, remote=repo.get_path().get_uri(), ref=ref) - else: - with utils._tempdir(dir=workdir, prefix='push-repo-') as temp_repo_dir: - - # First create a temporary archive-z2 repository, we can - # only use ostree-push with archive-z2 local repo. - temp_repo = ensure(temp_repo_dir, True) - - # Now push the ref we want to push into our temporary archive-z2 repo - fetch(temp_repo, remote=repo.get_path().get_uri(), ref=ref) - - kwargs = {} - kwargs['terminate'] = True - if output_file is not None: - kwargs['stdout'] = output_file - kwargs['stderr'] = output_file - - # Now use ostree-push to push the repo - exit_code, _ = utils._call([ - get_ostree_push(), '--verbose', - '--repo', temp_repo.get_path().get_path(), - remote, ref - ], **kwargs) - - if exit_code: - raise OSTreeError("Failed to push artifact {} to artifact server at {}".format(ref, remote)) - - # configure_remote(): # # Ensures a remote is setup to a given url. |