summaryrefslogtreecommitdiff
path: root/buildstream/_stream.py
diff options
context:
space:
mode:
authorPhil Dawson <phil.dawson@codethink.co.uk>2018-11-19 09:33:17 +0000
committerPhil Dawson <phil.dawson@codethink.co.uk>2018-12-12 14:43:40 +0000
commit85c61894d8871f6096fbd164280eb529981b40c6 (patch)
treecdbf5f7a621478d6043834939ce47c6aee7c8d9f /buildstream/_stream.py
parentc2efeba064f30c9bdbb4e370b1911dc50a78ff9b (diff)
downloadbuildstream-85c61894d8871f6096fbd164280eb529981b40c6.tar.gz
Remove source bundle command
This is part of the work towards #672
Diffstat (limited to 'buildstream/_stream.py')
-rw-r--r--buildstream/_stream.py81
1 files changed, 0 insertions, 81 deletions
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index 059b7f653..04eb409a5 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -732,87 +732,6 @@ class Stream():
'workspaces': workspaces
})
- # source_bundle()
- #
- # Create a host buildable tarball bundle for the given target.
- #
- # Args:
- # target (str): The target element to bundle
- # directory (str): The directory to output the tarball
- # track_first (bool): Track new source references before bundling
- # compression (str): The compression type to use
- # force (bool): Overwrite an existing tarball
- #
- def source_bundle(self, target, directory, *,
- track_first=False,
- force=False,
- compression="gz",
- except_targets=()):
-
- if track_first:
- track_targets = (target,)
- else:
- track_targets = ()
-
- elements, track_elements = self._load((target,), track_targets,
- selection=PipelineSelection.ALL,
- except_targets=except_targets,
- track_selection=PipelineSelection.ALL,
- fetch_subprojects=True)
-
- # source-bundle only supports one target
- target = self.targets[0]
-
- self._message(MessageType.INFO, "Bundling sources for target {}".format(target.name))
-
- # Find the correct filename for the compression algorithm
- tar_location = os.path.join(directory, target.normal_name + ".tar")
- if compression != "none":
- tar_location += "." + compression
-
- # Attempt writing a file to generate a good error message
- # early
- #
- # FIXME: A bit hackish
- try:
- open(tar_location, mode="x")
- os.remove(tar_location)
- except IOError as e:
- raise StreamError("Cannot write to {0}: {1}"
- .format(tar_location, e)) from e
-
- # Fetch and possibly track first
- #
- self._fetch(elements, track_elements=track_elements)
-
- # We don't use the scheduler for this as it is almost entirely IO
- # bound.
-
- # Create a temporary directory to build the source tree in
- builddir = self._context.builddir
- os.makedirs(builddir, exist_ok=True)
- prefix = "{}-".format(target.normal_name)
-
- with tempfile.TemporaryDirectory(prefix=prefix, dir=builddir) as tempdir:
- source_directory = os.path.join(tempdir, 'source')
- try:
- os.makedirs(source_directory)
- except OSError as e:
- raise StreamError("Failed to create directory: {}"
- .format(e)) from e
-
- # Any elements that don't implement _write_script
- # should not be included in the later stages.
- elements = [
- element for element in elements
- if self._write_element_script(source_directory, element)
- ]
-
- self._write_element_sources(os.path.join(tempdir, "source"), elements)
- self._write_master_build_script(tempdir, elements)
- self._collect_sources(tempdir, tar_location,
- target.normal_name, compression)
-
# redirect_element_names()
#
# Takes a list of element names and returns a list where elements have been