diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-09-07 10:38:43 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-09-28 10:00:28 +0000 |
commit | 54496d7d9b6d5e1c64c5c220ab2f280e0b9e84ec (patch) | |
tree | 450076664a98c2959a38343780452de622080c26 | |
parent | 63bb0c9c7edaf3cdaf8d03eb0fbcdbba40b65d36 (diff) | |
download | morph-54496d7d9b6d5e1c64c5c220ab2f280e0b9e84ec.tar.gz |
Use app.status() to log ldconfig messages
Using app.status() produces nicer logs as the messages will have the
status prefix prepended.
Change-Id: I0573d7066784afdbfb878bed85af704e82bb9797
-rw-r--r-- | morphlib/buildcommand.py | 2 | ||||
-rw-r--r-- | morphlib/builder.py | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 8b728b05..a0922165 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -533,7 +533,7 @@ class BuildCommand(object): staging_area.install_artifact(handle) if target_source.build_mode == 'staging': - morphlib.builder.ldconfig(self.app.runcmd, staging_area.dirname) + morphlib.builder.ldconfig(self.app, staging_area.dirname) def build_and_cache(self, staging_area, source, setup_mounts): '''Build a source and put its artifacts into the local cache.''' diff --git a/morphlib/builder.py b/morphlib/builder.py index 443741b0..cfd5510c 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -84,7 +84,7 @@ def set_mtime_recursively(root): # pragma: no cover os.utime(pathname, (now, now)) os.utime(dirname, (now, now)) -def ldconfig(runcmd, rootdir): # pragma: no cover +def ldconfig(app, rootdir): # pragma: no cover '''Run ldconfig for the filesystem below ``rootdir``. Essentially, ``rootdir`` specifies the root of a new system. @@ -104,7 +104,8 @@ def ldconfig(runcmd, rootdir): # pragma: no cover conf = os.path.join(rootdir, 'etc', 'ld.so.conf') if os.path.exists(conf): - logging.debug('Running ldconfig for %s' % rootdir) + app.status(msg="Running ldconfig for %(rootdir)s", + rootdir=rootdir, chatty=True) cache = os.path.join(rootdir, 'etc', 'ld.so.cache') # The following trickery with $PATH is necessary during the Baserock @@ -115,9 +116,10 @@ def ldconfig(runcmd, rootdir): # pragma: no cover env = dict(os.environ) old_path = env['PATH'] env['PATH'] = '%s:/sbin:/usr/sbin:/usr/local/sbin' % old_path - runcmd(['ldconfig', '-r', rootdir], env=env) + app.runcmd(['ldconfig', '-r', rootdir], env=env) else: - logging.debug('No %s, not running ldconfig' % conf) + app.status(msg="No %(conf)s, not running ldconfig", + conf=conf, chatty=True) def download_depends(constituents, lac, rac, metadatas=None): @@ -636,7 +638,7 @@ class SystemBuilder(BuilderBase): # pragma: no cover for stratum_artifact in self.source.dependencies: self.unpack_one_stratum(stratum_artifact, path) - ldconfig(self.app.runcmd, path) + ldconfig(self.app, path) def write_metadata(self, instdir, artifact_name): BuilderBase.write_metadata(self, instdir, artifact_name) |