mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1846705: Fix Updatebot Tag tracking r=jewilde
Always sort by creatordate, so we get the most recent tag at the end. Stop using the Github API, because we can't sort by creatordate. Unify the code paths to avoid duplication Differential Revision: https://phabricator.services.mozilla.com/D188263
This commit is contained in:
parent
274a39586b
commit
e6cb5f6b78
27
python/mozbuild/mozbuild/vendor/host_base.py
vendored
27
python/mozbuild/mozbuild/vendor/host_base.py
vendored
@ -33,25 +33,28 @@ class BaseHost:
|
|||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
os.chdir("/".join([temp_repo_clone, self.manifest["origin"]["name"]]))
|
os.chdir("/".join([temp_repo_clone, self.manifest["origin"]["name"]]))
|
||||||
if revision == "HEAD":
|
revision_arg = []
|
||||||
|
if revision and revision != "HEAD":
|
||||||
|
revision_arg = [revision]
|
||||||
|
|
||||||
|
try:
|
||||||
|
print(
|
||||||
|
["git", "--no-pager", "tag", "-l", "--sort=creatordate"]
|
||||||
|
+ revision_arg
|
||||||
|
)
|
||||||
tag = subprocess.run(
|
tag = subprocess.run(
|
||||||
["git", "--no-pager", "tag", "--sort=creatordate"],
|
["git", "--no-pager", "tag", "-l", "--sort=creatordate"]
|
||||||
|
+ revision_arg,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
check=True,
|
check=True,
|
||||||
).stdout.splitlines()[-1]
|
).stdout.splitlines()[-1]
|
||||||
else:
|
except IndexError: # 0 lines of output, the tag does not exist
|
||||||
try:
|
if revision:
|
||||||
tag = subprocess.run(
|
|
||||||
["git", "--no-pager", "tag", "-l", revision],
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
universal_newlines=True,
|
|
||||||
check=True,
|
|
||||||
).stdout.splitlines()[-1]
|
|
||||||
except IndexError: # 0 lines of output, the tag does not exist
|
|
||||||
raise Exception(f"Requested tag {revision} not found in source.")
|
raise Exception(f"Requested tag {revision} not found in source.")
|
||||||
|
else:
|
||||||
|
raise Exception("No tags found in source.")
|
||||||
|
|
||||||
tag_timestamp = subprocess.run(
|
tag_timestamp = subprocess.run(
|
||||||
[
|
[
|
||||||
|
@ -21,14 +21,6 @@ class GitHubHost(BaseHost):
|
|||||||
info = self.api_get(f"commits/{revision}")
|
info = self.api_get(f"commits/{revision}")
|
||||||
return (info["sha"], info["commit"]["committer"]["date"])
|
return (info["sha"], info["commit"]["committer"]["date"])
|
||||||
|
|
||||||
def upstream_tag(self, tag):
|
|
||||||
"""Github API allows using a tag name with the commits API."""
|
|
||||||
if tag == "HEAD": # Checking for latest tag
|
|
||||||
info = self.api_get("tags")
|
|
||||||
tag = info[0]["name"]
|
|
||||||
sha, timestamp = self.upstream_commit(tag)
|
|
||||||
return tag, timestamp
|
|
||||||
|
|
||||||
def upstream_snapshot(self, revision):
|
def upstream_snapshot(self, revision):
|
||||||
return "/".join(
|
return "/".join(
|
||||||
[self.manifest["vendoring"]["url"], "archive", revision + ".tar.gz"]
|
[self.manifest["vendoring"]["url"], "archive", revision + ".tar.gz"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user