[gnome-ostree/wip/gjs-round2] build: Log when we we're starting some processes



commit d2a40f86f19cf8649f9dc4eaac973ba207ce48fa
Author: Colin Walters <walters verbum org>
Date:   Sat Dec 15 07:22:15 2012 -0500

    build: Log when we we're starting some processes
    
    Just to be a bit more informative until the tasks stuff lands.

 src/ostbuild/js/build.js    |   12 ++++++++----
 src/ostbuild/js/procutil.js |   13 +++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/ostbuild/js/build.js b/src/ostbuild/js/build.js
index be8a6c3..7ae4e5e 100644
--- a/src/ostbuild/js/build.js
+++ b/src/ostbuild/js/build.js
@@ -427,6 +427,7 @@ const Build = new Lang.Class({
 	context.set_environment(ProcUtil.objectToEnvironment(envCopy));
 	let proc = new GSystem.Subprocess({ context: context });
 	proc.init(cancellable);
+	print(Format.vprintf("Started child process %s: pid=%s", [JSON.stringify(proc.context.argv), proc.get_pid()]));
 	let [res, estatus] = proc.wait_sync(cancellable);
 	let [buildSuccess, msg] = ProcUtil.getExitStatusAndString(estatus);
         if (!buildSuccess) {
@@ -458,7 +459,8 @@ const Build = new Lang.Class({
             commitArgs.push('--statoverride=' + statoverridePath.get_path());
 	}
 
-        ProcUtil.runSync(commitArgs, cancellable, {cwd: componentResultdir});
+        ProcUtil.runSync(commitArgs, cancellable, {cwd: componentResultdir,
+						   logInitiation: true});
         if (statoverridePath != null)
             GSystem.file_unlink(statoverridePath, cancellable);
 
@@ -536,7 +538,8 @@ const Build = new Lang.Class({
         ProcUtil.runSync(['ostree', '--repo=' + this.repo.get_path(),
 			  'checkout', '--user-mode', '--no-triggers', '--union', 
 			  '--from-file=' + contentsTmpPath.get_path(), composeRootdir.get_path()],
-			cancellable);
+			 cancellable,
+                         {logInitiation: true});
         GSystem.file_unlink(contentsTmpPath, cancellable);
 
         let contentsPath = composeRootdir.get_child('contents.json');
@@ -548,8 +551,9 @@ const Build = new Lang.Class({
 			 'commit', '-b', treename, '-s', 'Compose',
 			 '--owner-uid=0', '--owner-gid=0', '--no-xattrs', 
 			 '--related-objects-file=' + relatedTmpPath.get_path(),
-			 '--skip-if-unchanged'
-			 ], cancellable, {cwd: composeRootdir.get_path()});
+			 '--skip-if-unchanged'], cancellable,
+                          {cwd: composeRootdir.get_path(),
+                           logInitiation: true});
         GSystem.file_unlink(relatedTmpPath, cancellable);
         GSystem.shutil_rm_rf(composeRootdir, cancellable);
     },
diff --git a/src/ostbuild/js/procutil.js b/src/ostbuild/js/procutil.js
index 6964ff2..c72cc6d 100644
--- a/src/ostbuild/js/procutil.js
+++ b/src/ostbuild/js/procutil.js
@@ -16,7 +16,8 @@ function _newContext(argv, params) {
     let context = new GSystem.SubprocessContext({argv: argv});
     params = Params.parse(params, {cwd: null,
 				   env: null,
-				   stderr: null });
+				   stderr: null,
+				   logInitiation: false });
     if (typeof(params.cwd) == 'string')
 	context.set_cwd(params.cwd);
     else if (params.cwd)
@@ -27,7 +28,7 @@ function _newContext(argv, params) {
 
     if (params.stderr != null)
 	context.set_stderr_disposition(params.stderr);
-    return context;
+    return [context, params];
 }
 
 function _wait_sync_check_internal(proc, cancellable) {
@@ -46,18 +47,22 @@ function _wait_sync_check_internal(proc, cancellable) {
 }
 
 function runSync(argv, cancellable, params) {
-    let context = _newContext(argv, params);
+    let [context, pparams] = _newContext(argv, params);
     let proc = new GSystem.Subprocess({context: context});
     proc.init(cancellable);
+    if (pparams.logInitiation)
+	print(Format.vprintf("Started child process %s: pid=%s", [JSON.stringify(proc.context.argv), proc.get_pid()]));
     _wait_sync_check_internal(proc, cancellable);
 }
 
 function _runSyncGetOutputInternal(argv, cancellable, params, splitLines) {
-    let context = _newContext(argv, params);
+    let [context, pparams] = _newContext(argv, params);
     context.set_stdout_disposition(GSystem.SubprocessStreamDisposition.PIPE);
     context.set_stderr_disposition(GSystem.SubprocessStreamDisposition.INHERIT);
     let proc = new GSystem.Subprocess({context: context});
     proc.init(cancellable);
+    if (pparams.logInitiation)
+	print(Format.vprintf("Started child process %s: pid=%s", [JSON.stringify(proc.context.argv), proc.get_pid()]));
     let input = proc.get_stdout_pipe();
     let dataIn = Gio.DataInputStream.new(input);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]