... |
... |
@@ -7,6 +7,12 @@ import subprocess |
7
|
7
|
|
8
|
8
|
from combine import combine_files
|
9
|
9
|
|
|
10
|
+# Whether we are running within the gitlab CI, rather than on a developer
|
|
11
|
+# machine. This toggles some optimisations that work well in the temporary
|
|
12
|
+# gitlab environment but would cause problems if run locally for testing
|
|
13
|
+# purposes.
|
|
14
|
+IN_GITLAB_CI_ENV = os.environ.get("GITLAB_CI", "") == "true"
|
|
15
|
+
|
10
|
16
|
arg_parser = argparse.ArgumentParser(
|
11
|
17
|
description="Combine a translation file across two different versions"
|
12
|
18
|
)
|
... |
... |
@@ -86,7 +92,7 @@ class BrowserBranch: |
86
|
92
|
"""
|
87
|
93
|
version_match = re.match(
|
88
|
94
|
r"(?P<prefix>[a-z]+\-browser)\-"
|
89
|
|
- r"(?P<firefox>[0-9]+(?:\.[0-9]+){1,2})esr\-"
|
|
95
|
+ r"(?P<firefox>[0-9]+(?:\.[0-9]+){1,2})(?:esr|[ab][0-9]+)?\-"
|
90
|
96
|
r"(?P<browser>[0-9]+\.[05])\-"
|
91
|
97
|
r"(?P<number>[0-9]+)$",
|
92
|
98
|
branch_name,
|
... |
... |
@@ -170,11 +176,15 @@ class BrowserBranch: |
170
|
176
|
"""
|
171
|
177
|
if self._file_paths is None:
|
172
|
178
|
if not self._is_head:
|
173
|
|
- # Minimal fetch of non-HEAD branch to get the file paths.
|
174
|
|
- # Individual file blobs will be downloaded as needed.
|
175
|
|
- git_run(
|
176
|
|
- ["fetch", "--depth=1", "--filter=blob:none", "origin", self.name]
|
177
|
|
- )
|
|
179
|
+ fetch_args = ()
|
|
180
|
+ if IN_GITLAB_CI_ENV:
|
|
181
|
+ # Minimal fetch of non-HEAD branch to get the file paths.
|
|
182
|
+ # Individual file blobs will be downloaded as needed.
|
|
183
|
+ # Only do this when running in the gitlab CI since it will
|
|
184
|
+ # alter the user's .git/config and will effect future
|
|
185
|
+ # plain fetches.
|
|
186
|
+ fetch_args = ("--depth=1", "--filter=blob:none")
|
|
187
|
+ git_run(["fetch", *fetch_args, "origin", self.name])
|
178
|
188
|
self._file_paths = git_lines(
|
179
|
189
|
["ls-tree", "-r", "--format=%(path)", self._ref]
|
180
|
190
|
)
|
... |
... |
@@ -213,16 +223,19 @@ def get_stable_branch( |
213
|
223
|
# tor-browser-build.
|
214
|
224
|
tag_glob = f"{compare_version.prefix}-*-build1"
|
215
|
225
|
|
216
|
|
- # To speed up, only fetch the tags without blobs.
|
217
|
|
- git_run(
|
218
|
|
- ["fetch", "--depth=1", "--filter=object:type=tag", "origin", "tag", tag_glob]
|
219
|
|
- )
|
|
226
|
+ fetch_args = ()
|
|
227
|
+ if IN_GITLAB_CI_ENV:
|
|
228
|
+ # To speed up, only fetch the tags without blobs.
|
|
229
|
+ # Only do this when running in the gitlab CI since it will alter the
|
|
230
|
+ # user's .git/config and will effect future plain fetches.
|
|
231
|
+ fetch_args = ("--depth=1", "--filter=object:type=tag")
|
|
232
|
+ git_run(["fetch", *fetch_args, "origin", "tag", tag_glob])
|
220
|
233
|
stable_branches = []
|
221
|
234
|
legacy_branches = []
|
222
|
235
|
stable_annotation_regex = re.compile(r"\bstable\b")
|
223
|
236
|
legacy_annotation_regex = re.compile(r"\blegacy\b")
|
224
|
237
|
tag_pattern = re.compile(
|
225
|
|
- rf"^{re.escape(compare_version.prefix)}-[^-]+esr-[^-]+-[^-]+-build1$"
|
|
238
|
+ rf"^{re.escape(compare_version.prefix)}-[^-]+-[^-]+-[^-]+-build1$"
|
226
|
239
|
)
|
227
|
240
|
|
228
|
241
|
for build_tag, annotation in (
|
... |
... |
@@ -259,13 +272,7 @@ def get_stable_branch( |
259
|
272
|
continue
|
260
|
273
|
stable_branches.append(branch)
|
261
|
274
|
elif is_legacy:
|
262
|
|
- # Legacy can be two release versions behind.
|
263
|
|
- # We also allow for being just one version behind.
|
264
|
|
- if not (
|
265
|
|
- compare_version.release_below(branch, 2)
|
266
|
|
- or compare_version.release_below(branch, 1)
|
267
|
|
- ):
|
268
|
|
- continue
|
|
275
|
+ # Legacy can be arbitrary release versions behind.
|
269
|
276
|
legacy_branches.append(branch)
|
270
|
277
|
|
271
|
278
|
if not stable_branches:
|