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

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



Title: GitLab

Pier Angelo Vendrame pushed to branch maint-14.0 at The Tor Project / Applications / tor-browser-build

Commits:

  • d35b529e
    by Pier Angelo Vendrame at 2024-10-17T15:38:12+02: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.
    

1 changed file:

Changes:

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

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