Commit 4a3ec6ae authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by morgan
Browse files

Bug 41273: Bump Firefox/GeckoView tag when does not match HEAD.

If we detect the tag we would use for build does not match the HEAD of
the branch we are using, bump it preemptively.
Normally, we would add that tag when ready to build, so this change
can help us in case we forget to.
If the script is overzealous, we can change the build number before
committing.
parent 13b1b67d
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ class ReleasePreparation:
        logger.debug("About to fetch Firefox from %s.", remote)
        repo.remotes["origin"].fetch()
        tags = get_sorted_tags(repo)
        tag_info = None
        for t in tags:
            m = re.match(
                r"(\w+-browser)-([^-]+)-([\d\.]+)-(\d+)-build(\d+)", t.tag
@@ -259,8 +260,21 @@ class ReleasePreparation:
                and m.group(1) == browser
                and m.group(3) == self.version.major
            ):
                logger.debug("Matched tag %s.", t.tag)
                # firefox-version, rebase, build
                return (m.group(2), int(m.group(4)), int(m.group(5)))
                tag_info = [m.group(2), int(m.group(4)), int(m.group(5))]
                break
        if tag_info is None:
            raise RuntimeError("No compatible tag found.")
        branch = t.tag[: m.end(4)]
        logger.debug("Checking if tag %s is head of %s.", t.tag, branch)
        if t.object != repo.remotes["origin"].refs[branch].commit:
            logger.info(
                "Found new commits after tag %s, bumping the build number preemptively.",
                t.tag,
            )
            tag_info[2] += 1
        return tag_info

    def update_firefox_android(self):
        logger.info("Updating firefox-android")
@@ -402,9 +416,7 @@ class ReleasePreparation:

        source = self.find_input(config, "openssl")
        # No need to update URL, as it uses a variable.
        hash_url = (
            f"https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz.sha256"
        )
        hash_url = f"https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz.sha256"
        r = requests.get(hash_url)
        r.raise_for_status()
        source["sha256sum"] = r.text.strip()