def run(args, project_options): # noqa lifecycle_command = _get_lifecycle_command(args) argless_command = _get_command_from_arg(args) if lifecycle_command: lifecycle.execute(lifecycle_command, project_options, args['<part>']) elif argless_command: argless_command() elif args['clean']: _run_clean(args, project_options) elif args['cleanbuild']: lifecycle.cleanbuild(project_options, remote=args['--remote']), elif _is_store_command(args): _run_store_command(args) elif args['tour']: _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR) elif args['help']: snapcraft.topic_help(args['<topic>'] or args['<plugin>'], args['--devel'], args['topics']) elif args['enable-ci']: enable_ci(args['<ci-system>'], args['--refresh']) elif args['update']: parts.update() elif args['define']: parts.define(args['<part-name>']) elif args['search']: parts.search(' '.join(args['<query>'])) else: # snap by default: lifecycle.snap(project_options, args['<directory>'], args['--output']) return project_options
def run(args, project_options): lifecycle_command = _get_lifecycle_command(args) argless_command = _get_command_from_arg(args) if lifecycle_command: lifecycle.execute( lifecycle_command, project_options, args['<part>']) elif argless_command: argless_command() elif args['clean']: step = args['--step'] if step == 'strip': logger.warning('DEPRECATED: Use `prime` instead of `strip` ' 'as the step to clean') step = 'prime' lifecycle.clean(project_options, args['<part>'], step) elif args['upload']: snapcraft.upload(args['<snap-file>']) elif args['cleanbuild']: lifecycle.cleanbuild(project_options), # disable until the tour command is activated # elif args['tour']: # _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR) elif args['help']: snapcraft.topic_help(args['<topic>'] or args['<plugin>'], args['--devel'], args['topics']) else: # snap by default: lifecycle.snap(project_options, args['<directory>'], args['--output']) return project_options
def run(args, project_options): lifecycle_command = _get_lifecycle_command(args) argless_command = _get_command_from_arg(args) if lifecycle_command: lifecycle.execute(lifecycle_command, project_options, args['<part>']) elif argless_command: argless_command() elif args['clean']: step = args['--step'] if step == 'strip': logger.warning('DEPRECATED: Use `prime` instead of `strip` ' 'as the step to clean') step = 'prime' lifecycle.clean(project_options, args['<part>'], step) elif args['upload']: snapcraft.upload(args['<snap-file>']) elif args['cleanbuild']: lifecycle.cleanbuild(project_options), elif args['tour']: _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR) elif args['help']: snapcraft.topic_help(args['<topic>'] or args['<plugin>'], args['--devel'], args['topics']) else: # snap by default: lifecycle.snap(project_options, args['<directory>'], args['--output']) return project_options
def run(args, project_options): # noqa lifecycle_command = _get_lifecycle_command(args) argless_command = _get_command_from_arg(args) if lifecycle_command: lifecycle.execute( lifecycle_command, project_options, args['<part>']) elif argless_command: argless_command() elif args['clean']: _run_clean(args, project_options) elif args['cleanbuild']: lifecycle.cleanbuild(project_options), elif _is_store_command(args): _run_store_command(args) elif args['tour']: _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR) elif args['help']: snapcraft.topic_help(args['<topic>'] or args['<plugin>'], args['--devel'], args['topics']) elif args['update']: parts.update() elif args['define']: parts.define(args['<part-name>']) elif args['search']: parts.search(' '.join(args['<query>'])) else: # snap by default: lifecycle.snap(project_options, args['<directory>'], args['--output']) return project_options
def cleanbuild(remote, debug, **kwargs): """Create a snap using a clean environment managed by a build provider. \b Examples: snapcraft cleanbuild The cleanbuild command requires a properly setup lxd environment that can connect to external networks. Refer to the "Ubuntu Desktop and Ubuntu Server" section on https://linuxcontainers.org/lxd/getting-started-cli to get started. If using a remote, a prior setup is required which is described on: https://linuxcontainers.org/lxd/getting-started-cli/#multiple-hosts """ project = get_project(**kwargs, debug=debug) project_config = project_loader.load_config(project) # cleanbuild is a special snow flake, while all the other commands # would work with the host as the build_provider it makes little # sense in this scenario. build_environment = env.BuilderEnvironmentConfig( default="lxd", additional_providers=["multipass"] ) lifecycle.cleanbuild( project=project, project_config=project_config, echoer=echo, remote=remote, build_environment=build_environment, )
def cleanbuild(remote, **kwargs): """Create a snap using a clean environment managed by a build provider. \b Examples: snapcraft cleanbuild The cleanbuild command requires a properly setup lxd environment that can connect to external networks. Refer to the "Ubuntu Desktop and Ubuntu Server" section on https://linuxcontainers.org/lxd/getting-started-cli to get started. If using a remote, a prior setup is required which is described on: https://linuxcontainers.org/lxd/getting-started-cli/#multiple-hosts """ # cleanbuild is a special snow flake, while all the other commands # would work with the host as the build_provider it makes little # sense in this scenario. if sys.platform == "darwin": default_provider = "multipass" else: default_provider = "lxd" build_environment = env.BuilderEnvironmentConfig( default=default_provider, additional_providers=["multipass"]) project = get_project(is_managed=build_environment.is_managed_host, **kwargs) snap_filename = lifecycle.cleanbuild(project=project, echoer=echo, remote=remote, build_environment=build_environment) echo.info("Retrieved {!r}".format(snap_filename))
def cleanbuild(remote, debug, **kwargs): """Create a snap using a clean environment managed by lxd. \b Examples: snapcraft cleanbuild snapcraft cleanbuild --output The cleanbuild command requires a properly setup lxd environment that can connect to external networks. Refer to the "Ubuntu Desktop and Ubuntu Server" section on https://linuxcontainers.org/lxd/getting-started-cli to get started. If using a remote, a prior setup is required which is described on: https://linuxcontainers.org/lxd/getting-started-cli/#multiple-hosts """ project_options = get_project_options(**kwargs, debug=debug) lifecycle.cleanbuild(project_options, remote)
def run(args, project_options): lifecycle_command = _get_lifecycle_command(args) argless_command = _get_command_from_arg(args) if lifecycle_command: lifecycle.execute(lifecycle_command, project_options, args['<part>']) elif argless_command: argless_command() elif args['clean']: lifecycle.clean(project_options, args['<part>'], args['--step']) elif args['upload']: snapcraft.upload(args['<snap-file>']) elif args['cleanbuild']: lifecycle.cleanbuild(project_options), elif args['help']: snapcraft.topic_help(args['<topic>'] or args['<plugin>'], args['--devel'], args['topics']) else: # snap by default: lifecycle.snap(project_options, args['<directory>'], args['--output']) return project_options
def run(args, project_options): lifecycle_command = _get_lifecycle_command(args) argless_command = _get_command_from_arg(args) if lifecycle_command: lifecycle.execute( lifecycle_command, project_options, args['<part>']) elif argless_command: argless_command() elif args['clean']: lifecycle.clean(project_options, args['<part>'], args['--step']) elif args['upload']: snapcraft.upload(args['<snap-file>']) elif args['cleanbuild']: lifecycle.cleanbuild(project_options), elif args['help']: snapcraft.topic_help(args['<topic>'] or args['<plugin>'], args['--devel'], args['topics']) else: # snap by default: lifecycle.snap(project_options, args['<directory>'], args['--output']) return project_options
def run(args, project_options): # noqa lifecycle_command = _get_lifecycle_command(args) argless_command = _get_command_from_arg(args) if lifecycle_command: if _is_containerbuild(): lifecycle.containerbuild(lifecycle_command, project_options, args['<part>']) else: lifecycle.execute( lifecycle_command, project_options, args['<part>']) elif argless_command: argless_command() elif args['clean']: if _is_containerbuild(): step = args['--step'] or 'pull' lifecycle.containerbuild('clean', project_options, args=['--step', step] + args['<part>']) else: _run_clean(args, project_options) elif args['cleanbuild']: lifecycle.cleanbuild(project_options, remote=args['--remote']), elif _is_store_command(args): _run_store_command(args) elif args['tour']: _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR) elif args['help']: snapcraft.topic_help(args['<topic>'] or args['<plugin>'], args['--devel'], args['topics']) elif args['enable-ci']: enable_ci(args['<ci-system>'], args['--refresh']) elif args['update']: if _is_containerbuild(): lifecycle.containerbuild('update', project_options) else: parts.update() elif args['define']: if _is_containerbuild(): lifecycle.containerbuild('update', project_options, args=args['<part-name>']) else: parts.define(args['<part-name>']) elif args['search']: if _is_containerbuild(): lifecycle.containerbuild('search', project_options, args=' '.join(args['<query>'])) else: parts.search(' '.join(args['<query>'])) else: # snap by default: if _is_containerbuild(): lifecycle.containerbuild('snap', project_options, args['--output'], args['<directory>']) elif os.getenv('SNAPCRAFT_COLLABORATE'): # this is only for testing snapcraft.collaborate( os.getenv('SNAPCRAFT_COLLABORATORS_SNAP_NAME'), os.getenv('SNAPCRAFT_COLLABORATORS_SIGN_KEY')) else: lifecycle.snap(project_options, args['<directory>'], args['--output']) return project_options