[checkout] Add a patch_project parameter.
Some jiri projects have names that don't match their repo name.
Currently we use the gerrit_change.project as the project to pass to
`jiri patch`; however, it actually needs to be the name assigned to the
project in the jiri manifest. Thus, I added a patch_project param that
we can provide if the names don't match. This will be necessary for the
cobalt_config recipe.
Bug: 45618
Change-Id: I153416be602de970170d41b7e675625b592b17ba
diff --git a/recipe_modules/checkout/api.py b/recipe_modules/checkout/api.py
index 2aa64e9..64d5ad1 100644
--- a/recipe_modules/checkout/api.py
+++ b/recipe_modules/checkout/api.py
@@ -127,6 +127,7 @@
manifest,
remote,
project=None,
+ patch_project=None,
attributes=(),
build_input=None,
timeout_secs=None,
@@ -141,6 +142,8 @@
manifest (str): Relative path to the manifest in the remote repository.
remote (str): URL to the remote repository.
project (str): The name that jiri should assign to the project.
+ patch_project (str): The name of the jiri project to patch if different
+ from the gerrit_change project.
rebase_revision (str): The base revision to patch on top of, if the
build input is a Gerrit Change. TODO(kjharland): This is hacky, find a
better way to carry this information through to `from_patchset`.
@@ -166,6 +169,7 @@
manifest=manifest,
remote=remote,
project=project,
+ patch_project=patch_project,
rebase_revision=rebase_revision,
run_hooks=run_hooks,
timeout_secs=timeout_secs,
@@ -236,6 +240,7 @@
manifest,
remote,
project,
+ patch_project,
run_hooks,
timeout_secs,
gerrit_change,
@@ -247,6 +252,8 @@
manifest (str): Relative path to the manifest in the remote repository.
remote (str): URL to the remote repository.
project (str): The name that jiri should assign to the project.
+ patch_project (str): The name of the jiri project to patch if different
+ from the gerrit_change project.
timeout_secs (int): A timeout for jiri update in seconds.
gerrit_change: The GerritChange message from the BuildBucket build input.
rebase_revision: The revision to rebase gerrit_change on top of.
@@ -277,7 +284,7 @@
self.m.jiri.patch(
patch_ref,
host='https://%s' % gerrit_change.host,
- project=gerrit_change.project,
+ project=patch_project or gerrit_change.project,
rebase=True,
rebase_revision=rebase_revision,
)