ownik commented on code in PR #2129:
URL: https://github.com/apache/buildstream/pull/2129#discussion_r3747399762
##########
src/buildstream/_stream.py:
##########
@@ -916,6 +901,74 @@ def artifact_delete(self, targets, *,
selection=_PipelineSelection.NONE):
if not ref_removed:
self._context.messenger.info("No artifacts were removed")
+
+ # buildtree_checkout()
+ #
+ # Checkout target buildtree artifact to the specified location
+ #
+ # Args:
+ # target: Target to checkout
+ # location: Location to checkout the artifact to
+ # force: Whether files can be overwritten if necessary
+ # hardlinks: Whether checking out files hardlinked to
+ # their artifacts is acceptable
+ # tar: If true, a tarball from the artifact contents will
+ # be created, otherwise the file tree of the artifact
+ # will be placed at the given location. If true and
+ # location is '-', the tarball will be dumped on the
+ # standard output.
+ # artifact_remotes: Artifact cache remotes specified on the commmand
line
+ # ignore_project_artifact_remotes: Whether to ignore artifact remotes
specified by projects
+ #
+ def buildtree_checkout(
+ self,
+ target: str,
+ *,
+ location: Optional[str] = None,
+ buildroot: bool = False,
+ force: bool = False,
+ hardlinks: bool = False,
+ compression: str = "",
+ tar: bool = False,
+ artifact_remotes: Iterable[RemoteSpec] = (),
+ ignore_project_artifact_remotes: bool = False,
+ ):
+
+ elements = self._load(
+ (target,),
+ selection=_PipelineSelection.NONE,
+ load_artifacts=True,
+ attempt_artifact_metadata=True,
+ connect_artifact_cache=True,
+ artifact_remotes=artifact_remotes,
+ ignore_project_artifact_remotes=ignore_project_artifact_remotes,
+ )
+
+ # self.targets contains a list of the loaded target objects
+ # if we specify --deps build, Stream._load() will return a list
+ # of build dependency objects, however, we need to prepare a sandbox
+ # with the target (which has had its appropriate dependencies loaded)
+ element: Element = self.targets[0]
Review Comment:
Sorry for the delayed response, and thanks for pointing this out.
Yes, you're right. I've changed this to `element: Element = elements[0]`, is
it ok?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]