From 080877e41347b8987977fc8cc3ec90dcd149651a Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Tue, 9 Mar 2021 15:19:06 -0800 Subject: superproject: pass groups to ToXml method. Added the following methods to XmlManifest class. + GetDefaultGroupsStr() - return 'default,platform-' + platform.system().lower() + GetGroupsStr() - Same as gitc_utils.py's _manifest_groups func. + Replaced gitc_utils.py's_manifest_groups calls with GetGroupsStr. + Used the above methods to get groups in command.py::GetProjects and part of init.py. TODO: clean up these funcs to take structured group data more instead of passing strings around everywhere that need parsing. Tested the code with the following commands. $ ./run_tests -v Tested the sync code by using repo_dev alias and pointing to this CL and verified prebuilts/fullsdk-linux directory has all the folders. Tested repo init and repo sync with --use-superproject and without --use-superproject argument. $ repo_dev init -u sso://android.git.corp.google.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M --repo-rev=main --use-superproject $ repo_dev sync -c -j32 Bug: [google internal] b/181804931 Bug: https://crbug.com/gerrit/13707 Change-Id: Ia98585cbfa3a1449710655af55d56241794242b6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299422 Reviewed-by: Jonathan Nieder Reviewed-by: Mike Frysinger Tested-by: Raman Tenneti --- tests/test_git_superproject.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/test_git_superproject.py') diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index 07b9a7db..9550949b 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py @@ -15,6 +15,7 @@ """Unittests for the git_superproject.py module.""" import os +import platform import tempfile import unittest from unittest import mock @@ -34,6 +35,7 @@ class SuperprojectTestCase(unittest.TestCase): self.manifest_file = os.path.join( self.repodir, manifest_xml.MANIFEST_FILE_NAME) os.mkdir(self.repodir) + self.platform = platform.system().lower() # The manifest parsing really wants a git repo currently. gitdir = os.path.join(self.repodir, 'manifests.git') @@ -48,8 +50,8 @@ class SuperprojectTestCase(unittest.TestCase): - - + """) self._superproject = git_superproject.Superproject(manifest, self.repodir) @@ -142,7 +144,8 @@ class SuperprojectTestCase(unittest.TestCase): '' + '' + '' + - '' + + '' + '' + '') @@ -169,7 +172,8 @@ class SuperprojectTestCase(unittest.TestCase): '' + '' + '' + + 'revision="2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea" ' + + 'groups="notdefault,platform-' + self.platform + '"/>' + '' + '') -- cgit v1.2.3-54-g00ecf