Skip to content

Commit

Permalink
Merge pull request #79 from erstec/erstec-linux-installers-naming
Browse files Browse the repository at this point in the history
Linux installers - file naming
  • Loading branch information
Ernest Stepanov authored Jul 13, 2022
2 parents d73c664 + d59e8ad commit 8f12452
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
28 changes: 25 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ function getRunDebugAppCommand() {
}
}

function get_release_filename_base(platform) {
return 'INAV-BlackboxExplorer_' + platform;
}

function get_release_filename(platform, ext, addition = '') {
return 'INAV-BlackboxExplorer_' + platform + addition + '_' + pkg.version + '.' + ext;
return get_release_filename_base(platform) + addition + '_' + pkg.version + '.' + ext;
}

function get_nw_version() {
Expand Down Expand Up @@ -557,6 +561,24 @@ function release_deb(arch) {
}
}

function post_release_deb(arch) {
return function post_release_linux_deb(done) {
if ((arch === 'linux32') || (arch === 'linux64')) {
var rename = require("gulp-rename");
const metadata = require('./package.json');
const renameFrom = path.join(appsDir, metadata.name + '_' + metadata.version + '_' + getLinuxPackageArch('.deb', arch) + '.deb');
const renameTo = path.join(appsDir, get_release_filename_base(arch) + '_' + metadata.version + '.deb');
// Rename .deb build to common naming
console.log(`Renaming .deb installer ${renameFrom} to ${renameTo}`);
return gulp.src(renameFrom)
.pipe(rename(renameTo))
.pipe(gulp.dest("."));
}

return done();
}
}

function release_rpm(arch) {
return function release_rpm_proc(done) {
if (!getArguments().installer) {
Expand All @@ -582,7 +604,7 @@ function release_rpm(arch) {
createDirIfNotExists(appsDir);

const options = {
name: metadata.name,
name: get_release_filename_base(arch), //metadata.name,
version: metadata.version.replace(NAME_REGEX, '_'), // RPM does not like release candidate versions
buildArch: getLinuxPackageArch('rpm', arch),
vendor: metadata.author,
Expand Down Expand Up @@ -656,7 +678,7 @@ function releaseLinux(bits) {
}

//gulp.task('release-linux32', gulp.series(releaseLinux(32), post_build('linux32', appsDir), release_deb('linux32')));
gulp.task('release-linux64', gulp.series(releaseLinux(64), post_build('linux64', appsDir), release_deb('linux64'), release_rpm('linux64')));
gulp.task('release-linux64', gulp.series(releaseLinux(64), post_build('linux64', appsDir), release_deb('linux64'), post_release_deb('linux64'), release_rpm('linux64')));

gulp.task('release', gulp.series('apps', 'clean-release', getPlatforms().map(function(v) { return 'release-' + v; })));

Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"devDependencies": {
"@quanle94/innosetup": "^6.0.2",
"gulp-debian": "^0.1.9",
"gulp-rename": "^2.0.0",
"nw-builder": "^3.5.7",
"rpm-builder": "^1.2.1",
"semver": "6.3.0"
Expand Down

0 comments on commit 8f12452

Please sign in to comment.