Added canary. Refactored logging.
This commit is contained in:
parent
aa36fdb7ba
commit
10a2bebb1c
7 changed files with 77 additions and 31 deletions
3
repository/.gitignore
vendored
3
repository/.gitignore
vendored
|
@ -1,3 +1,6 @@
|
||||||
|
# Output directory
|
||||||
|
dist/
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
|
|
@ -3,15 +3,16 @@ const fs = require('fs-extra');
|
||||||
const exec = require('execa');
|
const exec = require('execa');
|
||||||
const sha1 = require('sha1-file');
|
const sha1 = require('sha1-file');
|
||||||
const req = require('request-promise');
|
const req = require('request-promise');
|
||||||
|
|
||||||
const zip_bin = require('7zip-bin').path7za;
|
const zip_bin = require('7zip-bin').path7za;
|
||||||
|
|
||||||
const destinationDirectory = "";
|
const logger = require('winston');
|
||||||
|
logger.exitOnError = false;
|
||||||
|
logger.add(logger.transports.File, { filename: './qt-installer-repository.log' });
|
||||||
|
|
||||||
|
const distDir = "./dist";
|
||||||
|
|
||||||
function mkdirIfNotExists(path) {
|
function mkdirIfNotExists(path) {
|
||||||
if (!fs.existsSync(path)){
|
if (!fs.existsSync(path)) { fs.mkdirSync(path); }
|
||||||
fs.mkdirSync(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getReleases(repo) {
|
async function getReleases(repo) {
|
||||||
|
@ -36,7 +37,7 @@ function getTopResultFor(jsonData, platform) {
|
||||||
"published_at": release.published_at.substr(0, 10),
|
"published_at": release.published_at.substr(0, 10),
|
||||||
"name": asset.name,
|
"name": asset.name,
|
||||||
"size": asset.size,
|
"size": asset.size,
|
||||||
"hash": release.target_commitish
|
"hash": release.tag_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,8 +46,8 @@ function getTopResultFor(jsonData, platform) {
|
||||||
return {"notFound": true};
|
return {"notFound": true};
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.removeSync("build");
|
fs.removeSync(distDir);
|
||||||
mkdirIfNotExists("build");
|
mkdirIfNotExists(distDir);
|
||||||
|
|
||||||
// The Qt Installer Framework is a pain to build or download.
|
// The Qt Installer Framework is a pain to build or download.
|
||||||
// Because all we need are a few 7-zipped + xml files, we might as well generate them for ourselves.
|
// Because all we need are a few 7-zipped + xml files, we might as well generate them for ourselves.
|
||||||
|
@ -64,12 +65,12 @@ let targets = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "org.citra.bleeding.%platform%",
|
"Name": "org.citra.canary.%platform%",
|
||||||
"DisplayName": "Citra Bleeding Edge",
|
"DisplayName": "Citra Canary",
|
||||||
"Description": "An in-development version of Citra that uses changes that are relatively untested.\n" +
|
"Description": "An in-development version of Citra that uses changes that are relatively untested.\n" +
|
||||||
"(%platform%, commit: %commithash%, release date: %releasedate%)",
|
"(%platform%, commit: %commithash%, release date: %releasedate%)",
|
||||||
"Repo": "citra-emu/citra-bleeding-edge",
|
"Repo": "citra-emu/citra-canary",
|
||||||
"ScriptName": "bleeding",
|
"ScriptName": "canary",
|
||||||
"Default": "script",
|
"Default": "script",
|
||||||
"Licenses": [
|
"Licenses": [
|
||||||
{"License": [{ _attr: { file: 'license.txt', name: "GNU General Public License v2.0" }}]}
|
{"License": [{ _attr: { file: 'license.txt', name: "GNU General Public License v2.0" }}]}
|
||||||
|
@ -79,13 +80,13 @@ let targets = [
|
||||||
|
|
||||||
async function execute() {
|
async function execute() {
|
||||||
// Get Git information
|
// Get Git information
|
||||||
console.log("Getting release info...");
|
logger.debug("Getting release info...");
|
||||||
for (result_key in targets) {
|
for (result_key in targets) {
|
||||||
const target = targets[result_key];
|
const target = targets[result_key];
|
||||||
target.Repo = await getReleases(target.Repo);
|
target.Repo = await getReleases(target.Repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Building metadata...");
|
logger.debug("Building metadata...");
|
||||||
// Updates.xml
|
// Updates.xml
|
||||||
let updates = [
|
let updates = [
|
||||||
{"ApplicationName": "{AnyApplication}"},
|
{"ApplicationName": "{AnyApplication}"},
|
||||||
|
@ -100,33 +101,36 @@ async function execute() {
|
||||||
const name = target_source.Name.replace("%platform%", platform);
|
const name = target_source.Name.replace("%platform%", platform);
|
||||||
|
|
||||||
if (release_data.notFound === true) {
|
if (release_data.notFound === true) {
|
||||||
console.warn("Unable to find a release for " + name);
|
logger.error(`Release information not found for ${name}!`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info(`Building release information for ${name}.`);
|
||||||
const scriptName = platform + "-" + target_source.ScriptName;
|
const scriptName = platform + "-" + target_source.ScriptName;
|
||||||
|
|
||||||
// Build 7zip file
|
// Build 7zip file
|
||||||
const version = release_data.release_id;
|
const version = release_data.release_id;
|
||||||
|
|
||||||
console.log("Building \"" + name + "\"...");
|
|
||||||
|
|
||||||
// Build directory structure
|
// Build directory structure
|
||||||
mkdirIfNotExists("build/" + name);
|
mkdirIfNotExists(`${distDir}/${name}`);
|
||||||
|
|
||||||
|
logger.debug(`Copying files for ${name}`);
|
||||||
|
|
||||||
// Copy license
|
// Copy license
|
||||||
fs.copySync("license.txt", "build/" + name + "/license.txt");
|
fs.copySync("license.txt", `${distDir}/${name}/license.txt`);
|
||||||
fs.copySync("scripts/" + scriptName + ".qs", "build/" + name + "/installscript.qs");
|
fs.copySync("scripts/" + scriptName + ".qs", `${distDir}/${name}/installscript.qs`);
|
||||||
|
|
||||||
// Create 7zip archive
|
// Create 7zip archive
|
||||||
fs.removeSync("meta.7z");
|
fs.removeSync("meta.7z");
|
||||||
exec.sync(zip_bin, ["a", "../meta.7z", name], {"cwd": "build"});
|
exec.sync(zip_bin, ["a", "../meta.7z", name], {"cwd": distDir});
|
||||||
fs.removeSync("build/" + name);
|
fs.removeSync(`${distDir}/${name}`);
|
||||||
const sha = sha1("meta.7z");
|
const sha = sha1("meta.7z");
|
||||||
|
|
||||||
// Setup final structure
|
// Setup final structure
|
||||||
mkdirIfNotExists("build/" + name);
|
mkdirIfNotExists(`${distDir}/${name}`);
|
||||||
fs.moveSync("meta.7z", "build/" + name + "/" + version + "meta.7z");
|
fs.moveSync("meta.7z", `${distDir}/${name}/${version}/meta.7z`);
|
||||||
|
|
||||||
|
logger.debug(`Creating target metadata for ${name}`);
|
||||||
|
|
||||||
// Create metadata
|
// Create metadata
|
||||||
let target = [];
|
let target = [];
|
||||||
|
@ -143,7 +147,7 @@ async function execute() {
|
||||||
|
|
||||||
target.push({"ReleaseDate": release_data.published_at});
|
target.push({"ReleaseDate": release_data.published_at});
|
||||||
target.push({"Description": target_source.Description.replace("%platform%", platform)
|
target.push({"Description": target_source.Description.replace("%platform%", platform)
|
||||||
.replace("%commithash%", release_data.hash.substr(0,7))
|
.replace("%commithash%", release_data.hash)
|
||||||
.replace("%releasedate%", release_data.published_at)});
|
.replace("%releasedate%", release_data.published_at)});
|
||||||
target.push({"Default": target_source.Default});
|
target.push({"Default": target_source.Default});
|
||||||
target.push({"Licenses": target_source.Licenses});
|
target.push({"Licenses": target_source.Licenses});
|
||||||
|
@ -157,15 +161,15 @@ async function execute() {
|
||||||
const updatesXml = xml({"Updates": updates}, {indent: " "});
|
const updatesXml = xml({"Updates": updates}, {indent: " "});
|
||||||
|
|
||||||
// Save Updates.xml
|
// Save Updates.xml
|
||||||
fs.writeFile("build/Updates.xml", updatesXml, function (err) {
|
fs.writeFile(`${distDir}/Updates.xml`, updatesXml, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
execute()
|
execute().then(function() {
|
||||||
.then(() => {})
|
logger.info(`Completed repository creation at ${distDir}.`);
|
||||||
.catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(err);
|
logger.error(err);
|
||||||
});
|
});
|
||||||
|
|
38
repository/package-lock.json
generated
38
repository/package-lock.json
generated
|
@ -37,6 +37,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
|
||||||
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ="
|
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ="
|
||||||
},
|
},
|
||||||
|
"async": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k="
|
||||||
|
},
|
||||||
"asynckit": {
|
"asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
@ -84,6 +89,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||||
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
|
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
|
||||||
},
|
},
|
||||||
|
"colors": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
|
||||||
|
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs="
|
||||||
|
},
|
||||||
"combined-stream": {
|
"combined-stream": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
|
||||||
|
@ -115,6 +125,11 @@
|
||||||
"boom": "2.10.1"
|
"boom": "2.10.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"cycle": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
|
||||||
|
"integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI="
|
||||||
|
},
|
||||||
"dashdash": {
|
"dashdash": {
|
||||||
"version": "1.14.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||||
|
@ -168,6 +183,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
|
||||||
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
|
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
|
||||||
},
|
},
|
||||||
|
"eyes": {
|
||||||
|
"version": "0.1.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
|
||||||
|
"integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A="
|
||||||
|
},
|
||||||
"forever-agent": {
|
"forever-agent": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||||
|
@ -509,6 +529,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"stack-trace": {
|
||||||
|
"version": "0.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||||
|
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
|
||||||
|
},
|
||||||
"stealthy-require": {
|
"stealthy-require": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
||||||
|
@ -581,6 +606,19 @@
|
||||||
"isexe": "2.0.0"
|
"isexe": "2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"winston": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/winston/-/winston-2.3.1.tgz",
|
||||||
|
"integrity": "sha1-C0hCDZeMAYBM8CMLZIhhWYIloRk=",
|
||||||
|
"requires": {
|
||||||
|
"async": "1.0.0",
|
||||||
|
"colors": "1.0.3",
|
||||||
|
"cycle": "1.0.3",
|
||||||
|
"eyes": "0.1.8",
|
||||||
|
"isstream": "0.1.2",
|
||||||
|
"stack-trace": "0.0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"xml": {
|
"xml": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"request": "^2.81.0",
|
"request": "^2.81.0",
|
||||||
"request-promise": "^4.2.1",
|
"request-promise": "^4.2.1",
|
||||||
"sha1-file": "^1.0.0",
|
"sha1-file": "^1.0.0",
|
||||||
|
"winston": "^2.3.1",
|
||||||
"xml": "^1.0.1"
|
"xml": "^1.0.1"
|
||||||
},
|
},
|
||||||
"preferGlobal": false,
|
"preferGlobal": false,
|
||||||
|
|
Loading…
Reference in a new issue