summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-02-25 11:06:14 +0100
committerJürg Billeter <j@bitron.ch>2019-02-28 12:12:38 +0100
commit99b76bd922e44ac53dcecda64af390dc5872c5a7 (patch)
tree2f866b8e0383895177cacd137555fbb08c34ece5 /buildstream
parent4427343fcca3794ad78767837a6d3e7af0c19d2e (diff)
downloadbuildstream-99b76bd922e44ac53dcecda64af390dc5872c5a7.tar.gz
cascache.py: Remove unused extract() method
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/_cas/cascache.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py
index 2978b9bfe..40d7efe78 100644
--- a/buildstream/_cas/cascache.py
+++ b/buildstream/_cas/cascache.py
@@ -135,53 +135,6 @@ class CASCache():
# True if subdir content is cached or if empty as expected
return os.path.exists(objpath)
- # extract():
- #
- # Extract cached directory for the specified ref if it hasn't
- # already been extracted.
- #
- # Args:
- # ref (str): The ref whose directory to extract
- # path (str): The destination path
- # subdir (str): Optional specific dir to extract
- #
- # Raises:
- # CASCacheError: In cases there was an OSError, or if the ref did not exist.
- #
- # Returns: path to extracted directory
- #
- def extract(self, ref, path, subdir=None):
- tree = self.resolve_ref(ref, update_mtime=True)
-
- originaldest = dest = os.path.join(path, tree.hash)
-
- # If artifact is already extracted, check if the optional subdir
- # has also been extracted. If the artifact has not been extracted
- # a full extraction would include the optional subdir
- if os.path.isdir(dest):
- if subdir:
- if not os.path.isdir(os.path.join(dest, subdir)):
- dest = os.path.join(dest, subdir)
- tree = self._get_subdir(tree, subdir)
- else:
- return dest
- else:
- return dest
-
- with utils._tempdir(prefix='tmp', dir=self.tmpdir) as tmpdir:
- checkoutdir = os.path.join(tmpdir, ref)
- self.checkout(checkoutdir, tree, can_link=True)
-
- try:
- utils.move_atomic(checkoutdir, dest)
- except utils.DirectoryExistsError:
- # Another process beat us to rename
- pass
- except OSError as e:
- raise CASCacheError("Failed to extract directory for ref '{}': {}".format(ref, e)) from e
-
- return originaldest
-
# checkout():
#
# Checkout the specified directory digest.