server: adjust the uncompress size guessing

This commit is contained in:
liushuyu 2022-10-16 17:28:05 -06:00
parent 93a88521aa
commit d98c7c01e0
No known key found for this signature in database
GPG key ID: 23D1CE4534419437

View file

@ -143,7 +143,7 @@ async function execute() {
const targetMetadataFilePath = `${distDir}/${name}/${version}meta.7z`; const targetMetadataFilePath = `${distDir}/${name}/${version}meta.7z`;
if (await checkExists(targetMetadataFilePath)) { if (await checkExists(targetMetadataFilePath)) {
console.debug( console.debug(
`Metadata information already exists for ${name} ${version}, skipping.` `Metadata information already exists for ${name} ${version}, skipping.`,
); );
} else { } else {
console.info(`Building release information for ${name} ${version}.`); console.info(`Building release information for ${name} ${version}.`);
@ -157,7 +157,7 @@ async function execute() {
await Deno.copyFile("license.txt", `${workingDirectoryPath}/license.txt`); await Deno.copyFile("license.txt", `${workingDirectoryPath}/license.txt`);
await Deno.copyFile( await Deno.copyFile(
`scripts/${scriptName}.qs`, `scripts/${scriptName}.qs`,
`${workingDirectoryPath}/installscript.qs` `${workingDirectoryPath}/installscript.qs`,
); );
// Create 7zip archive // Create 7zip archive
@ -169,13 +169,13 @@ async function execute() {
const status = (await proc.status()).code; const status = (await proc.status()).code;
if (status !== 0) { if (status !== 0) {
throw new Error( throw new Error(
`Error when creating ${name} archive. Exited with ${status}.` `Error when creating ${name} archive. Exited with ${status}.`,
); );
} }
// Copy the metadata file into the target path. // Copy the metadata file into the target path.
console.debug( console.debug(
`Creating target metadata for ${name} at ${targetMetadataFilePath}` `Creating target metadata for ${name} at ${targetMetadataFilePath}`,
); );
await Deno.mkdir(`${distDir}/${name}`, { recursive: true }); await Deno.mkdir(`${distDir}/${name}`, { recursive: true });
await Deno.rename(`${tempDir}/${fileName}`, `${targetMetadataFilePath}`); await Deno.rename(`${tempDir}/${fileName}`, `${targetMetadataFilePath}`);
@ -187,7 +187,7 @@ async function execute() {
// Create metadata for the Update.xml // Create metadata for the Update.xml
const metaHash = await crypto.subtle.digest( const metaHash = await crypto.subtle.digest(
"SHA-1", "SHA-1",
await Deno.readFile(targetMetadataFilePath) await Deno.readFile(targetMetadataFilePath),
); );
const target = { const target = {
@ -199,7 +199,7 @@ async function execute() {
// (to make sure they have enough disk space). // (to make sure they have enough disk space).
// OS flag is useless - i.e the installer stubs it :P // OS flag is useless - i.e the installer stubs it :P
UpdateFile: { UpdateFile: {
"@UncompressedSize": releaseData.size * 2, "@UncompressedSize": Math.ceil(releaseData.size * 4.85),
"@CompressedSize": releaseData.size, "@CompressedSize": releaseData.size,
"@OS": "Any", "@OS": "Any",
}, },
@ -220,9 +220,9 @@ async function execute() {
await Promise.all( await Promise.all(
["mingw", "osx", "linux"].map((platform) => { ["mingw", "osx", "linux"].map((platform) => {
return Promise.all( return Promise.all(
targets.map((targetSource) => generate(targetSource, platform)) targets.map((targetSource) => generate(targetSource, platform)),
); );
}) }),
); );
if (updatesAvailable) { if (updatesAvailable) {
@ -233,7 +233,7 @@ async function execute() {
console.info("Wrote a new Updates.xml file -- updates available."); console.info("Wrote a new Updates.xml file -- updates available.");
} else { } else {
console.info( console.info(
"No Citra binary release updates are available for the Updates.xml -- nothing to do." "No Citra binary release updates are available for the Updates.xml -- nothing to do.",
); );
} }