[gnome-continuous] Exit with a non-zero exit status when 'ostbuild make' fails



commit 0481222d0c53691f83a007a4d6dc161896f79a79
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Jun 5 09:34:11 2014 -0400

    Exit with a non-zero exit status when 'ostbuild make' fails
    
    Make the execute() function of builtins return true/false to indicate
    success or failure, and use this so that 'ostbuild make' has the right
    exit status, allowing 'ostbuild make && ...' to work properly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732358

 src/js/builtin.js               |    2 +-
 src/js/builtins/autobuilder.js  |    2 ++
 src/js/builtins/checkout.js     |    2 ++
 src/js/builtins/git_mirror.js   |    2 ++
 src/js/builtins/make.js         |    6 +++++-
 src/js/builtins/qa_make_disk.js |    2 ++
 src/js/builtins/run_task.js     |    2 ++
 src/js/builtins/shell.js        |    2 ++
 src/js/main.js                  |    4 ++--
 9 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/js/builtin.js b/src/js/builtin.js
index d8e52fc..e9106cb 100644
--- a/src/js/builtin.js
+++ b/src/js/builtin.js
@@ -62,6 +62,6 @@ const Builtin = new Lang.Class({
 
     main: function(argv, loop, cancellable) {
        let args = this.parser.parse(argv);
-       this.execute(args, loop, cancellable);
+       return this.execute(args, loop, cancellable);
     }
 });
diff --git a/src/js/builtins/autobuilder.js b/src/js/builtins/autobuilder.js
index 78c9551..0a6b0da 100644
--- a/src/js/builtins/autobuilder.js
+++ b/src/js/builtins/autobuilder.js
@@ -92,6 +92,8 @@ const Autobuilder = new Lang.Class({
        this._updateStatus();
 
        loop.run();
+
+       return true;
     },
 
     _onTaskExecuting: function(taskmaster, task) {
diff --git a/src/js/builtins/checkout.js b/src/js/builtins/checkout.js
index 3574b8b..2a33ea7 100644
--- a/src/js/builtins/checkout.js
+++ b/src/js/builtins/checkout.js
@@ -139,5 +139,7 @@ const Checkout = new Lang.Class({
                                        overwrite: args.overwrite });
            }
        }
+
+       return true;
     }
 });
diff --git a/src/js/builtins/git_mirror.js b/src/js/builtins/git_mirror.js
index e830eab..9e4d024 100644
--- a/src/js/builtins/git_mirror.js
+++ b/src/js/builtins/git_mirror.js
@@ -74,5 +74,7 @@ const GitMirror = new Lang.Class({
                            timeoutSec: args.timeout_sec });
            }
        }));
+
+       return true;
     }
 });
diff --git a/src/js/builtins/make.js b/src/js/builtins/make.js
index a05b392..460680d 100644
--- a/src/js/builtins/make.js
+++ b/src/js/builtins/make.js
@@ -58,8 +58,12 @@ const Make = new Lang.Class({
         GSystem.file_ensure_directory(buildPath, false, cancellable);
        taskmaster.pushTask(buildPath, args.taskname, params);
        loop.run();
-       if (!this._failed)
+       if (this._failed) {
+            return false;
+        } else {
            print("Success!")
+           return true;
+        }
     },
 
     _parseParameters: function(paramStrings) {
diff --git a/src/js/builtins/qa_make_disk.js b/src/js/builtins/qa_make_disk.js
index 7fecbef..776e7e2 100644
--- a/src/js/builtins/qa_make_disk.js
+++ b/src/js/builtins/qa_make_disk.js
@@ -49,5 +49,7 @@ const QaMakeDisk = new Lang.Class({
         LibQA.createDisk(tmppath, cancellable);
         GSystem.file_rename(tmppath, path, cancellable);
         print("Created: " + path.get_path());
+
+        return true;
     }
 });
diff --git a/src/js/builtins/run_task.js b/src/js/builtins/run_task.js
index 396c716..b4b2e01 100644
--- a/src/js/builtins/run_task.js
+++ b/src/js/builtins/run_task.js
@@ -38,5 +38,7 @@ const RunTask = new Lang.Class({
        let params = JSON.parse(args.parameters);
        let instance = new taskDef(params);
        instance.execute(cancellable);
+
+       return true;
     }
 });
diff --git a/src/js/builtins/shell.js b/src/js/builtins/shell.js
index 7c91940..1409494 100644
--- a/src/js/builtins/shell.js
+++ b/src/js/builtins/shell.js
@@ -27,5 +27,7 @@ const Shell = new Lang.Class({
 
     execute: function(args, loop, cancellable) {
        imports.console.interact();
+
+       return true;
     }
 });
diff --git a/src/js/main.js b/src/js/main.js
index 4967985..2d7f5d7 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -79,8 +79,8 @@ function main() {
                          function() {
                              ecode = 1;
                              try {
-                                 instance.main(argv, loop, cancellable);
-                                 ecode = 0;
+                                 if (instance.main(argv, loop, cancellable))
+                                      ecode = 0;
                              } finally {
                                  loop.quit();
                              }


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