mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Update roll_downstream_gcs_deps to take a list of source and destination packages.
This is needed to support rolling multiple packages at once when package names don't match. Change-Id: I20bb5edfee87bb3e089a2c25f597e4778e0fe60f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5867086 Reviewed-by: Stephanie Kim <kimstephanie@google.com> Auto-Submit: Josip Sokcevic <sokcevic@chromium.org> Commit-Queue: Stephanie Kim <kimstephanie@google.com>
This commit is contained in:
@@ -18,16 +18,17 @@ class CopyPackageTest(unittest.TestCase):
|
||||
|
||||
def testNoDepsToRoll(self):
|
||||
with self.assertRaises(Exception):
|
||||
roll_downstream_gcs_deps.copy_packages('', '', ['foo'])
|
||||
roll_downstream_gcs_deps.copy_packages('', '', ['foo'], ['foo'])
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
roll_downstream_gcs_deps.copy_packages('deps = {"foo": ""}',
|
||||
'deps = {}', ['foo'])
|
||||
'deps = {}', ['foo'],
|
||||
['foo'])
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
roll_downstream_gcs_deps.copy_packages('deps = {"foo": ""}',
|
||||
'deps = {"bar": ""}',
|
||||
['foo'])
|
||||
['foo'], ['baz'])
|
||||
|
||||
def testNoGCSDeps(self):
|
||||
source_deps = '''
|
||||
@@ -62,7 +63,8 @@ deps = {
|
||||
'''
|
||||
with self.assertRaises(Exception):
|
||||
roll_downstream_gcs_deps.copy_packages(source_deps,
|
||||
destination_deps, ['foo'])
|
||||
destination_deps, ['foo'],
|
||||
['foo'])
|
||||
|
||||
def testObjectInLineUpdate(self):
|
||||
source_deps = '''
|
||||
@@ -125,7 +127,7 @@ deps = {
|
||||
'''
|
||||
result = roll_downstream_gcs_deps.copy_packages(source_deps,
|
||||
destination_deps,
|
||||
['foo'])
|
||||
['foo'], ['foo'])
|
||||
self.assertEqual(result, expected_deps)
|
||||
|
||||
def testGCSRustPackageNewPlatform(self):
|
||||
@@ -169,7 +171,7 @@ deps = {
|
||||
'''
|
||||
destination_deps = '''
|
||||
deps = {
|
||||
'src/third_party/rust-toolchain': {
|
||||
'third_party/rust-toolchain': {
|
||||
'dep_type': 'gcs',
|
||||
'bucket': 'chromium-browser-clang',
|
||||
'objects': [
|
||||
@@ -183,10 +185,56 @@ deps = {
|
||||
],
|
||||
},
|
||||
}
|
||||
'''
|
||||
expected_deps = '''
|
||||
deps = {
|
||||
'third_party/rust-toolchain': {
|
||||
'dep_type': 'gcs',
|
||||
'bucket': 'chromium-browser-clang',
|
||||
'objects': [
|
||||
{
|
||||
'object_name': 'Linux_x64/rust-toolchain-595316b4006932405a63862d8fe65f71a6356293-3-llvmorg-20-init-1009-g7088a5ed.tar.xz',
|
||||
'sha256sum': '560c02da5300f40441992ef639d83cee96cae3584c3d398704fdb2f02e475bbf',
|
||||
'size_bytes': 152024840,
|
||||
'generation': 1722663990116408,
|
||||
'condition': 'host_os == "linux" and non_git_source',
|
||||
},
|
||||
{
|
||||
'object_name': 'Mac/rust-toolchain-595316b4006932405a63862d8fe65f71a6356293-3-llvmorg-20-init-1009-g7088a5ed.tar.xz',
|
||||
'sha256sum': '9f39154b4337438fd170e729ed2ae4c978b22f11708d683c28265bd096df17a5',
|
||||
'size_bytes': 144459260,
|
||||
'generation': 1722663991651609,
|
||||
'condition': 'host_os == "mac" and host_cpu == "x64"',
|
||||
},
|
||||
{
|
||||
'object_name': 'Mac_arm64/rust-toolchain-595316b4006932405a63862d8fe65f71a6356293-3-llvmorg-20-init-1009-g7088a5ed.tar.xz',
|
||||
'sha256sum': '4b89cf125ffa39e8fc74f01ec3beeb632fd3069478d8c6cc4fcae506b4917151',
|
||||
'size_bytes': 135571272,
|
||||
'generation': 1722663993205996,
|
||||
'condition': 'host_os == "mac" and host_cpu == "arm64"',
|
||||
},
|
||||
{
|
||||
'object_name': 'Win/rust-toolchain-595316b4006932405a63862d8fe65f71a6356293-3-llvmorg-20-init-1009-g7088a5ed.tar.xz',
|
||||
'sha256sum': '3f6a1a87695902062a6575632552b9f2cbbbcda1907fe3232f49b8ea29baecf5',
|
||||
'size_bytes': 208844028,
|
||||
'generation': 1722663994756449,
|
||||
'condition': 'host_os == "win"',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
'''
|
||||
result = roll_downstream_gcs_deps.copy_packages(
|
||||
source_deps, destination_deps, ['src/third_party/rust-toolchain'])
|
||||
self.assertEqual(result, source_deps)
|
||||
source_deps, destination_deps, ['src/third_party/rust-toolchain'],
|
||||
['third_party/rust-toolchain'])
|
||||
self.assertEqual(result, expected_deps)
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
# no destination_package match, so expect a failure.
|
||||
roll_downstream_gcs_deps.copy_packages(
|
||||
source_deps, destination_deps,
|
||||
['src/third_party/rust-toolchain'],
|
||||
['src/third_party/rust-toolchain'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user