Update pkg to use new API

This commit is contained in:
Wildan M
2026-03-08 20:53:33 +07:00
parent 7806f87c56
commit a6fd457652
5 changed files with 119 additions and 375 deletions
Generated
+72 -248
View File
@@ -8,7 +8,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"cipher",
"cpufeatures",
]
@@ -22,21 +22,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "alloc-no-stdlib"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"
[[package]]
name = "alloc-stdlib"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece"
dependencies = [
"alloc-no-stdlib",
]
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -46,15 +31,6 @@ dependencies = [
"libc",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "anstream"
version = "0.6.21"
@@ -140,16 +116,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "async-compression"
version = "0.4.37"
name = "arrayvec"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d10e4f991a553474232bc0a31799f6d24b034a84c0971d80d2e2f78b2e576e40"
dependencies = [
"compression-codecs",
"compression-core",
"pin-project-lite",
"tokio",
]
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "atomic-waker"
@@ -157,17 +127,6 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.5.0"
@@ -210,7 +169,7 @@ version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"
dependencies = [
"digest 0.10.7",
"digest",
]
[[package]]
@@ -220,24 +179,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
dependencies = [
"arrayref",
"arrayvec",
"constant_time_eq",
"arrayvec 0.5.2",
"constant_time_eq 0.1.5",
]
[[package]]
name = "blake3"
version = "0.3.8"
version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3"
checksum = "2468ef7d57b3fb7e16b576e8377cdbde2320c60e1491e961d11da40fc4f02a2d"
dependencies = [
"arrayref",
"arrayvec",
"arrayvec 0.7.6",
"cc",
"cfg-if 0.1.10",
"constant_time_eq",
"crypto-mac",
"digest 0.9.0",
"rayon",
"cfg-if",
"constant_time_eq 0.4.2",
"cpufeatures",
"rayon-core",
]
[[package]]
@@ -249,27 +207,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "brotli"
version = "8.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
"brotli-decompressor",
]
[[package]]
name = "brotli-decompressor"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
]
[[package]]
name = "bstr"
version = "1.12.1"
@@ -328,12 +265,6 @@ dependencies = [
"shlex",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.4"
@@ -352,7 +283,7 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"cipher",
"cpufeatures",
]
@@ -381,43 +312,12 @@ dependencies = [
"zeroize",
]
[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term",
"atty",
"bitflags 1.3.2",
"strsim",
"textwrap",
"unicode-width 0.1.14",
"vec_map",
]
[[package]]
name = "colorchoice"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
name = "compression-codecs"
version = "0.4.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00828ba6fd27b45a448e57dbfe84f1029d4c9f26b368157e9a448a5f49a2ec2a"
dependencies = [
"brotli",
"compression-core",
]
[[package]]
name = "compression-core"
version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75984efb6ed102a0d42db99afb6c1948f0380d1d91808d5529916e6c08b49d8d"
[[package]]
name = "console"
version = "0.15.11"
@@ -427,7 +327,7 @@ dependencies = [
"encode_unicode",
"libc",
"once_cell",
"unicode-width 0.2.2",
"unicode-width",
"windows-sys 0.59.0",
]
@@ -437,6 +337,12 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "constant_time_eq"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
@@ -502,23 +408,13 @@ dependencies = [
"typenum",
]
[[package]]
name = "crypto-mac"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
dependencies = [
"generic-array",
"subtle",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"cpufeatures",
"curve25519-dalek-derive",
"fiat-crypto",
@@ -538,15 +434,6 @@ dependencies = [
"syn",
]
[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
"generic-array",
]
[[package]]
name = "digest"
version = "0.10.7"
@@ -560,22 +447,23 @@ dependencies = [
[[package]]
name = "dirs"
version = "3.0.2"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309"
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.3.7"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
"redox_users",
"winapi",
"windows-sys 0.61.2",
]
[[package]]
@@ -609,12 +497,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "encode_unicode"
version = "1.0.0"
@@ -779,7 +661,7 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
@@ -790,7 +672,7 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"js-sys",
"libc",
"wasi 0.11.1+wasi-snapshot-preview1",
@@ -803,7 +685,7 @@ version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"js-sys",
"libc",
"r-efi",
@@ -842,15 +724,6 @@ version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hex"
version = "0.4.3"
@@ -1131,7 +1004,7 @@ dependencies = [
"console",
"number_prefix",
"portable-atomic",
"unicode-width 0.2.2",
"unicode-width",
"web-time",
]
@@ -1259,6 +1132,15 @@ version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08ab2867e3eeeca90e844d1940eab391c9dc5228783db2ed999acbc0a9ed375a"
[[package]]
name = "lzma-rust2"
version = "0.16.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47bb1e988e6fb779cf720ad431242d3f03167c1b3f2b1aae7f1a94b2495b36ae"
dependencies = [
"sha2",
]
[[package]]
name = "memchr"
version = "2.7.6"
@@ -1294,7 +1176,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags 2.10.0",
"cfg-if 1.0.4",
"cfg-if",
"cfg_aliases",
"libc",
]
@@ -1332,6 +1214,12 @@ version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "page_size"
version = "0.6.0"
@@ -1368,14 +1256,13 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkgar"
version = "0.1.19"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dab99cb7a6d62ca2667eca54ffab93fc77e3f4d19e67a2dce7d65c22adaa7324"
checksum = "04a4f986e17eddde10e5e13eed8871040c6d03c84899c7bd45eb677d2a075aad"
dependencies = [
"anyhow",
"blake3",
"bytemuck",
"clap",
"lzma-rust2",
"pkgar-core",
"pkgar-keys",
"thiserror 2.0.18",
@@ -1383,11 +1270,11 @@ dependencies = [
[[package]]
name = "pkgar-core"
version = "0.1.19"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc0f6069f730523018711e77c41b642cf922ef7f4b5505bbf28e7070da4de206"
checksum = "f70ece1ac795894e114aaf0f6fe6e48a1eb17ff4ab7904e166378dca79d69312"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.10.0",
"blake3",
"bytemuck",
"dryoc",
@@ -1395,12 +1282,10 @@ dependencies = [
[[package]]
name = "pkgar-keys"
version = "0.1.19"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "928cd21d644eb3c0a687bc5b76c07a2ace4e96a8f3c948538e4d4e6a5b8aeabf"
checksum = "78621dc3c54df318ce004a5e1b5d9ab128b1d7a39b228bc478e74ccd20712151"
dependencies = [
"anyhow",
"clap",
"dirs",
"hex",
"lazy_static",
@@ -1568,16 +1453,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384c2842d4e069d5ccacf5fe1dca4ef8d07a5444329715f0fc3c61813502d4d1"
[[package]]
name = "rayon"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.13.0"
@@ -1596,11 +1471,11 @@ checksum = "436d45c2b6a5b159d43da708e62b25be3a4a3d5550d654b72216ade4c4bfd717"
[[package]]
name = "redox-pkg"
version = "0.2.9"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a18d9b020d0fd3fa4e613bc7ffc3c789fba16f4e74c484cc7e63f6ffb71bc09"
checksum = "7f575a9a62d27b1e228eaa8d16283dd91bba034e4a56425d52f0d67e64527877"
dependencies = [
"anyhow",
"hex",
"ignore",
"indicatif",
"pkgar",
@@ -1660,13 +1535,13 @@ dependencies = [
[[package]]
name = "redox_users"
version = "0.4.6"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [
"getrandom 0.2.17",
"libredox",
"thiserror 1.0.69",
"thiserror 2.0.18",
]
[[package]]
@@ -1770,14 +1645,14 @@ dependencies = [
[[package]]
name = "ring"
version = "0.17.8"
source = "git+https://gitlab.redox-os.org/redox-os/ring.git?branch=redox-0.17.8#fce20f12b6aad164a1a7e13ae1dcb46422b171c0"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if 1.0.4",
"cfg-if",
"getrandom 0.2.17",
"libc",
"spin",
"untrusted",
"windows-sys 0.52.0",
]
@@ -1790,7 +1665,7 @@ checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb"
dependencies = [
"base64 0.13.1",
"blake2b_simd",
"constant_time_eq",
"constant_time_eq 0.1.5",
"crossbeam-utils",
]
@@ -1966,9 +1841,9 @@ version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"cpufeatures",
"digest 0.10.7",
"digest",
]
[[package]]
@@ -1999,24 +1874,12 @@ dependencies = [
"windows-sys 0.60.2",
]
[[package]]
name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "subtle"
version = "2.6.1"
@@ -2064,15 +1927,6 @@ dependencies = [
"numtoa",
]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width 0.1.14",
]
[[package]]
name = "thiserror"
version = "1.0.69"
@@ -2162,19 +2016,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
]
[[package]]
name = "toml"
version = "0.8.23"
@@ -2237,18 +2078,13 @@ version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
dependencies = [
"async-compression",
"bitflags 2.10.0",
"bytes",
"futures-core",
"futures-util",
"http",
"http-body",
"http-body-util",
"iri-string",
"pin-project-lite",
"tokio",
"tokio-util",
"tower",
"tower-layer",
"tower-service",
@@ -2303,12 +2139,6 @@ version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
[[package]]
name = "unicode-width"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
[[package]]
name = "unicode-width"
version = "0.2.2"
@@ -2356,12 +2186,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.5"
@@ -2414,7 +2238,7 @@ version = "0.2.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
@@ -2427,7 +2251,7 @@ version = "0.4.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f"
dependencies = [
"cfg-if 1.0.4",
"cfg-if",
"futures-util",
"js-sys",
"once_cell",
+4 -4
View File
@@ -29,11 +29,11 @@ fatfs = { version = "0.3.0", optional = true }
fscommon = { version = "0.1.1", optional = true }
gpt = { version = "3.0.0", optional = true }
libc = "0.2.70"
pkgar = { version = "0.1.19", optional = true }
pkgar-core = { version = "0.1.19", optional = true }
pkgar-keys = { version = "0.1.19", optional = true }
pkgar = { version = "0.2", optional = true }
pkgar-core = { version = "0.2", optional = true }
pkgar-keys = { version = "0.2", optional = true }
rand = { version = "0.9", optional = true }
redox-pkg = { version = "0.2.9", features = ["indicatif"], optional = true }
redox-pkg = { version = "0.3", features = ["indicatif"], optional = true }
redox_syscall = { version = "0.7", optional = true }
redoxfs = { version = "0.9", optional = true, default-features = false, features = ["std", "log"] }
rust-argon2 = { version = "0.8.2", optional = true }
+1 -43
View File
@@ -102,49 +102,7 @@ fn main() {
process::exit(1);
}
// Add cookbook key to config
let key_path = Path::new(&path).join("build/id_ed25519.pub.toml");
match fs::read_to_string(&key_path) {
Ok(data) => {
config.files.push(redox_installer::FileConfig {
path: "pkg/id_ed25519.pub.toml".to_string(),
data,
..Default::default()
});
Some(path)
}
Err(err) => {
// if there are no recipes coming from the cookbook, this is not a fatal error
if config
.packages
.clone()
.into_iter()
.any(|(_packagename, package)| match package {
PackageConfig::Empty => false,
PackageConfig::Spec {
version: None,
git: None,
path: None,
} => false,
_ => true,
})
{
eprintln!(
"installer: {}: failed to read cookbook key: {}",
key_path.display(),
err
);
process::exit(1);
} else {
eprintln!(
"installer: {}: (non-fatal) missing cookbook key: {}",
key_path.display(),
err
);
None
}
}
}
Some(path)
} else {
None
};
+18
View File
@@ -8,6 +8,8 @@ use anyhow::bail;
use anyhow::Context;
use anyhow::Result;
use crate::PackageConfig;
pub mod file;
#[cfg(feature = "installer")]
pub mod file_impl;
@@ -32,6 +34,7 @@ pub struct Config {
}
impl Config {
/// Load installer config from a TOML path
pub fn from_file(path: &Path) -> Result<Self> {
let mut config: Config = match fs::read_to_string(&path) {
Ok(config_data) => match toml::from_str(&config_data) {
@@ -65,6 +68,21 @@ impl Config {
Ok(config)
}
/// Load hardcoded install config to fetch bootloaders
pub fn bootloader_config() -> Self {
let mut bootloader_config = Config::default();
// TODO: This is unused
bootloader_config.files.push(file::FileConfig {
path: "/etc/pkg.d/50_redox".to_string(),
data: "https://static.redox-os.org/pkg".to_string(),
..Default::default()
});
bootloader_config
.packages
.insert("bootloader".to_string(), PackageConfig::default());
bootloader_config
}
pub fn merge(&mut self, other: Config) {
assert!(self.include.is_empty());
assert!(other.include.is_empty());
+24 -80
View File
@@ -87,50 +87,9 @@ pub fn prompt_password(prompt: &str, confirm_prompt: &str) -> Result<Option<Stri
bail!("passwords do not match, giving up");
}
fn install_local_pkgar(cookbook: &str, target: &str, packagename: &str, dest: &Path) -> Result<()> {
let head_path = get_head_path(packagename, dest);
let public_path = PathBuf::from(format!("{cookbook}/build/id_ed25519.pub.toml"));
let pkgar_path = PathBuf::from(format!("{cookbook}/repo/{target}/{packagename}.pkgar"));
let pkginfo_path = PathBuf::from(format!("{cookbook}/repo/{target}/{packagename}.toml"));
if !pkginfo_path.is_file() {
bail!("Package is not exist: {}", pkginfo_path.display());
}
let pkginfo = pkg::Package::from_toml(&fs::read_to_string(pkginfo_path)?)?;
if pkginfo.version != "" {
if !pkgar_path.is_file() {
bail!("Package is not exist: {}", pkgar_path.display());
}
pkgar::extract(&public_path, &pkgar_path, dest)
.with_context(|| format!("failed to pkgar extract {}", pkgar_path.display()))?;
pkgar::split(&public_path, &pkgar_path, head_path, Option::<&str>::None)
.with_context(|| format!("failed to pkgar split {}", pkgar_path.display()))?;
}
// Recursively install any runtime dependencies.
for dep in pkginfo.depends.iter() {
let depname = dep.as_str();
if !get_head_path(depname, dest).exists() {
println!("Installing runtime dependency for {packagename} from local repo: {depname}");
install_local_pkgar(cookbook, target, depname, dest)?;
}
}
Ok(())
}
fn get_head_path(packagename: &str, dest: &Path) -> PathBuf {
dest.join(format!("pkg/packages/{packagename}.pkgar_head"))
}
fn install_packages(config: &Config, dest: &Path, cookbook: Option<&str>) -> anyhow::Result<()> {
let target = &get_target();
let callback = pkg::callback::IndicatifCallback::new();
let packages: Vec<&String> = config
.packages
.iter()
@@ -140,35 +99,30 @@ fn install_packages(config: &Config, dest: &Path, cookbook: Option<&str>) -> any
})
.collect();
if let Some(cookbook) = cookbook {
let dest_pkg = dest.join("pkg/packages");
if !Path::new(&dest_pkg).is_dir() {
fs::create_dir_all(&dest_pkg)?;
}
for packagename in packages {
if !get_head_path(packagename, dest).exists() {
println!("Installing package from local repo: {}", packagename);
install_local_pkgar(cookbook, target, packagename, dest)?;
}
}
let mut library = if let Some(cookbook) = cookbook {
let callback = pkg::callback::PlainCallback::new();
let repo = Path::new(cookbook).join("repo");
let pubkey = Path::new(cookbook).join("build");
Library::new_local(
repo,
pubkey,
dest.to_path_buf(),
target,
Rc::new(RefCell::new(callback)),
)
} else {
let mut library = Library::new(dest, target, Rc::new(RefCell::new(callback)))?;
let mut package_len = packages.len();
for packagename in packages {
if !get_head_path(packagename, dest).exists() {
if package_len == 1 {
println!("Installing package from remote: {packagename}");
}
library.install(vec![pkg::PackageName::new(packagename)?])?;
} else {
package_len -= 1;
}
}
if package_len != 1 {
println!("Installing {} packages from remote", package_len);
}
library.apply()?;
}
let callback = pkg::callback::IndicatifCallback::new();
Library::new_remote(
&vec!["https://static.redox-os.org/pkg"],
dest,
target,
Rc::new(RefCell::new(callback)),
)
}?;
let packages = pkg::PackageName::from_list(packages)?;
library.install(packages)?;
library.apply()?;
Ok(())
}
@@ -537,18 +491,8 @@ pub fn fetch_bootloaders(
fs::create_dir(&bootloader_dir)?;
let mut bootloader_config = Config::default();
let mut bootloader_config = Config::bootloader_config();
bootloader_config.general = config.general.clone();
// Ensure a pkgar remote is available
FileConfig {
path: "/etc/pkg.d/50_redox".to_string(),
data: "https://static.redox-os.org/pkg".to_string(),
..Default::default()
}
.create(&bootloader_dir)?;
bootloader_config
.packages
.insert("bootloader".to_string(), PackageConfig::default());
install_packages(&bootloader_config, &bootloader_dir, cookbook)?;
let boot_dir = bootloader_dir.join("usr/lib/boot");