Bug 1234913 - Post: Stop using local pushlog in |mach artifact install|. r?chmanchester
MozReview-Commit-ID: CG5KcYbTcbM
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -5,18 +5,20 @@
'''
Fetch build artifacts from a Firefox tree.
This provides an (at-the-moment special purpose) interface to download Android
artifacts from Mozilla's Task Cluster.
This module performs the following steps:
-* find a candidate hg parent revision using the local pushlog. The local
- pushlog is maintained by mozext locally and updated on every pull.
+* find a candidate hg parent revision. At one time we used the local pushlog,
+ which required the mozext hg extension. This isn't feasible with git, and it
+ is only mildly less efficient to not use the pushlog, so we don't use it even
+ when querying hg.
* map the candidate parent to candidate Task Cluster tasks and artifact
locations. Pushlog entries might not correspond to tasks (yet), and those
tasks might not produce the desired class of artifacts.
* fetch fresh Task Cluster artifacts and purge old artifacts, using a simple
Least Recently Used cache.
@@ -738,52 +740,40 @@ class Artifacts(object):
return 'macosx64'
raise Exception('Cannot determine default job for |mach artifact|!')
def _find_hg_pushheads(self):
"""Return an iterator of (hg_hash, {tree-set}) associating hg revision
hashes that might be pushheads with the trees they are known
to be in.
- More recent hashes should come earlier in the list. We always
- have the pushlog locally, so we'll never yield an empty tree-set.
+ More recent hashes come earlier in the list.
"""
- try:
- output = subprocess.check_output([
- self._hg, 'log',
- '--template', '{node},{join(trees, ",")}\n',
- '-r', 'last(pushhead({tree}) and ::., {num})'.format(
- tree=self._tree or '', num=NUM_PUSHHEADS_TO_QUERY_PER_PARENT)
- ])
- except subprocess.CalledProcessError:
- # We probably don't have the mozext extension installed.
- ret = subprocess.call([self._hg, 'showconfig', 'extensions.mozext'])
- if ret:
- raise Exception('Could not find pushheads for recent revisions.\n\n'
- 'You need to enable the "mozext" hg extension: '
- 'see https://developer.mozilla.org/en-US/docs/Artifact_builds')
- raise
+ hg_hash_list = subprocess.check_output([
+ self._hg, 'log',
+ '--template', '{node}\n',
+ '-r', 'last(public() and ::., {num})'.format(
+ num=NUM_PUSHHEADS_TO_QUERY_PER_PARENT)
+ ])
+ # We are not using any local pushlog data, so we never know there is a
+ # push (resulting in any kind of job) corresponding to any trees.
+ trees = tuple()
count = 0
- for line in output.splitlines():
- if not line:
- continue
- rev_info = line.split(',')
- if len(rev_info) == 1:
- # If pushhead() is true, it would seem "trees" should be
- # non-empty, but this is defensive.
+ for hg_hash in hg_hash_list.splitlines():
+ hg_hash = hg_hash.strip()
+ if not hg_hash:
continue
count += 1
- yield rev_info[0], tuple(rev_info[1:])
+ yield (hg_hash, trees)
if not count:
raise Exception('Could not find any candidate pushheads in the last {num} revisions.\n\n'
- 'Try running |hg pushlogsync|;\n'
- 'see https://developer.mozilla.org/en-US/docs/Artifact_builds'.format(
+ 'See https://developer.mozilla.org/en-US/docs/Artifact_builds'.format(
num=NUM_PUSHHEADS_TO_QUERY_PER_PARENT))
def _find_git_pushheads(self, rev):
"""Return an iterator of (hg_hash, {tree-set}) associating hg revision
hashes that might be pushheads with the trees they are known
to be in.
More recent hashes should come earlier in the list. It's okay