Merge lp://qastaging/~cjwatson/snapcraft/tidy-noninteractive-logging into lp://qastaging/~snappy-dev/snapcraft/core

Proposed by Colin Watson
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 219
Merged at revision: 220
Proposed branch: lp://qastaging/~cjwatson/snapcraft/tidy-noninteractive-logging
Merge into: lp://qastaging/~snappy-dev/snapcraft/core
Diff against target: 121 lines (+30/-8)
3 files modified
snapcraft/log.py (+12/-2)
snapcraft/repo.py (+14/-3)
snapcraft/tests/test_log.py (+4/-3)
To merge this branch: bzr merge lp://qastaging/~cjwatson/snapcraft/tidy-noninteractive-logging
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Michael Vogt (community) Approve
Review via email: mp+272748@code.qastaging.launchpad.net

Commit message

Apply better logging and progress behaviour if stdout is not a tty.

Description of the change

Launchpad snap builds have very noisy logs. For example:

  https://launchpadlibrarian.net/219104056/buildlog_snap_ubuntu_vivid_amd64_wget_BUILDING.txt.gz

This applies better logging and progress behaviour in the case where stdout is not a tty: we get rid of the ANSI escapes in snapcraft's own logging output, and we suppress the "pulse" step in apt's progress output.

I also arranged to use the system's apt/GPG configuration. This was prompted by apt missing a newline in its stderr output in that case which made the output look weird, but it seems correct to do this anyway rather than doing insecure downloads.

To post a comment you must log in.
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

thank you Colin!

review: Approve
Revision history for this message
Michael Vogt (mvo) wrote :

Just one small comment inline.

review: Approve
Revision history for this message
Colin Watson (cjwatson) :
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~cjwatson/snapcraft/tidy-noninteractive-logging into lp:snapcraft failed. Below is the output from the failed tests.

The project has gotten complex.
Here's the list of units exceeding 10:
- snapcraft/cmds.py:
  286:1: 'cmd' 13

name: # the name of the snap
version: # the version of the snap
# The vendor for the snap (replace 'Vendor <email address hidden>')
vendor: Vendor <email address hidden>
summary: # 79 char long summary
description: # A longer description for the snap
icon: # A path to an icon for the package
cp --preserve=all -R zzz /tmp/tmp5v9adb9a/parts/copy/install/zzz
cp --preserve=all -R src /tmp/tmp0i6wa7xe/parts/copy/install/dst
cp --preserve=all -R src /tmp/tmpw4g8955p/parts/copy/install/dir/dst

.......................EEE.........Warning: unable to find "test_relexepath" in the path
...................................................................
======================================================================
ERROR: test_configure_must_log_info_and_higher (snapcraft.tests.test_log.LogTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/mock.py", line 1125, in patched
    return func(*args, **keywargs)
  File "/tmp/tarmac/branch.BM9_gP/snapcraft/tests/test_log.py", line 70, in test_configure_must_log_info_and_higher
    log.configure(logger_name)
  File "/tmp/tarmac/branch.BM9_gP/snapcraft/log.py", line 45, in configure
    sys.stdout.detach(), encoding='UTF-8', line_buffering=True)
io.UnsupportedOperation: detach

======================================================================
ERROR: test_configure_must_send_errors_to_stderr (snapcraft.tests.test_log.LogTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/mock.py", line 1125, in patched
    return func(*args, **keywargs)
  File "/tmp/tarmac/branch.BM9_gP/snapcraft/tests/test_log.py", line 53, in test_configure_must_send_errors_to_stderr
    log.configure(logger_name)
  File "/tmp/tarmac/branch.BM9_gP/snapcraft/log.py", line 45, in configure
    sys.stdout.detach(), encoding='UTF-8', line_buffering=True)
io.UnsupportedOperation: detach

======================================================================
ERROR: test_configure_must_send_messages_to_stdout (snapcraft.tests.test_log.LogTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/mock.py", line 1125, in patched
    return func(*args, **keywargs)
  File "/tmp/tarmac/branch.BM9_gP/snapcraft/tests/test_log.py", line 34, in test_configure_must_send_messages_to_stdout
    log.configure(logger_name)
  File "/tmp/tarmac/branch.BM9_gP/snapcraft/log.py", line 45, in configure
    sys.stdout.detach(), encoding='UTF-8', line_buffering=True)
io.UnsupportedOperation: detach

----------------------------------------------------------------------
Ran 102 tests in 2.687s

FAILED (errors=3)

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Ah, those legacy tests that need to not check the logger... :-/

On Tue, Sep 29, 2015 at 10:02 PM, Snappy Tarmac <email address hidden>
wrote:

> The proposal to merge lp:~cjwatson/snapcraft/tidy-noninteractive-logging
> into lp:snapcraft has been updated.
>
> Status: Approved => Needs review
>
> For more details, see:
>
> https://code.launchpad.net/~cjwatson/snapcraft/tidy-noninteractive-logging/+merge/272748
> --
> You are reviewing the proposed merge of
> lp:~cjwatson/snapcraft/tidy-noninteractive-logging into lp:snapcraft.
>
> Launchpad-Message-Rationale: Reviewer
> Launchpad-Message-For: sergiusens
> Launchpad-Notification-Type: code-review
> Launchpad-Branch: ~cjwatson/snapcraft/tidy-noninteractive-logging
> Launchpad-Project: snapcraft
>

219. By Colin Watson

Mock os.isatty in snapcraft.log tests.

Revision history for this message
Colin Watson (cjwatson) wrote :

Can you retry? I've added a bit of extra mocking to work around this.

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

oh thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches