def add_to_stack(domain, name, version, file_name, meta_path, stack_version): """ Add created package to stack and reference packages. <name> actual name of the package. <version> version of the package. <file_name> exact file_name of the package (versioned, architecture...). <meta_path> path to the stacks and other meta information related to package <stack_version> version of the stack to attach the package to. """ # get the meta_path from .gachetterc meta_path = meta_path if 'meta_path' not in env else env.meta_path stack = Stack(domain, stack_version, meta_path=meta_path) stack.add_package(name, version, file_name)
def add_to_stack(domain, name, version, file_name, meta_path, stack_version): """ Add created package to stack and reference packages. <name> actual name of the package. <version> version of the package. <file_name> exact file_name of the package (versioned, architecture...). <meta_path> path to the stacks and other meta information related to package <stack_version> version of the stack to attach the package to. """ # get the meta_path from .gachetterc meta_path = meta_path if 'meta_path' not in env else env.meta_path stack = Stack(domain, stack_version, meta_path=meta_path) stack.add_package(name, version, file_name)
def quick(domain, stack_version, project_name, ref="origin/master", url=None, path_to_missile=None, debs_path=None, meta_path=None): """ One-command to build and add to stack a specific branch. Depends heavily on pre-configuration via config file. Package version are set from Git commit. <domain> domain where the stack will be registered to (some kind of type for stack). <stack_version> version of the stack to attach the package to. <project_name> name of the project. <branch> is the branch to actually checkout. <url> is the url of the repo in github. <path_to_missile> is the path to the missile file in the project that will be used by trebuchet to build packages. <debs_path> path to where the DEB package should be created into. <meta_path> path to the stacks and other meta information related to package """ # Get value for the project, complain otherwise meta_path = meta_path if 'meta_path' not in env else env.meta_path debs_path = debs_path if 'debs_path' not in env else env.debs_path url = url if "projects" not in env or project_name not in env.projects or 'url' not in env.projects[project_name] else env.projects[project_name]['url'] path_to_missile = path_to_missile if "projects" not in env or project_name not in env.projects or 'path_to_missile' not in env.projects[project_name] else env.projects[project_name]['path_to_missile'] if not meta_path or not debs_path: abort("Please specify a meta_path/debs_path or add it approprietly in a config file") if not url: abort("Please specify a url or add it approprietly in a config file: projects.%s.url" % project_name) name = project_name if ref is None else project_name+"_"+ref.replace("/", "-") # use existing stack only (create one manually) new_stack = Stack(domain, stack_version, meta_path=meta_path) if not new_stack.is_persisted(): abort("""Please create a new stack first, using: `gachette stack_create`""") # Checkout specific branch and build wc = WorkingCopy(name) wc.prepare_environment() wc.checkout_working_copy(url, ref) # set version based on the git commit suffix = "" if ref is None else ref.replace("/", "-") version = wc.get_version_from_git(suffix=suffix) wc.set_version(app=version, env=version, service=version) results = wc.build(debs_path, path_to_missile, trebuchet_bin=trebuchet_bin) print "results: ", results # TODO extract package build results properly for item in results: new_stack.add_package(item['name'], item['version'], item['file_name'])
def quick(domain, stack_version, project_name, ref="origin/master", url=None, path_to_missile=None, debs_path=None, meta_path=None): """ One-command to build and add to stack a specific branch. Depends heavily on pre-configuration via config file. Package version are set from Git commit. <domain> domain where the stack will be registered to (some kind of type for stack). <stack_version> version of the stack to attach the package to. <project_name> name of the project. <branch> is the branch to actually checkout. <url> is the url of the repo in github. <path_to_missile> is the path to the missile file in the project that will be used by trebuchet to build packages. <debs_path> path to where the DEB package should be created into. <meta_path> path to the stacks and other meta information related to package """ # Get value for the project, complain otherwise meta_path = meta_path if 'meta_path' not in env else env.meta_path debs_path = debs_path if 'debs_path' not in env else env.debs_path url = url if "projects" not in env or project_name not in env.projects or 'url' not in env.projects[ project_name] else env.projects[project_name]['url'] path_to_missile = path_to_missile if "projects" not in env or project_name not in env.projects or 'path_to_missile' not in env.projects[ project_name] else env.projects[project_name]['path_to_missile'] if not meta_path or not debs_path: abort( "Please specify a meta_path/debs_path or add it approprietly in a config file" ) if not url: abort( "Please specify a url or add it approprietly in a config file: projects.%s.url" % project_name) name = project_name if ref is None else project_name + "_" + ref.replace( "/", "-") # use existing stack only (create one manually) new_stack = Stack(domain, stack_version, meta_path=meta_path) if not new_stack.is_persisted(): abort( """Please create a new stack first, using: `gachette stack_create`""" ) # Checkout specific branch and build wc = WorkingCopy(name) wc.prepare_environment() wc.checkout_working_copy(url, ref) # set version based on the git commit suffix = "" if ref is None else ref.replace("/", "-") version = wc.get_version_from_git(suffix=suffix) wc.set_version(app=version, env=version, service=version) results = wc.build(debs_path, path_to_missile, trebuchet_bin=trebuchet_bin) print "results: ", results # TODO extract package build results properly for item in results: new_stack.add_package(item['name'], item['version'], item['file_name'])