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

tvb pushed a commit to branch tristan/add-except-option
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 10c64e62be8df5f4e339e9f26b1d26d749a754d3
Author: Tristan van Berkom <[email protected]>
AuthorDate: Fri Feb 19 15:54:24 2021 +0900

    _frontend/cli.py: Add `--except` option to `bst source push`
    
    This is for consistency of `--except` options as outlined in issue #1349
---
 src/buildstream/_frontend/cli.py | 15 +++++++++++++--
 src/buildstream/_stream.py       |  3 +++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 132069e..b6a68b1 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -826,6 +826,13 @@ def source_fetch(app, elements, deps, except_, remotes, 
ignore_project_remotes):
 ##################################################################
 @source.command(name="push", short_help="Push sources in a pipeline")
 @click.option(
+    "--except",
+    "except_",
+    multiple=True,
+    type=click.Path(readable=False),
+    help="Except certain dependencies from pushing",
+)
[email protected](
     "--deps",
     "-d",
     default=_PipelineSelection.NONE,
@@ -852,7 +859,7 @@ def source_fetch(app, elements, deps, except_, remotes, 
ignore_project_remotes):
 @click.option("--ignore-project-remotes", is_flag=True, help="Ignore remotes 
recommended by projects")
 @click.argument("elements", nargs=-1, type=click.Path(readable=False))
 @click.pass_obj
-def source_push(app, elements, deps, remotes, ignore_project_remotes):
+def source_push(app, elements, deps, except_, remotes, ignore_project_remotes):
     """Push sources required to build the pipeline
 
     Specifying no elements will result in pushing the sources of the default
@@ -876,7 +883,11 @@ def source_push(app, elements, deps, remotes, 
ignore_project_remotes):
             elements = app.project.get_default_targets()
 
         app.stream.source_push(
-            elements, selection=deps, source_remotes=remotes, 
ignore_project_source_remotes=ignore_project_remotes
+            elements,
+            selection=deps,
+            except_targets=except_,
+            source_remotes=remotes,
+            ignore_project_source_remotes=ignore_project_remotes,
         )
 
 
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 17011de..a44d613 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -434,6 +434,7 @@ class Stream:
     # Args:
     #    targets (list of str): Targets to push
     #    selection (_PipelineSelection): The selection mode for the specified 
targets
+    #    except_targets: Specified targets to except from pushing
     #    source_remotes: Source cache remotes specified on the commmand line
     #    ignore_project_source_remotes: Whether to ignore source remotes 
specified by projects
     #
@@ -449,6 +450,7 @@ class Stream:
         targets,
         *,
         selection=_PipelineSelection.NONE,
+        except_targets: Iterable[str] = (),
         source_remotes: Iterable[RemoteSpec] = (),
         ignore_project_source_remotes: bool = False,
     ):
@@ -456,6 +458,7 @@ class Stream:
         elements = self._load(
             targets,
             selection=selection,
+            except_targets=except_targets,
             load_artifacts=True,
             connect_source_cache=True,
             source_remotes=source_remotes,

Reply via email to