diff options
-rw-r--r-- | buildstream/_frontend/main.py | 81 |
1 files changed, 27 insertions, 54 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py index 84e2850b1..d21e4031f 100644 --- a/buildstream/_frontend/main.py +++ b/buildstream/_frontend/main.py @@ -195,15 +195,13 @@ def cli(context, **kwargs): help="Build elements that would not be needed for the current build plan") @click.option('--track', default=False, is_flag=True, help="Track new source references before building (implies --all)") -@click.option('--variant', - help='A variant of the specified target') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def build(app, target, variant, all, track): +def build(app, target, all, track): """Build elements in a pipeline""" - app.initialize(target, variant, rewritable=track, inconsistent=track) + app.initialize(target, rewritable=track, inconsistent=track) app.print_heading() try: app.pipeline.build(app.scheduler, all, track) @@ -226,12 +224,10 @@ def build(app, target, variant, all, track): help='The dependencies to fetch (default: plan)') @click.option('--track', default=False, is_flag=True, help="Track new source references before fetching") -@click.option('--variant', - help='A variant of the specified target') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def fetch(app, target, variant, deps, track, except_): +def fetch(app, target, deps, track, except_): """Fetch sources required to build the pipeline By default this will only try to fetch sources which are @@ -246,7 +242,7 @@ def fetch(app, target, variant, deps, track, except_): plan: Only dependencies required for the build plan all: All dependencies """ - app.initialize(target, variant, rewritable=track, inconsistent=track) + app.initialize(target, rewritable=track, inconsistent=track) try: dependencies = app.pipeline.deps_elements(deps, except_) app.print_heading(deps=dependencies) @@ -268,12 +264,10 @@ def fetch(app, target, variant, deps, track, except_): @click.option('--deps', '-d', default='none', type=click.Choice(['none', 'all']), help='The dependencies to track (default: none)') -@click.option('--variant', - help='A variant of the specified target') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def track(app, target, variant, deps, except_): +def track(app, target, deps, except_): """Consults the specified tracking branches for new versions available to build and updates the project with any newly available references. @@ -286,7 +280,7 @@ def track(app, target, variant, deps, except_): none: No dependencies, just the element itself all: All dependencies """ - app.initialize(target, variant, rewritable=True, inconsistent=True) + app.initialize(target, rewritable=True, inconsistent=True) try: dependencies = app.pipeline.deps_elements(deps, except_) app.print_heading(deps=dependencies) @@ -303,15 +297,13 @@ def track(app, target, variant, deps, except_): # Pull Command # ################################################################## @cli.command(short_help="Pull a built artifact") -@click.option('--variant', - help='A variant of the specified target') @click.option('--deps', '-d', default='none', type=click.Choice(['none', 'all']), help='The dependency artifacts to pull (default: none)') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def pull(app, target, variant, deps): +def pull(app, target, deps): """Pull a built artifact from the configured remote artifact cache. Specify `--deps` to control which artifacts to pull: @@ -320,7 +312,7 @@ def pull(app, target, variant, deps): none: No dependencies, just the element itself all: All dependencies """ - app.initialize(target, variant) + app.initialize(target) try: to_pull = app.pipeline.deps_elements(deps) app.pipeline.pull(app.scheduler, to_pull) @@ -335,15 +327,13 @@ def pull(app, target, variant, deps): # Push Command # ################################################################## @cli.command(short_help="Push a built artifact") -@click.option('--variant', - help='A variant of the specified target') @click.option('--deps', '-d', default='none', type=click.Choice(['none', 'all']), help='The dependencies to push (default: none)') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def push(app, target, variant, deps): +def push(app, target, deps): """Push a built artifact to the configured remote artifact cache. Specify `--deps` to control which artifacts to push: @@ -352,7 +342,7 @@ def push(app, target, variant, deps): none: No dependencies, just the element itself all: All dependencies """ - app.initialize(target, variant) + app.initialize(target) try: to_push = app.pipeline.deps_elements(deps) app.pipeline.push(app.scheduler, to_push) @@ -378,12 +368,10 @@ def push(app, target, variant, deps): @click.option('--format', '-f', metavar='FORMAT', default=None, type=click.STRING, help='Format string for each element') -@click.option('--variant', - help='A variant of the specified target') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def show(app, target, variant, deps, except_, order, format): +def show(app, target, deps, except_, order, format): """Show elements in the pipeline By default this will show all of the dependencies of the @@ -406,7 +394,6 @@ def show(app, target, variant, deps, except_, order, format): \b %{name} The element name - %{variant} The selected element variant %{key} The abbreviated cache key (if all sources are consistent) %{full-key} The full cache key (if all sources are consistent) %{state} cached, buildable, waiting or inconsistent @@ -431,7 +418,7 @@ def show(app, target, variant, deps, except_, order, format): bst show target.bst --format \\ $'---------- %{name} ----------\\n%{vars}' """ - app.initialize(target, variant) + app.initialize(target) try: dependencies = app.pipeline.deps_elements(deps, except_) except PipelineError as e: @@ -457,13 +444,11 @@ def show(app, target, variant, deps, except_, order, format): @click.option('--sysroot', '-s', default=None, type=click.Path(exists=True, file_okay=False, readable=True), help="An existing sysroot") -@click.option('--variant', - help='A variant of the specified target') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.argument('command', type=click.STRING, nargs=-1) @click.pass_obj -def shell(app, target, variant, sysroot, build, command): +def shell(app, target, sysroot, build, command): """Run a command in the target element's sandbox environment This will first stage a temporary sysroot for running @@ -485,7 +470,7 @@ def shell(app, target, variant, sysroot, build, command): else: scope = Scope.RUN - app.initialize(target, variant) + app.initialize(target) # Assert we have everything we need built. missing_deps = [] @@ -518,16 +503,14 @@ def shell(app, target, variant, sysroot, build, command): @cli.command(short_help="Checkout a built artifact") @click.option('--force', '-f', default=False, is_flag=True, help="Overwrite files existing in checkout directory") -@click.option('--variant', - help='A variant of the specified target') @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.argument('directory', type=click.Path(file_okay=False)) @click.pass_obj -def checkout(app, target, variant, directory, force): +def checkout(app, target, directory, force): """Checkout a built artifact to the specified directory """ - app.initialize(target, variant) + app.initialize(target) try: app.pipeline.checkout(directory, force) click.echo("") @@ -548,8 +531,6 @@ def checkout(app, target, variant, directory, force): help="Compress the tar file using the given algorithm.") @click.option('--track', default=False, is_flag=True, help="Track new source references before building") -@click.option('--variant', - help='A variant of the specified target') @click.option('--force', '-f', default=False, is_flag=True, help="Overwrite files existing in checkout directory") @click.option('--directory', default=os.getcwd(), @@ -557,10 +538,10 @@ def checkout(app, target, variant, directory, force): @click.argument('target', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def source_bundle(app, target, variant, force, directory, +def source_bundle(app, target, force, directory, track, compression, except_): """Produce a source bundle to be manually executed""" - app.initialize(target, variant, rewritable=track, inconsistent=track) + app.initialize(target, rewritable=track, inconsistent=track) try: dependencies = app.pipeline.deps_elements('all', except_) app.print_heading(dependencies) @@ -592,18 +573,16 @@ def workspace(): help="Overwrite files existing in checkout directory") @click.option('--source', '-s', default=None, type=click.INT, metavar='INDEX', help="The source to create a workspace for. Projects with one source may omit this") -@click.option('--variant', - help='A variant of the specified target') @click.option('--track', default=False, is_flag=True, help="Track and fetch new source references before checking out the workspace") @click.argument('element', type=click.Path(dir_okay=False, readable=True)) @click.argument('directory', type=click.Path(file_okay=False)) @click.pass_obj -def workspace_open(app, no_checkout, force, source, variant, track, element, directory): +def workspace_open(app, no_checkout, force, source, track, element, directory): """Open a workspace for manual source modification""" - app.initialize(element, variant, rewritable=track, inconsistent=track) + app.initialize(element, rewritable=track, inconsistent=track) try: app.pipeline.open_workspace(app.scheduler, directory, source, no_checkout, track, force) click.echo("") @@ -621,15 +600,13 @@ def workspace_open(app, no_checkout, force, source, variant, track, element, dir help="The source of the workspace to remove. Projects with one source may omit this") @click.option('--remove-dir', default=False, is_flag=True, help="Remove the path that contains the closed workspace") -@click.option('--variant', - help='A variant of the specified target') @click.argument('element', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def workspace_close(app, source, remove_dir, variant, element): +def workspace_close(app, source, remove_dir, element): """Close a workspace""" - app.initialize(element, variant) + app.initialize(element) if app.interactive and remove_dir: if not click.confirm('This will remove all your changes, are you sure?'): click.echo('Aborting') @@ -654,14 +631,12 @@ def workspace_close(app, source, remove_dir, variant, element): help="Track and fetch the latest source before resetting") @click.option('--no-checkout', default=False, is_flag=True, help="Do not checkout the source, only link to the given directory") -@click.option('--variant', - help='A variant of the specified target') @click.argument('element', type=click.Path(dir_okay=False, readable=True)) @click.pass_obj -def workspace_reset(app, source, track, no_checkout, variant, element): +def workspace_reset(app, source, track, no_checkout, element): """Reset a workspace to its original state""" - app.initialize(element, variant) + app.initialize(element) if app.interactive: if not click.confirm('This will remove all your changes, are you sure?'): click.echo('Aborting') @@ -720,7 +695,6 @@ class App(): self.logger = None self.status = None self.target = None - self.variant = None self.host_arch = main_options['host_arch'] or main_options['arch'] self.target_arch = main_options['target_arch'] or main_options['arch'] @@ -774,9 +748,8 @@ class App(): # # Initialize the main pipeline # - def initialize(self, target, variant, rewritable=False, inconsistent=False): + def initialize(self, target, rewritable=False, inconsistent=False): self.target = target - self.variant = variant profile_start(Topics.LOAD_PIPELINE, target.replace(os.sep, '-') + '-' + self.host_arch + '-' + self.target_arch) @@ -850,7 +823,7 @@ class App(): sys.exit(1) try: - self.pipeline = Pipeline(self.context, self.project, target, variant, + self.pipeline = Pipeline(self.context, self.project, target, inconsistent=inconsistent, rewritable=rewritable, load_ticker=self.load_ticker, @@ -1032,7 +1005,7 @@ class App(): # will process a pipeline. # def print_heading(self, deps=None): - self.logger.print_heading(self.pipeline, self.variant, + self.logger.print_heading(self.pipeline, self.main_options['log_file'], styling=self.colors, deps=deps) |