Commit 8f19db3a authored by Mark Janes's avatar Mark Janes

fetch_sources: infer --project from --branch

Most jenkins builds trigger the project that is specified for the
branch in the buildspec.  We need to provide this information to
fetch_sources, so all the required sources can be fetched.
parent 540a0f26
......@@ -71,19 +71,33 @@ def main():
args = parser.parse_args()
repos = bs.RepoSet()
spec = bs.BuildSpecification()
limit_to_repos = {}
for c in args.commits:
limit_to_repos[c.split("=")[0]] = c.split("=")[1]
if args.project:
deps = bs.DependencyGraph(args.project, bs.Options(args = [sys.argv[0]]))
project = args.project
branch = args.branch
branchspec = None
if branch:
branchspec = spec.branch_specification(branch)
if not project and branchspec:
# we can infer the project from the --branch parameter
project = branchspec.project
if project:
# only fetch sources that are required for the project
deps = bs.DependencyGraph(project, bs.Options(args = [sys.argv[0]]))
for repo in deps.all_sources():
if repo not in limit_to_repos:
limit_to_repos[repo] = None
spec = bs.BuildSpecification()
if args.branch:
branch = spec.branch_specification(args.branch)
if branchspec:
# use the branch specification to configure any sources that remain indeterminate
for i in range(15):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment