[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser-build][maint-13.5] 2 commits: Bug 41274: Improve changelog generation for major releases.



Title: GitLab

morgan pushed to branch maint-13.5 at The Tor Project / Applications / tor-browser-build

Commits:

  • 13b1b67d
    by Pier Angelo Vendrame at 2024-10-17T18:19:32+00:00
    Bug 41274: Improve changelog generation for major releases.
    
    This commits implements --include-from to get linked issues from many
    issues (potentially all the alpha release preps).
    It also implements --exclude-from to avoid including issues that were
    already linked to other rel preps (potentially the previous stables).
    
    Also, make sure to look only for currently open issues, otherwise all
    the various alpha relpreps would be matched when specifying the version
    number.
    
  • 4a3ec6ae
    by Pier Angelo Vendrame at 2024-10-17T18:19:41+00:00
    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.
    

2 changed files:

Changes:

  • tools/fetch_changelogs.py
    ... ... @@ -156,7 +156,7 @@ class ChangelogBuilder:
    156 156
             elif not is_mullvad and is_mullvad is not None:
    
    157 157
                 labels += "&not[labels]=Sponsor 131"
    
    158 158
             r = requests.get(
    
    159
    -            f"{API_URL}/projects/{PROJECT_ID}/issues?labels={labels}&search={issue_or_version}&in=title",
    
    159
    +            f"{API_URL}/projects/{PROJECT_ID}/issues?labels={labels}&search={issue_or_version}&in=title&state=opened",
    
    160 160
                 headers=self.headers,
    
    161 161
             )
    
    162 162
             r.raise_for_status()
    
    ... ... @@ -196,7 +196,7 @@ class ChangelogBuilder:
    196 196
                 raise ValueError(
    
    197 197
                     "Inconsistency detected: a browser was explicitly specified, but the issue does not have the correct labels."
    
    198 198
                 )
    
    199
    -        self.issue_id = issue["iid"]
    
    199
    +        self.relprep_issue = issue["iid"]
    
    200 200
             self.is_mullvad = has_s131
    
    201 201
     
    
    202 202
             if self.version is None:
    
    ... ... @@ -205,7 +205,9 @@ class ChangelogBuilder:
    205 205
                     self.version = version_match.group()
    
    206 206
     
    
    207 207
         def create(self, **kwargs):
    
    208
    -        self._find_linked()
    
    208
    +        self._find_linked(
    
    209
    +            kwargs.get("include_from"), kwargs.get("exclude_from")
    
    210
    +        )
    
    209 211
             self._add_updates(kwargs)
    
    210 212
             self._sort_issues()
    
    211 213
             name = "Mullvad" if self.is_mullvad else "Tor"
    
    ... ... @@ -233,16 +235,46 @@ class ChangelogBuilder:
    233 235
                     text += f"     * {issue}\n"
    
    234 236
             return text
    
    235 237
     
    
    236
    -    def _find_linked(self):
    
    238
    +    def _find_linked(self, include_relpreps=[], exclude_relpreps=[]):
    
    237 239
             self.issues = []
    
    238 240
             self.issues_build = []
    
    239 241
     
    
    242
    +        if include_relpreps is None:
    
    243
    +            include_relpreps = [self.relprep_issue]
    
    244
    +        elif self.relprep_issue not in include_relpreps:
    
    245
    +            include_relpreps.append(self.relprep_issue)
    
    246
    +        if exclude_relpreps is None:
    
    247
    +            exclude_relpreps = []
    
    248
    +
    
    249
    +        included = {}
    
    250
    +        excluded = set()
    
    251
    +        for relprep in include_relpreps:
    
    252
    +            included.update(
    
    253
    +                {
    
    254
    +                    issue["references"]["full"]: issue
    
    255
    +                    for issue in self._get_linked_issues(relprep)
    
    256
    +                }
    
    257
    +            )
    
    258
    +        for relprep in exclude_relpreps:
    
    259
    +            excluded.update(
    
    260
    +                [
    
    261
    +                    issue["references"]["full"]
    
    262
    +                    for issue in self._get_linked_issues(relprep)
    
    263
    +                ]
    
    264
    +            )
    
    265
    +        for ex in excluded:
    
    266
    +            if ex in included:
    
    267
    +                included.pop(ex)
    
    268
    +        for data in included.values():
    
    269
    +            self._add_issue(data)
    
    270
    +
    
    271
    +    def _get_linked_issues(self, issue_id):
    
    240 272
             r = requests.get(
    
    241
    -            f"{API_URL}/projects/{PROJECT_ID}/issues/{self.issue_id}/links",
    
    273
    +            f"{API_URL}/projects/{PROJECT_ID}/issues/{issue_id}/links",
    
    242 274
                 headers=self.headers,
    
    243 275
             )
    
    244
    -        for i in r.json():
    
    245
    -            self._add_issue(i)
    
    276
    +        r.raise_for_status()
    
    277
    +        return r.json()
    
    246 278
     
    
    247 279
         def _add_issue(self, gitlab_data):
    
    248 280
             self._add_entry(Issue(gitlab_data, self.is_mullvad))
    
    ... ... @@ -334,6 +366,16 @@ if __name__ == "__main__":
    334 366
             help="New Mullvad Browser Extension version (if updated)",
    
    335 367
         )
    
    336 368
         parser.add_argument("--ublock", help="New uBlock version (if updated)")
    
    369
    +    parser.add_argument(
    
    370
    +        "--exclude-from",
    
    371
    +        help="Relprep issues to remove entries from, useful when doing a major release",
    
    372
    +        nargs="*",
    
    373
    +    )
    
    374
    +    parser.add_argument(
    
    375
    +        "--include-from",
    
    376
    +        help="Relprep issues to add entries from, useful when doing a major release",
    
    377
    +        nargs="*",
    
    378
    +    )
    
    337 379
         args = parser.parse_args()
    
    338 380
     
    
    339 381
         if not args.issue_version:
    
    ... ... @@ -350,17 +392,4 @@ if __name__ == "__main__":
    350 392
             sys.exit(2)
    
    351 393
         is_mullvad = args.browser == "mullvad-browser" if args.browser else None
    
    352 394
         cb = ChangelogBuilder(token, args.issue_version, is_mullvad)
    
    353
    -    print(
    
    354
    -        cb.create(
    
    355
    -            date=args.date,
    
    356
    -            firefox=args.firefox,
    
    357
    -            tor=args.tor,
    
    358
    -            noscript=args.noscript,
    
    359
    -            openssl=args.openssl,
    
    360
    -            zlib=args.zlib,
    
    361
    -            zstd=args.zstd,
    
    362
    -            go=args.go,
    
    363
    -            mb_extension=args.mb_extension,
    
    364
    -            ublock=args.ublock,
    
    365
    -        )
    
    366
    -    )
    395
    +    print(cb.create(**vars(args)))

  • tools/relprep.py
    ... ... @@ -250,6 +250,7 @@ class ReleasePreparation:
    250 250
             logger.debug("About to fetch Firefox from %s.", remote)
    
    251 251
             repo.remotes["origin"].fetch()
    
    252 252
             tags = get_sorted_tags(repo)
    
    253
    +        tag_info = None
    
    253 254
             for t in tags:
    
    254 255
                 m = re.match(
    
    255 256
                     r"(\w+-browser)-([^-]+)-([\d\.]+)-(\d+)-build(\d+)", t.tag
    
    ... ... @@ -259,8 +260,21 @@ class ReleasePreparation:
    259 260
                     and m.group(1) == browser
    
    260 261
                     and m.group(3) == self.version.major
    
    261 262
                 ):
    
    263
    +                logger.debug("Matched tag %s.", t.tag)
    
    262 264
                     # firefox-version, rebase, build
    
    263
    -                return (m.group(2), int(m.group(4)), int(m.group(5)))
    
    265
    +                tag_info = [m.group(2), int(m.group(4)), int(m.group(5))]
    
    266
    +                break
    
    267
    +        if tag_info is None:
    
    268
    +            raise RuntimeError("No compatible tag found.")
    
    269
    +        branch = t.tag[: m.end(4)]
    
    270
    +        logger.debug("Checking if tag %s is head of %s.", t.tag, branch)
    
    271
    +        if t.object != repo.remotes["origin"].refs[branch].commit:
    
    272
    +            logger.info(
    
    273
    +                "Found new commits after tag %s, bumping the build number preemptively.",
    
    274
    +                t.tag,
    
    275
    +            )
    
    276
    +            tag_info[2] += 1
    
    277
    +        return tag_info
    
    264 278
     
    
    265 279
         def update_firefox_android(self):
    
    266 280
             logger.info("Updating firefox-android")
    
    ... ... @@ -402,9 +416,7 @@ class ReleasePreparation:
    402 416
     
    
    403 417
             source = self.find_input(config, "openssl")
    
    404 418
             # No need to update URL, as it uses a variable.
    
    405
    -        hash_url = (
    
    406
    -            f"https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz.sha256"
    
    407
    -        )
    
    419
    +        hash_url = f"https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz.sha256"
    
    408 420
             r = requests.get(hash_url)
    
    409 421
             r.raise_for_status()
    
    410 422
             source["sha256sum"] = r.text.strip()
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits