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/02/04 07:28:36 UTC

[buildstream] 08/09: Make source-checkout fetch by default

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

tvb pushed a commit to branch gokcen/add_no_fetch_flag
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit af2bf4a7bb019d764e895bcb99ad5644aa69756b
Author: Gökçen Nurlu <gn...@bloomberg.net>
AuthorDate: Fri Nov 23 17:05:53 2018 +0000

    Make source-checkout fetch by default
    
    This replaces `--fetch` with `--no-fetch`.
---
 buildstream/_frontend/cli.py | 8 ++++----
 buildstream/_stream.py       | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py
index d9ce8c5..8596bd6 100644
--- a/buildstream/_frontend/cli.py
+++ b/buildstream/_frontend/cli.py
@@ -684,20 +684,20 @@ def checkout(app, element, location, force, deps, integrate, hardlinks, tar, no_
 @click.option('--deps', '-d', default='none',
               type=click.Choice(['build', 'none', 'run', 'all']),
               help='The dependencies whose sources to checkout (default: none)')
-@click.option('--fetch', 'fetch_', default=False, is_flag=True,
-              help='Fetch elements if they are not fetched')
+@click.option('--no-fetch', 'no_fetch', default=False, is_flag=True,
+              help="Disable auto-fetching of element and related junction(s)")
 @click.argument('element',
                 type=click.Path(readable=False))
 @click.argument('location', type=click.Path())
 @click.pass_obj
-def source_checkout(app, element, location, deps, fetch_, except_):
+def source_checkout(app, element, location, deps, no_fetch, except_):
     """Checkout sources of an element to the specified location
     """
     with app.initialized():
         app.stream.source_checkout(element,
                                    location=location,
                                    deps=deps,
-                                   fetch=fetch_,
+                                   fetch=not no_fetch,
                                    except_targets=except_)
 
 
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index 36086ed..67c861c 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -439,13 +439,13 @@ class Stream():
     #    target (str): The target element whose sources to checkout
     #    location (str): Location to checkout the sources to
     #    deps (str): The dependencies to checkout
-    #    fetch (bool): Whether to fetch missing sources
+    #    fetch (bool): Whether to fetch missing sources, including junction(s)
     #    except_targets (list): List of targets to except from staging
     #
     def source_checkout(self, target, *,
                         location=None,
                         deps='none',
-                        fetch=False,
+                        fetch=True,
                         except_targets=()):
 
         self._check_location_writable(location)
@@ -453,7 +453,7 @@ class Stream():
         elements, _ = self._load((target,), (),
                                  selection=deps,
                                  except_targets=except_targets,
-                                 fetch_subprojects=True)
+                                 fetch_subprojects=fetch)
 
         # Assert all sources are cached
         if fetch: