def make_containerbuild(self): return lxd.Project( output="snap.snap", source="project.tar", metadata={"name": "project"}, project_options=self.project_options, )
def refresh(debug, **kwargs): """Refresh an existing LXD container. \b Examples: snapcraft refresh This will take care of updating the apt package cache, upgrading packages as needed as well as refreshing snaps. """ container_config = env.get_container_config() if not container_config.use_container: raise errors.SnapcraftEnvironmentError( "The 'refresh' command only applies to LXD containers but " "SNAPCRAFT_CONTAINER_BUILDS is not set or 0.\n" "Maybe you meant to update the parts cache instead? " "You can do that with the following command:\n\n" "snapcraft update") project_options = get_project_options(**kwargs, debug=debug) config = project_loader.load_config(project_options) lxd.Project(project_options=project_options, remote=container_config.remote, output=None, source=os.path.curdir, metadata=config.get_metadata()).refresh()
def containerbuild(project_options, output=None, remote=''): config = snapcraft.internal.load_config(project_options) lxd.Project(output=output, source=os.path.curdir, project_options=project_options, remote=remote, metadata=config.get_metadata()).execute()
def refresh(debug, **kwargs): """Refresh an existing LXD container. \b Examples: snapcraft refresh This will take care of updating the apt package cache, upgrading packages as needed as well as refreshing snaps. """ build_environment = env.BuilderEnvironmentConfig() if build_environment.is_host: raise errors.SnapcraftEnvironmentError( "The 'refresh' command only applies to LXD containers but " "SNAPCRAFT_BUILD_ENVIRONMENT is not set or set to host.\n" "Maybe you meant to update the parts cache instead? " "You can do that with the following command:\n\n" "snapcraft update") project = get_project(**kwargs, debug=debug) config = project_loader.load_config(project) lxd.Project( project_options=project, output=None, source=os.path.curdir, metadata=config.get_metadata(), ).refresh()
def clean(parts, step_name, **kwargs): """Remove content - cleans downloads, builds or install artifacts. \b Examples: snapcraft clean snapcraft clean my-part --step build """ try: project = get_project(**kwargs) except YamlValidationError: # We need to be able to clean invalid projects too. project = get_project(skip_snapcraft_yaml=True, **kwargs) build_environment = env.BuilderEnvironmentConfig() step = None if step_name: if step_name == "strip": echo.warning( "DEPRECATED: Use `prime` instead of `strip` as the step to clean" ) step_name = "prime" step = steps.get_step_by_name(step_name) if build_environment.is_host: lifecycle.clean(project, parts, step) else: project_config = project_loader.load_config(project) lxd.Project( project_options=project, output=None, source=os.path.curdir, metadata=project_config.get_metadata(), ).clean(parts, step)
def containerbuild(command: str, project_config, output=None, args=None): if args is None: args = [] lxd.Project( output=output, source=os.path.curdir, project_options=project_config.project, metadata=project_config.get_metadata(), ).execute(command, args)
def containerbuild(*, command: str, project: Project, output: str = None, args: Sequence[str] = None) -> None: if args is None: args = [] lxd.Project(output=output, source=os.path.curdir, project=project).execute(command, args)
def containerbuild(step, project_options, container_config, output=None, args=[]): config = load_config(project_options) if container_config.remote: logger.info('Using LXD remote {!r} from SNAPCRAFT_CONTAINER_BUILDS' .format(container_config.remote)) else: logger.info('Using default LXD remote because ' 'SNAPCRAFT_CONTAINER_BUILDS is set to 1') lxd.Project(output=output, source=os.path.curdir, project_options=project_options, remote=container_config.remote, metadata=config.get_metadata()).execute(step, args)
def refresh(debug, **kwargs): """Refresh existing packages. \b Examples: snapcraft refresh """ build_environment = env.BuilderEnvironmentConfig() if build_environment.is_lxd: project = get_project(**kwargs, debug=debug) lxd.Project(project=project, output=None, source=os.path.curdir).refresh() else: repo.Repo.refresh_build_packages()
def clean(parts, step_name): """Remove content - cleans downloads, builds or install artifacts. \b Examples: snapcraft clean snapcraft clean my-part --step build """ build_environment = env.BuilderEnvironmentConfig() try: project = get_project( is_managed_host=build_environment.is_managed_host ) except YamlValidationError: # We need to be able to clean invalid projects too. project = get_project( is_managed_host=build_environment.is_managed_host, skip_snapcraft_yaml=True ) step = None if step_name: if step_name == "strip": echo.warning( "DEPRECATED: Use `prime` instead of `strip` as the step to clean" ) step_name = "prime" step = steps.get_step_by_name(step_name) if build_environment.is_lxd: lxd.Project(project=project, output=None, source=os.path.curdir).clean( parts, step ) elif build_environment.is_host: lifecycle.clean(project, parts, step) else: # TODO support for steps. if parts or step_name: raise errors.SnapcraftEnvironmentError( "Build providers are still not feature complete, specifying parts or a step name " "is not yet supported.") build_provider_class = build_providers.get_provider_for( build_environment.provider ) build_provider_class(project=project, echoer=echo).clean_project()
def clean(parts, step, **kwargs): """Remove content - cleans downloads, builds or install artifacts. \b Examples: snapcraft clean snapcraft clean my-part --step build """ project_options = get_project_options(**kwargs) container_config = env.get_container_config() if container_config.use_container: config = snapcraft.internal.load_config(project_options) lxd.Project(project_options=project_options, remote=container_config.remote, output=None, source=os.path.curdir, metadata=config.get_metadata()).clean(parts, step) else: step = step or 'pull' if step == 'strip': echo.warning('DEPRECATED: Use `prime` instead of `strip` ' 'as the step to clean') step = 'prime' lifecycle.clean(project_options, parts, step)
def clean(parts, step, **kwargs): """Remove content - cleans downloads, builds or install artifacts. \b Examples: snapcraft clean snapcraft clean my-part --step build """ project_options = get_project_options(**kwargs) build_environment = env.BuilderEnvironmentConfig() if build_environment.is_host: step = step or 'pull' if step == 'strip': echo.warning('DEPRECATED: Use `prime` instead of `strip` ' 'as the step to clean') step = 'prime' lifecycle.clean(project_options, parts, step) else: config = project_loader.load_config(project_options) lxd.Project(project_options=project_options, output=None, source=os.path.curdir, metadata=config.get_metadata()).clean(parts, step)
def containerbuild(step, project_options, output=None, args=[]): config = snapcraft.internal.load_config(project_options) lxd.Project(output=output, source=os.path.curdir, project_options=project_options, metadata=config.get_metadata()).execute(step, args)
def make_containerbuild(self): return lxd.Project(output='snap.snap', source='project.tar', metadata={'name': 'project'}, project_options=self.project_options, remote=self.remote)
def make_containerbuild(self): return lxd.Project(output="snap.snap", source="project.tar", project=self.project)