mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
output actual CIPD package URL instead of 'None' when calling revinfo -a
Note: we are only evaluating cipd variables in the URL not the package string on the left hand side, as to not break any existing expected behaviour. Bug:b/279097790 Change-Id: I0b6008254bd387584b9c0ee083c79bf5dc77fbc8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4536475 Commit-Queue: Dan Le Febvre <dlf@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
12
gclient.py
12
gclient.py
@@ -538,6 +538,11 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|||||||
return
|
return
|
||||||
url = None
|
url = None
|
||||||
scm = self.CreateSCM()
|
scm = self.CreateSCM()
|
||||||
|
if scm.name == 'cipd':
|
||||||
|
revision = scm.revinfo(None, None, None)
|
||||||
|
package = self.GetExpandedPackageName()
|
||||||
|
url = '%s/p/%s/+/%s' % (scm.GetActualRemoteURL(None), package, revision)
|
||||||
|
|
||||||
if os.path.isdir(scm.checkout_path):
|
if os.path.isdir(scm.checkout_path):
|
||||||
revision = scm.revinfo(None, None, None)
|
revision = scm.revinfo(None, None, None)
|
||||||
url = '%s@%s' % (gclient_utils.SplitUrlRevision(self.url)[0], revision)
|
url = '%s@%s' % (gclient_utils.SplitUrlRevision(self.url)[0], revision)
|
||||||
@@ -2277,6 +2282,13 @@ class CipdDependency(Dependency):
|
|||||||
"""Always 'cipd'."""
|
"""Always 'cipd'."""
|
||||||
return 'cipd'
|
return 'cipd'
|
||||||
|
|
||||||
|
def GetExpandedPackageName(self):
|
||||||
|
"""Return the CIPD package name with the variables evaluated."""
|
||||||
|
package = self._cipd_root.expand_package_name(self._package_name)
|
||||||
|
if package:
|
||||||
|
return package
|
||||||
|
return self._package_name
|
||||||
|
|
||||||
#override
|
#override
|
||||||
def CreateSCM(self, out_cb=None):
|
def CreateSCM(self, out_cb=None):
|
||||||
"""Create a Wrapper instance suitable for handling this CIPD dependency."""
|
"""Create a Wrapper instance suitable for handling this CIPD dependency."""
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
echo off
|
@echo off
|
||||||
:: Copyright (c) 2018 The Chromium Authors. All rights reserved.
|
:: Copyright (c) 2018 The Chromium Authors. All rights reserved.
|
||||||
:: Use of this source code is governed by a BSD-style license that can be
|
:: Use of this source code is governed by a BSD-style license that can be
|
||||||
:: found in the LICENSE file.
|
:: found in the LICENSE file.
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ class FakeReposBase(object):
|
|||||||
|
|
||||||
class FakeRepos(FakeReposBase):
|
class FakeRepos(FakeReposBase):
|
||||||
"""Implements populateGit()."""
|
"""Implements populateGit()."""
|
||||||
NB_GIT_REPOS = 17
|
NB_GIT_REPOS = 18
|
||||||
|
|
||||||
def populateGit(self):
|
def populateGit(self):
|
||||||
# Testing:
|
# Testing:
|
||||||
@@ -732,6 +732,30 @@ hooks = [{
|
|||||||
'origin': 'git/repo_17@2\n'
|
'origin': 'git/repo_17@2\n'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self._commit_git(
|
||||||
|
'repo_18', {
|
||||||
|
'DEPS':
|
||||||
|
textwrap.dedent("""\
|
||||||
|
deps = {
|
||||||
|
'src/cipd_dep': {
|
||||||
|
'packages': [
|
||||||
|
{
|
||||||
|
'package': 'package0',
|
||||||
|
'version': 'package0-fake-tag:1.0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'package': 'package0/${{platform}}',
|
||||||
|
'version': 'package0/${{platform}}-fake-tag:1.0',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'dep_type': 'cipd',
|
||||||
|
},
|
||||||
|
}"""),
|
||||||
|
'origin':
|
||||||
|
'git/repo_18@2\n'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class FakeRepoSkiaDEPS(FakeReposBase):
|
class FakeRepoSkiaDEPS(FakeReposBase):
|
||||||
"""Simulates the Skia DEPS transition in Chrome."""
|
"""Simulates the Skia DEPS transition in Chrome."""
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import gclient_smoketest_base
|
|||||||
|
|
||||||
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
CHROME_INFRA_URL = "https://chrome-infra-packages.appspot.com"
|
||||||
|
|
||||||
|
|
||||||
class GClientSmokeCipd(gclient_smoketest_base.GClientSmokeBase):
|
class GClientSmokeCipd(gclient_smoketest_base.GClientSmokeBase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -132,6 +134,42 @@ class GClientSmokeCipd(gclient_smoketest_base.GClientSmokeBase):
|
|||||||
})
|
})
|
||||||
self.assertTree(tree)
|
self.assertTree(tree)
|
||||||
|
|
||||||
|
def testRevInfo(self):
|
||||||
|
self.gclient(['config', self.git_base + 'repo_18', '--name', 'src'])
|
||||||
|
self.gclient(['sync'])
|
||||||
|
results = self.gclient(['revinfo'])
|
||||||
|
out = ('src: %(base)srepo_18\n'
|
||||||
|
'src/cipd_dep:package0: %(instance_url1)s\n'
|
||||||
|
'src/cipd_dep:package0/${platform}: %(instance_url2)s\n' % {
|
||||||
|
'base':
|
||||||
|
self.git_base,
|
||||||
|
'instance_url1':
|
||||||
|
CHROME_INFRA_URL + '/package0@package0-fake-tag:1.0',
|
||||||
|
'instance_url2':
|
||||||
|
CHROME_INFRA_URL +
|
||||||
|
'/package0/${platform}@package0/${platform}-fake-tag:1.0',
|
||||||
|
})
|
||||||
|
self.check((out, '', 0), results)
|
||||||
|
|
||||||
|
def testRevInfoActual(self):
|
||||||
|
self.gclient(['config', self.git_base + 'repo_18', '--name', 'src'])
|
||||||
|
self.gclient(['sync'])
|
||||||
|
results = self.gclient(['revinfo', '--actual'])
|
||||||
|
out = ('src: %(base)srepo_18@%(hash1)s\n'
|
||||||
|
'src/cipd_dep:package0: %(instance_url1)s\n'
|
||||||
|
'src/cipd_dep:package0/${platform}: %(instance_url2)s\n' % {
|
||||||
|
'base':
|
||||||
|
self.git_base,
|
||||||
|
'hash1':
|
||||||
|
self.githash('repo_18', 1),
|
||||||
|
'instance_url1':
|
||||||
|
CHROME_INFRA_URL + '/p/package0/+/package0-fake-instance-id',
|
||||||
|
'instance_url2':
|
||||||
|
CHROME_INFRA_URL + '/p/package0/platform-expanded-test-only' +
|
||||||
|
'/+/package0/${platform}-fake-instance-id',
|
||||||
|
})
|
||||||
|
self.check((out, '', 0), results)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if '-v' in sys.argv:
|
if '-v' in sys.argv:
|
||||||
|
|||||||
Reference in New Issue
Block a user