From a86546d3ce79be8b2a9ece38ba816ae9840573e5 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 22 Jul 2016 22:05:01 +0100 Subject: [PATCH] Rename archives to be lowercase with no spaces Also give them a root folder with the same name as the archive basename. --- README.md | 4 ++-- appveyor.yml | 12 +++++------ scripts/archive.js | 50 ++++++++++++++++++++++++++++------------------ scripts/helpers.js | 4 ++-- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 5d6c0231..63644b81 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ LOOT is intended to make using mods easier, and mod users should still possess a ## Snapshot Builds -In addition to the releases hosted on GitHub, snapshot build archives of LOOT and its API are available on [Bintray](https://bintray.com/wrinklyninja/loot). The archives are named in the following manner: +In addition to the releases hosted on GitHub, snapshot build archives of LOOT and its API are available on [Bintray](https://bintray.com/wrinklyninja/loot). The archives are named like so: ``` -LOOT --g-.7z +loot_--g_.7z ``` For example `LOOT v0.7.0-alpha-2-10-gf6d7e80-dev.7z` was built using the revision with shortened commit ID `f6d7e80`, which is `10` revisions after the revision tagged `v0.7.0-alpha-2`, and is on the `dev` branch. diff --git a/appveyor.yml b/appveyor.yml index 215f61a2..fb449d3c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,16 +37,16 @@ after_test: # AppVeyor checks out a specific commit, but that means the archive script # can't tell which branch it's on, so rename the 7z archives. - ps: $env:GIT_DESCRIBE = ((git describe --tags --long) | Out-String) -replace "`n|`r", "" - - ps: mv "build\LOOT $($env:GIT_DESCRIBE)-HEAD.7z" "build\LOOT $($env:GIT_DESCRIBE)-$($env:APPVEYOR_REPO_BRANCH).7z" - - ps: mv "build\LOOT API $($env:GIT_DESCRIBE)-HEAD.7z" "build\LOOT API $($env:GIT_DESCRIBE)-$($env:APPVEYOR_REPO_BRANCH).7z" - - ps: mv "build\Metadata Validator $($env:GIT_DESCRIBE)-HEAD.7z" "build\Metadata Validator $($env:GIT_DESCRIBE)-$($env:APPVEYOR_REPO_BRANCH).7z" + - ps: mv "build\loot_$($env:GIT_DESCRIBE)_HEAD.7z" "build\loot_$($env:GIT_DESCRIBE)_$($env:APPVEYOR_REPO_BRANCH).7z" + - ps: mv "build\loot-api_$($env:GIT_DESCRIBE)_HEAD.7z" "build\loot-api_$($env:GIT_DESCRIBE)_$($env:APPVEYOR_REPO_BRANCH).7z" + - ps: mv "build\metadata-validator_$($env:GIT_DESCRIBE)_HEAD.7z" "build\metadata-validator_$($env:GIT_DESCRIBE)_$($env:APPVEYOR_REPO_BRANCH).7z" artifacts: - - path: build\LOOT $(GIT_DESCRIBE)-$(APPVEYOR_REPO_BRANCH).7z + - path: build\loot_$(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH).7z name: LOOT - - path: build\LOOT API $(GIT_DESCRIBE)-$(APPVEYOR_REPO_BRANCH).7z + - path: build\loot-api_$(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH).7z name: API - - path: build\Metadata Validator $(GIT_DESCRIBE)-$(APPVEYOR_REPO_BRANCH).7z + - path: build\metadata-validator_$(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH).7z name: metadata-validator deploy: diff --git a/scripts/archive.js b/scripts/archive.js index 6237e3ca..0f61a40a 100644 --- a/scripts/archive.js +++ b/scripts/archive.js @@ -28,13 +28,17 @@ function getGitDescription() { 'HEAD', ])).slice(0, -1); - return `${describe}-${branch}`; + return `${describe}_${branch}`; } function compress(sourcePath, destPath) { // First remove any existing archive. fs.removeSync(destPath); + const filename = path.basename(destPath); + const rootFolder = path.basename(sourcePath); + const workingDirectory = path.dirname(sourcePath); + if (os.platform() === 'win32') { let sevenzipPath = path.join('C:\\', 'Program Files', '7-Zip', '7z.exe'); if (!helpers.fileExists(sevenzipPath)) { @@ -46,15 +50,15 @@ function compress(sourcePath, destPath) { return childProcess.execFileSync(sevenzipPath, [ 'a', '-r', - `${destPath}.7z`, - `.${path.sep}${path.join(sourcePath, '*')}`, - ]); + filename, + rootFolder, + ], { + cwd: workingDirectory, + }); } - const filename = path.join('..', path.basename(destPath)); - - return childProcess.execSync(`tar -cJf "${filename}.tar.xz" *`, { - cwd: sourcePath, + return childProcess.execSync(`tar -cJf ${filename} ${rootFolder}`, { + cwd: workingDirectory, }); } @@ -204,41 +208,49 @@ function createMetadataValidatorArchive(rootPath, binaryPath, tempPath, destPath function getFilenameSuffix(label, gitDescription) { if (label) { - return `${gitDescription} (${label})`; + return `${gitDescription}_${label}`; } return `${gitDescription}`; } +function getArchiveFileExtension() { + if (os.platform() === 'win32') { + return '.7z'; + } + + return '.tar.xz'; +} + let rootPath = '.'; if (process.argv.length > 2) { rootPath = process.argv[2]; } -const tempPath = path.join(rootPath, 'build', 'archive.tmp'); const gitDesc = getGitDescription(); +const fileExtension = getArchiveFileExtension(); vulcanize(rootPath); helpers.getAppReleasePaths(rootPath).forEach(releasePath => { - const filename = `LOOT ${getFilenameSuffix(releasePath.label, gitDesc)}`; + const filename = `loot_${getFilenameSuffix(releasePath.label, gitDesc)}`; createAppArchive(rootPath, releasePath.path, - tempPath, - path.join(rootPath, 'build', filename)); + path.join(rootPath, 'build', filename), + path.join(rootPath, 'build', filename + fileExtension)); }); helpers.getApiBinaryPaths(rootPath).forEach(binaryPath => { - const filename = `LOOT API ${getFilenameSuffix(binaryPath.label, gitDesc)}`; + const filename = `loot-api_${getFilenameSuffix(binaryPath.label, gitDesc)}`; createApiArchive(rootPath, binaryPath.path, - tempPath, - path.join(rootPath, 'build', filename)); + path.join(rootPath, 'build', filename), + path.join(rootPath, 'build', filename + fileExtension)); }); helpers.getMetadataValidatorBinaryPaths(rootPath).forEach(binaryPath => { - const filename = `Metadata Validator ${getFilenameSuffix(binaryPath.label, gitDesc)}`; + const filename = `metadata-validator_${getFilenameSuffix(binaryPath.label, gitDesc)}`; createMetadataValidatorArchive(rootPath, binaryPath.path, - tempPath, - path.join(rootPath, 'build', filename)); + path.join(rootPath, 'build', filename), + path.join(rootPath, 'build', filename + fileExtension)); }); diff --git a/scripts/helpers.js b/scripts/helpers.js index 010c2e5f..2a1bda5c 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -28,11 +28,11 @@ function getBinaryParentPaths(rootPath) { }, { path: path.join(rootPath, 'build', '32'), - label: '32 bit', + label: '32-bit', }, { path: path.join(rootPath, 'build', '64'), - label: '64 bit', + label: '64-bit', }, ];