summaryrefslogtreecommitdiffstats
path: root/debian/latest_nightly.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:34:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:34:35 +0000
commit63de81373e18709bf3cf805a9aea810d7105be62 (patch)
tree381c798425ec7b9d4634609f0ac776a4b3e7e309 /debian/latest_nightly.py
parentAdding upstream version 115.7.0esr. (diff)
downloadfirefox-esr-63de81373e18709bf3cf805a9aea810d7105be62.tar.xz
firefox-esr-63de81373e18709bf3cf805a9aea810d7105be62.zip
Adding debian version 115.7.0esr-1~deb12u1.debian/115.7.0esr-1_deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/latest_nightly.py')
-rw-r--r--debian/latest_nightly.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/latest_nightly.py b/debian/latest_nightly.py
new file mode 100644
index 0000000000..02f3f4c23b
--- /dev/null
+++ b/debian/latest_nightly.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+
+import os
+import re
+import sys
+import http.client
+import urllib.request, urllib.error, urllib.parse
+import urllib.parse
+
+
+def main():
+ product = sys.argv[1]
+
+ conn = http.client.HTTPSConnection('download.mozilla.org')
+ conn.request('HEAD', '/?product=%s-latest&os=linux&lang=en-US' % product)
+ res = conn.getresponse()
+ assert res.status == 302
+ location = res.getheader('Location')
+
+ if '-' in product:
+ product, variant = product.split('-', 1)
+ else:
+ variant = ''
+
+ u = urllib.parse.urlparse(location)
+ p = u.path.split('/')
+ assert p[0] == ''
+ assert p[1] == 'pub'
+ assert p[2] == product
+ assert p[3] in ('releases', 'nightly')
+ if p[3] == 'nightly':
+ filename = os.path.basename(location)
+ assert filename.startswith(product + '-')
+ version = filename[len(product) + 1:]
+ m = re.match(r'([0-9]+(?:\.[0-9]+)*(?:[ab][0-9]+)?)\.', version)
+ assert m
+ version = m.group(1)
+
+ url = location.replace('.tar.bz2', '.txt')
+ assert url != location
+
+ f = urllib.request.urlopen(url.replace('-l10n', ''))
+ print(version, ' '.join(l.decode().rstrip() for l in f.readlines()))
+ f.close()
+ elif p[3] == 'releases':
+ version = p[4]
+ print(version)
+
+if __name__ == '__main__':
+ main()