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/01/31 00:25:31 UTC
[07/13] git commit: bin/build/build: generate deb package
bin/build/build: generate deb package
Project: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/commit/699f0d24
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/tree/699f0d24
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/diff/699f0d24
Branch: refs/heads/master
Commit: 699f0d245f89db6adb6007e258c5c0e25ab2906b
Parents: a4aaf83
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Sun Dec 29 08:40:19 2013 +0400
Committer: Maxim Ermilov <ma...@canonical.com>
Committed: Sun Dec 29 08:40:19 2013 +0400
----------------------------------------------------------------------
bin/build/lib/ubuntu.js | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/699f0d24/bin/build/lib/ubuntu.js
----------------------------------------------------------------------
diff --git a/bin/build/lib/ubuntu.js b/bin/build/lib/ubuntu.js
index 1fde472..35ff185 100644
--- a/bin/build/lib/ubuntu.js
+++ b/bin/build/lib/ubuntu.js
@@ -120,6 +120,30 @@ function buildNative(campoDir, ubuntuDir, nobuild) {
cp(path.join(ubuntuDir, 'qml', '*'), path.join(prefixDir, 'qml'));
popd();
+
+ var manifest = JSON.parse(fs.readFileSync(path.join(ubuntuDir, 'manifest.json'), {encoding: "utf8"}));
+
+ assert(manifest.name.length);
+ assert(manifest.name.indexOf(' ') == -1);
+
+ var debDir = path.join(nativeDir, manifest.name);
+
+ shell.rm('-rf', debDir);
+ shell.mkdir('-p', path.join(debDir, 'opt', manifest.name));
+ cp(path.join(prefixDir, '*'), path.join(debDir, 'opt', manifest.name));
+
+ var destDir = path.join('/opt', manifest.name);
+ shell.mkdir('-p', path.join(debDir, 'usr', 'share', 'applications'));
+ shell.mkdir('-p', path.join(debDir, 'DEBIAN'));
+ fs.writeFileSync(path.join(debDir, 'DEBIAN', 'control'), 'Package: ' + manifest.name + '\nVersion: ' + manifest.version + '\nMaintainer: ' + manifest.maintainer + '\nArchitecture: ' + manifest.architecture + '\nDescription: ' + manifest.description + '\n')
+ fs.writeFileSync(path.join(debDir, 'usr', 'share', 'applications', manifest.name + '.desktop'), '[Desktop Entry]\nName=' + manifest.title + '\nExec=' + path.join(destDir, 'cordova-ubuntu') + ' ' + path.join(destDir, 'www') + '\nIcon=qmlscene\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true\n');
+
+ pushd(nativeDir);
+
+ exec('dpkg-deb -b "' + manifest.name + '" .');
+ shell.rm('-rf', debDir);
+
+ popd();
}
module.exports.ALL = 2;