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/05/06 01:43:08 UTC

[02/11] git commit: check requirements before build

check requirements before build


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

Branch: refs/heads/master
Commit: 77cda302b077d712bb4e938581febd1bce5efca2
Parents: af5a228
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Wed Apr 16 13:50:22 2014 +0400
Committer: Maxim Ermilov <ma...@canonical.com>
Committed: Wed Apr 16 14:28:08 2014 +0400

----------------------------------------------------------------------
 bin/build/build         |  4 +++-
 bin/build/lib/ubuntu.js |  5 +++++
 bin/build/run           |  4 +++-
 bin/check_reqs          | 27 ++++++++++-----------------
 bin/create              |  1 +
 5 files changed, 22 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/77cda302/bin/build/build
----------------------------------------------------------------------
diff --git a/bin/build/build b/bin/build/build
index ed2635f..81810d3 100755
--- a/bin/build/build
+++ b/bin/build/build
@@ -25,4 +25,6 @@ var platform = require('./lib/ubuntu');
 var root = path.resolve();
 var www = path.join(root, 'www');
 
-platform.build(root, platform.ALL).done();
+platform.check_reqs(root).then(function () {
+    return platform.build(root, platform.ALL);
+}).done();

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/77cda302/bin/build/lib/ubuntu.js
----------------------------------------------------------------------
diff --git a/bin/build/lib/ubuntu.js b/bin/build/lib/ubuntu.js
index 75c9f9f..e7429fa 100644
--- a/bin/build/lib/ubuntu.js
+++ b/bin/build/lib/ubuntu.js
@@ -323,3 +323,8 @@ module.exports.run = function(rootDir, desktop, debug, target, nobuild) {
         });
     }
 }
+
+module.exports.check_reqs = function(rootDir) {
+    var checkReqs = path.join(rootDir, 'platforms', 'ubuntu', 'cordova', 'check_reqs');
+    return execAsync(checkReqs);
+}

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/77cda302/bin/build/run
----------------------------------------------------------------------
diff --git a/bin/build/run b/bin/build/run
index 9345f07..923171d 100755
--- a/bin/build/run
+++ b/bin/build/run
@@ -26,5 +26,7 @@ var www = path.join(root, 'www');
 
 var argv = require('optimist').boolean(['device', 'debug', 'nobuild']).string(['target']).argv;
 
-platform.run(root, !argv.device, argv.debug, argv.target, argv.nobuild).done();
+platform.check_reqs(root).then(function () {
+    return platform.run(root, !argv.device, argv.debug, argv.target, argv.nobuild);
+}).done();
 

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/77cda302/bin/check_reqs
----------------------------------------------------------------------
diff --git a/bin/check_reqs b/bin/check_reqs
index 2340fdd..08166fb 100755
--- a/bin/check_reqs
+++ b/bin/check_reqs
@@ -25,29 +25,22 @@ var exec = require('child_process').exec;
 var deps = "cmake libicu-dev pkg-config qtbase5-dev qtchooser qtdeclarative5-dev qtfeedback5-dev qtlocation5-dev qtmultimedia5-dev qtpim5-dev qtsensors5-dev qtsystems5-dev";
 var depsArm = "cmake libicu-dev:armhf pkg-config qtbase5-dev:armhf qtchooser qtdeclarative5-dev:armhf qtfeedback5-dev:armhf qtlocation5-dev:armhf qtmultimedia5-dev:armhf qtpim5-dev:armhf qtsensors5-dev:armhf qtsystems5-dev:armhf";
 var framework = "ubuntu-sdk-13.10";
-exec("dpkg-query -Wf'$${db:Status-abbrev}' click " + deps, function(error, stdout, stderr) {
-    if (error) {
+
+exec("dpkg-query -Wf'${db:Status-abbrev}\n' click " + deps, function(error, stdout, stderr) {
+    if (error || stdout.indexOf('un') !== -1) {
         console.error("Error: missing dependency " + deps);
-        process.exit(error.code);
+        process.exit(2);
     }
 
-    exec("dpkg-query -Wf='${Version}' click", function(error, stdout, stderr) {
-        //FIXME:
-        if (error || stdout != "0.4.13") {
-            console.error("Error: click package too old");
-            process.exit(error.code);
-        }
-
-        exec("click chroot -aarmhf -f " + framework + " run dpkg-query -l " + deps, function(error, stdout, stderr) {
-            if (error) {
-                console.error("Error: missing armhf chroot");
+    exec("click chroot -aarmhf -f " + framework + " run dpkg-query -Wf'${db:Status-abbrev}\n' " + deps, function(error, stdout, stderr) {
+        if (error || stdout.indexOf('un') !== -1) {
+            console.error("Error: missing armhf chroot");
 // to fix problem click chroot -aarmhf -f ubuntu-sdk-13.10 maint
 // dpkg --force-overwrite --force-conflicts -i /var/cache/apt/archives/qtbase5-dev_5.0.2+dfsg1-7ubuntu13_amd64.deb
 // apt-get install -f
-                console.error("run:\nclick chroot -aarmhf -f " + framework + " create\n click chroot -aarmhf -f " + framework + " install " + depsArm);
-                process.exit(error.code);
-            }
+            console.error("run:\nsudo click chroot -aarmhf -f " + framework + " create\nsudo click chroot -aarmhf -f " + framework + " install " + depsArm);
+            process.exit(2);
         }
     })
-}
+});
 

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/77cda302/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 2d83bef..bf5c25f 100755
--- a/bin/create
+++ b/bin/create
@@ -44,6 +44,7 @@ function create(project_path, package_name, project_name, project_template_dir)
         shell.mkdir(path.join(project_path, 'armhf'));
         shell.mkdir(path.join(project_path, 'native'));
         shell.cp('-r', path.join(ROOT, 'bin/build/*'), path.join(project_path, 'cordova'));
+        shell.cp('-r', path.join(ROOT, 'bin/check_reqs'), path.join(project_path, 'cordova'));
 
         shell.cp('-r', path.join(ROOT, 'bin/node_modules'), path.join(project_path, 'cordova'));