From aa6dfcbb70c03dfeb3f9af02283aa1ab83667162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Sun, 12 Apr 2015 15:31:04 +0100 Subject: Use --verbose/-v to show build output, --debug/-d for morph debug Its going to be more likely that a baserock user is more interesed in the build log than actually the debug output from morph. And also the intuitive option would be to use -v for this. --verbose/-v: show build output --debug/-d: show morph debug output Change-Id: I1fb99034dc8680a5f168f6306724663aea33ebc5 --- morphlib/app.py | 16 ++++++++++------ morphlib/cachedrepo.py | 2 +- morphlib/cachedrepo_tests.py | 2 +- morphlib/localrepocache.py | 4 ++-- morphlib/localrepocache_tests.py | 2 +- scripts/test-morph | 2 +- yarns/morph.shell-lib | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/morphlib/app.py b/morphlib/app.py index 1017ce9a..293b8517 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -55,7 +55,7 @@ class Morph(cliapp.Application): def add_settings(self): self.settings.boolean(['verbose', 'v'], - 'show what is happening in much detail') + 'write build log on stdout') self.settings.boolean(['quiet', 'q'], 'show no output unless there is an error') @@ -84,7 +84,11 @@ class Morph(cliapp.Application): 'automatically', group=group_advanced) self.settings.boolean(['build-log-on-stdout'], - 'write build log on stdout', + 'internal option for use by distbuild to' + 'transfer logs from the worker to the' + 'initiator in real time') + self.settings.boolean(['debug', 'd'], + 'show what is happening in much detail', group=group_advanced) self.settings.string_list(['repo-alias'], 'list of URL prefix definitions, in the ' @@ -319,7 +323,7 @@ class Morph(cliapp.Application): * ``msg`` is the message text; it can use ``%(foo)s`` to embed the value of keyword argument ``foo`` * ``chatty`` should be true when the message is only informative, - and only useful for users who want to know everything (--verbose) + and only useful for users who want to know everything (--debug) * ``error`` should be true when it is an error message All other keywords are ignored unless embedded in ``msg``. @@ -335,7 +339,7 @@ class Morph(cliapp.Application): error = kwargs.get('error', False) chatty = kwargs.get('chatty', False) quiet = self.settings['quiet'] - verbose = self.settings['verbose'] + debug = self.settings['debug'] if error: logging.error(text) @@ -344,7 +348,7 @@ class Morph(cliapp.Application): else: logging.info(text) - ok = verbose or error or (not quiet and not chatty) + ok = debug or error or (not quiet and not chatty) if ok: self._write_status(text) @@ -371,7 +375,7 @@ class Morph(cliapp.Application): else: print_command = True - if print_command and self.settings['verbose']: + if print_command and self.settings['debug']: # Don't call self.status() here, to avoid writing the message to # the log as well as to the console. The cliapp.runcmd() function # will also log the command, and it's messy having it logged twice. diff --git a/morphlib/cachedrepo.py b/morphlib/cachedrepo.py index b41ba86f..0c0f5cb7 100644 --- a/morphlib/cachedrepo.py +++ b/morphlib/cachedrepo.py @@ -249,7 +249,7 @@ class CachedRepo(object): try: self._gitdir.update_remotes( - echo_stderr=self.app.settings['verbose']) + echo_stderr=self.app.settings['debug']) self.already_updated = True except cliapp.AppException: raise UpdateError(self) diff --git a/morphlib/cachedrepo_tests.py b/morphlib/cachedrepo_tests.py index 404a0778..da88dab4 100644 --- a/morphlib/cachedrepo_tests.py +++ b/morphlib/cachedrepo_tests.py @@ -28,7 +28,7 @@ class FakeApplication(object): def __init__(self): self.settings = { - 'verbose': True + 'debug': True } diff --git a/morphlib/localrepocache.py b/morphlib/localrepocache.py index 4fc3916a..53f3d5a4 100644 --- a/morphlib/localrepocache.py +++ b/morphlib/localrepocache.py @@ -118,7 +118,7 @@ class LocalRepoCache(object): self._app.status(msg="Trying to fetch %(tarball)s to seed the cache", tarball=url, chatty=True) - if self._app.settings['verbose']: + if self._app.settings['debug']: verbosity_flags = [] kwargs = dict(stderr=sys.stderr) else: @@ -212,7 +212,7 @@ class LocalRepoCache(object): try: self._git(['clone', '--mirror', '-n', repourl, target], - echo_stderr=self._app.settings['verbose']) + echo_stderr=self._app.settings['debug']) except cliapp.AppException as e: errors.append('Unable to clone from %s to %s: %s' % (repourl, target, e)) diff --git a/morphlib/localrepocache_tests.py b/morphlib/localrepocache_tests.py index aeef18f1..5ac85e95 100644 --- a/morphlib/localrepocache_tests.py +++ b/morphlib/localrepocache_tests.py @@ -28,7 +28,7 @@ class FakeApplication(object): def __init__(self): self.settings = { - 'verbose': True + 'debug': True } def status(self, msg): diff --git a/scripts/test-morph b/scripts/test-morph index 9a48d12a..cc8bb7c4 100755 --- a/scripts/test-morph +++ b/scripts/test-morph @@ -34,7 +34,7 @@ if [ "$1" = "--find-system-artifact" ]; then "$SRCDIR/morph" --no-default-config \ --tarball-server= --cache-server= \ --cachedir-min-space=0 --tempdir-min-space=0 \ - --config="$DATADIR/morph.conf" --verbose "$@" > $DATADIR/stdout + --config="$DATADIR/morph.conf" --debug "$@" > $DATADIR/stdout ARTIFACT=$(grep "system \S\+-rootfs is cached at" "$DATADIR/stdout" | \ sed -nre "s/^.*system \S+-rootfs is cached at (\S+)$/\1/p") diff --git a/yarns/morph.shell-lib b/yarns/morph.shell-lib index e7011091..faf094ff 100644 --- a/yarns/morph.shell-lib +++ b/yarns/morph.shell-lib @@ -36,7 +36,7 @@ run_morph() { { set +e - "$SRCDIR"/morph --verbose \ + "$SRCDIR"/morph --debug \ --cachedir-min-space=0 --tempdir-min-space=0 \ --no-default-config --config "$DATADIR/morph.conf" \ --log="$DATADIR/log-$1" \ -- cgit v1.2.1