Merge ~jslarraz/review-tools:fix-plasma into review-tools:master

Proposed by Jorge Sancho Larraz
Status: Merged
Merged at revision: 220620a1a53e4f24bd597231881f95b327c8b91a
Proposed branch: ~jslarraz/review-tools:fix-plasma
Merge into: review-tools:master
Diff against target: 61 lines (+15/-7)
2 files modified
bin/snap-review (+7/-4)
reviewtools/containers/squashfs_container.py (+8/-3)
Reviewer Review Type Date Requested Status
Alex Murray Approve
Review via email: mp+466848@code.launchpad.net

Commit message

Fix for the error mentioned in https://code.launchpad.net/~evancaville/review-tools/+git/review-tools/+merge/466828

The expected outcome is review tools raising a Runtime exception related to unsquashfs failing (it finds some files with xattr). The review should fail because of this runtime exception

To post a comment you must log in.
Revision history for this message
Alex Murray (alexmurray) wrote :

LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/snap-review b/bin/snap-review
2index 777f418..299473e 100755
3--- a/bin/snap-review
4+++ b/bin/snap-review
5@@ -9,7 +9,7 @@ import shutil
6 import sys
7 import tempfile
8 import textwrap
9-import traceback
10+import logging
11
12 from reviewtools.common import (
13 MKDTEMP_PREFIX,
14@@ -150,9 +150,12 @@ def main():
15
16 review_report = review.do_checks()
17 report.update(review_report)
18- except Exception:
19- print("Caught exception (setting rc=1 and continuing):")
20- traceback.print_exc(file=sys.stdout)
21+ except Exception as e:
22+ if args.verbose:
23+ logging.exception("Caught exception (setting rc=1 and continuing):")
24+ report.add_result(
25+ "runtime-errors", "error", "msg", str(e), manual_review=True
26+ )
27 rc = 1
28
29 # Write out our state
30diff --git a/reviewtools/containers/squashfs_container.py b/reviewtools/containers/squashfs_container.py
31index 4896bbb..9ebd26d 100644
32--- a/reviewtools/containers/squashfs_container.py
33+++ b/reviewtools/containers/squashfs_container.py
34@@ -1,6 +1,11 @@
35 import os
36 import shutil
37-from reviewtools.common import cmd, cmdIgnoreErrorStrings, UNSQUASHFS_IGNORED_ERRORS
38+from reviewtools.common import (
39+ cmd,
40+ cmdIgnoreErrorStrings,
41+ UNSQUASHFS_IGNORED_ERRORS,
42+ recursive_rm,
43+)
44 from reviewtools.containers.base_container import BaseContainer, ContainerException
45
46
47@@ -89,12 +94,12 @@ class SquashfsContainer(BaseContainer):
48 (rc, out) = cmdIgnoreErrorStrings(cmd, UNSQUASHFS_IGNORED_ERRORS)
49 if rc != 0:
50 if os.path.isdir(stage_dir):
51- shutil.rmtree(stage_dir)
52+ recursive_rm(stage_dir)
53 raise RuntimeError("unpacking failed with '%d':\n%s" % (rc, out))
54
55 # Update on success
56 if self._unpack_dir is not None and os.path.exists(self._unpack_dir):
57- shutil.rmtree(self._unpack_dir)
58+ recursive_rm(self._unpack_dir)
59 self._unpack_dir = ".".join(self.filename.split(".")[:-1])
60 shutil.move(stage_dir, self._unpack_dir)
61 return self._unpack_dir

Subscribers

People subscribed via source and target branches