зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1632348 - Convert mach artifact to python 3. r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D72114
This commit is contained in:
Родитель
340788143e
Коммит
568944c117
1
mach
1
mach
|
@ -14,7 +14,6 @@ py2commands="
|
||||||
analyze
|
analyze
|
||||||
android
|
android
|
||||||
android-emulator
|
android-emulator
|
||||||
artifact
|
|
||||||
awsy-test
|
awsy-test
|
||||||
browsertime
|
browsertime
|
||||||
cargo
|
cargo
|
||||||
|
|
|
@ -705,7 +705,7 @@ def open_manifest(manifest_file):
|
||||||
"""I know how to take a filename and load it into a Manifest object"""
|
"""I know how to take a filename and load it into a Manifest object"""
|
||||||
if os.path.exists(manifest_file):
|
if os.path.exists(manifest_file):
|
||||||
manifest = Manifest()
|
manifest = Manifest()
|
||||||
with open(manifest_file, "rb") as f:
|
with open(manifest_file, "r" if PY3 else "rb") as f:
|
||||||
manifest.load(f)
|
manifest.load(f)
|
||||||
log.debug("loaded manifest from file '%s'" % manifest_file)
|
log.debug("loaded manifest from file '%s'" % manifest_file)
|
||||||
return manifest
|
return manifest
|
||||||
|
|
|
@ -162,7 +162,7 @@ class ArtifactCache(object):
|
||||||
if len(fname) not in (32, 40, 56, 64, 96, 128):
|
if len(fname) not in (32, 40, 56, 64, 96, 128):
|
||||||
raise TypeError()
|
raise TypeError()
|
||||||
binascii.unhexlify(fname)
|
binascii.unhexlify(fname)
|
||||||
except TypeError:
|
except (TypeError, binascii.Error):
|
||||||
# We download to a temporary name like HASH[:16]-basename to
|
# We download to a temporary name like HASH[:16]-basename to
|
||||||
# differentiate among URLs with the same basenames. We used to then
|
# differentiate among URLs with the same basenames. We used to then
|
||||||
# extract the build ID from the downloaded artifact and use it to make a
|
# extract the build ID from the downloaded artifact and use it to make a
|
||||||
|
|
|
@ -412,7 +412,7 @@ class PackageFrontend(MachCommandBase):
|
||||||
# Keep a sha256 of each downloaded file, for the chain-of-trust
|
# Keep a sha256 of each downloaded file, for the chain-of-trust
|
||||||
# validation.
|
# validation.
|
||||||
if artifact_manifest is not None:
|
if artifact_manifest is not None:
|
||||||
with open(local) as fh:
|
with open(local, 'rb') as fh:
|
||||||
h = hashlib.sha256()
|
h = hashlib.sha256()
|
||||||
while True:
|
while True:
|
||||||
data = fh.read(1024 * 1024)
|
data = fh.read(1024 * 1024)
|
||||||
|
|
|
@ -897,6 +897,7 @@ class Artifacts(object):
|
||||||
env = kwargs.get('env', {})
|
env = kwargs.get('env', {})
|
||||||
env['HGPLAIN'] = '1'
|
env['HGPLAIN'] = '1'
|
||||||
kwargs['env'] = ensure_subprocess_env(env)
|
kwargs['env'] = ensure_subprocess_env(env)
|
||||||
|
kwargs['universal_newlines'] = True
|
||||||
return subprocess.check_output([self._hg] + list(args),
|
return subprocess.check_output([self._hg] + list(args),
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
@ -979,11 +980,11 @@ class Artifacts(object):
|
||||||
self._git, 'rev-list', '--topo-order',
|
self._git, 'rev-list', '--topo-order',
|
||||||
'--max-count={num}'.format(num=NUM_REVISIONS_TO_QUERY),
|
'--max-count={num}'.format(num=NUM_REVISIONS_TO_QUERY),
|
||||||
'HEAD',
|
'HEAD',
|
||||||
], cwd=self._topsrcdir)
|
], universal_newlines=True, cwd=self._topsrcdir)
|
||||||
|
|
||||||
hg_hash_list = subprocess.check_output([
|
hg_hash_list = subprocess.check_output([
|
||||||
self._git, 'cinnabar', 'git2hg'
|
self._git, 'cinnabar', 'git2hg'
|
||||||
] + rev_list.splitlines(), cwd=self._topsrcdir)
|
] + rev_list.splitlines(), universal_newlines=True, cwd=self._topsrcdir)
|
||||||
|
|
||||||
zeroes = "0" * 40
|
zeroes = "0" * 40
|
||||||
|
|
||||||
|
@ -1201,7 +1202,8 @@ see https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code
|
||||||
elif self._git:
|
elif self._git:
|
||||||
revset = subprocess.check_output([
|
revset = subprocess.check_output([
|
||||||
self._git, 'rev-parse', '%s^{commit}' % revset],
|
self._git, 'rev-parse', '%s^{commit}' % revset],
|
||||||
stderr=open(os.devnull, 'w'), cwd=self._topsrcdir).strip()
|
stderr=open(os.devnull, 'w'), universal_newlines=True,
|
||||||
|
cwd=self._topsrcdir).strip()
|
||||||
else:
|
else:
|
||||||
# Fallback to the exception handling case from both hg and git
|
# Fallback to the exception handling case from both hg and git
|
||||||
raise subprocess.CalledProcessError()
|
raise subprocess.CalledProcessError()
|
||||||
|
@ -1215,7 +1217,8 @@ see https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code
|
||||||
|
|
||||||
if revision is None and self._git:
|
if revision is None and self._git:
|
||||||
revision = subprocess.check_output(
|
revision = subprocess.check_output(
|
||||||
[self._git, 'cinnabar', 'git2hg', revset], cwd=self._topsrcdir).strip()
|
[self._git, 'cinnabar', 'git2hg', revset], universal_newlines=True,
|
||||||
|
cwd=self._topsrcdir).strip()
|
||||||
|
|
||||||
if revision == "0" * 40 or revision is None:
|
if revision == "0" * 40 or revision is None:
|
||||||
raise ValueError('revision specification must resolve to a commit known to hg')
|
raise ValueError('revision specification must resolve to a commit known to hg')
|
||||||
|
|
Загрузка…
Ссылка в новой задаче