initial commit.
This commit is contained in:
commit
52197b9f2b
24 changed files with 2530 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
635
Cargo.lock
generated
Normal file
635
Cargo.lock
generated
Normal file
|
@ -0,0 +1,635 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ambient-authority"
|
||||||
|
version = "0.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base16ct"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cap-primitives"
|
||||||
|
version = "3.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff5bcbaf57897c8f14098cc9ad48a78052930a9948119eea01b80ca224070fa6"
|
||||||
|
dependencies = [
|
||||||
|
"ambient-authority",
|
||||||
|
"fs-set-times",
|
||||||
|
"io-extras",
|
||||||
|
"io-lifetimes",
|
||||||
|
"ipnet",
|
||||||
|
"maybe-owned",
|
||||||
|
"rustix",
|
||||||
|
"windows-sys",
|
||||||
|
"winx",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cap-std"
|
||||||
|
version = "3.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6cf1a22e6eab501e025a9953532b1e95efb8a18d6364bf8a4a7547b30c49186"
|
||||||
|
dependencies = [
|
||||||
|
"cap-primitives",
|
||||||
|
"io-extras",
|
||||||
|
"io-lifetimes",
|
||||||
|
"rustix",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cap-tempfile"
|
||||||
|
version = "3.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8563f37bd2d9ec79a08dc6b062b6733adc84f929d23f45388ba52025c7b32e26"
|
||||||
|
dependencies = [
|
||||||
|
"cap-std",
|
||||||
|
"rand",
|
||||||
|
"rustix",
|
||||||
|
"uuid",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer",
|
||||||
|
"crypto-common",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "equivalent"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fs-set-times"
|
||||||
|
version = "0.20.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "033b337d725b97690d86893f9de22b67b80dcc4e9ad815f348254c38119db8fb"
|
||||||
|
dependencies = [
|
||||||
|
"io-lifetimes",
|
||||||
|
"rustix",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.14.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ia"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"base16ct",
|
||||||
|
"cap-std",
|
||||||
|
"cap-tempfile",
|
||||||
|
"digest",
|
||||||
|
"serde",
|
||||||
|
"sha2",
|
||||||
|
"sha3",
|
||||||
|
"strum",
|
||||||
|
"thiserror",
|
||||||
|
"toml",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
|
||||||
|
dependencies = [
|
||||||
|
"equivalent",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "io-extras"
|
||||||
|
version = "0.18.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c9f046b9af244f13b3bd939f55d16830ac3a201e8a9ba9661bfcb03e2be72b9b"
|
||||||
|
dependencies = [
|
||||||
|
"io-lifetimes",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "io-lifetimes"
|
||||||
|
version = "2.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ipnet"
|
||||||
|
version = "2.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "keccak"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
|
||||||
|
dependencies = [
|
||||||
|
"cpufeatures",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.159"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.4.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maybe-owned"
|
||||||
|
version = "0.3.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.20.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1"
|
||||||
|
dependencies = [
|
||||||
|
"portable-atomic",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.86"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.37"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.38.37"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"errno",
|
||||||
|
"itoa",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys",
|
||||||
|
"once_cell",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustversion"
|
||||||
|
version = "1.0.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.210"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.210"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_spanned"
|
||||||
|
version = "0.6.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha2"
|
||||||
|
version = "0.10.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cpufeatures",
|
||||||
|
"digest",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha3"
|
||||||
|
version = "0.10.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
|
||||||
|
dependencies = [
|
||||||
|
"digest",
|
||||||
|
"keccak",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strum"
|
||||||
|
version = "0.26.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||||
|
dependencies = [
|
||||||
|
"strum_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strum_macros"
|
||||||
|
version = "0.26.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||||
|
dependencies = [
|
||||||
|
"heck",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"rustversion",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.79"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "1.0.64"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "1.0.64"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.8.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"toml_edit",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_datetime"
|
||||||
|
version = "0.6.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_edit"
|
||||||
|
version = "0.22.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uuid"
|
||||||
|
version = "1.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.52.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winnow"
|
||||||
|
version = "0.6.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winx"
|
||||||
|
version = "0.36.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.7.35"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"zerocopy-derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy-derive"
|
||||||
|
version = "0.7.35"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
5
Cargo.toml
Normal file
5
Cargo.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[workspace]
|
||||||
|
resolver = "2"
|
||||||
|
members = [ "./crates/*" ]
|
||||||
|
|
||||||
|
default-members = [ "./crates/ia" ]
|
661
LICENSE
Normal file
661
LICENSE
Normal file
|
@ -0,0 +1,661 @@
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
149
README.md
Normal file
149
README.md
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
# ia
|
||||||
|
|
||||||
|
while several existing package managers implement one, or some, of these attributes, none of them:
|
||||||
|
* avoid doing weird things to archive files for file formats;
|
||||||
|
* avoid introducing a second-tier meta-language such as "macros";
|
||||||
|
* ensure that packages are built reproducibly by default, only providing an escape hatch for impossible cases;
|
||||||
|
* ensure that package composition is constructed in a clean, restricted namespace;
|
||||||
|
* optionally create an immutable overlay using reflinks into the running system to provide an immutable base;
|
||||||
|
* exclusively utilise a capability-based operating model for the packaging pipeline to mitigate malicious build manifests;
|
||||||
|
* provide easily-indexable information on package contents for end-users;
|
||||||
|
* provide atomicity of *individual* package installation and uninstallation; **and**
|
||||||
|
* use a declarative composition pipeline and configuration using a simple, halting configuration language.
|
||||||
|
|
||||||
|
many wrappers for current package managers exist that attempt to create declarative behaviour or implement some of these traits, and in some cases processes or external tools are used by maintainers to perform the above. many of these tools simply spawn these underlying tools as subprocesses, cleaning up as best they can, and operating on a trust model with the underlying imperative package manager.
|
||||||
|
|
||||||
|
`ia` is an attempt at a fully declarative package manager as thoroughly as usably viable while attempting to learn from experiences packaging for (and using) various distributions throughout the years.
|
||||||
|
|
||||||
|
fundamentally, `ia` functions similar to the build process in almost any other package manager, utilising the [apk file format](https://wiki.alpinelinux.org/wiki/Apk_spec) for artifact outputs. optionally, `ia` can generate an ostree overlay containing the package composition pipeline's outputs. this can be overlayed onto the root filesystem to provide read-only access to the package's files.
|
||||||
|
|
||||||
|
## current status
|
||||||
|
|
||||||
|
`ia` usage is currently represented by its [test suite](crates/ia/src/tests).
|
||||||
|
|
||||||
|
## install
|
||||||
|
|
||||||
|
* `ia-cli` binary: `cargo build --bin ia-cli`
|
||||||
|
* this is the `ia` executable which provides the client and server modules.
|
||||||
|
* `ia` library: `cargo build --lib ia`
|
||||||
|
* this is a rust library that can be used by others.
|
||||||
|
|
||||||
|
## configuration
|
||||||
|
|
||||||
|
* `ia` configuration file manpage: `man 5 ia.toml`
|
||||||
|
* [example configuration file](./crates/tests/fixtures/package/manifest.toml)
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
* `ia` help: `ia --help`
|
||||||
|
* `ia` cli manpage: `man 8 ia`
|
||||||
|
* `ia` [library development docs](https://docs.rs/git.mischief.expert/arcayr/ia)
|
||||||
|
|
||||||
|
## packaging for ia
|
||||||
|
|
||||||
|
* `ia build` help: `ia build --help`
|
||||||
|
* `ia build` manpage: `man 8 ia-build`
|
||||||
|
* [example manifest](./crates/tests/fixtures/package/manifest.toml)
|
||||||
|
* `ia` [package manifest source](./crates/ia/src/manifest)
|
||||||
|
|
||||||
|
## repository hosting for ia
|
||||||
|
|
||||||
|
* `ia server` help: `ia server --help`
|
||||||
|
* `ia server` manpage: `man 8 ia-server`
|
||||||
|
|
||||||
|
## why the name?
|
||||||
|
|
||||||
|
short, it doesn't mean anything. it was called `pk` before this, which meant 'package keeper'. this was obviously even less unimaginative and very taken.
|
||||||
|
|
||||||
|
if you really need a longer name to attach to it, i guess 'installation assistant' works just fine.
|
||||||
|
|
||||||
|
## something's wrong
|
||||||
|
|
||||||
|
🚧
|
||||||
|
|
||||||
|
## this is bad / this makes me angry / i don't like this
|
||||||
|
|
||||||
|
🙂
|
||||||
|
|
||||||
|
## what's the todo?
|
||||||
|
|
||||||
|
`ia` is considered pre-pre alpha.
|
||||||
|
|
||||||
|
### pre-alpha
|
||||||
|
- **package building pipeline unsandboxed**
|
||||||
|
- ~~full manifest parsing~~
|
||||||
|
- ~~source file hash verification~~
|
||||||
|
- ~~implementation of fetchers for local files~~
|
||||||
|
- basic cli
|
||||||
|
- most commands will be behind "unsafe" flags, as their behaviour will be kept to bypass
|
||||||
|
cases where the standard method simply cannot work
|
||||||
|
- package building pipeline via `exec` escape hatch
|
||||||
|
|
||||||
|
### alpha
|
||||||
|
- **package building pipeline sandboxed**
|
||||||
|
build pipeline utilises `cap_std`, ia will utilise the repository server to obtain build dependencies
|
||||||
|
- implementation of fetchers for `http`/`https`, `git`, and `ftp`.
|
||||||
|
- `build_dependencies` support
|
||||||
|
- package lockfile generation
|
||||||
|
- cli configuration file
|
||||||
|
- repository server
|
||||||
|
- package definition import from:
|
||||||
|
- apk: apkbuild
|
||||||
|
- implementation of specific configuration / pre-build handlers
|
||||||
|
- autoconf
|
||||||
|
- implementation of specific build handlers
|
||||||
|
- cmake
|
||||||
|
- go
|
||||||
|
- meson
|
||||||
|
- cpan
|
||||||
|
- python: setup.py
|
||||||
|
- implementation of specific test handlers
|
||||||
|
- cmake
|
||||||
|
- go
|
||||||
|
- cargo
|
||||||
|
- meson
|
||||||
|
|
||||||
|
### beta
|
||||||
|
- ostree overlays from ia transactions
|
||||||
|
- implementation of further download handlers
|
||||||
|
- hg
|
||||||
|
- bzr
|
||||||
|
- implementation of further build handlers
|
||||||
|
- cargo
|
||||||
|
- python (distutils)
|
||||||
|
- package definition import from:
|
||||||
|
- apk: apkbuild
|
||||||
|
- pacman: pkgbuild
|
||||||
|
- rpm: specfile
|
||||||
|
- `exec` escape hatch moved to require unsafe flag
|
||||||
|
- 100% test coverage
|
||||||
|
- some tests will need to be executed separately due to their interaction
|
||||||
|
with state outside of the library (e.g., source fetching).
|
||||||
|
|
||||||
|
### 1.0+
|
||||||
|
* package definition import from:
|
||||||
|
* deb: debian control
|
||||||
|
* library package definition import from:
|
||||||
|
* javascript: npm
|
||||||
|
* ruby: rubygems (via git)
|
||||||
|
* python: pypi
|
||||||
|
* rust: crates.io
|
||||||
|
* go: pkg.dev
|
||||||
|
* packagekit integration
|
||||||
|
|
||||||
|
## references and inspirations
|
||||||
|
|
||||||
|
* [apk](https://wiki.alpinelinux.org/wiki/Alpine_Package_Keeper)
|
||||||
|
* [the apk file specification](https://wiki.alpinelinux.org/wiki/Apk_spec)
|
||||||
|
* [ostree](https://ostreedev.github.io/)
|
||||||
|
* [rpm-ostree](https://coreos.github.io/rpm-ostree)
|
||||||
|
* [overlayfs](https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt)
|
||||||
|
* [composefs](https://github.com/containers/composefs)
|
||||||
|
* [bootc](https://containers.github.io/bootc)
|
||||||
|
* [nix](https://nixos.org/)
|
||||||
|
|
||||||
|
## license
|
||||||
|
|
||||||
|
`ia` is released under the AGPLv3 license, the text of which you can find [in the LICENSE file](./LICENSE).
|
||||||
|
|
||||||
|
`ia` will not be dual licensed, and is provided as-is without warranty.
|
16
crates/ia/Cargo.toml
Normal file
16
crates/ia/Cargo.toml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[package]
|
||||||
|
name = "ia"
|
||||||
|
version = "0.0.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
base16ct = { version = "0.2.0", features = ["alloc", "std"] }
|
||||||
|
cap-std = "3.3.0"
|
||||||
|
cap-tempfile = "3.3.0"
|
||||||
|
digest = { version = "0.10.7", features = ["alloc", "std"] }
|
||||||
|
serde = { version = "1.0.210", features = ["derive"] }
|
||||||
|
sha2 = "0.10.8"
|
||||||
|
sha3 = "0.10.8"
|
||||||
|
strum = { version = "0.26.3", features = ["derive"] }
|
||||||
|
thiserror = "1.0.64"
|
||||||
|
toml = "0.8.19"
|
28
crates/ia/fixtures/package/manifest.toml
Normal file
28
crates/ia/fixtures/package/manifest.toml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
name = "test-package"
|
||||||
|
description = "test package"
|
||||||
|
version = "1.2.3-git"
|
||||||
|
revision = 42
|
||||||
|
license = "gpl-3.0-only"
|
||||||
|
architectures = [ "ppc64" ]
|
||||||
|
dependencies = [ ]
|
||||||
|
build_dependencies = [ ]
|
||||||
|
provides = [ "hello-world" ]
|
||||||
|
groups = [ "examples" ]
|
||||||
|
|
||||||
|
[[sources]]
|
||||||
|
name = "test-source.txt"
|
||||||
|
url = "file:./source-test.txt"
|
||||||
|
hash = "sha2:4cbf04bd094e2bd2eda36cf3561bfa61cb1a83c29427f0dd01d8b071cd8d002f3f46aa1c8b5eef25e7743f629ad4976f59bf7ee07d345b9bdb89c85703e581c7"
|
||||||
|
|
||||||
|
[configure]
|
||||||
|
exec = """
|
||||||
|
"""
|
||||||
|
|
||||||
|
[build]
|
||||||
|
exec = """
|
||||||
|
make
|
||||||
|
"""
|
||||||
|
|
||||||
|
[test]
|
||||||
|
exec = """
|
||||||
|
"""
|
1
crates/ia/fixtures/package/test-source.txt
Normal file
1
crates/ia/fixtures/package/test-source.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
test
|
59
crates/ia/src/error.rs
Normal file
59
crates/ia/src/error.rs
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
//! error types used within ia
|
||||||
|
|
||||||
|
use thiserror::Error;
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
pub enum Error<ErrorSource> {
|
||||||
|
Manifest(ErrorSource),
|
||||||
|
Hash(ErrorSource),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
pub enum Hash {
|
||||||
|
#[error("invalid hash algorithm: {0}")]
|
||||||
|
InvalidAlgorithm(String),
|
||||||
|
#[error("invalid hash string: {0}")]
|
||||||
|
InvalidHashString(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
pub enum Source {
|
||||||
|
#[error("bad source url: {0}")]
|
||||||
|
BadUrl(String),
|
||||||
|
#[error("hash error: {0}")]
|
||||||
|
Hash(Hash),
|
||||||
|
#[error("no fetcher attached to source: {0}")]
|
||||||
|
NoFetcher(String),
|
||||||
|
#[error("fetcher error: {0}")]
|
||||||
|
Fetcher(Fetcher),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
pub enum Manifest {
|
||||||
|
#[error("parse error")]
|
||||||
|
Parse,
|
||||||
|
#[error("filesystem error: {0}")]
|
||||||
|
FS(FS),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
pub enum FS {
|
||||||
|
#[error("could not create file")]
|
||||||
|
Create,
|
||||||
|
#[error("could not read file")]
|
||||||
|
Read,
|
||||||
|
#[error("could not write file")]
|
||||||
|
Write,
|
||||||
|
#[error("could not create directory")]
|
||||||
|
CreateDir,
|
||||||
|
#[error("could not read file: {0}")]
|
||||||
|
ReadNamed(String),
|
||||||
|
#[error("could not read file: {0}")]
|
||||||
|
WriteNamed(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum Fetcher {
|
||||||
|
#[error("filesystem error: {0}")]
|
||||||
|
FS(FS),
|
||||||
|
}
|
177
crates/ia/src/fs.rs
Normal file
177
crates/ia/src/fs.rs
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
//! abstractions over the filesystem, predominantly over the capability-based
|
||||||
|
//! filesystem offered by [cap_std].
|
||||||
|
use std::{
|
||||||
|
io::{BufReader, BufWriter, Read, Seek, Write},
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::error;
|
||||||
|
use cap_std::fs;
|
||||||
|
use cap_tempfile;
|
||||||
|
|
||||||
|
pub enum Permissions {
|
||||||
|
Read,
|
||||||
|
Write,
|
||||||
|
WriteCreate,
|
||||||
|
ReadWrite,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Permissions> for fs::OpenOptions {
|
||||||
|
fn from(value: Permissions) -> Self {
|
||||||
|
match value {
|
||||||
|
Permissions::Read => fs::OpenOptions::new().read(true).to_owned(),
|
||||||
|
Permissions::Write => fs::OpenOptions::new().write(true).to_owned(),
|
||||||
|
Permissions::WriteCreate => fs::OpenOptions::new()
|
||||||
|
.read(true)
|
||||||
|
.write(true)
|
||||||
|
.create(true)
|
||||||
|
.to_owned(),
|
||||||
|
Permissions::ReadWrite => fs::OpenOptions::new().read(true).write(true).to_owned(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// a representation of an entry in a directory on the filesystem.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub struct DirEntry(fs::DirEntry);
|
||||||
|
|
||||||
|
impl DirEntry {}
|
||||||
|
|
||||||
|
/// a representation of an open directory on the filesystem.
|
||||||
|
pub struct Dir(fs::Dir);
|
||||||
|
|
||||||
|
impl Dir {
|
||||||
|
/// constructs a new Dir by opening `path` as a directory
|
||||||
|
/// using the process's ambient authority.
|
||||||
|
pub fn open_ambient(path: PathBuf) -> Result<Self, error::FS> {
|
||||||
|
fs::Dir::open_ambient_dir(&path, cap_std::ambient_authority())
|
||||||
|
.map(Dir)
|
||||||
|
.map_err(|_| error::FS::ReadNamed(path.to_string_lossy().to_string()))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// attempts to return a list of entries within the directory.
|
||||||
|
/// any entries that cannot be properly parsed into a path are ignored.
|
||||||
|
pub fn entries(&self) -> Result<Vec<DirEntry>, error::FS> {
|
||||||
|
Ok(self
|
||||||
|
.0
|
||||||
|
.entries()
|
||||||
|
.map_err(|_| error::FS::Read)?
|
||||||
|
.filter_map(|de| de.ok())
|
||||||
|
.map(DirEntry)
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// attempts to open a file by name in the directory, with the provided [Permissions].
|
||||||
|
pub fn open_file<P: AsRef<Path>>(
|
||||||
|
&self,
|
||||||
|
path: P,
|
||||||
|
permissions: Permissions,
|
||||||
|
) -> Result<File, error::FS> {
|
||||||
|
self.0
|
||||||
|
.open_with(&path, &permissions.into())
|
||||||
|
.map(File)
|
||||||
|
.map_err(|_| error::FS::ReadNamed(path.as_ref().to_string_lossy().to_string()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
/// a representation of an open file on the filesystem.
|
||||||
|
pub struct File(fs::File);
|
||||||
|
|
||||||
|
impl File {
|
||||||
|
/// constructs a new [File] by opening the `path` as a file
|
||||||
|
/// using the process's ambient authority.
|
||||||
|
/// this method should be used sparingly, and never directly
|
||||||
|
/// take user input.
|
||||||
|
pub fn open_ambient(path: &PathBuf) -> Result<Self, error::FS> {
|
||||||
|
fs::File::open_ambient(path, cap_std::ambient_authority())
|
||||||
|
.map(File)
|
||||||
|
.map_err(|_| error::FS::ReadNamed(path.to_string_lossy().to_string()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read(&mut self, dst_bytes: &mut [u8]) -> Result<usize, error::FS> {
|
||||||
|
self.0.read(dst_bytes).map_err(|_| error::FS::Read)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// writes a slice of bytes to the beginning of a file.
|
||||||
|
pub fn write(&mut self, bytes: &[u8]) -> Result<usize, error::FS> {
|
||||||
|
self.0
|
||||||
|
.seek(std::io::SeekFrom::Start(0))
|
||||||
|
.map_err(|_| error::FS::Read)?;
|
||||||
|
|
||||||
|
self.0.write(bytes).map_err(|_| error::FS::Write)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// converts self into a [BufReader].
|
||||||
|
pub fn into_reader(self) -> Result<BufReader<File>, error::FS> {
|
||||||
|
Ok(BufReader::new(self))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// converts self into a [BufWriter].
|
||||||
|
pub fn into_writer(self) -> Result<BufWriter<File>, error::FS> {
|
||||||
|
Ok(BufWriter::new(self))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// copies the contents of self into `dst`.
|
||||||
|
pub fn copy_to(&mut self, dst: &mut dyn std::io::Write) -> Result<usize, error::FS> {
|
||||||
|
std::io::copy(self, dst)
|
||||||
|
.map_err(|_| error::FS::Write)
|
||||||
|
.and_then(|i| {
|
||||||
|
dst.flush()
|
||||||
|
.map(|_| i as usize)
|
||||||
|
.map_err(|_| error::FS::Write)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Read for File {
|
||||||
|
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||||
|
self.0.read(buf)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Write for File {
|
||||||
|
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||||
|
self.0.write(buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> std::io::Result<()> {
|
||||||
|
self.0.flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// a representation of an open temporary directory on the filesystem.
|
||||||
|
/// this directory will be deleted from the filesystem when it goes out of
|
||||||
|
/// scope.
|
||||||
|
pub struct TempDir(cap_tempfile::TempDir);
|
||||||
|
|
||||||
|
impl TempDir {
|
||||||
|
/// constructs a new [TempDir] using the ambient authority.
|
||||||
|
pub fn new() -> Result<Self, error::FS> {
|
||||||
|
cap_tempfile::TempDir::new(cap_std::ambient_authority())
|
||||||
|
.map(TempDir)
|
||||||
|
.map_err(|_| error::FS::CreateDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// constructs a new [TempDir] within the provided [Dir].
|
||||||
|
pub fn new_in(dir: &Dir) -> Result<Self, error::FS> {
|
||||||
|
cap_tempfile::TempDir::new_in(&dir.0)
|
||||||
|
.map(TempDir)
|
||||||
|
.map_err(|_| error::FS::CreateDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn open_file<P: AsRef<Path>>(
|
||||||
|
&self,
|
||||||
|
path: P,
|
||||||
|
permissions: Permissions,
|
||||||
|
) -> Result<File, error::FS> {
|
||||||
|
self.0
|
||||||
|
.open_with(&path, &permissions.into())
|
||||||
|
.map(File)
|
||||||
|
.map_err(|_| error::FS::ReadNamed(path.as_ref().to_string_lossy().to_string()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn into_dir(self) -> Result<Dir, error::FS> {
|
||||||
|
self.0.into_dir().map(Dir).map_err(|_| error::FS::Read)
|
||||||
|
}
|
||||||
|
}
|
135
crates/ia/src/hashstring.rs
Normal file
135
crates/ia/src/hashstring.rs
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
//! creation and manipulation of ia hashstrings.
|
||||||
|
use crate::error;
|
||||||
|
use digest::DynDigest;
|
||||||
|
use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
use std::{fmt::Display, io::Write, str::FromStr};
|
||||||
|
|
||||||
|
/// a hash algorithm supported by ia.
|
||||||
|
#[derive(
|
||||||
|
strum::Display, strum::EnumString, Clone, Debug, Deserialize, Serialize, PartialEq, Eq,
|
||||||
|
)]
|
||||||
|
pub enum HashAlgorithm {
|
||||||
|
#[strum(to_string = "sha2", ascii_case_insensitive)]
|
||||||
|
Sha2,
|
||||||
|
#[strum(to_string = "sha3", ascii_case_insensitive)]
|
||||||
|
Sha3,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// a collection of bytes representing the generated hash.
|
||||||
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
|
pub struct HashValue(Box<[u8]>);
|
||||||
|
|
||||||
|
impl HashValue {
|
||||||
|
pub fn new<T: AsRef<[u8]>>(val: T) -> Self {
|
||||||
|
Self(val.as_ref().to_owned().into_boxed_slice())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for HashValue {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match String::from_utf8(self.0.to_vec()) {
|
||||||
|
Ok(s) => write!(f, "{}", s),
|
||||||
|
Err(_) => write!(f, "{}", base16ct::lower::encode_string(&self.0)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// an individual hashstring for a package, input, or output.
|
||||||
|
/// hashstrings are expressed as a string in the format `alg:hash`.
|
||||||
|
/// hashes of package inputs are used to verify their authenticity.
|
||||||
|
/// hashes of the package outputs allow the content-addressed storage model to work.
|
||||||
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
|
pub struct Hashstring {
|
||||||
|
pub algorithm: HashAlgorithm,
|
||||||
|
pub value: HashValue,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for Hashstring {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "{}:{}", self.algorithm, self.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Hasher: DynDigest + Write {}
|
||||||
|
|
||||||
|
impl Hasher for sha2::Sha512 {}
|
||||||
|
|
||||||
|
impl Hasher for sha3::Sha3_512 {}
|
||||||
|
|
||||||
|
impl Hashstring {
|
||||||
|
pub fn hasher_for(alg: &HashAlgorithm) -> Result<Box<dyn Hasher>, error::Hash> {
|
||||||
|
match alg {
|
||||||
|
HashAlgorithm::Sha2 => Ok(Box::new(sha2::Sha512::default())),
|
||||||
|
HashAlgorithm::Sha3 => Ok(Box::new(sha3::Sha3_512::default())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// creates a new hash with the provided algorithm and value.
|
||||||
|
pub fn new(alg: HashAlgorithm, val: String) -> Result<Self, error::Hash> {
|
||||||
|
Ok(Self {
|
||||||
|
algorithm: alg,
|
||||||
|
value: HashValue::new(val.as_bytes()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Hashstring {
|
||||||
|
type Err = error::Hash;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
s.to_lowercase()
|
||||||
|
.split_once(':')
|
||||||
|
.ok_or(error::Hash::InvalidHashString(s.to_owned()))
|
||||||
|
.map(|(alg, val)| {
|
||||||
|
HashAlgorithm::from_str(alg)
|
||||||
|
.map_err(|_| error::Hash::InvalidAlgorithm(alg.to_owned()))
|
||||||
|
.map(|alg| (alg, val))
|
||||||
|
})?
|
||||||
|
.map(|(alg, val)| Hashstring::new(alg, val.to_owned()))?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HashVisitor;
|
||||||
|
|
||||||
|
impl<'de> Visitor<'de> for HashVisitor {
|
||||||
|
type Value = Hashstring;
|
||||||
|
|
||||||
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
formatter.write_str("a hash string (`algorithm:value`)")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: serde::de::Error,
|
||||||
|
{
|
||||||
|
Hashstring::from_str(v).map_err(|_| E::invalid_type(serde::de::Unexpected::Str(v), &self))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: serde::de::Error,
|
||||||
|
{
|
||||||
|
// all hashes are represented in lowercase.
|
||||||
|
// this generally handles unicode, but
|
||||||
|
// hashes currently used by ia use ascii only.
|
||||||
|
self.visit_str(&v.to_lowercase())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de> Deserialize<'de> for Hashstring {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
deserializer.deserialize_string(HashVisitor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Serialize for Hashstring {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
serializer.serialize_str(self.to_string().as_str())
|
||||||
|
}
|
||||||
|
}
|
92
crates/ia/src/lib.rs
Normal file
92
crates/ia/src/lib.rs
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
|
||||||
|
pub mod error;
|
||||||
|
pub mod fs;
|
||||||
|
|
||||||
|
mod license;
|
||||||
|
pub use license::License;
|
||||||
|
|
||||||
|
pub mod version;
|
||||||
|
pub use version::Version;
|
||||||
|
|
||||||
|
pub mod manifest;
|
||||||
|
pub use manifest::Manifest;
|
||||||
|
|
||||||
|
pub mod source;
|
||||||
|
pub use source::Source;
|
||||||
|
|
||||||
|
pub mod hashstring;
|
||||||
|
pub use hashstring::Hashstring;
|
||||||
|
|
||||||
|
/// a package name, usually verbatim from upstream.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Name(String);
|
||||||
|
|
||||||
|
impl Display for Name {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"{}",
|
||||||
|
// this isn't a safety net but to make sure nobody does stupid
|
||||||
|
// things with package names.
|
||||||
|
// if someone intentionally shoots themself in the foot by
|
||||||
|
// circumventing these replacements they will only injure their own
|
||||||
|
// filesystem.
|
||||||
|
self.0
|
||||||
|
.to_ascii_lowercase()
|
||||||
|
.replace("_", "-")
|
||||||
|
.replace(" ", "-")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Name {
|
||||||
|
type Err = error::Manifest;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
Ok(Self(
|
||||||
|
s.replace("_", "-").replace(" ", "-").to_ascii_lowercase(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// a package description, usually verbatim from upstream.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Description(String);
|
||||||
|
|
||||||
|
impl Display for Description {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "{}", self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Description {
|
||||||
|
type Err = error::Manifest;
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
Ok(Self(s.to_string()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// an architecture supported by an ia package.
|
||||||
|
#[derive(strum::Display, Debug, Deserialize, Serialize)]
|
||||||
|
pub enum Architecture {
|
||||||
|
#[strum(to_string = "all")]
|
||||||
|
#[serde(rename = "all")]
|
||||||
|
All,
|
||||||
|
#[strum(to_string = "aarch64")]
|
||||||
|
#[serde(rename = "aarch64")]
|
||||||
|
Aarch64,
|
||||||
|
#[strum(to_string = "amd64")]
|
||||||
|
#[serde(rename = "amd64")]
|
||||||
|
Amd64,
|
||||||
|
#[strum(to_string = "riscv")]
|
||||||
|
#[serde(rename = "riscv")]
|
||||||
|
RiscV,
|
||||||
|
#[strum(to_string = "other:{0}")]
|
||||||
|
Other(String),
|
||||||
|
}
|
42
crates/ia/src/license.rs
Normal file
42
crates/ia/src/license.rs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
// a license supported by ia packages. these are represented
|
||||||
|
// as a spdx license expression.
|
||||||
|
// "other" is included, but its usage in application code is
|
||||||
|
// discouraged.
|
||||||
|
#[derive(strum::Display, Debug, Deserialize, Serialize)]
|
||||||
|
pub enum License {
|
||||||
|
#[strum(to_string = "gpl-3.0-only")]
|
||||||
|
#[serde(rename = "gpl-3.0-only")]
|
||||||
|
Gpl3Only,
|
||||||
|
#[strum(to_string = "gpl-3.0-or-later")]
|
||||||
|
#[serde(rename = "gpl-3.0-or-later")]
|
||||||
|
Gpl3OrLater,
|
||||||
|
#[strum(to_string = "gpl-2.0-only")]
|
||||||
|
#[serde(rename = "gpl-2.0-only")]
|
||||||
|
Gpl2Only,
|
||||||
|
#[strum(to_string = "gpl-2.0-or-later")]
|
||||||
|
#[serde(rename = "gpl-2.0-or-later")]
|
||||||
|
Gpl2OrLater,
|
||||||
|
#[strum(to_string = "lgpl-3.0-only")]
|
||||||
|
#[serde(rename = "lgpl-3.0-only")]
|
||||||
|
Lgpl3Only,
|
||||||
|
#[strum(to_string = "lgpl-3.0-or-later")]
|
||||||
|
#[serde(rename = "lgpl-3.0-or-later")]
|
||||||
|
Lgpl3OrLater,
|
||||||
|
#[strum(to_string = "bsd-2-clause")]
|
||||||
|
#[serde(rename = "bsd-2-clause")]
|
||||||
|
Bsd2,
|
||||||
|
#[strum(to_string = "bsd-3-clause")]
|
||||||
|
#[serde(rename = "bsd-3-clause")]
|
||||||
|
Bsd3,
|
||||||
|
#[strum(to_string = "mit")]
|
||||||
|
#[serde(rename = "mit")]
|
||||||
|
Mit,
|
||||||
|
#[strum(to_string = "mpl-2.0")]
|
||||||
|
#[serde(rename = "mpl-2.0")]
|
||||||
|
Mozilla2,
|
||||||
|
#[strum(to_string = "other:{0}")]
|
||||||
|
#[serde(rename = "other:{0}")]
|
||||||
|
Other(String),
|
||||||
|
}
|
79
crates/ia/src/manifest/dependency.rs
Normal file
79
crates/ia/src/manifest/dependency.rs
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
|
use serde::{de::Visitor, Deserialize, Deserializer, Serialize};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
version::{Version, VersionOper},
|
||||||
|
Name,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// a dependency entry from a manifest.
|
||||||
|
/// these may be represented in two variants:
|
||||||
|
/// a version-free name, which will pull the latest version of the package as
|
||||||
|
/// a dependency, or a versioned name.
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct Dependency(Name, Option<(VersionOper, Version)>);
|
||||||
|
|
||||||
|
impl Dependency {
|
||||||
|
fn new(name: Name, opped_version: Option<(VersionOper, Version)>) -> Self {
|
||||||
|
Self(name, opped_version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for Dependency {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match &self.1 {
|
||||||
|
None => write!(f, "{}", self.0 .0),
|
||||||
|
Some((op, version)) => write!(f, "{}{}{}", self.0 .0, op, version),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DependencyVisitor;
|
||||||
|
|
||||||
|
impl<'de> Visitor<'de> for DependencyVisitor {
|
||||||
|
type Value = Dependency;
|
||||||
|
|
||||||
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
formatter.write_str("a version string (e.g., `package_name=1.0`)")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: serde::de::Error,
|
||||||
|
{
|
||||||
|
["<=", ">=", "=", "<", ">"]
|
||||||
|
.into_iter()
|
||||||
|
.find_map(|oper| {
|
||||||
|
s.rsplit_once(oper)
|
||||||
|
.map(|(name, version)| {
|
||||||
|
(
|
||||||
|
Name(name.to_string()),
|
||||||
|
VersionOper::from_str(oper).unwrap_or(VersionOper::Equal),
|
||||||
|
Version::new(version),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.map(|(n, o, v)| Dependency::new(n, Some((o, v))))
|
||||||
|
})
|
||||||
|
.or(Some(Dependency::new(Name(s.to_string()), None)))
|
||||||
|
.ok_or(E::invalid_value(serde::de::Unexpected::Str(s), &self))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: serde::de::Error,
|
||||||
|
{
|
||||||
|
// all hashes are represented in lowercase. this generally handles
|
||||||
|
// unicode, but hashes currently used by ia use ascii only.
|
||||||
|
self.visit_str(&v.to_lowercase())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de> Deserialize<'de> for Dependency {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
deserializer.deserialize_string(DependencyVisitor)
|
||||||
|
}
|
||||||
|
}
|
57
crates/ia/src/manifest/mod.rs
Normal file
57
crates/ia/src/manifest/mod.rs
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
//! creation and processing of package manifest files.
|
||||||
|
|
||||||
|
mod dependency;
|
||||||
|
use crate::{error, fs::File, version::Revision, Description, Name, Source, Version};
|
||||||
|
pub use dependency::Dependency;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::{path::PathBuf, str::FromStr};
|
||||||
|
|
||||||
|
/// a full parsed package manifest.
|
||||||
|
/// manifests are a representation of the "recipe" used to build the package.
|
||||||
|
/// a package manifest is the 'recipe' for constructing an ia package.
|
||||||
|
/// in the future, this will be used to generate a lockfile, which will
|
||||||
|
/// in turn be used to construct a package.
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Manifest {
|
||||||
|
pub name: Name,
|
||||||
|
pub description: Description,
|
||||||
|
pub version: Version,
|
||||||
|
pub revision: Revision,
|
||||||
|
pub sources: Vec<Source>,
|
||||||
|
pub patches: Option<Vec<Source>>,
|
||||||
|
pub dependencies: Vec<Dependency>,
|
||||||
|
pub build_dependencies: Vec<Dependency>,
|
||||||
|
// #[serde(rename = "configure")]
|
||||||
|
// pub configure_phase: ConfigurePhase,
|
||||||
|
// #[serde(rename = "build")]
|
||||||
|
// pub build_phase: BuildPhase,
|
||||||
|
// #[serde(rename = "test")]
|
||||||
|
// pub test_phase: TestPhase,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Manifest {
|
||||||
|
/// deserializes a manifest from an open file reference.
|
||||||
|
pub fn from_file(mut file: File) -> Result<Self, error::Manifest> {
|
||||||
|
let mut file_bytes = Vec::new();
|
||||||
|
file.read(&mut file_bytes)
|
||||||
|
.map(|_| file_bytes)
|
||||||
|
.map_err(error::Manifest::FS)
|
||||||
|
.map(|b| String::from_utf8(b).map_err(|_| error::Manifest::FS(error::FS::Read)))?
|
||||||
|
.map(|s| Self::from_str(&s))?
|
||||||
|
}
|
||||||
|
|
||||||
|
/// deserializes a manifest from a path.
|
||||||
|
pub fn from_path(path: &PathBuf) -> Result<Self, error::Manifest> {
|
||||||
|
File::open_ambient(path)
|
||||||
|
.map_err(error::Manifest::FS)
|
||||||
|
.map(Self::from_file)?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Manifest {
|
||||||
|
type Err = error::Manifest;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
toml::de::from_str(s).map_err(|_| error::Manifest::Parse)
|
||||||
|
}
|
||||||
|
}
|
35
crates/ia/src/source/fetcher/file.rs
Normal file
35
crates/ia/src/source/fetcher/file.rs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
error,
|
||||||
|
fs::{Dir, Permissions},
|
||||||
|
source::Url,
|
||||||
|
};
|
||||||
|
|
||||||
|
use super::Fetcher;
|
||||||
|
|
||||||
|
pub struct FileFetcher<'a> {
|
||||||
|
/// used for manifest-relative file paths.
|
||||||
|
pub manifest_root: &'a Dir,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> FileFetcher<'a> {
|
||||||
|
pub fn new(manifest_root: &'a Dir) -> Self {
|
||||||
|
Self { manifest_root }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Fetcher for FileFetcher<'_> {
|
||||||
|
fn fetch_to(&self, url: &Url, dst: &mut dyn Write) -> Result<usize, error::Fetcher> {
|
||||||
|
let mut src_file = self
|
||||||
|
.manifest_root
|
||||||
|
.open_file(url.location(), Permissions::Read)
|
||||||
|
.map_err(error::Fetcher::FS)?;
|
||||||
|
|
||||||
|
src_file.copy_to(dst).map_err(error::Fetcher::FS)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scheme(&self) -> &'static str {
|
||||||
|
"file"
|
||||||
|
}
|
||||||
|
}
|
11
crates/ia/src/source/fetcher/mod.rs
Normal file
11
crates/ia/src/source/fetcher/mod.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
pub mod file;
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
use crate::{error, source::Url};
|
||||||
|
|
||||||
|
/// a construct capable of fetching a particular source.
|
||||||
|
pub trait Fetcher {
|
||||||
|
fn fetch_to(&self, url: &Url, dst: &mut dyn Write) -> Result<usize, error::Fetcher>;
|
||||||
|
fn scheme(&self) -> &'static str;
|
||||||
|
}
|
134
crates/ia/src/source/mod.rs
Normal file
134
crates/ia/src/source/mod.rs
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
pub mod fetcher;
|
||||||
|
|
||||||
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
|
use fetcher::Fetcher;
|
||||||
|
use serde::{de::Visitor, Deserialize, Deserializer, Serialize};
|
||||||
|
|
||||||
|
use crate::{error, fs::File, Hashstring, Name};
|
||||||
|
|
||||||
|
/// a source url, stored as a pair of strings (scheme, location).
|
||||||
|
/// the [Display] implementation concatenates the two strings with a `:`.
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct Url((String, String));
|
||||||
|
|
||||||
|
impl Url {
|
||||||
|
/// returns the url scheme, such as `http` or `file`.
|
||||||
|
pub fn scheme(&self) -> String {
|
||||||
|
self.0 .0.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// returns the location, or tail of the url.
|
||||||
|
/// this is the remainder after removing the scheme.
|
||||||
|
pub fn location(&self) -> String {
|
||||||
|
self.0 .1.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Url {
|
||||||
|
type Err = error::Source;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
s.split_once(':')
|
||||||
|
.map(|(scheme, tail)| Self((scheme.to_owned(), tail.to_owned())))
|
||||||
|
.ok_or(Self::Err::BadUrl(s.to_string()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for Url {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "{}:{}", self.0 .0, self.0 .1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UrlVisitor;
|
||||||
|
|
||||||
|
impl<'de> Visitor<'de> for UrlVisitor {
|
||||||
|
type Value = Url;
|
||||||
|
|
||||||
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
formatter.write_str("a source url")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: serde::de::Error,
|
||||||
|
{
|
||||||
|
Url::from_str(v).map_err(|_| E::invalid_type(serde::de::Unexpected::Str(v), &self))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: serde::de::Error,
|
||||||
|
{
|
||||||
|
self.visit_str(&v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de> Deserialize<'de> for Url {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
deserializer.deserialize_string(UrlVisitor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// a source entry, or "input". a url pointing to a source file of some
|
||||||
|
/// kind.
|
||||||
|
/// the currently-supported scheme handlers are:
|
||||||
|
/// - `file:`, which is a local file
|
||||||
|
/// - _for technical reasons, this is handled differently to other
|
||||||
|
/// retrieval mechanisms. local file paths are not legitimate urls, and
|
||||||
|
/// local file access requires escaping the sandbox for ambient file
|
||||||
|
/// access._
|
||||||
|
/// - `http://` and `https://`, which interact over HTTP/HTTPS protocols
|
||||||
|
/// respectively
|
||||||
|
/// - `git://`, which interacts over the git DVCS protocol
|
||||||
|
/// - `sftp://`, which interacts over the SSH File Transfer Protocol
|
||||||
|
/// when a source is created, ia will attempt to assign a fetcher to the
|
||||||
|
/// source based on the scheme of its url. if this cannot be performed,
|
||||||
|
/// the creation of the source will fail.
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Source {
|
||||||
|
pub name: Name,
|
||||||
|
pub url: Url,
|
||||||
|
#[serde(rename = "hash")]
|
||||||
|
pub hashstring: Hashstring,
|
||||||
|
#[serde(skip)]
|
||||||
|
fetcher: Option<Box<dyn Fetcher>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Source {
|
||||||
|
/// creates a new source from a name, url, and hash.
|
||||||
|
/// no handler is assigned at this time.
|
||||||
|
pub fn new(name: String, url: String, hash: String) -> Result<Self, error::Source> {
|
||||||
|
Ok(Self {
|
||||||
|
name: Name(name),
|
||||||
|
url: Url::from_str(&url)?,
|
||||||
|
hashstring: Hashstring::from_str(&hash).map_err(error::Source::Hash)?,
|
||||||
|
fetcher: None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// attaches a fetcher to a source, allowing it to be retrieved via [Self::fetch_to].
|
||||||
|
pub fn with_fetcher(self, fetcher: Box<dyn Fetcher>) -> Result<Self, error::Source> {
|
||||||
|
Ok(Self {
|
||||||
|
fetcher: Some(fetcher),
|
||||||
|
..self
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// fetches this source, via its assigned fetcher, to the designated file.
|
||||||
|
/// if this source does not have a handler assigned (via e.g.,
|
||||||
|
/// [Self::with_fetcher]), this function will fail.
|
||||||
|
pub fn fetch_to(self, mut dst: File) -> Result<usize, error::Source> {
|
||||||
|
let fetcher = self
|
||||||
|
.fetcher
|
||||||
|
.ok_or(error::Source::NoFetcher(self.name.to_string()))?;
|
||||||
|
|
||||||
|
fetcher
|
||||||
|
.fetch_to(&self.url, &mut dst)
|
||||||
|
.map_err(error::Source::Fetcher)
|
||||||
|
}
|
||||||
|
}
|
46
crates/ia/src/tests/fetcher/file.rs
Normal file
46
crates/ia/src/tests/fetcher/file.rs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
use std::{io::Read, path::PathBuf, str::FromStr};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
fs::{Dir, Permissions},
|
||||||
|
source::{
|
||||||
|
fetcher::{file::FileFetcher, Fetcher},
|
||||||
|
Url,
|
||||||
|
},
|
||||||
|
tests::fetcher::test_buildroot,
|
||||||
|
};
|
||||||
|
|
||||||
|
const TEST_PACKAGE_SOURCE_FILENAME: &str = "./test-source.txt";
|
||||||
|
const TEST_PACKAGE_SOURCE_URL: &str = "file:./test-source.txt";
|
||||||
|
const TEST_PACKAGE_ROOT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/fixtures/package");
|
||||||
|
const TEST_MANIFEST_SOURCE_FILE_BODY_STRING: &str =
|
||||||
|
include_str!("../../../fixtures/package/test-source.txt");
|
||||||
|
|
||||||
|
fn package_root() -> Dir {
|
||||||
|
PathBuf::from_str(TEST_PACKAGE_ROOT)
|
||||||
|
.map(Dir::open_ambient)
|
||||||
|
.unwrap()
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_fetch_file() {
|
||||||
|
let pkg_root = package_root();
|
||||||
|
let build_root = test_buildroot();
|
||||||
|
|
||||||
|
let url = Url::from_str(TEST_PACKAGE_SOURCE_URL).unwrap();
|
||||||
|
|
||||||
|
let mut dst_file = build_root
|
||||||
|
.open_file(TEST_PACKAGE_SOURCE_FILENAME, Permissions::WriteCreate)
|
||||||
|
.unwrap();
|
||||||
|
FileFetcher::new(&pkg_root)
|
||||||
|
.fetch_to(&url, &mut dst_file)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let mut dst_file = build_root
|
||||||
|
.open_file(TEST_PACKAGE_SOURCE_FILENAME, Permissions::Read)
|
||||||
|
.unwrap();
|
||||||
|
let mut buf = String::new();
|
||||||
|
dst_file.read_to_string(&mut buf).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(buf, TEST_MANIFEST_SOURCE_FILE_BODY_STRING);
|
||||||
|
}
|
8
crates/ia/src/tests/fetcher/mod.rs
Normal file
8
crates/ia/src/tests/fetcher/mod.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use crate::fs::{Dir, TempDir};
|
||||||
|
|
||||||
|
mod file;
|
||||||
|
|
||||||
|
/// creates the temporary buildroot used for testing.
|
||||||
|
pub(crate) fn test_buildroot() -> Dir {
|
||||||
|
TempDir::new().unwrap().into_dir().unwrap()
|
||||||
|
}
|
48
crates/ia/src/tests/hashstring.rs
Normal file
48
crates/ia/src/tests/hashstring.rs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use crate::{hashstring::HashAlgorithm, Hashstring};
|
||||||
|
|
||||||
|
const SHA2_HASHSTR: &str = "sha2:3bb12eda3c298db5de25597f54d924f2e17e78a26ad8953ed8218ee682f0bbbe9021e2f3009d152c911bf1f25ec683a902714166767afbd8e5bd0fb0124ecb8a";
|
||||||
|
const SHA2_HASHSTR_ALG: HashAlgorithm = HashAlgorithm::Sha2;
|
||||||
|
const SHA2_HASHSTR_VALUE: &str = "3bb12eda3c298db5de25597f54d924f2e17e78a26ad8953ed8218ee682f0bbbe9021e2f3009d152c911bf1f25ec683a902714166767afbd8e5bd0fb0124ecb8a";
|
||||||
|
const SHA3_HASHSTR: &str = "sha3:e6da59e7349fb06a3de52ab3a2b383090f80d45ea8489d76b231d580ccf01fb112e509dedd5cc09bead4aa54455ca4c66cd46abe35c061325802d5df12b2a55d";
|
||||||
|
const SHA3_HASHSTR_ALG: HashAlgorithm = HashAlgorithm::Sha3;
|
||||||
|
const SHA3_HASHSTR_VALUE: &str = "e6da59e7349fb06a3de52ab3a2b383090f80d45ea8489d76b231d580ccf01fb112e509dedd5cc09bead4aa54455ca4c66cd46abe35c061325802d5df12b2a55d";
|
||||||
|
const INVALIDALG_HASHSTR: &str = "abcd213:3bb12eda3c298db5de25597f54d924f2e17e78a26ad8953ed8218ee682f0bbbe9021e2f3009d152c911bf1f25ec683a902714166767afbd8e5bd0fb0124ecb8a";
|
||||||
|
const INVALIDVALUE_HASHSTR: &str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_parse_sha2_alg() {
|
||||||
|
let hash = Hashstring::from_str(SHA2_HASHSTR).unwrap();
|
||||||
|
assert_eq!(hash.algorithm, SHA2_HASHSTR_ALG)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_parse_sha2_value() {
|
||||||
|
let hash = Hashstring::from_str(SHA2_HASHSTR).unwrap();
|
||||||
|
assert_eq!(hash.value.to_string(), SHA2_HASHSTR_VALUE.to_owned())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_parse_sha3_alg() {
|
||||||
|
let hash = Hashstring::from_str(SHA3_HASHSTR).unwrap();
|
||||||
|
assert_eq!(hash.algorithm, SHA3_HASHSTR_ALG)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_parse_sha3_value() {
|
||||||
|
let hash = Hashstring::from_str(SHA3_HASHSTR).unwrap();
|
||||||
|
assert_eq!(hash.value.to_string(), SHA3_HASHSTR_VALUE.to_owned())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rejects_invalid_alg() {
|
||||||
|
let hash = Hashstring::from_str(INVALIDALG_HASHSTR);
|
||||||
|
assert!(hash.is_err())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rejects_invalid_hash() {
|
||||||
|
let hash = Hashstring::from_str(INVALIDVALUE_HASHSTR);
|
||||||
|
assert!(hash.is_err())
|
||||||
|
}
|
24
crates/ia/src/tests/manifest.rs
Normal file
24
crates/ia/src/tests/manifest.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
use super::{TEST_MANIFEST_STRING, TEST_PACKAGE_NAME, TEST_PACKAGE_REVISION, TEST_PACKAGE_VERSION};
|
||||||
|
use crate::{version::Revision, Manifest, Version};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_parse_toml() {
|
||||||
|
let manifest_toml: toml::Table = toml::from_str(TEST_MANIFEST_STRING).unwrap();
|
||||||
|
assert_eq!(manifest_toml["name"].as_str(), Some(TEST_PACKAGE_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_parse_manifest() {
|
||||||
|
let manifest: Manifest = toml::from_str(TEST_MANIFEST_STRING).unwrap();
|
||||||
|
assert_eq!(manifest.name.to_string(), TEST_PACKAGE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_parse_version() {
|
||||||
|
let version = Version::new(TEST_PACKAGE_VERSION);
|
||||||
|
let revision = Revision::new(TEST_PACKAGE_REVISION);
|
||||||
|
let manifest: Manifest = toml::from_str(TEST_MANIFEST_STRING).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(manifest.version, version);
|
||||||
|
assert_eq!(manifest.revision, revision);
|
||||||
|
}
|
15
crates/ia/src/tests/mod.rs
Normal file
15
crates/ia/src/tests/mod.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
mod fetcher;
|
||||||
|
mod hashstring;
|
||||||
|
mod manifest;
|
||||||
|
|
||||||
|
/// a string containing an entire unparsed manifest file.
|
||||||
|
pub(crate) const TEST_MANIFEST_STRING: &str = include_str!("../../fixtures/package/manifest.toml");
|
||||||
|
|
||||||
|
/// the package [Name](crate::Name) as per the test manifest file.
|
||||||
|
pub(crate) const TEST_PACKAGE_NAME: &str = "test-package";
|
||||||
|
|
||||||
|
/// the package [Version](crate::Version) as per the test manifest file.
|
||||||
|
pub(crate) const TEST_PACKAGE_VERSION: &str = "1.2.3-git";
|
||||||
|
|
||||||
|
/// the package [Revision](crate::version::Revision) as per the test manifest file.
|
||||||
|
pub(crate) const TEST_PACKAGE_REVISION: u8 = 42;
|
72
crates/ia/src/version.rs
Normal file
72
crates/ia/src/version.rs
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::error;
|
||||||
|
|
||||||
|
// a package revision.
|
||||||
|
// this is used by maintainers where package updates are required
|
||||||
|
// that do not include changes from upstream.
|
||||||
|
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, Eq)]
|
||||||
|
pub struct Revision(u8);
|
||||||
|
|
||||||
|
impl Revision {
|
||||||
|
pub fn new(rev: u8) -> Self {
|
||||||
|
Self(rev)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// an operator applied to a version requirement, allowing a package
|
||||||
|
/// to pin a dependency to a specific version or range of versions.
|
||||||
|
///
|
||||||
|
/// while only one version operator should be present per string, the version
|
||||||
|
/// operators are matched in the following order:
|
||||||
|
/// - `<=`
|
||||||
|
/// - `>=`
|
||||||
|
/// - `=`
|
||||||
|
/// - `<`
|
||||||
|
/// - `>`
|
||||||
|
#[derive(strum::Display, Debug, Deserialize, PartialEq, Serialize)]
|
||||||
|
pub enum VersionOper {
|
||||||
|
#[strum(to_string = "<")]
|
||||||
|
LessThan,
|
||||||
|
#[strum(to_string = "<=")]
|
||||||
|
LessThanOrEqual,
|
||||||
|
#[strum(to_string = "=")]
|
||||||
|
Equal,
|
||||||
|
#[strum(to_string = ">=")]
|
||||||
|
GreaterThanOrEqual,
|
||||||
|
#[strum(to_string = ">")]
|
||||||
|
GreaterThan,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for VersionOper {
|
||||||
|
type Err = error::Manifest;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s {
|
||||||
|
"<=" => Ok(VersionOper::LessThanOrEqual),
|
||||||
|
">=" => Ok(VersionOper::GreaterThanOrEqual),
|
||||||
|
"=" => Ok(VersionOper::Equal),
|
||||||
|
"<" => Ok(VersionOper::LessThan),
|
||||||
|
">" => Ok(VersionOper::GreaterThan),
|
||||||
|
_ => Err(error::Manifest::Parse),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// a package's version.
|
||||||
|
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||||
|
pub struct Version(String);
|
||||||
|
|
||||||
|
impl Display for Version {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "{}", self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Version {
|
||||||
|
pub fn new<T: AsRef<str>>(upstream: T) -> Self {
|
||||||
|
Version(upstream.as_ref().to_string())
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue