Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update include_multiple_projects_version and fixes around remote revision #43

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions repo_resource/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def __get_remote_url(self, remote):
return self.__remote_url[remote]

def __get_remote_revision(self, remote):
return self.__remote_revision[remote]
return self.__remote_revision.get(remote)

def set_rewrite(self, matrix: dict = None):
if matrix is None:
Expand Down Expand Up @@ -460,8 +460,10 @@ def update_manifest(self, jobs):

for p in manifest.findall('project'):
project = p.get('name')
projectBranch = p.get('revision') or defaultBranch
projectRemote = p.get('remote') or defaultRemote
projectBranch = p.get('revision') \
or self.__get_remote_revision(projectRemote) \
or defaultBranch
projectRemoteUrl = self.__get_remote_url(projectRemote)
projects.append((projectRemote, projectRemoteUrl,
project, projectBranch))
Expand All @@ -472,8 +474,10 @@ def update_manifest(self, jobs):
# Update revisions
for p in manifest.findall('project'):
project = p.get('name')
projectBranch = p.get('revision') or defaultBranch
projectRemote = p.get('remote') or defaultRemote
projectBranch = p.get('revision') \
or self.__get_remote_revision(projectRemote) \
or defaultBranch
# find revision of the project in revisionList
for url, branch, rev in revisionList:
if (
Expand Down
2 changes: 1 addition & 1 deletion repo_resource/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def test_include_multiple_projects_version(self):
instream = StringIO(json.dumps(data))
versions = check.check(instream)

expected_version = '<manifest><remote fetch=\"https://android.googlesource.com/\" name=\"aosp\"></remote><default remote=\"aosp\" revision=\"refs/tags/android-12.0.0_r32\"></default><remote fetch=\"https://github.com/\" name=\"github\"></remote><project name=\"wimglenn/oyaml\" path=\"external/oyaml\" remote=\"github\" revision=\"6350d9de586f40014296b55427ccbc1d7f47269a\"></project><remote fetch=\"https://github.com/\" name=\"github\"></remote><project name=\"OP-TEE/optee_client\" path=\"vendor/linaro/optee_client\" remote=\"github\" revision=\"8533e0e6329840ee96cf81b6453f257204227e6c\"></project><project groups=\"pdk\" name=\"device/generic/common\" path=\"device/generic/common\" revision=\"033d50e2298811d81de7db8cdea63e349a96c9ba\"></project><remote fetch=\"https://github.com/\" name=\"github\"></remote><project name=\"CirrusLogic/tinyhal\" path=\"external/tinyhal\" remote=\"github\" revision=\"69d47887c13da461bf8400231a1c7f7290826037\"></project></manifest>' # noqa: E501
expected_version = '<manifest><remote fetch=\"https://android.googlesource.com/\" name=\"aosp\"></remote><default remote=\"aosp\" revision=\"refs/tags/android-12.0.0_r32\"></default><remote fetch=\"https://github.com/\" name=\"github\"></remote><project name=\"wimglenn/oyaml\" path=\"external/oyaml\" remote=\"github\" revision=\"6350d9de586f40014296b55427ccbc1d7f47269a\"></project><remote fetch=\"https://github.com/\" name=\"optee_github\" revision=\"refs/tags/3.21.0\"></remote><project name=\"OP-TEE/optee_client\" path=\"vendor/linaro/optee_client\" remote=\"optee_github\" revision=\"8533e0e6329840ee96cf81b6453f257204227e6c\"></project><project groups=\"pdk\" name=\"device/generic/common\" path=\"device/generic/common\" revision=\"033d50e2298811d81de7db8cdea63e349a96c9ba\"></project><remote fetch=\"https://github.com/\" name=\"github\"></remote><project name=\"CirrusLogic/tinyhal\" path=\"external/tinyhal\" remote=\"github\" revision=\"69d47887c13da461bf8400231a1c7f7290826037\"></project></manifest>' # noqa: E501

version = versions[0]['version']
self.assertEqual(version, expected_version)
Expand Down
Loading