ws-arch2-unix: docs/guide/archive.md sections for cpio, ar / .deb, rpm, .Z / .lz4, ISO (inputs: tools/fixtures/docs_arch_unix.py); archive/cpio: variant option (default: the source's variant)
This commit is contained in:
1 parent
411261470a
commit
29afbfb165
3 files changed
+186
-9
No files matched your search
@@ -27,7 +27,8 @@ export type DecodeOptions = {
|
||||
verify: boolean?, -- crc archives: check the data sums (default true)
|
||||
}
|
||||
export type EncodeOptions = {
|
||||
format: string?, -- "newc" (default), "crc" or "odc" (any other value: newc)
|
||||
variant: ("newc" | "crc" | "odc")?, -- default: the source archive's (old binary: newc), else "newc"
|
||||
format: string?, -- "newc", "crc" or "odc" here too; any other value (the api's "cpio") means the variant default
|
||||
block: number?, -- pad to a multiple of this many bytes (default 512, as GNU cpio; 1 = none)
|
||||
}
|
||||
|
||||
@@ -152,9 +153,11 @@ function CpioFormat.encode(archive: any, opts: EncodeOptions?): (buffer?, Err.Er
|
||||
rdevminor = num(e.rdevminor),
|
||||
})
|
||||
end
|
||||
-- opts.format may also be the api's format name ("cpio"): the newc default then
|
||||
-- opts.format may also be the api's format name ("cpio"): the variant default then
|
||||
local o: any = opts or {}
|
||||
local variant = if o.format == "crc" or o.format == "odc" then o.format else "newc"
|
||||
local src = type(archive.meta) == "table" and type(archive.meta.source) == "table" and archive.meta.source
|
||||
local own = if src and src.format == "cpio" and (src.variant == "crc" or src.variant == "odc") then src.variant else "newc"
|
||||
local variant = o.variant or (if o.format == "crc" or o.format == "odc" or o.format == "newc" then o.format else own)
|
||||
return Cpio.write(list, { format = variant, block = o.block })
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user