summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Firth <dan.firth@codethink.co.uk>2013-10-11 10:29:54 +0100
committerDaniel Firth <dan.firth@codethink.co.uk>2013-10-11 10:29:54 +0100
commitdbbee9a5f94569a330aa477bc5fc1bf3a1fd5d86 (patch)
tree42f21d88e3074214ea96f3600670fe3bfb871f09
parent090d21ed8e9cb7bd640c2632217399dc72e0df0a (diff)
parent31ca4d455d1bbce69c6dc461dbd506b3523ac2d9 (diff)
downloadmorph-dbbee9a5f94569a330aa477bc5fc1bf3a1fd5d86.tar.gz
Merge branch 'danielfirth/RT193'
Reviewed by: Lars Wirzenius Reviewed by: Pedro Alvarezwq
-rw-r--r--morphlib/app.py2
-rw-r--r--morphlib/builder2.py14
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py2
-rw-r--r--morphlib/stagingarea.py6
-rw-r--r--morphlib/stagingarea_tests.py3
-rw-r--r--morphlib/util.py8
6 files changed, 21 insertions, 14 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 0c4f3455..f916ae17 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -431,7 +431,7 @@ class Morph(cliapp.Application):
# Log the environment.
prev = getattr(self, 'prev_env', {})
- morphlib.util.log_dict_diff(kwargs['env'], prev)
+ morphlib.util.log_dict_diff(self, kwargs['env'], prev)
self.prev_env = kwargs['env']
# run the command line
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index e1eaaa86..bab89aa2 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -439,8 +439,10 @@ class ChunkBuilder(BuilderBase):
contents = morphlib.bins.chunk_contents(destdir, patterns)
self.write_metadata(destdir, artifact_name, contents)
- logging.debug('assembling chunk %s' % artifact_name)
- logging.debug('assembling into %s' % f.name)
+ self.app.status(msg='assembling chunk %s' % artifact_name,
+ chatty=True)
+ self.app.status(msg='assembling into %s' % f.name,
+ chatty=True)
self.app.status(msg='Creating chunk artifact %(name)s',
name=artifact.name)
morphlib.bins.create_chunk(destdir, f, patterns)
@@ -700,8 +702,10 @@ class Builder(object): # pragma: no cover
self.remote_artifact_cache, artifact,
self.repo_cache, self.max_jobs,
self.setup_mounts)
- logging.debug('Builder.build: artifact %s with %s' %
- (artifact.name, repr(o)))
+ self.app.status(msg='Builder.build: artifact %s with %s' %
+ (artifact.name, repr(o)),
+ chatty=True)
built_artifacts = o.build_and_cache()
- logging.debug('Builder.build: done')
+ self.app.status(msg='Builder.build: done',
+ chatty=True)
return built_artifacts
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py
index 0a43b918..9a0ee484 100644
--- a/morphlib/plugins/branch_and_merge_new_plugin.py
+++ b/morphlib/plugins/branch_and_merge_new_plugin.py
@@ -822,7 +822,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
system, metadata = self._load_system_metadata(metadata_path)
resolved_refs = dict(self._resolve_refs_from_metadata(alias_resolver,
metadata))
- logging.debug('Resolved refs: %r' % resolved_refs)
+ self.app.status(msg='Resolved refs: %r' % resolved_refs)
base_ref = system['sha1']
# The previous version would fall back to deducing this from the repo
# url and the repo alias resolver, but this does not always work, and
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py
index 7d034ff2..3cd3818c 100644
--- a/morphlib/stagingarea.py
+++ b/morphlib/stagingarea.py
@@ -156,8 +156,8 @@ class StagingArea(object):
'''
- logging.debug('Installing artifact %s' %
- getattr(handle, 'name', 'unknown name'))
+ self._app.status(msg='Installing artifact %s' %
+ getattr(handle, 'name', 'unknown name'))
chunk_cache_dir = os.path.join(self._app.settings['tempdir'], 'chunks')
unpacked_artifact = os.path.join(
@@ -296,7 +296,7 @@ class StagingArea(object):
if not self.use_chroot:
do_not_mount_dirs += [temp_dir]
- logging.debug("Not mounting dirs %r" % do_not_mount_dirs)
+ self._app.status(msg="Not mounting dirs %r" % do_not_mount_dirs)
real_argv = ['linux-user-chroot', '--chdir', cwd, '--unshare-net']
for d in morphlib.fsutils.invert_paths(os.walk(chroot_dir),
diff --git a/morphlib/stagingarea_tests.py b/morphlib/stagingarea_tests.py
index 7cd4a5c3..27f85dff 100644
--- a/morphlib/stagingarea_tests.py
+++ b/morphlib/stagingarea_tests.py
@@ -57,6 +57,9 @@ class FakeApplication(object):
def runcmd_unchecked(self, *args, **kwargs):
return cliapp.runcmd_unchecked(*args, **kwargs)
+ def status(self, msg):
+ pass
+
class StagingAreaTests(unittest.TestCase):
diff --git a/morphlib/util.py b/morphlib/util.py
index 19c0046f..8a2cfd71 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -171,20 +171,20 @@ def new_repo_caches(app): # pragma: no cover
return lrc, rrc
-def log_dict_diff(cur, pre): # pragma: no cover
+def log_dict_diff(app, cur, pre): # pragma: no cover
'''Log the differences between two dicts to debug log'''
dictA = cur
dictB = pre
for key in dictA.keys():
if key not in dictB:
- logging.debug("New environment: %s = %s" % (key, dictA[key]))
+ app.status(msg="New environment: %s = %s" % (key, dictA[key]))
elif dictA[key] != dictB[key]:
- logging.debug(
+ app.status(msg= \
"Environment changed: %(key)s = %(valA)s to %(key)s = %(valB)s"
% {"key": key, "valA": dictA[key], "valB": dictB[key]})
for key in dictB.keys():
if key not in dictA:
- logging.debug("Environment removed: %s = %s" % (key, dictB[key]))
+ app.status(msg="Environment removed: %s = %s" % (key, dictB[key]))
# This acquired from rdiff-backup which is GPLv2+ and a patch from 2011