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
=== modified file 'click/commands/install.py'
--- click/commands/install.py 2014-09-10 12:28:49 +0000
+++ click/commands/install.py 2014-12-03 12:45:25 +0000
@@ -46,6 +46,9 @@
46 parser.add_option(46 parser.add_option(
47 "--allow-unauthenticated", default=False, action="store_true",47 "--allow-unauthenticated", default=False, action="store_true",
48 help="allow installing packages with no signatures")48 help="allow installing packages with no signatures")
49 parser.add_option(
50 "--verbose", default=False, action="store_true",
51 help="be more verbose on install")
49 options, args = parser.parse_args(argv)52 options, args = parser.parse_args(argv)
50 if len(args) < 1:53 if len(args) < 1:
51 parser.error("need package file name")54 parser.error("need package file name")
@@ -59,7 +62,8 @@
59 allow_unauthenticated=options.allow_unauthenticated)62 allow_unauthenticated=options.allow_unauthenticated)
60 try:63 try:
61 installer.install(64 installer.install(
62 package_path, user=options.user, all_users=options.all_users)65 package_path, user=options.user, all_users=options.all_users,
66 quiet=not options.verbose)
63 except ClickInstallerError as e:67 except ClickInstallerError as e:
64 print("Cannot install %s: %s" % (package_path, e), file=sys.stderr)68 print("Cannot install %s: %s" % (package_path, e), file=sys.stderr)
65 return 169 return 1
6670
=== modified file 'click/install.py'
--- click/install.py 2014-09-10 11:50:18 +0000
+++ click/install.py 2014-12-03 12:45:25 +0000
@@ -347,7 +347,7 @@
347 os.mkdir(os.path.join(admin_dir, "updates"))347 os.mkdir(os.path.join(admin_dir, "updates"))
348 os.mkdir(os.path.join(admin_dir, "triggers"))348 os.mkdir(os.path.join(admin_dir, "triggers"))
349349
350 def _unpack(self, path, user=None, all_users=False):350 def _unpack(self, path, user=None, all_users=False, quiet=True):
351 package_name, package_version = self.audit(path, check_arch=True)351 package_name, package_version = self.audit(path, check_arch=True)
352352
353 # Is this package already unpacked in an underlay (non-topmost)353 # Is this package already unpacked in an underlay (non-topmost)
@@ -401,9 +401,20 @@
401 kwargs = {}401 kwargs = {}
402 if sys.version >= "3.2":402 if sys.version >= "3.2":
403 kwargs["pass_fds"] = (fd.fileno(),)403 kwargs["pass_fds"] = (fd.fileno(),)
404 subprocess.check_call(404 if quiet:
405 command, preexec_fn=partial(self._install_preexec, inst_dir),405 fn = subprocess.check_output
406 env=env, **kwargs)406 kwargs["stderr"] = subprocess.STDOUT
407 else:
408 fn = subprocess.check_call
409 try:
410 fn(command,
411 preexec_fn=partial(self._install_preexec, inst_dir),
412 env=env, universal_newlines=True,
413 **kwargs)
414 except subprocess.CalledProcessError as e:
415 logging.error("%s failed with exit_code %s:\n%s" % (
416 command, e.returncode, e.output))
417 raise
407 for dirpath, dirnames, filenames in os.walk(inst_dir):418 for dirpath, dirnames, filenames in os.walk(inst_dir):
408 for entry in dirnames + filenames:419 for entry in dirnames + filenames:
409 entry_path = os.path.join(dirpath, entry)420 entry_path = os.path.join(dirpath, entry)
@@ -441,9 +452,9 @@
441452
442 return package_name, package_version, old_version453 return package_name, package_version, old_version
443454
444 def install(self, path, user=None, all_users=False):455 def install(self, path, user=None, all_users=False, quiet=True):
445 package_name, package_version, old_version = self._unpack(456 package_name, package_version, old_version = self._unpack(
446 path, user=user, all_users=all_users)457 path, user=user, all_users=all_users, quiet=quiet)
447458
448 if user is not None or all_users:459 if user is not None or all_users:
449 if all_users:460 if all_users:
450461
=== modified file 'click/tests/test_install.py'
--- click/tests/test_install.py 2014-08-19 06:32:16 +0000
+++ click/tests/test_install.py 2014-12-03 12:45:25 +0000
@@ -456,18 +456,12 @@
456 with self.run_in_subprocess(456 with self.run_in_subprocess(
457 "click_get_frameworks_dir") as (enter, preloads):457 "click_get_frameworks_dir") as (enter, preloads):
458 enter()458 enter()
459 original_call = subprocess.call459 original_call = subprocess.check_output
460460
461 def call_side_effect(*args, **kwargs):461 def call_side_effect(*args, **kwargs):
462 if "TEST_VERBOSE" in os.environ:462 return original_call(
463 return original_call(463 ["touch", os.path.join(self.temp_dir, "sentinel")],
464 ["touch", os.path.join(self.temp_dir, "sentinel")],464 **kwargs)
465 **kwargs)
466 else:
467 with open("/dev/null", "w") as devnull:
468 return original_call(
469 ["touch", os.path.join(self.temp_dir, "sentinel")],
470 stdout=devnull, stderr=devnull, **kwargs)
471465
472 path = self.make_fake_package(466 path = self.make_fake_package(
473 control_fields={467 control_fields={
@@ -490,7 +484,7 @@
490 db.add(root)484 db.add(root)
491 installer = ClickInstaller(db)485 installer = ClickInstaller(db)
492 self._setup_frameworks(preloads, frameworks=["ubuntu-sdk-13.10"])486 self._setup_frameworks(preloads, frameworks=["ubuntu-sdk-13.10"])
493 with mock.patch("subprocess.call") as mock_call:487 with mock.patch("subprocess.check_output") as mock_call:
494 mock_call.side_effect = call_side_effect488 mock_call.side_effect = call_side_effect
495 self.assertRaises(489 self.assertRaises(
496 subprocess.CalledProcessError, installer.install, path)490 subprocess.CalledProcessError, installer.install, path)

Subscribers

People subscribed via source and target branches

to all changes: