diff options
author | Raman Tenneti <rtenneti@google.com> | 2021-03-09 15:19:06 -0800 |
---|---|---|
committer | Raman Tenneti <rtenneti@google.com> | 2021-03-11 01:24:52 +0000 |
commit | 080877e41347b8987977fc8cc3ec90dcd149651a (patch) | |
tree | 57a8c76bd02da5f9400cdec5da6a75f4e4f2d3f2 /tests/test_git_superproject.py | |
parent | 9888accb0cf2c17e0f4bbc399782ccd2a4be0196 (diff) | |
download | git-repo-080877e41347b8987977fc8cc3ec90dcd149651a.tar.gz |
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 <jrn@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Raman Tenneti <rtenneti@google.com>
Diffstat (limited to 'tests/test_git_superproject.py')
-rw-r--r-- | tests/test_git_superproject.py | 12 |
1 files changed, 8 insertions, 4 deletions
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 @@ | |||
15 | """Unittests for the git_superproject.py module.""" | 15 | """Unittests for the git_superproject.py module.""" |
16 | 16 | ||
17 | import os | 17 | import os |
18 | import platform | ||
18 | import tempfile | 19 | import tempfile |
19 | import unittest | 20 | import unittest |
20 | from unittest import mock | 21 | from unittest import mock |
@@ -34,6 +35,7 @@ class SuperprojectTestCase(unittest.TestCase): | |||
34 | self.manifest_file = os.path.join( | 35 | self.manifest_file = os.path.join( |
35 | self.repodir, manifest_xml.MANIFEST_FILE_NAME) | 36 | self.repodir, manifest_xml.MANIFEST_FILE_NAME) |
36 | os.mkdir(self.repodir) | 37 | os.mkdir(self.repodir) |
38 | self.platform = platform.system().lower() | ||
37 | 39 | ||
38 | # The manifest parsing really wants a git repo currently. | 40 | # The manifest parsing really wants a git repo currently. |
39 | gitdir = os.path.join(self.repodir, 'manifests.git') | 41 | gitdir = os.path.join(self.repodir, 'manifests.git') |
@@ -48,8 +50,8 @@ class SuperprojectTestCase(unittest.TestCase): | |||
48 | <remote name="default-remote" fetch="http://localhost" /> | 50 | <remote name="default-remote" fetch="http://localhost" /> |
49 | <default remote="default-remote" revision="refs/heads/main" /> | 51 | <default remote="default-remote" revision="refs/heads/main" /> |
50 | <superproject name="superproject"/> | 52 | <superproject name="superproject"/> |
51 | <project path="art" name="platform/art" /> | 53 | <project path="art" name="platform/art" groups="notdefault,platform-""" + self.platform + """ |
52 | </manifest> | 54 | " /></manifest> |
53 | """) | 55 | """) |
54 | self._superproject = git_superproject.Superproject(manifest, self.repodir) | 56 | self._superproject = git_superproject.Superproject(manifest, self.repodir) |
55 | 57 | ||
@@ -142,7 +144,8 @@ class SuperprojectTestCase(unittest.TestCase): | |||
142 | '<?xml version="1.0" ?><manifest>' + | 144 | '<?xml version="1.0" ?><manifest>' + |
143 | '<remote name="default-remote" fetch="http://localhost"/>' + | 145 | '<remote name="default-remote" fetch="http://localhost"/>' + |
144 | '<default remote="default-remote" revision="refs/heads/main"/>' + | 146 | '<default remote="default-remote" revision="refs/heads/main"/>' + |
145 | '<project name="platform/art" path="art" revision="ABCDEF"/>' + | 147 | '<project name="platform/art" path="art" revision="ABCDEF" ' + |
148 | 'groups="notdefault,platform-' + self.platform + '"/>' + | ||
146 | '<superproject name="superproject"/>' + | 149 | '<superproject name="superproject"/>' + |
147 | '</manifest>') | 150 | '</manifest>') |
148 | 151 | ||
@@ -169,7 +172,8 @@ class SuperprojectTestCase(unittest.TestCase): | |||
169 | '<remote name="default-remote" fetch="http://localhost"/>' + | 172 | '<remote name="default-remote" fetch="http://localhost"/>' + |
170 | '<default remote="default-remote" revision="refs/heads/main"/>' + | 173 | '<default remote="default-remote" revision="refs/heads/main"/>' + |
171 | '<project name="platform/art" path="art" ' + | 174 | '<project name="platform/art" path="art" ' + |
172 | 'revision="2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea"/>' + | 175 | 'revision="2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea" ' + |
176 | 'groups="notdefault,platform-' + self.platform + '"/>' + | ||
173 | '<superproject name="superproject"/>' + | 177 | '<superproject name="superproject"/>' + |
174 | '</manifest>') | 178 | '</manifest>') |
175 | 179 | ||