Merge ~jslarraz/review-tools:minor-improvements into review-tools:master

Proposed by Jorge Sancho Larraz
Status: Merged
Merged at revision: 4d64a0b818fefcdc9f0949e6df030d57a163a803
Proposed branch: ~jslarraz/review-tools:minor-improvements
Merge into: review-tools:master
Diff against target: 191 lines (+18/-23)
9 files modified
bin/dump-tool (+0/-1)
bin/rock-check-notices (+0/-3)
bin/rock-updates-available (+0/-2)
bin/snap-check-notices (+0/-3)
bin/snap-updates-available (+0/-2)
bin/store-query (+0/-2)
reviewtools/common.py (+0/-7)
reviewtools/containers/base_container.py (+15/-2)
reviewtools/containers/squashfs_container.py (+3/-1)
Reviewer Review Type Date Requested Status
Alex Murray Approve
Review via email: mp+467030@code.launchpad.net

Commit message

adds some missing documentation and cleans up some unused environment variable and leftovers from https://git.launchpad.net/review-tools/commit/?id=f2c630c4f9025a91435ee9a60d93b382756c13e4

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

LGTM - thanks @jslarraz

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/dump-tool b/bin/dump-tool
2index 4a9658b..d42d8f0 100755
3--- a/bin/dump-tool
4+++ b/bin/dump-tool
5@@ -146,7 +146,6 @@ def _write_json_db(db, fn, stdout=False):
6
7
8 def main():
9- common.REPORT_OUTPUT = "console"
10 parser = argparse.ArgumentParser(
11 prog="dump-tool",
12 formatter_class=argparse.RawDescriptionHelpFormatter,
13diff --git a/bin/rock-check-notices b/bin/rock-check-notices
14index 2b7303c..a550b1a 100755
15--- a/bin/rock-check-notices
16+++ b/bin/rock-check-notices
17@@ -20,7 +20,6 @@ import os
18 import sys
19 from reviewtools import logger
20
21-import reviewtools.common as common
22 from reviewtools.common import (
23 cmd,
24 fetch_usn_db,
25@@ -53,8 +52,6 @@ def main():
26 )
27 (args, argv) = parser.parse_known_args()
28
29- common.REPORT_OUTPUT = "console"
30-
31 # initialize variables
32 initialize_environment_variables()
33
34diff --git a/bin/rock-updates-available b/bin/rock-updates-available
35index a6f12bf..1ec395d 100755
36--- a/bin/rock-updates-available
37+++ b/bin/rock-updates-available
38@@ -43,12 +43,10 @@ import textwrap
39
40 import reviewtools.available as available
41
42-import reviewtools.common as common
43 from reviewtools import logger
44
45
46 def main():
47- common.REPORT_OUTPUT = "console"
48 parser = argparse.ArgumentParser(
49 prog="rock-updates-available",
50 formatter_class=argparse.RawDescriptionHelpFormatter,
51diff --git a/bin/snap-check-notices b/bin/snap-check-notices
52index 81f2bc0..05535fb 100755
53--- a/bin/snap-check-notices
54+++ b/bin/snap-check-notices
55@@ -20,7 +20,6 @@ import os
56 import sys
57
58 from reviewtools import logger
59-import reviewtools.common as common
60 from reviewtools.common import (
61 cmd,
62 fetch_usn_db,
63@@ -52,8 +51,6 @@ def main():
64 )
65 (args, argv) = parser.parse_known_args()
66
67- common.REPORT_OUTPUT = "console"
68-
69 # initialize variables
70 initialize_environment_variables()
71
72diff --git a/bin/snap-updates-available b/bin/snap-updates-available
73index 98e888a..27888ff 100755
74--- a/bin/snap-updates-available
75+++ b/bin/snap-updates-available
76@@ -44,12 +44,10 @@ import textwrap
77
78 import reviewtools.available as available
79
80-import reviewtools.common as common
81 from reviewtools import logger
82
83
84 def main():
85- common.REPORT_OUTPUT = "console"
86 parser = argparse.ArgumentParser(
87 prog="snap-updates-available",
88 formatter_class=argparse.RawDescriptionHelpFormatter,
89diff --git a/bin/store-query b/bin/store-query
90index 8d2d6fe..f971ab4 100755
91--- a/bin/store-query
92+++ b/bin/store-query
93@@ -34,7 +34,6 @@ import re
94 import requests
95 import yaml
96
97-import reviewtools.common as common
98 from reviewtools import logger
99
100 from reviewtools.sr_common import SnapReview
101@@ -320,7 +319,6 @@ def _get_all_snap_declarations_by_id(snap_id):
102
103
104 def main():
105- common.REPORT_OUTPUT = "console"
106 parser = argparse.ArgumentParser(
107 prog="store-query",
108 formatter_class=argparse.RawDescriptionHelpFormatter,
109diff --git a/reviewtools/common.py b/reviewtools/common.py
110index 2b8472e..5de33ee 100644
111--- a/reviewtools/common.py
112+++ b/reviewtools/common.py
113@@ -37,12 +37,8 @@ import yaml
114 from reviewtools.overrides import common_external_symlink_override
115 from reviewtools.report import Report
116
117-REPORT_OUTPUT = "json"
118-RESULT_TYPES = ["info", "warn", "error"]
119-TMP_DIR = None
120 MKDTEMP_PREFIX = "review-tools-"
121 MKDTEMP_DIR = None
122-VALID_SYSCALL = r"^[a-z0-9_]{2,64}$"
123 # This needs to match up with snapcraft. Note, 'xz' is still the default
124 # compression algorithm, and support for lzo has been added, but others
125 # may be supported
126@@ -77,9 +73,6 @@ UNSQUASHFS_IGNORED_ERRORS = [
127 # under LXC
128 AA_PROFILE_NAME_MAXLEN = 230 # 245 minus a bit for child profiles
129 AA_PROFILE_NAME_ADVLEN = 100
130-# Store enforces this length for snap v2
131-STORE_PKGNAME_SNAPV2_MINLEN = 2
132-STORE_PKGNAME_SNAPV2_MAXLEN = 40
133 # Per noise: "07:33 < noise> jdstrand: yeah, i think 5GB compressed would be a
134 # good/reasonable limit for now
135 # https://forum.snapcraft.io/t/max-snap-size-and-getting-software-to-consumers/2913/2
136diff --git a/reviewtools/containers/base_container.py b/reviewtools/containers/base_container.py
137index 0759469..77853f8 100644
138--- a/reviewtools/containers/base_container.py
139+++ b/reviewtools/containers/base_container.py
140@@ -7,7 +7,6 @@ from tempfile import mkdtemp
141
142 from reviewtools.common import (
143 MKDTEMP_PREFIX,
144- MKDTEMP_DIR,
145 recursive_rm,
146 )
147
148@@ -75,7 +74,21 @@ class BaseContainer:
149 _bin_files = None
150
151 def __init__(self, fn):
152- self.tmp_dir = mkdtemp(prefix=MKDTEMP_PREFIX, dir=MKDTEMP_DIR)
153+ """
154+ Note:
155+ This object will create a temporary copy of the provided container file.
156+ Automatically created temporary files will be automatically cleaned up
157+ on container object deletion.
158+
159+ Args:
160+ fn (str): relative or absolute path to the container file.
161+
162+ Raises:
163+ ContainerException: Calling this method will raise an exception
164+ if the provided path does not exist or its basename does not
165+ include an appropriate extension.
166+ """
167+ self.tmp_dir = mkdtemp(prefix=MKDTEMP_PREFIX)
168 if os.path.isfile(fn):
169 if os.path.basename(fn).count(".") == 0:
170 raise ContainerException("container filename must include an extension")
171diff --git a/reviewtools/containers/squashfs_container.py b/reviewtools/containers/squashfs_container.py
172index 9ebd26d..c113499 100644
173--- a/reviewtools/containers/squashfs_container.py
174+++ b/reviewtools/containers/squashfs_container.py
175@@ -21,7 +21,7 @@ class SquashfsContainer(BaseContainer):
176
177 Raises:
178 ContainerException: This method will raise an exception if the
179- container file is not a squashfs container.
180+ container file is not a squashfs container.
181 """
182 with open(self.filename, "rb") as f:
183 header = f.read(10)
184@@ -59,6 +59,8 @@ class SquashfsContainer(BaseContainer):
185 the newly unpacked directory.
186
187 Args:
188+ items (list[str], optional): If not empty, it will only unpack files
189+ included in the list.
190 force (bool, optional): If ``True``, the unpack_dir will be overwritten
191 if it already exists. Defaults to ``False``
192

Subscribers

People subscribed via source and target branches