Merge pull request #833 from McGiverGim/bf-create_deb_packages

Create debian packages
10.3.x-maintenance
Michael Keller 2018-01-12 12:47:06 +13:00 committed by GitHub
commit c74bb7872c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 122 additions and 30 deletions

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Name=Betaflight Configurator (English)
Comment=Crossplatform configuration tool for the Betaflight flight control system
Exec=bash -c "LANGUAGE=en /opt/betaflight/betaflight-configurator/betaflight-configurator"
Icon=/opt/betaflight/betaflight-configurator/icon/bf_icon_english_128.png
Terminal=false
Type=Application

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Name=Betaflight Configurator
Comment=Crossplatform configuration tool for the Betaflight flight control system
Exec=/opt/betaflight/betaflight-configurator/betaflight-configurator
Icon=/opt/betaflight/betaflight-configurator/icon/bf_icon_128.png
Terminal=false
Type=Application

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -6,15 +6,18 @@ var child_process = require('child_process');
var fs = require('fs');
var path = require('path');
var archiver = require('archiver');
var zip = require('gulp-zip');
var del = require('del');
var NwBuilder = require('nw-builder');
var makensis = require('makensis');
var deb = require('gulp-debian');
var gulp = require('gulp');
var concat = require('gulp-concat');
var install = require("gulp-install");
var rename = require('gulp-rename');
var runSequence = require('run-sequence');
var mergeStream = require('merge-stream');
var os = require('os');
var distDir = './dist/';
@ -316,7 +319,9 @@ gulp.task('apps', ['dist', 'clean-apps'], function (done) {
process.exit(1);
});
}
done();
runSequence('post-build', function() {
done();
});
});
} else {
console.log('No platform suitable for the apps task')
@ -324,6 +329,30 @@ gulp.task('apps', ['dist', 'clean-apps'], function (done) {
}
});
gulp.task('post-build', function (done) {
var platforms = getPlatforms();
var merged = mergeStream();
if (platforms.indexOf('linux32') != -1) {
// Copy Ubuntu launcher scripts to destination dir
var launcherDir = path.join(appsDir, pkg.name, 'linux32');
console.log('Copy Ubuntu launcher scripts to ' + launcherDir);
merged.add(gulp.src('assets/linux/**')
.pipe(gulp.dest(launcherDir)));
}
if (platforms.indexOf('linux64') != -1) {
// Copy Ubuntu launcher scripts to destination dir
var launcherDir = path.join(appsDir, pkg.name, 'linux64');
console.log('Copy Ubuntu launcher scripts to ' + launcherDir);
merged.add(gulp.src('assets/linux/**')
.pipe(gulp.dest(launcherDir)));
}
return merged.isEmpty() ? done() : merged;
});
// Create debug app directories in ./debug
gulp.task('debug', ['dist', 'clean-debug'], function (done) {
var platforms = getPlatforms();
@ -392,30 +421,63 @@ function release_win(arch) {
// Create distribution package (zip) for windows and linux platforms
function release(arch) {
var src = path.join(appsDir, pkg.name, arch);
var output = fs.createWriteStream(path.join(releaseDir, get_release_filename(arch, 'zip')));
var archive = archiver('zip', {
zlib: { level: 9 }
});
archive.on('warning', function (err) { throw err; });
archive.on('error', function (err) { throw err; });
archive.pipe(output);
archive.directory(src, 'Betaflight Configurator');
return archive.finalize();
var src = path.join(appsDir, pkg.name, arch, '**');
var output = get_release_filename(arch, 'zip');
console.log('zip package started: ' + arch);
return gulp.src(src, {base: path.join(appsDir, pkg.name, arch) })
.pipe(rename(function(actualPath){ actualPath.dirname = path.join('Betaflight Configurator', actualPath.dirname) }))
.pipe(zip(output))
.pipe(gulp.dest(releaseDir));
}
function release_deb(arch) {
var debArch;
switch (arch) {
case 'linux32':
debArch = 'i386';
break;
case 'linux64':
debArch = 'amd64';
break;
default:
console.error("Deb package error, arch: " + arch);
process.exit(1);
break;
}
console.log("Debian package started arch: " + arch);
return gulp.src([path.join(appsDir, pkg.name, arch, '*')])
.pipe(deb({
package: pkg.name,
version: pkg.version,
section: 'base',
priority: 'optional',
architecture: debArch,
maintainer: pkg.author,
description: pkg.description,
postinst: ['xdg-desktop-menu install /opt/betaflight/betaflight-configurator/betaflight-configurator.desktop /opt/betaflight/betaflight-configurator/betaflight-configurator-english.desktop'],
prerm: ['xdg-desktop-menu uninstall betaflight-configurator.desktop betaflight-configurator-english.desktop'],
depends: 'libgconf-2-4',
changelog: [],
_target: 'opt/betaflight/betaflight-configurator',
_out: releaseDir,
_clean: true
}));
}
// Create distribution package for chromeos platform
function release_chromeos() {
var src = distDir;
var output = fs.createWriteStream(path.join(releaseDir, get_release_filename('chromeos', 'zip')));
var archive = archiver('zip', {
zlib: { level: 9 }
});
archive.on('warning', function (err) { throw err; });
archive.on('error', function (err) { throw err; });
archive.pipe(output);
archive.directory(src, false);
return archive.finalize();
var src = distDir + '/**';
var output = get_release_filename('chromeos', 'zip');
console.log('chromeos package started');
return gulp.src(src)
.pipe(zip(output))
.pipe(gulp.dest(releaseDir));
}
// Create distribution package for macOS platform
@ -446,7 +508,7 @@ function release_osx64() {
}
// Create distributable .zip files in ./release
gulp.task('release', ['apps', 'clean-release'], function () {
gulp.task('release', ['apps', 'clean-release'], function (done) {
fs.mkdir(releaseDir, '0775', function(err) {
if (err) {
if (err.code !== 'EEXIST') {
@ -458,20 +520,24 @@ gulp.task('release', ['apps', 'clean-release'], function () {
var platforms = getPlatforms();
console.log('Packing release.');
var merged = mergeStream();
if (platforms.indexOf('chromeos') !== -1) {
release_chromeos();
merged.add(release_chromeos());
}
if (platforms.indexOf('linux64') !== -1) {
release('linux64');
merged.add(release('linux64'));
merged.add(release_deb('linux64'));
}
if (platforms.indexOf('linux32') !== -1) {
release('linux32');
merged.add(release('linux32'));
merged.add(release_deb('linux32'));
}
if (platforms.indexOf('osx64') !== -1) {
release_osx64();
merged.add(release_osx64());
}
if (platforms.indexOf('win32') !== -1) {
@ -481,6 +547,8 @@ gulp.task('release', ['apps', 'clean-release'], function () {
if (platforms.indexOf('win64') !== -1) {
release_win('win64');
}
return merged.isEmpty() ? done() : merged;
});
gulp.task('default', ['debug']);

8
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "betaflight-configurator",
"version": "10.0.0-rc4",
"version": "10.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -2036,6 +2036,12 @@
"integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=",
"dev": true
},
"makensis": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/makensis/-/makensis-0.9.0.tgz",
"integrity": "sha512-J7l6dARQ+bnKkSCsvzpLmdwZsEko6lR0M8ljMgfpH1P9Bck3LioQiIwsPCdfL74KPHzO8wWJJpHkhH1bSZkuvQ==",
"dev": true
},
"map-cache": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",

View File

@ -23,19 +23,23 @@
"license": "GPL-3.0",
"dependencies": {},
"devDependencies": {
"archiver": "^2.0.3",
"del": "^3.0.0",
"gulp": "~3.9.1",
"gulp-concat": "~2.6.1",
"gulp-debian": "~0.1.6",
"gulp-install": "^1.1.0",
"gulp-rename": "~1.2.2",
"gulp-zip": "^4.1.0",
"inflection": "1.12.0",
"jquery-ui-npm": "1.12.0",
"makensis": "^0.9.0",
"merge-stream": "^1.0.1",
"nw-builder": "^3.4.1",
"os": "^0.1.1",
"platform-dependent-modules": "0.0.14",
"run-sequence": "^2.2.0",
"temp": "^0.8.3"
"temp": "^0.8.3",
"title-case": "^2.1.0"
},
"config": {
"platformDependentModules": {