mirror of
https://github.com/lune-org/lune.git
synced 2025-04-15 09:23:49 +01:00
Fix gzip test file having os flag embedded in it
This commit is contained in:
parent
d11bb16e88
commit
ba390399d4
3 changed files with 27 additions and 7 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -163,9 +163,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-compression"
|
name = "async-compression"
|
||||||
version = "0.4.8"
|
version = "0.4.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "07dbbf24db18d609b1462965249abdf49129ccad073ec257da372adc83259c60"
|
checksum = "9c90a406b4495d129f00461241616194cb8a032c8d1c53c657f0961d5f8e0498"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"brotli",
|
"brotli",
|
||||||
"flate2",
|
"flate2",
|
||||||
|
@ -313,9 +313,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "brotli"
|
name = "brotli"
|
||||||
version = "4.0.0"
|
version = "6.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "125740193d7fee5cc63ab9e16c2fdc4e07c74ba755cc53b327d6ea029e9fc569"
|
checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloc-no-stdlib",
|
"alloc-no-stdlib",
|
||||||
"alloc-stdlib",
|
"alloc-stdlib",
|
||||||
|
@ -324,9 +324,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "brotli-decompressor"
|
name = "brotli-decompressor"
|
||||||
version = "3.0.0"
|
version = "4.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "65622a320492e09b5e0ac436b14c54ff68199bac392d0e89a6832c4518eea525"
|
checksum = "e6221fe77a248b9117d431ad93761222e1cf8ff282d9d1d5d9f53d6299a1cf76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloc-no-stdlib",
|
"alloc-no-stdlib",
|
||||||
"alloc-stdlib",
|
"alloc-stdlib",
|
||||||
|
|
|
@ -57,6 +57,21 @@ local function hexDiff(a: string, b: string): string
|
||||||
return table.concat(diff)
|
return table.concat(diff)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Make some processing functions for manipulating output of certain commands
|
||||||
|
|
||||||
|
local function processNoop(output: string): string
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
|
||||||
|
local function processGzipSetOsUnknown(output: string): string
|
||||||
|
-- This will set the os bits to be "unknown" so that the
|
||||||
|
-- output is deterministic and consistent with serde lib
|
||||||
|
-- https://www.rfc-editor.org/rfc/rfc1952#section-2.3.1
|
||||||
|
local buf = buffer.fromstring(output)
|
||||||
|
buffer.writeu8(buf, 9, 0xFF)
|
||||||
|
return buffer.tostring(buf)
|
||||||
|
end
|
||||||
|
|
||||||
-- Make sure we have all of the different compression tools installed,
|
-- Make sure we have all of the different compression tools installed,
|
||||||
-- note that on macos we do not use the system-installed compression
|
-- note that on macos we do not use the system-installed compression
|
||||||
-- tools, instead preferring to use homebrew-installed (gnu) ones
|
-- tools, instead preferring to use homebrew-installed (gnu) ones
|
||||||
|
@ -118,6 +133,7 @@ local OUTPUT_FILES = {
|
||||||
format = "brotli" :: serde.CompressDecompressFormat,
|
format = "brotli" :: serde.CompressDecompressFormat,
|
||||||
args = { "--best", "-w", "22", TEMP_FILE },
|
args = { "--best", "-w", "22", TEMP_FILE },
|
||||||
output = TEMP_FILE .. ".br",
|
output = TEMP_FILE .. ".br",
|
||||||
|
process = processNoop,
|
||||||
final = INPUT_FILE .. ".br",
|
final = INPUT_FILE .. ".br",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -125,13 +141,15 @@ local OUTPUT_FILES = {
|
||||||
format = "gzip" :: serde.CompressDecompressFormat,
|
format = "gzip" :: serde.CompressDecompressFormat,
|
||||||
args = { "--best", "--no-name", "--synchronous", TEMP_FILE },
|
args = { "--best", "--no-name", "--synchronous", TEMP_FILE },
|
||||||
output = TEMP_FILE .. ".gz",
|
output = TEMP_FILE .. ".gz",
|
||||||
|
process = processGzipSetOsUnknown,
|
||||||
final = INPUT_FILE .. ".gz",
|
final = INPUT_FILE .. ".gz",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command = BIN_LZ4,
|
command = BIN_LZ4,
|
||||||
format = "lz4" :: serde.CompressDecompressFormat,
|
format = "lz4" :: serde.CompressDecompressFormat,
|
||||||
args = { "--best", TEMP_FILE },
|
args = { "--best", TEMP_FILE, TEMP_FILE .. ".lz4" },
|
||||||
output = TEMP_FILE .. ".lz4",
|
output = TEMP_FILE .. ".lz4",
|
||||||
|
process = processNoop,
|
||||||
final = INPUT_FILE .. ".lz4",
|
final = INPUT_FILE .. ".lz4",
|
||||||
},
|
},
|
||||||
-- {
|
-- {
|
||||||
|
@ -139,6 +157,7 @@ local OUTPUT_FILES = {
|
||||||
-- format = "zlib" :: serde.CompressDecompressFormat,
|
-- format = "zlib" :: serde.CompressDecompressFormat,
|
||||||
-- args = { "-c", INPUT_FILE },
|
-- args = { "-c", INPUT_FILE },
|
||||||
-- output = TEMP_FILE .. ".z",
|
-- output = TEMP_FILE .. ".z",
|
||||||
|
-- process = processNoop,
|
||||||
-- final = INPUT_FILE .. ".z",
|
-- final = INPUT_FILE .. ".z",
|
||||||
-- },
|
-- },
|
||||||
}
|
}
|
||||||
|
@ -158,6 +177,7 @@ for _, spec in OUTPUT_FILES do
|
||||||
local compressedContents
|
local compressedContents
|
||||||
pcall(function()
|
pcall(function()
|
||||||
compressedContents = fs.readFile(spec.output)
|
compressedContents = fs.readFile(spec.output)
|
||||||
|
compressedContents = spec.process(compressedContents)
|
||||||
fs.removeFile(spec.output)
|
fs.removeFile(spec.output)
|
||||||
end)
|
end)
|
||||||
if not compressedContents then
|
if not compressedContents then
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue