You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/10/10 02:41:34 UTC

[buildstream] 02/02: Remove `--pull` option from `bst artifact checkout`, and pull dependencies by default

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/shell-checkout-always-pull
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 564e0ceb7453e1c7076d0d061589d059e7515652
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Sun Oct 10 11:37:16 2021 +0900

    Remove `--pull` option from `bst artifact checkout`, and pull dependencies by default
    
    Summary of changes:
    
      * _frontend/cli.py: Remove the `--pull` option
    
      * _stream.py: remove `pull` option from `Stream.checkout()`
    
      * tests/frontend/artifact_checkout.py,buildcheckout.py: Updated tests
    
    This fixes #819
---
 src/buildstream/_frontend/cli.py    | 3 ---
 src/buildstream/_stream.py          | 5 +----
 tests/frontend/artifact_checkout.py | 3 +--
 tests/frontend/buildcheckout.py     | 8 ++++----
 4 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index c845cd4..d2fcc62 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -1269,7 +1269,6 @@ def artifact_show(app, deps, artifacts):
     type=click.Choice(["gz", "xz", "bz2"]),
     help="The compression option of the tarball created.",
 )
-@click.option("--pull", "pull_", is_flag=True, help="Pull the artifact if it's missing or incomplete.")
 @click.option(
     "--directory", default=None, type=click.Path(file_okay=False), help="The directory to checkout the artifact to"
 )
@@ -1295,7 +1294,6 @@ def artifact_checkout(
     hardlinks,
     tar,
     compression,
-    pull_,
     directory,
     artifact_remotes,
     ignore_project_artifact_remotes,
@@ -1357,7 +1355,6 @@ def artifact_checkout(
             selection=deps,
             integrate=True if integrate is None else integrate,
             hardlinks=hardlinks,
-            pull=pull_,
             compression=compression,
             tar=bool(tar),
             artifact_remotes=artifact_remotes,
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 51ddec6..6fcfd12 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -647,8 +647,6 @@ class Stream:
     #         will be placed at the given location. If true and
     #         location is '-', the tarball will be dumped on the
     #         standard output.
-    #    pull: If true will attempt to pull any missing or incomplete
-    #          artifacts.
     #    artifact_remotes: Artifact cache remotes specified on the commmand line
     #    ignore_project_artifact_remotes: Whether to ignore artifact remotes specified by projects
     #
@@ -662,7 +660,6 @@ class Stream:
         integrate: bool = True,
         hardlinks: bool = False,
         compression: str = "",
-        pull: bool = False,
         tar: bool = False,
         artifact_remotes: Iterable[RemoteSpec] = (),
         ignore_project_artifact_remotes: bool = False,
@@ -673,7 +670,7 @@ class Stream:
             selection=selection,
             load_artifacts=True,
             attempt_artifact_metadata=True,
-            connect_artifact_cache=pull,
+            connect_artifact_cache=True,
             artifact_remotes=artifact_remotes,
             ignore_project_artifact_remotes=ignore_project_artifact_remotes,
         )
diff --git a/tests/frontend/artifact_checkout.py b/tests/frontend/artifact_checkout.py
index e8231b8..962b31f 100644
--- a/tests/frontend/artifact_checkout.py
+++ b/tests/frontend/artifact_checkout.py
@@ -63,8 +63,7 @@ def test_checkout(cli, tmpdir, datafiles, deps, expect_exist, expect_noexist, wi
 
         # Now checkout the artifact
         result = cli.run(
-            project=project,
-            args=["artifact", "checkout", "--directory", checkout, "--pull", "--deps", deps, artifact_name],
+            project=project, args=["artifact", "checkout", "--directory", checkout, "--deps", deps, artifact_name],
         )
 
         if deps in ["all", "run"]:
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py
index 6021ff0..f031365 100644
--- a/tests/frontend/buildcheckout.py
+++ b/tests/frontend/buildcheckout.py
@@ -1124,13 +1124,13 @@ def test_partial_artifact_checkout_fetch(cli, datafiles, tmpdir):
         os.unlink(objpath)
 
         # Verify that the build-only dependency is not (complete) in the local cache
+        cli.configure({"artifacts": {}})
         result = cli.run(project=project, args=["artifact", "checkout", input_name, "--directory", checkout_dir])
         result.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")
 
         # Verify that the pull method fetches relevant artifacts in order to stage
-        result = cli.run(
-            project=project, args=["artifact", "checkout", "--pull", input_name, "--directory", checkout_dir]
-        )
+        cli.configure({"artifacts": {"servers": [{"url": share.repo, "push": True}]}})
+        result = cli.run(project=project, args=["artifact", "checkout", input_name, "--directory", checkout_dir])
         result.assert_success()
 
         # should have pulled whatever was deleted previous
@@ -1147,7 +1147,7 @@ def test_partial_checkout_fail(tmpdir, datafiles, cli):
 
         cli.configure({"artifacts": {"servers": [{"url": share.repo, "push": True}]}})
 
-        res = cli.run(project=project, args=["artifact", "checkout", "--pull", build_elt, "--directory", checkout_dir])
+        res = cli.run(project=project, args=["artifact", "checkout", build_elt, "--directory", checkout_dir])
         res.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")
         assert re.findall(r"Remote \((\S+)\) does not have artifact (\S+) cached", res.stderr)