[gnome-ostree] autobuilder: Run build-disks too



commit 623c9af5bcd2b3dcadb9fd751d1b9aa6681c2c80
Author: Colin Walters <walters verbum org>
Date:   Tue Jan 29 09:54:14 2013 -0500

    autobuilder: Run build-disks too

 src/ostbuild/js/builtins/autobuilder.js |   39 ++++++++++++++++++++++++------
 1 files changed, 31 insertions(+), 8 deletions(-)
---
diff --git a/src/ostbuild/js/builtins/autobuilder.js b/src/ostbuild/js/builtins/autobuilder.js
index 4fe1141..605ece4 100644
--- a/src/ostbuild/js/builtins/autobuilder.js
+++ b/src/ostbuild/js/builtins/autobuilder.js
@@ -80,6 +80,7 @@ const Autobuilder = new Lang.Class({
 	let taskdir = this.workdir.get_child('tasks');
 	this._resolve_taskset = new SubTask.TaskSet(taskdir.get_child(this.prefix + '-resolve'));
 	this._build_taskset = new SubTask.TaskSet(taskdir.get_child(this.prefix + '-build'));
+	this._builddisks_taskset = new SubTask.TaskSet(taskdir.get_child(this.prefix + '-build-disks'));
 
 	this._source_snapshot_path = this._src_db.getLatestPath();
 
@@ -98,14 +99,14 @@ const Autobuilder = new Lang.Class({
 
     _updateStatus: function() {
 	let newStatus = "";
-	if (!this._resolve_taskset.isRunning() && !this._build_taskset.isRunning()) {
-	    newStatus = "idle";
-	} else {
-	    if (this._resolve_taskset.isRunning())
-		newStatus += "[resolving] ";
-	    if (this._build_taskset.isRunning())
-		newStatus += "[building] ";
-	}
+	if (this._resolve_taskset.isRunning())
+	    newStatus += "[resolving] ";
+	if (this._build_taskset.isRunning())
+	    newStatus += " [building] ";
+	if (this._builddisks_taskset.isRunning())
+	    newStatus += " [disks] ";
+	if (newStatus == "")
+	    newStatus = "[idle]";
 	if (newStatus != this._status) {
 	    this._status = newStatus;
 	    print(this._status);
@@ -230,14 +231,36 @@ const Autobuilder = new Lang.Class({
 	this._updateStatus();
     },
 
+    _run_builddisks: function() {
+	let cancellable = null;
+	if (this._builddisks_taskset.isRunning()) throw new Error();
+
+	let args = ['ostbuild', 'build-disks'];
+
+	let context = new GSystem.SubprocessContext({ argv: args });
+	let task = this._builddisks_taskset.start(context,
+						  cancellable,
+						  Lang.bind(this, this._onBuildDisksExited));
+	print(Format.vprintf("Builddisks task %s.%s started", [task.major, task.minor]));
+
+	this._updateStatus();
+    },
+
     _onBuildExited: function(buildTaskset, success, msg) {
 	print(Format.vprintf("build exited; success=%s msg=%s", [success, msg]))
 	if (this._build_needed)
 	    this._run_build()
+	if (success && !this._builddisks_taskset.isRunning())
+	    this._run_builddisks();
 	
 	this._updateStatus();
     },
 
+    _onBuildDisksExited: function(buildTaskset, success, msg) {
+	print(Format.vprintf("builddisks exited; success=%s msg=%s", [success, msg]))
+	this._updateStatus();
+    },
+
     _getBuildDiffForTask: function(task) {
 	let cancellable = null;
         if (task.build_diff != undefined)



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