allocates a unique directory in /tmp for building purposes

This commit is contained in:
Igor Klopov 2016-08-12 22:33:00 +03:00
parent 28abf5fa75
commit 85690b012d
5 changed files with 16 additions and 4 deletions

View File

@ -12,7 +12,7 @@ function isBrokenBuild (nodeVersion, target) {
return false;
}
export default async function main () {
export async function main () {
for (const nodeVersion in patchesJson) {
for (const target of targets) {
if (isBrokenBuild(nodeVersion, target)) continue;

View File

@ -4,9 +4,11 @@ import patchesJson from '../patches/patches.json';
import path from 'path';
import rimraf from 'rimraf-promise';
import { spawn } from './spawn.js';
import { tempPath } from './temp-path.js';
const windows = process.platform === 'win32';
const buildPath = path.resolve(__dirname, '../temp');
const buildPath = tempPath();
const nodePath = path.join(buildPath, 'node');
const patchesPath = path.resolve(__dirname, '../patches');

5
lib/temp-path.js Normal file
View File

@ -0,0 +1,5 @@
import uniqueTempDir from 'unique-temp-dir';
export function tempPath (...args) {
return uniqueTempDir(...args);
}

View File

@ -51,7 +51,8 @@
"mkdirp-promise": "2.0.0",
"request": "2.74.0",
"rimraf-promise": "2.0.0",
"semver": "5.3.0"
"semver": "5.3.0",
"unique-temp-dir": "1.0.0"
},
"devDependencies": {
"ava": "0.16.0",

View File

@ -1,6 +1,5 @@
import assert from 'assert';
import fs from 'fs';
import main from '../lib/build-and-upload.js';
import path from 'path';
import test from 'ava';
@ -20,6 +19,10 @@ const assets = [];
require('../package.json').version = '7.8.9';
require('../lib/temp-path.js').tempPath = function () {
return path.join(__dirname, '../temp');
};
require('../lib/spawn.js').spawn = function (cmd, args, opts) {
assert(opts);
assert(opts.cwd);
@ -67,6 +70,7 @@ require('../lib/github.js').uploadAsset = function (local, release, name) {
};
test(async () => {
const { main } = require('../lib/build-and-upload.js');
await main();
const mustBe = [
'git clone https://github.com/nodejs/node node {"stdio":"inherit","cwd":"../temp"}',