Merge lp:~mvo/click/dpkg-less-verbose into lp:click/devel

Proposed by Michael Vogt
Status: Merged
Merged at revision: 549
Proposed branch: lp:~mvo/click/dpkg-less-verbose
Merge into: lp:click/devel
Diff against target: 108 lines (+27/-18)
3 files modified
click/commands/install.py (+5/-1)
click/install.py (+17/-6)
click/tests/test_install.py (+5/-11)
To merge this branch: bzr merge lp:~mvo/click/dpkg-less-verbose
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Colin Watson Approve
Review via email: mp+243532@code.launchpad.net

Description of the change

This branch hides the dpkg unpack output by default unless "--verbose" is given.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:547
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mvo/click/dpkg-less-verbose/+merge/243532/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/click-devel-ci/125/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-amd64-ci/9
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-armhf-ci/9
        deb: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-armhf-ci/9/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-i386-ci/9

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/click-devel-ci/125/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click/commands/install.py'
2--- click/commands/install.py 2014-09-10 12:28:49 +0000
3+++ click/commands/install.py 2014-12-03 12:45:25 +0000
4@@ -46,6 +46,9 @@
5 parser.add_option(
6 "--allow-unauthenticated", default=False, action="store_true",
7 help="allow installing packages with no signatures")
8+ parser.add_option(
9+ "--verbose", default=False, action="store_true",
10+ help="be more verbose on install")
11 options, args = parser.parse_args(argv)
12 if len(args) < 1:
13 parser.error("need package file name")
14@@ -59,7 +62,8 @@
15 allow_unauthenticated=options.allow_unauthenticated)
16 try:
17 installer.install(
18- package_path, user=options.user, all_users=options.all_users)
19+ package_path, user=options.user, all_users=options.all_users,
20+ quiet=not options.verbose)
21 except ClickInstallerError as e:
22 print("Cannot install %s: %s" % (package_path, e), file=sys.stderr)
23 return 1
24
25=== modified file 'click/install.py'
26--- click/install.py 2014-09-10 11:50:18 +0000
27+++ click/install.py 2014-12-03 12:45:25 +0000
28@@ -347,7 +347,7 @@
29 os.mkdir(os.path.join(admin_dir, "updates"))
30 os.mkdir(os.path.join(admin_dir, "triggers"))
31
32- def _unpack(self, path, user=None, all_users=False):
33+ def _unpack(self, path, user=None, all_users=False, quiet=True):
34 package_name, package_version = self.audit(path, check_arch=True)
35
36 # Is this package already unpacked in an underlay (non-topmost)
37@@ -401,9 +401,20 @@
38 kwargs = {}
39 if sys.version >= "3.2":
40 kwargs["pass_fds"] = (fd.fileno(),)
41- subprocess.check_call(
42- command, preexec_fn=partial(self._install_preexec, inst_dir),
43- env=env, **kwargs)
44+ if quiet:
45+ fn = subprocess.check_output
46+ kwargs["stderr"] = subprocess.STDOUT
47+ else:
48+ fn = subprocess.check_call
49+ try:
50+ fn(command,
51+ preexec_fn=partial(self._install_preexec, inst_dir),
52+ env=env, universal_newlines=True,
53+ **kwargs)
54+ except subprocess.CalledProcessError as e:
55+ logging.error("%s failed with exit_code %s:\n%s" % (
56+ command, e.returncode, e.output))
57+ raise
58 for dirpath, dirnames, filenames in os.walk(inst_dir):
59 for entry in dirnames + filenames:
60 entry_path = os.path.join(dirpath, entry)
61@@ -441,9 +452,9 @@
62
63 return package_name, package_version, old_version
64
65- def install(self, path, user=None, all_users=False):
66+ def install(self, path, user=None, all_users=False, quiet=True):
67 package_name, package_version, old_version = self._unpack(
68- path, user=user, all_users=all_users)
69+ path, user=user, all_users=all_users, quiet=quiet)
70
71 if user is not None or all_users:
72 if all_users:
73
74=== modified file 'click/tests/test_install.py'
75--- click/tests/test_install.py 2014-08-19 06:32:16 +0000
76+++ click/tests/test_install.py 2014-12-03 12:45:25 +0000
77@@ -456,18 +456,12 @@
78 with self.run_in_subprocess(
79 "click_get_frameworks_dir") as (enter, preloads):
80 enter()
81- original_call = subprocess.call
82+ original_call = subprocess.check_output
83
84 def call_side_effect(*args, **kwargs):
85- if "TEST_VERBOSE" in os.environ:
86- return original_call(
87- ["touch", os.path.join(self.temp_dir, "sentinel")],
88- **kwargs)
89- else:
90- with open("/dev/null", "w") as devnull:
91- return original_call(
92- ["touch", os.path.join(self.temp_dir, "sentinel")],
93- stdout=devnull, stderr=devnull, **kwargs)
94+ return original_call(
95+ ["touch", os.path.join(self.temp_dir, "sentinel")],
96+ **kwargs)
97
98 path = self.make_fake_package(
99 control_fields={
100@@ -490,7 +484,7 @@
101 db.add(root)
102 installer = ClickInstaller(db)
103 self._setup_frameworks(preloads, frameworks=["ubuntu-sdk-13.10"])
104- with mock.patch("subprocess.call") as mock_call:
105+ with mock.patch("subprocess.check_output") as mock_call:
106 mock_call.side_effect = call_side_effect
107 self.assertRaises(
108 subprocess.CalledProcessError, installer.install, path)

Subscribers

People subscribed via source and target branches

to all changes: