Merge lp:~laney/ubuntu-archive-tools/retry-autopkgtest-regressions-lzma-cache into lp:ubuntu-archive-tools

Proposed by Iain Lane
Status: Merged
Merged at revision: 1346
Proposed branch: lp:~laney/ubuntu-archive-tools/retry-autopkgtest-regressions-lzma-cache
Merge into: lp:ubuntu-archive-tools
Diff against target: 33 lines (+9/-2)
1 file modified
retry-autopkgtest-regressions (+9/-2)
To merge this branch: bzr merge lp:~laney/ubuntu-archive-tools/retry-autopkgtest-regressions-lzma-cache
Reviewer Review Type Date Requested Status
Ubuntu Package Archive Administrators Pending
Review via email: mp+387242@code.launchpad.net

Description of the change

Handle LZMA files in the cache by moving lzma.open down to a more common location.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'retry-autopkgtest-regressions'
2--- retry-autopkgtest-regressions 2020-07-01 16:28:26 +0000
3+++ retry-autopkgtest-regressions 2020-07-10 20:54:52 +0000
4@@ -110,12 +110,14 @@
5 new_timestamp = datetime.now(tz=tzutc()).timestamp()
6
7 try:
8- f = lzma.open(urllib.request.urlopen(excuses_url))
9+ f = urllib.request.urlopen(excuses_url)
10+ is_xz = True
11 except urllib.error.HTTPError as e:
12 if e.code == 404:
13 # some versions of britney output this file uncompressed, try that
14 # location too
15 f = urllib.request.urlopen(excuses_url.rstrip('.xz'))
16+ is_xz = False
17 else:
18 raise
19 if cache_file:
20@@ -129,7 +131,12 @@
21 f.close()
22 f = open(cache_file, 'rb')
23
24- excuses = yaml.load(f, Loader=yaml.CSafeLoader)
25+ if is_xz:
26+ lzma_f = lzma.open(f)
27+ excuses = yaml.load(lzma_f, Loader=yaml.CSafeLoader)
28+ lzma_f.close()
29+ else:
30+ excuses = yaml.load(f, Loader=yaml.CSafeLoader)
31 f.close()
32 regressions = {}
33 for excuse in excuses['sources']:

Subscribers

People subscribed via source and target branches