You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/08/26 22:46:40 UTC

[07/15] git commit: bin/build/build: integrate with click-reviewers-tools

bin/build/build: integrate with click-reviewers-tools


Project: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/commit/042ecbe4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/tree/042ecbe4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/diff/042ecbe4

Branch: refs/heads/master
Commit: 042ecbe42ad439345bd55efe46d8126dd873f02f
Parents: a815d58
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Wed Jun 4 01:33:43 2014 +0400
Committer: Maxim Ermilov <ma...@canonical.com>
Committed: Tue Aug 19 14:19:49 2014 +0400

----------------------------------------------------------------------
 bin/build/lib/ubuntu.js | 58 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/042ecbe4/bin/build/lib/ubuntu.js
----------------------------------------------------------------------
diff --git a/bin/build/lib/ubuntu.js b/bin/build/lib/ubuntu.js
index a096c83..d834b79 100644
--- a/bin/build/lib/ubuntu.js
+++ b/bin/build/lib/ubuntu.js
@@ -28,10 +28,10 @@ var colors = require('colors');
 var Q = require("q");
 var os = require("os");
 
-function exec(cmd) {
+function exec(cmd, silent) {
     console.log(cmd.green);
 
-    var res = shell.exec(cmd);
+    var res = shell.exec(cmd, { silent: silent });
     if (res.code !== 0) {
         console.error(cmd.green + " " + "FAILED".underline.red);
         process.exit(1);
@@ -97,6 +97,59 @@ function checkChrootEnv(architecture, framework) {
     }
 }
 
+function checkClickPackage(prefixDir) {
+    pushd(prefixDir);
+
+    // 13.10 missing click-reviewers-tools package
+    // FIXME: remove this check after EOL
+    if (fs.existsSync('/usr/bin/click-run-checks')) {
+        var cmd = '/usr/bin/click-run-checks *.click';
+        console.log(cmd.green);
+        var output = shell.exec(cmd, { silent: true }).output;
+        var json = '[', b = 0;
+        for (var i = 0; i < output.length; i++) {
+            if (output[i] == '{') {
+                if (json.length > 1 && !b)
+                    json += ', ';
+                b++;
+            } else if (output[i] == '}') {
+                b--;
+                if (b == 0)
+                    json += '} ';
+            }
+            if (b > 0) {
+                json += output[i];
+            }
+        }
+        json += ']';
+        var out = JSON.parse(json);
+        for (var i = 0; i < out.length; i++) {
+            if (out[i].warn) {
+                for (var m in out[i].warn) {
+                    if (out[i].warn[m].text) {
+                        console.warn(out[i].warn[m].text.yellow);
+                        if (out[i].warn[m].link)
+                            console.warn(out[i].warn[m].link);
+                    }
+                }
+            }
+        }
+        for (var i = 0; i < out.length; i++) {
+            if (out[i].error) {
+                for (var m in out[i].error) {
+                    if (out[i].error[m].text) {
+                        console.warn(out[i].error[m].text.yellow);
+                        if (out[i].error[m].link)
+                            console.warn(out[i].error[m].link);
+                    }
+                }
+            }
+        }
+    }
+
+    popd();
+}
+
 function buildClickPackage(campoDir, ubuntuDir, nobuild, architecture, framework) {
     assert.ok(architecture && architecture.match(/^[a-z0-9_]+$/));
 
@@ -145,6 +198,7 @@ function buildClickPackage(campoDir, ubuntuDir, nobuild, architecture, framework
 
         return execAsync('click build .');
     }).then(function () {
+        checkClickPackage(prefixDir);
         popd();
 
         popd();