[gnome-ostree/wip/gjs-round3: 3/3] wip



commit e741ec2e88c9505e53cee6776a6ed16e0c10be4d
Author: Colin Walters <walters verbum org>
Date:   Wed Dec 12 08:19:47 2012 -0500

    wip

 src/ostbuild/js/build.js |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/src/ostbuild/js/build.js b/src/ostbuild/js/build.js
index 9c74ec3..3286a60 100644
--- a/src/ostbuild/js/build.js
+++ b/src/ostbuild/js/build.js
@@ -57,17 +57,8 @@ const TaskComposeTarget = new Lang.Class({
 	return [];
     },
 
-    execute: function(inputs, dependResults, cancellable, onComplete) {
-	let name = inputs.NAME;
-	let composeRootdir = this.tmpdir.get_child('contents-' + name).get_path();
-	let context = GSystem.Subprocess.new_simple_argv(['ostree', '--repo=' + this.repo.get_path(),
-							  'checkout', '--user-mode', '--no-triggers', '--union', 
-							  '--from-file=ostbuild-compose-' + name,
-							  composeRootdir],
-							 GSystem.SubprocessStreamDisposition.INHERIT,
-							 GSystem.SubprocessStreamDisposition.INHERIT);
-	context.init(cancellable);
-
+    _onCheckout: function(proc, result, state) {
+	let composeRootdir = state.composeRootdir;
         let contentsPath = composeRootdir.get_child('contents.json');
         JsonUtil.writeJsonFileAtomic(contentsPath, this._snapshot, cancellable);
 
@@ -82,6 +73,26 @@ const TaskComposeTarget = new Lang.Class({
         GSystem.file_unlink(relatedTmpPath, cancellable);
         GSystem.shutil_rm_rf(composeRootdir, cancellable);
 
+    },
+
+    execute: function(inputs, dependResults, cancellable, onComplete) {
+	let name = inputs.NAME;
+	let composeRootdir = this.tmpdir.get_child('contents-' + name).get_path();
+	let state = {me: this,
+		     name: name,
+		     composeRootdir: composeRootdir,
+		     onComplete: onComplete};
+	let context = GSystem.Subprocess.new_simple_argv(['ostree', '--repo=' + this.repo.get_path(),
+							  'checkout', '--user-mode', '--no-triggers', '--union', 
+							  '--from-file=ostbuild-compose-' + name,
+							  composeRootdir],
+							 GSystem.SubprocessStreamDisposition.INHERIT,
+							 GSystem.SubprocessStreamDisposition.INHERIT);
+	context.init(cancellable);
+
+	context.wait(cancellable, Lang.bind(this, this._onCheckout, state));
+
+
     }
 });
 



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