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

[tor-commits] [Git][tpo/applications/tor-browser-build][maint-13.0] Bug 40972: Tweaks to the changelog script for MB and group projects



Title: GitLab

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

Commits:

  • d355fa8c
    by Pier Angelo Vendrame at 2023-10-03T19:48:02+02:00
    Bug 40972: Tweaks to the changelog script for MB and group projects
    
    The changelog script works well also with Mullvad Browser, but there
    are a few changes we need to do every time we use it for MB instead of
    TBB.
    With this commit we automate them.
    
    In addition to that, we group items by project, as it makes reading the
    changelog easier.
    

1 changed file:

Changes:

  • tools/fetch-changelogs.py
    ... ... @@ -2,6 +2,7 @@
    2 2
     from datetime import datetime
    
    3 3
     import enum
    
    4 4
     from pathlib import Path
    
    5
    +import re
    
    5 6
     import sys
    
    6 7
     
    
    7 8
     import requests
    
    ... ... @@ -11,6 +12,16 @@ GITLAB = "https://gitlab.torproject.org"
    11 12
     API_URL = f"{GITLAB}/api/v4"
    
    12 13
     PROJECT_ID = 473
    
    13 14
     
    
    15
    +is_mb = False
    
    16
    +project_order = {
    
    17
    +    "tor-browser-spec": 0,
    
    18
    +    # Leave 1 free, so we can redefine mullvad-browser when needed.
    
    19
    +    "tor-browser": 2,
    
    20
    +    "tor-browser-build": 3,
    
    21
    +    "mullvad-browser": 4,
    
    22
    +    "rbm": 5,
    
    23
    +}
    
    24
    +
    
    14 25
     
    
    15 26
     class Platform(enum.IntFlag):
    
    16 27
         WINDOWS = 8
    
    ... ... @@ -27,6 +38,7 @@ class Issue:
    27 38
             self.project, self.number = (
    
    28 39
                 j["references"]["full"].rsplit("/", 2)[-1].split("#")
    
    29 40
             )
    
    41
    +        self.number = int(self.number)
    
    30 42
             self.platform = 0
    
    31 43
             self.num_platforms = 0
    
    32 44
             if "Desktop" in j["labels"]:
    
    ... ... @@ -43,9 +55,14 @@ class Issue:
    43 55
                     self.platform |= Platform.LINUX
    
    44 56
                     self.num_platforms += 1
    
    45 57
             if "Android" in j["labels"]:
    
    46
    -            self.platform |= Platform.ANDROID
    
    47
    -            self.num_platforms += 1
    
    48
    -        if not self.platform:
    
    58
    +            if is_mb and self.num_platforms == 0:
    
    59
    +                raise Exception(
    
    60
    +                    f"Android-only issue on Mullvad Browser: {j['references']['full']}!"
    
    61
    +                )
    
    62
    +            elif not is_mb:
    
    63
    +                self.platform |= Platform.ANDROID
    
    64
    +                self.num_platforms += 1
    
    65
    +        if not self.platform or (is_mb and self.platform == Platform.DESKTOP):
    
    49 66
                 self.platform = Platform.ALL_PLATFORMS
    
    50 67
                 self.num_platforms = 4
    
    51 68
             self.is_build = "Build System" in j["labels"]
    
    ... ... @@ -68,7 +85,9 @@ class Issue:
    68 85
             return f"Bug {self.number}: {self.title} [{self.project}]"
    
    69 86
     
    
    70 87
         def __lt__(self, other):
    
    71
    -        return self.number < other.number
    
    88
    +        if self.project == other.project:
    
    89
    +            return self.number < other.number
    
    90
    +        return project_order[self.project] < project_order[other.project]
    
    72 91
     
    
    73 92
     
    
    74 93
     def sorted_issues(issues):
    
    ... ... @@ -125,7 +144,7 @@ elif len(issues) > 1:
    125 144
         sys.exit(4)
    
    126 145
     else:
    
    127 146
         iid = version
    
    128
    -    version = None
    
    147
    +    version = "CHANGEME!"
    
    129 148
         if iid[0] == "#":
    
    130 149
             iid = iid[1:]
    
    131 150
         try:
    
    ... ... @@ -136,6 +155,9 @@ else:
    136 155
             )
    
    137 156
             if r.ok and r.json():
    
    138 157
                 issue = r.json()[0]
    
    158
    +            version_match = re.search(r"\b[0-9]+\.[.0-9a]+\b", issue["title"])
    
    159
    +            if version_match:
    
    160
    +                version = version_match.group()
    
    139 161
         except ValueError:
    
    140 162
             pass
    
    141 163
     if not issue:
    
    ... ... @@ -143,6 +165,9 @@ if not issue:
    143 165
             "Release preparation issue not found. Please make sure it has ~Release Prep."
    
    144 166
         )
    
    145 167
         sys.exit(5)
    
    168
    +if "Sponsor 131" in issue["labels"]:
    
    169
    +    is_mb = True
    
    170
    +    project_order["mullvad-browser"] = 1
    
    146 171
     iid = issue["iid"]
    
    147 172
     
    
    148 173
     linked = {}
    
    ... ... @@ -159,8 +184,9 @@ for i in r.json():
    159 184
     linked = sorted_issues(linked)
    
    160 185
     linked_build = sorted_issues(linked_build)
    
    161 186
     
    
    187
    +name = "Mullvad" if is_mb else "Tor"
    
    162 188
     date = datetime.now().strftime("%B %d %Y")
    
    163
    -print(f"Tor Browser {version} - {date}")
    
    189
    +print(f"{name} Browser {version} - {date}")
    
    164 190
     for issues in linked:
    
    165 191
         print(f" * {issues[0].get_platforms()}")
    
    166 192
         for i in issues:
    

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