def clone_all_git(args, spec): """ Clone all git repositories for a package """ for resource in spec.resources(): if resource.is_repo: # remove trailing '.git' destination = Path(args.repos, resource.basename[:-4]) clone_resource(resource, destination)
def test_source_replaces_source0(self): """A link with a Source entry is parsed into Source0""" link = planex.link.Link("tests/data/ocaml-cstruct.lnk") spec = planex.spec.load("tests/data/ocaml-cstruct.spec", link=link, defines=RPM_DEFINES) self.assertEqual( spec.resources(), [Blob(spec, "tests/data/test-git.tar.gz", "tests/data/ocaml-cstruct.lnk")] )
def clone_all_fetchable(args, package, spec): """ Clone all remote resources for a package """ for resource in spec.resources(): if resource.is_fetchable: if resource.is_repo: # remove trailing '.git' destination = Path(args.repos, resource.basename[:-4]) else: destination = Path(args.repos, package) clone_resource(resource, destination)
def clone_jenkins(args, spec): """ Generate either a JSON object or a Groovy fragment that describes the git-based resources of a package """ for resource in spec.resources(): if resource.is_repo: package = resource.basename.rsplit(".git")[0] url = resource.url commitish = resource.commitish if args.credentials: # output Groovy fragment print('echo "Cloning %s#%s"' % (url, commitish)) clone_jenkins_groovy(package, args.repos, args.credentials, url, commitish) else: # output JSON object clone_jenkins_json(package, args.output, url, commitish)