[gnome-continuous] task: Make the CWD public as well



commit 1230ff62ec0b1dcc6b24bf2928aaad4dfb675c91
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Oct 9 16:03:55 2013 -0400

    task: Make the CWD public as well
    
    The make builtin needs this to see the output of a task.

 src/js/builtins/make.js |    2 +-
 src/js/task.js          |   18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/js/builtins/make.js b/src/js/builtins/make.js
index 89a95e2..e1b6dc0 100644
--- a/src/js/builtins/make.js
+++ b/src/js/builtins/make.js
@@ -79,7 +79,7 @@ const Make = new Lang.Class({
 
     _onTaskExecuting: function(taskmaster, task) {
        print("Task " + task.name + " executing on " + task.buildName);
-       let output = task._taskCwd.get_child('output.txt');
+       let output = task.taskCwd.get_child('output.txt');
        if (this._oneOnly) {
            let context = new GSystem.SubprocessContext({ argv: ['tail', '-f', output.get_path() ] });
            this._tail = new GSystem.Subprocess({ context: context });
diff --git a/src/js/task.js b/src/js/task.js
index 4ba9b88..49f1fd6 100644
--- a/src/js/task.js
+++ b/src/js/task.js
@@ -390,23 +390,23 @@ const TaskRunner = new Lang.Class({
         buildPath = GSystem.file_realpath(buildPath);
 
         this.buildName = buildPath.get_basename();
-        this._taskCwd = buildPath.get_child(this.name);
-        GSystem.file_ensure_directory(this._taskCwd, false, cancellable);
+        this.taskCwd = buildPath.get_child(this.name);
+        GSystem.file_ensure_directory(this.taskCwd, false, cancellable);
 
        let baseArgv = ['ostbuild', 'run-task', this.name, JSON.stringify(this.taskData.parameters)];
        let context = new GSystem.SubprocessContext({ argv: baseArgv });
-       context.set_cwd(this._taskCwd.get_path());
+       context.set_cwd(this.taskCwd.get_path());
        let childEnv = GLib.get_environ();
         childEnv.push('_OSTBUILD_BUILDDIR=' + buildPath.get_path());
        childEnv.push('_OSTBUILD_WORKDIR=' + this.workdir.get_path());
        context.set_environment(childEnv);
        if (this.taskData.taskDef.PreserveStdout) {
-           let outPath = this._taskCwd.get_child('output.txt');
+           let outPath = this.taskCwd.get_child('output.txt');
            context.set_stdout_file_path(outPath.get_path());
            context.set_stderr_disposition(GSystem.SubprocessStreamDisposition.STDERR_MERGE);
        } else {
            context.set_stdout_disposition(GSystem.SubprocessStreamDisposition.NULL);
-           let errPath = this._taskCwd.get_child('errors.txt');
+           let errPath = this.taskCwd.get_child('errors.txt');
            context.set_stderr_file_path(errPath.get_path());
        }
        this._proc = new GSystem.Subprocess({ context: context });
@@ -421,7 +421,7 @@ const TaskRunner = new Lang.Class({
        let target;
 
         this.changed = true;
-        let modifiedPath = this._taskCwd.get_child('modified.json');
+        let modifiedPath = this.taskCwd.get_child('modified.json');
         if (modifiedPath.query_exists(null)) {
             let data = JsonUtil.loadJson(modifiedPath, null);
             this.changed = data['modified'];
@@ -433,7 +433,7 @@ const TaskRunner = new Lang.Class({
             return;
 
        let elapsedMillis = GLib.get_monotonic_time() / 1000 - this._startTimeMillis;
-       let targetPath = this.workdir.get_relative_path(this._taskCwd);
+       let targetPath = this.workdir.get_relative_path(this.taskCwd);
 
        let meta = { taskMetaVersion: 0,
                      buildName: this.buildName,
@@ -441,12 +441,12 @@ const TaskRunner = new Lang.Class({
                     errmsg: errmsg,
                     elapsedMillis: elapsedMillis,
                     path: targetPath };
-       let statusTxtPath = this._taskCwd.get_child('status.txt');
+       let statusTxtPath = this.taskCwd.get_child('status.txt');
        if (statusTxtPath.query_exists(null)) {
            let contents = GSystem.file_load_contents_utf8(statusTxtPath, cancellable);
            meta['status'] = contents.replace(/[ \n]+$/, '');
        }
 
-       JsonUtil.writeJsonFileAtomic(this._taskCwd.get_child('meta.json'), meta, cancellable);
+       JsonUtil.writeJsonFileAtomic(this.taskCwd.get_child('meta.json'), meta, cancellable);
     }
 });


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