From 2f2742e11b0a9ab4cae4dc2db796b58aa6fca22f Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 17 Jun 2016 09:20:44 -0400 Subject: [PATCH 1/2] Consistent build archives We do not release zip archives for any operating system except windows, and we do not release tar.gz archives for windows. For consistency and clarity sake, we'll explicitly list the architecture (x86) of the windows build as well. --- README.md | 2 +- tasks/build/archives.js | 10 +++------- tasks/build/download_node_builds.js | 2 +- tasks/config/platforms.js | 4 ++-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 502ee787ee090..365aa34e9aca9 100644 --- a/README.md +++ b/README.md @@ -46,4 +46,4 @@ For the daring, snapshot builds are available. These builds are created after ea | OSX | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-darwin-x64.tar.gz) | | Linux x64 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-linux-x64.tar.gz) [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-amd64.deb) [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-x86_64.rpm) | | Linux x86 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-linux-x86.tar.gz) [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-i386.deb) [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-i686.rpm) | -| Windows | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-windows.zip) | +| Windows | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-alpha5-SNAPSHOT-windows-x86.zip) | diff --git a/tasks/build/archives.js b/tasks/build/archives.js index 1b8f85ffd7f83..08a09b176b34f 100644 --- a/tasks/build/archives.js +++ b/tasks/build/archives.js @@ -1,6 +1,6 @@ module.exports = function createPackages(grunt) { let { config } = grunt; - let { resolve, relative } = require('path'); + let { resolve } = require('path'); let { execFile } = require('child_process'); let { all, fromNode } = require('bluebird'); @@ -13,14 +13,10 @@ module.exports = function createPackages(grunt) { let archives = async (platform) => { - // kibana.tar.gz - await exec('tar', ['-zchf', relative(buildPath, platform.tarPath), platform.buildName]); - - // kibana.zip if (/windows/.test(platform.name)) { - await exec('zip', ['-rq', '-ll', relative(buildPath, platform.zipPath), platform.buildName]); + await exec('zip', ['-rq', '-ll', platform.zipPath, platform.buildName]); } else { - await exec('zip', ['-rq', relative(buildPath, platform.zipPath), platform.buildName]); + await exec('tar', ['-zchf', platform.tarPath, platform.buildName]); } }; diff --git a/tasks/build/download_node_builds.js b/tasks/build/download_node_builds.js index f3938549aa4e1..cb74b55cec446 100644 --- a/tasks/build/download_node_builds.js +++ b/tasks/build/download_node_builds.js @@ -40,7 +40,7 @@ module.exports = function (grunt) { platform.downloadPromise = (async function () { grunt.file.mkdir(downloadDir); - if (platform.name === 'windows') { + if (platform.win) { await fromNode(cb => { resp .pipe(createWriteStream(resolve(downloadDir, 'node.exe'))) diff --git a/tasks/config/platforms.js b/tasks/config/platforms.js index aff25a263b026..ea80654215f51 100644 --- a/tasks/config/platforms.js +++ b/tasks/config/platforms.js @@ -10,9 +10,9 @@ module.exports = function (grunt) { 'darwin-x64', 'linux-x64', 'linux-x86', - 'windows' + 'windows-x86' ].map(function (name) { - let win = name === 'windows'; + let win = name === 'windows-x86'; let nodeUrl = win ? `${baseUri}/win-x86/node.exe` : `${baseUri}/node-v${nodeVersion}-${name}.tar.gz`; let nodeDir = resolve(rootPath, `.node_binaries/${nodeVersion}/${name}`); From c00e49dd062bc89796c241a56151d65e3f97b18b Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 17 Jun 2016 09:39:14 -0400 Subject: [PATCH 2/2] internal: Cleanup code in _build:archives task This just a code cleanup - there are no functional changes to this task. --- tasks/build/archives.js | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tasks/build/archives.js b/tasks/build/archives.js index 08a09b176b34f..9d6ff8163317f 100644 --- a/tasks/build/archives.js +++ b/tasks/build/archives.js @@ -1,34 +1,30 @@ -module.exports = function createPackages(grunt) { - let { config } = grunt; - let { resolve } = require('path'); - let { execFile } = require('child_process'); - let { all, fromNode } = require('bluebird'); +import { execFile } from 'child_process'; +import { all, fromNode } from 'bluebird'; +export default (grunt) => { + const { config, log } = grunt; + + const cwd = config.get('buildDir'); const targetDir = config.get('target'); - let buildPath = resolve(config.get('root'), 'build'); - let exec = async (cmd, args) => { - grunt.log.writeln(` > ${cmd} ${args.join(' ')}`); - await fromNode(cb => execFile(cmd, args, { cwd: buildPath }, cb)); - }; + async function exec(cmd, args) { + log.writeln(` > ${cmd} ${args.join(' ')}`); + await fromNode(cb => execFile(cmd, args, { cwd }, cb)); + }; - let archives = async (platform) => { - if (/windows/.test(platform.name)) { - await exec('zip', ['-rq', '-ll', platform.zipPath, platform.buildName]); + async function archives({ name, buildName, zipPath, tarPath }) { + if (/windows/.test(name)) { + await exec('zip', ['-rq', '-ll', zipPath, buildName]); } else { - await exec('tar', ['-zchf', platform.tarPath, platform.buildName]); + await exec('tar', ['-zchf', tarPath, buildName]); } }; grunt.registerTask('_build:archives', function () { + grunt.file.mkdir(targetDir); all( - grunt.config.get('platforms') - .map(async platform => { - - grunt.file.mkdir(targetDir); - await archives(platform); - }) + config.get('platforms').map(async platform => await archives(platform)) ) .nodeify(this.async());