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
diff --git a/bin/dump-tool b/bin/dump-tool
index 4a9658b..d42d8f0 100755
--- a/bin/dump-tool
+++ b/bin/dump-tool
@@ -146,7 +146,6 @@ def _write_json_db(db, fn, stdout=False):
146146
147147
148def main():148def main():
149 common.REPORT_OUTPUT = "console"
150 parser = argparse.ArgumentParser(149 parser = argparse.ArgumentParser(
151 prog="dump-tool",150 prog="dump-tool",
152 formatter_class=argparse.RawDescriptionHelpFormatter,151 formatter_class=argparse.RawDescriptionHelpFormatter,
diff --git a/bin/rock-check-notices b/bin/rock-check-notices
index 2b7303c..a550b1a 100755
--- a/bin/rock-check-notices
+++ b/bin/rock-check-notices
@@ -20,7 +20,6 @@ import os
20import sys20import sys
21from reviewtools import logger21from reviewtools import logger
2222
23import reviewtools.common as common
24from reviewtools.common import (23from reviewtools.common import (
25 cmd,24 cmd,
26 fetch_usn_db,25 fetch_usn_db,
@@ -53,8 +52,6 @@ def main():
53 )52 )
54 (args, argv) = parser.parse_known_args()53 (args, argv) = parser.parse_known_args()
5554
56 common.REPORT_OUTPUT = "console"
57
58 # initialize variables55 # initialize variables
59 initialize_environment_variables()56 initialize_environment_variables()
6057
diff --git a/bin/rock-updates-available b/bin/rock-updates-available
index a6f12bf..1ec395d 100755
--- a/bin/rock-updates-available
+++ b/bin/rock-updates-available
@@ -43,12 +43,10 @@ import textwrap
4343
44import reviewtools.available as available44import reviewtools.available as available
4545
46import reviewtools.common as common
47from reviewtools import logger46from reviewtools import logger
4847
4948
50def main():49def main():
51 common.REPORT_OUTPUT = "console"
52 parser = argparse.ArgumentParser(50 parser = argparse.ArgumentParser(
53 prog="rock-updates-available",51 prog="rock-updates-available",
54 formatter_class=argparse.RawDescriptionHelpFormatter,52 formatter_class=argparse.RawDescriptionHelpFormatter,
diff --git a/bin/snap-check-notices b/bin/snap-check-notices
index 81f2bc0..05535fb 100755
--- a/bin/snap-check-notices
+++ b/bin/snap-check-notices
@@ -20,7 +20,6 @@ import os
20import sys20import sys
2121
22from reviewtools import logger22from reviewtools import logger
23import reviewtools.common as common
24from reviewtools.common import (23from reviewtools.common import (
25 cmd,24 cmd,
26 fetch_usn_db,25 fetch_usn_db,
@@ -52,8 +51,6 @@ def main():
52 )51 )
53 (args, argv) = parser.parse_known_args()52 (args, argv) = parser.parse_known_args()
5453
55 common.REPORT_OUTPUT = "console"
56
57 # initialize variables54 # initialize variables
58 initialize_environment_variables()55 initialize_environment_variables()
5956
diff --git a/bin/snap-updates-available b/bin/snap-updates-available
index 98e888a..27888ff 100755
--- a/bin/snap-updates-available
+++ b/bin/snap-updates-available
@@ -44,12 +44,10 @@ import textwrap
4444
45import reviewtools.available as available45import reviewtools.available as available
4646
47import reviewtools.common as common
48from reviewtools import logger47from reviewtools import logger
4948
5049
51def main():50def main():
52 common.REPORT_OUTPUT = "console"
53 parser = argparse.ArgumentParser(51 parser = argparse.ArgumentParser(
54 prog="snap-updates-available",52 prog="snap-updates-available",
55 formatter_class=argparse.RawDescriptionHelpFormatter,53 formatter_class=argparse.RawDescriptionHelpFormatter,
diff --git a/bin/store-query b/bin/store-query
index 8d2d6fe..f971ab4 100755
--- a/bin/store-query
+++ b/bin/store-query
@@ -34,7 +34,6 @@ import re
34import requests34import requests
35import yaml35import yaml
3636
37import reviewtools.common as common
38from reviewtools import logger37from reviewtools import logger
3938
40from reviewtools.sr_common import SnapReview39from reviewtools.sr_common import SnapReview
@@ -320,7 +319,6 @@ def _get_all_snap_declarations_by_id(snap_id):
320319
321320
322def main():321def main():
323 common.REPORT_OUTPUT = "console"
324 parser = argparse.ArgumentParser(322 parser = argparse.ArgumentParser(
325 prog="store-query",323 prog="store-query",
326 formatter_class=argparse.RawDescriptionHelpFormatter,324 formatter_class=argparse.RawDescriptionHelpFormatter,
diff --git a/reviewtools/common.py b/reviewtools/common.py
index 2b8472e..5de33ee 100644
--- a/reviewtools/common.py
+++ b/reviewtools/common.py
@@ -37,12 +37,8 @@ import yaml
37from reviewtools.overrides import common_external_symlink_override37from reviewtools.overrides import common_external_symlink_override
38from reviewtools.report import Report38from reviewtools.report import Report
3939
40REPORT_OUTPUT = "json"
41RESULT_TYPES = ["info", "warn", "error"]
42TMP_DIR = None
43MKDTEMP_PREFIX = "review-tools-"40MKDTEMP_PREFIX = "review-tools-"
44MKDTEMP_DIR = None41MKDTEMP_DIR = None
45VALID_SYSCALL = r"^[a-z0-9_]{2,64}$"
46# This needs to match up with snapcraft. Note, 'xz' is still the default42# This needs to match up with snapcraft. Note, 'xz' is still the default
47# compression algorithm, and support for lzo has been added, but others43# compression algorithm, and support for lzo has been added, but others
48# may be supported44# may be supported
@@ -77,9 +73,6 @@ UNSQUASHFS_IGNORED_ERRORS = [
77# under LXC73# under LXC
78AA_PROFILE_NAME_MAXLEN = 230 # 245 minus a bit for child profiles74AA_PROFILE_NAME_MAXLEN = 230 # 245 minus a bit for child profiles
79AA_PROFILE_NAME_ADVLEN = 10075AA_PROFILE_NAME_ADVLEN = 100
80# Store enforces this length for snap v2
81STORE_PKGNAME_SNAPV2_MINLEN = 2
82STORE_PKGNAME_SNAPV2_MAXLEN = 40
83# Per noise: "07:33 < noise> jdstrand: yeah, i think 5GB compressed would be a76# Per noise: "07:33 < noise> jdstrand: yeah, i think 5GB compressed would be a
84# good/reasonable limit for now77# good/reasonable limit for now
85# https://forum.snapcraft.io/t/max-snap-size-and-getting-software-to-consumers/2913/278# https://forum.snapcraft.io/t/max-snap-size-and-getting-software-to-consumers/2913/2
diff --git a/reviewtools/containers/base_container.py b/reviewtools/containers/base_container.py
index 0759469..77853f8 100644
--- a/reviewtools/containers/base_container.py
+++ b/reviewtools/containers/base_container.py
@@ -7,7 +7,6 @@ from tempfile import mkdtemp
77
8from reviewtools.common import (8from reviewtools.common import (
9 MKDTEMP_PREFIX,9 MKDTEMP_PREFIX,
10 MKDTEMP_DIR,
11 recursive_rm,10 recursive_rm,
12)11)
1312
@@ -75,7 +74,21 @@ class BaseContainer:
75 _bin_files = None74 _bin_files = None
7675
77 def __init__(self, fn):76 def __init__(self, fn):
78 self.tmp_dir = mkdtemp(prefix=MKDTEMP_PREFIX, dir=MKDTEMP_DIR)77 """
78 Note:
79 This object will create a temporary copy of the provided container file.
80 Automatically created temporary files will be automatically cleaned up
81 on container object deletion.
82
83 Args:
84 fn (str): relative or absolute path to the container file.
85
86 Raises:
87 ContainerException: Calling this method will raise an exception
88 if the provided path does not exist or its basename does not
89 include an appropriate extension.
90 """
91 self.tmp_dir = mkdtemp(prefix=MKDTEMP_PREFIX)
79 if os.path.isfile(fn):92 if os.path.isfile(fn):
80 if os.path.basename(fn).count(".") == 0:93 if os.path.basename(fn).count(".") == 0:
81 raise ContainerException("container filename must include an extension")94 raise ContainerException("container filename must include an extension")
diff --git a/reviewtools/containers/squashfs_container.py b/reviewtools/containers/squashfs_container.py
index 9ebd26d..c113499 100644
--- a/reviewtools/containers/squashfs_container.py
+++ b/reviewtools/containers/squashfs_container.py
@@ -21,7 +21,7 @@ class SquashfsContainer(BaseContainer):
2121
22 Raises:22 Raises:
23 ContainerException: This method will raise an exception if the23 ContainerException: This method will raise an exception if the
24 container file is not a squashfs container.24 container file is not a squashfs container.
25 """25 """
26 with open(self.filename, "rb") as f:26 with open(self.filename, "rb") as f:
27 header = f.read(10)27 header = f.read(10)
@@ -59,6 +59,8 @@ class SquashfsContainer(BaseContainer):
59 the newly unpacked directory.59 the newly unpacked directory.
6060
61 Args:61 Args:
62 items (list[str], optional): If not empty, it will only unpack files
63 included in the list.
62 force (bool, optional): If ``True``, the unpack_dir will be overwritten64 force (bool, optional): If ``True``, the unpack_dir will be overwritten
63 if it already exists. Defaults to ``False``65 if it already exists. Defaults to ``False``
6466

Subscribers

People subscribed via source and target branches