Rename archives to be lowercase with no spaces

Also give them a root folder with the same name as the archive basename.
This commit is contained in:
Oliver Hamlet
2016-07-22 22:17:20 +01:00
parent e876adbcf1
commit a86546d3ce
4 changed files with 41 additions and 29 deletions
+2 -2
View File
@@ -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 <last tag>-<revisions since tag>-g<short revision ID>-<branch>.7z
loot_<last tag>-<revisions since tag>-g<short revision ID>_<branch>.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.
+6 -6
View File
@@ -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:
+31 -19
View File
@@ -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));
});
+2 -2
View File
@@ -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',
},
];