Merge PreInstall commands

This commit is contained in:
Zykino 2023-06-28 22:46:56 +02:00
parent 7b9c487650
commit 804584d21c
10 changed files with 201 additions and 232 deletions

300
Cargo.lock generated
View File

@ -3,10 +3,53 @@
version = 3 version = 3
[[package]] [[package]]
name = "autocfg" name = "anstream"
version = "1.1.0" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is-terminal",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd"
[[package]]
name = "anstyle-parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@ -16,9 +59,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.78" version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -28,27 +71,35 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.1.1" version = "4.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2" checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d"
dependencies = [ dependencies = [
"bitflags", "clap_builder",
"clap_derive", "clap_derive",
"clap_lex",
"is-terminal",
"once_cell", "once_cell",
]
[[package]]
name = "clap_builder"
version = "4.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0"
dependencies = [
"anstream",
"anstyle",
"bitflags",
"clap_lex",
"strsim", "strsim",
"termcolor",
] ]
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.1.0" version = "4.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
@ -56,12 +107,15 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.3.1" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
dependencies = [
"os_str_bytes", [[package]]
] name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]] [[package]]
name = "directories" name = "directories"
@ -84,14 +138,20 @@ dependencies = [
] ]
[[package]] [[package]]
name = "errno" name = "equivalent"
version = "0.2.8" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
[[package]]
name = "errno"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [ dependencies = [
"errno-dragonfly", "errno-dragonfly",
"libc", "libc",
"winapi", "windows-sys",
] ]
[[package]] [[package]]
@ -106,9 +166,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.8" version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@ -117,50 +177,48 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.12.3" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.4.0" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.2.6" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.2" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [ dependencies = [
"autocfg", "equivalent",
"hashbrown", "hashbrown",
] ]
[[package]] [[package]]
name = "io-lifetimes" name = "io-lifetimes"
version = "1.0.4" version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [ dependencies = [
"hermit-abi",
"libc", "libc",
"windows-sys", "windows-sys",
] ]
[[package]] [[package]]
name = "is-terminal" name = "is-terminal"
version = "0.4.2" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi",
"io-lifetimes", "io-lifetimes",
@ -170,72 +228,42 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.139" version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.1.4" version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.17.0" version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.49" version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.23" version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -262,9 +290,9 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.36.6" version = "0.37.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"errno", "errno",
@ -276,24 +304,24 @@ dependencies = [
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.12" version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.152" version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.152" version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -302,9 +330,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_yaml" name = "serde_yaml"
version = "0.9.16" version = "0.9.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834" checksum = "452e67b9c20c37fa79df53201dc03839651086ed9bbe92b3ca585ca9fdaa7d85"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"itoa", "itoa",
@ -321,9 +349,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.107" version = "2.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -338,31 +366,23 @@ dependencies = [
"directories", "directories",
"serde", "serde",
"serde_yaml", "serde_yaml",
] "thiserror",
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
] ]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.38" version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.38" version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -371,21 +391,21 @@ dependencies = [
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.6" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
[[package]] [[package]]
name = "unsafe-libyaml" name = "unsafe-libyaml"
version = "0.2.5" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6"
[[package]] [[package]]
name = "version_check" name = "utf8parse"
version = "0.9.4" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]] [[package]]
name = "wasi" name = "wasi"
@ -409,15 +429,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
@ -426,9 +437,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.42.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm", "windows_aarch64_gnullvm",
"windows_aarch64_msvc", "windows_aarch64_msvc",
@ -441,42 +461,42 @@ dependencies = [
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.42.1" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.42.1" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.42.1" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.42.1" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.42.1" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.42.1" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.42.1" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

View File

@ -14,3 +14,4 @@ clap = { version = "4.1", features = ["derive"] }
directories = "4.0" directories = "4.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9" serde_yaml = "0.9"
thiserror = "1.0"

View File

@ -1,6 +1,6 @@
packages: executors:
- name: Apt - name: Apt
fetch: pre_install:
- exe: sudo - exe: sudo
params: params:
- apt - apt

View File

@ -1,4 +1,4 @@
packages: executors:
- name: Flatpack - name: Flatpack
install: install:
exe: flatpak exe: flatpak

View File

@ -1,6 +1,6 @@
packages: executors:
- name: Helix (git) - name: Helix (git)
fetch: pre_install:
- exe: git - exe: git
params: params:
- pull - pull

View File

@ -1,4 +1,4 @@
packages: executors:
- name: Pipx - name: Pipx
install: install:
exe: pipx exe: pipx

View File

@ -1,4 +1,4 @@
packages: executors:
- name: Rustup - name: Rustup
install: install:
exe: rustup exe: rustup

View File

@ -8,8 +8,7 @@ use std::{fmt, fs, io};
#[derive(Debug, Serialize, Deserialize, PartialEq)] #[derive(Debug, Serialize, Deserialize, PartialEq)]
enum UpdateSteps { enum UpdateSteps {
Fetch, PreInstall,
Compile,
Install, Install,
PostInstall, PostInstall,
} }
@ -19,7 +18,7 @@ enum UpdateSteps {
/// Root of the machines dependency graph /// Root of the machines dependency graph
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct Updater { pub struct Updater {
pub systems: BTreeMap<String, System>, pub packagers: BTreeMap<String, Packager>,
} }
/// A list of equivalent executors that will update a given component /// A list of equivalent executors that will update a given component
@ -27,21 +26,19 @@ pub struct Updater {
/// Example: the `system` one will try to do update the system for as if it is Debian with `apt update`, if it fails it will try for openSUSE with `zypper refresh`, … /// Example: the `system` one will try to do update the system for as if it is Debian with `apt update`, if it fails it will try for openSUSE with `zypper refresh`, …
/// The step will be considered a succes if **any** executor succeed and will skip all the other ones. /// The step will be considered a succes if **any** executor succeed and will skip all the other ones.
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct System { pub struct Packager {
packages: Vec<Package>, executors: Vec<Executor>,
// TODO: => make a system dependend on another? This will allow to give a "Rust" config which update "rustup", and a custom "git helix" could then be executed after (with the updated toolchain, and NOT concurrently) // TODO: => make a system dependend on another? This will allow to give a "Rust" config which update "rustup", and a custom "git helix" could then be executed after (with the updated toolchain, and NOT concurrently)
} }
/// All the infos for an executor to proceed until completion /// All the infos for an executor to proceed until completion
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct Package { pub struct Executor {
pub name: String, pub name: String,
fetch: Option<Vec<Cmd>>, pre_install: Option<Vec<Cmd>>,
compile: Option<Vec<Cmd>>,
install: Cmd, install: Cmd,
post_install: Option<Vec<Cmd>>, post_install: Option<Vec<Cmd>>,
// deps or rDeps : Tree // deps or rDeps : Tree
// exclusive_with : List
} }
/// A command to execute on the system as part of an executor /// A command to execute on the system as part of an executor
@ -62,26 +59,10 @@ pub(crate) struct ActualCmd {
env: BTreeMap<String, String>, env: BTreeMap<String, String>,
} }
// QUESTION: Would String be less awkward?
impl From<&str> for UpdateSteps {
fn from(value: &str) -> Self {
match &*value.to_lowercase() {
"fetch" => UpdateSteps::Fetch,
"compile" => UpdateSteps::Compile,
"install" => UpdateSteps::Install,
"post_install" => UpdateSteps::PostInstall,
_ => panic!("Step {} not recognized", value),
}
}
}
// QUESTION: Would String be less awkward?
impl From<&String> for UpdateSteps { impl From<&String> for UpdateSteps {
fn from(value: &String) -> Self { fn from(value: &String) -> Self {
match &*value.to_lowercase() { match value.to_lowercase().as_str() {
"fetch" => UpdateSteps::Fetch, "pre_install" => UpdateSteps::PreInstall,
"compile" => UpdateSteps::Compile,
"install" => UpdateSteps::Install, "install" => UpdateSteps::Install,
"post_install" => UpdateSteps::PostInstall, "post_install" => UpdateSteps::PostInstall,
@ -105,7 +86,7 @@ pub fn get_packages_folder(opt: &Opt) -> io::Result<PathBuf> {
impl Updater { impl Updater {
fn new() -> Updater { fn new() -> Updater {
Updater { Updater {
systems: BTreeMap::from([(String::new(), System { packages: vec![] })]), packagers: BTreeMap::from([(String::new(), Packager { executors: vec![] })]),
} }
} }
@ -136,17 +117,16 @@ impl Updater {
// Example to generate a config file // Example to generate a config file
if false { if false {
updater updater
.systems .packagers
.insert("Test".to_owned(), System { packages: vec![] }); .insert("Test".to_owned(), Packager { executors: vec![] });
let sys = updater let sys = updater
.systems .packagers
.get_mut("Test") .get_mut("Test")
.expect("We just created the key"); .expect("We just created the key");
sys.packages.push(Package { sys.executors.push(Executor {
name: "Rustup".to_owned(), name: "Rustup".to_owned(),
fetch: None, pre_install: None,
compile: None,
install: Cmd { install: Cmd {
exe: "rustup".to_owned(), exe: "rustup".to_owned(),
params: Some(vec!["self".to_owned(), "update".to_owned()]), params: Some(vec!["self".to_owned(), "update".to_owned()]),
@ -156,10 +136,9 @@ impl Updater {
post_install: None, post_install: None,
}); });
sys.packages.push(Package { sys.executors.push(Executor {
name: "Cargo".to_owned(), name: "Cargo".to_owned(),
fetch: None, pre_install: None,
compile: None,
install: Cmd { install: Cmd {
exe: "cargo".to_owned(), exe: "cargo".to_owned(),
params: Some(vec!["install-update".to_owned(), "-a".to_owned()]), params: Some(vec!["install-update".to_owned(), "-a".to_owned()]),
@ -212,7 +191,7 @@ impl Updater {
) )
})?; })?;
updater updater
.systems .packagers
.insert(file.file_stem().unwrap().to_str().unwrap().to_owned(), sys); .insert(file.file_stem().unwrap().to_str().unwrap().to_owned(), sys);
} }
@ -225,8 +204,8 @@ impl Updater {
let mut status: Vec<_> = vec![]; let mut status: Vec<_> = vec![];
// XXX: We may parallelise (iter_par from rayon?) this loop. But the UI will be problematic to handle // XXX: We may parallelise (iter_par from rayon?) this loop. But the UI will be problematic to handle
for (_sys_name, sys) in &self.systems { for (_packager_name, packager) in &self.packagers {
for pkg in &sys.packages { for pkg in &packager.executors {
status.push((pkg.name.clone(), self.update(&pkg, opt).into())); status.push((pkg.name.clone(), self.update(&pkg, opt).into()));
} }
} }
@ -234,12 +213,11 @@ impl Updater {
Summary { status } Summary { status }
} }
fn update(&self, sys: &Package, opt: &Opt) -> Result<()> { fn update(&self, sys: &Executor, opt: &Opt) -> Result<()> {
// TODO: compute once before calling this function, maybe? // TODO: compute once before calling this function, maybe?
let steps = if opt.steps.is_empty() { let steps = if opt.steps.is_empty() {
vec![ vec![
UpdateSteps::Fetch, UpdateSteps::PreInstall,
UpdateSteps::Compile,
UpdateSteps::Install, UpdateSteps::Install,
UpdateSteps::PostInstall, UpdateSteps::PostInstall,
] ]
@ -247,11 +225,8 @@ impl Updater {
opt.steps.iter().map(|u| u.into()).collect() opt.steps.iter().map(|u| u.into()).collect()
}; };
if steps.contains(&UpdateSteps::Fetch) { if steps.contains(&UpdateSteps::PreInstall) {
sys.fetch(opt)?; sys.pre_install(opt)?;
}
if steps.contains(&UpdateSteps::Compile) {
sys.compile(opt)?;
} }
if steps.contains(&UpdateSteps::Install) { if steps.contains(&UpdateSteps::Install) {
sys.install(opt)?; sys.install(opt)?;
@ -264,38 +239,18 @@ impl Updater {
} }
} }
impl Package { impl Executor {
pub fn fetch(&self, opt: &Opt) -> Result<()> { pub fn pre_install(&self, opt: &Opt) -> Result<()> {
if let Some(fetch) = &self.fetch { if let Some(pre_install) = &self.pre_install {
for cmd in fetch { for cmd in pre_install {
let cmd = cmd.clone().prepare(opt); let cmd = cmd.clone().prepare(opt);
let exit_status = cmd let exit_status = cmd
.execute(opt) .execute(opt)
.map_err(|err| MyError::new(MyErrorKind::Fetch, err, cmd.clone()))?; .map_err(|err| MyError::new(MyErrorKind::PreInstall, err, cmd.clone()))?;
if !exit_status.success() { if !exit_status.success() {
return Err(MyError::new( return Err(MyError::new(
MyErrorKind::Fetch, MyErrorKind::PreInstall,
io::Error::new(io::ErrorKind::Other, format!("{}", exit_status)),
cmd.clone(),
));
}
}
}
Ok(())
}
pub fn compile(&self, opt: &Opt) -> Result<()> {
if let Some(compile) = &self.compile {
for cmd in compile {
let cmd = cmd.clone().prepare(opt);
let exit_status = cmd
.execute(opt)
.map_err(|err| MyError::new(MyErrorKind::Compile, err, cmd.clone()))?;
if !exit_status.success() {
return Err(MyError::new(
MyErrorKind::Compile,
io::Error::new(io::ErrorKind::Other, format!("{}", exit_status)), io::Error::new(io::ErrorKind::Other, format!("{}", exit_status)),
cmd.clone(), cmd.clone(),
)); ));

View File

@ -22,8 +22,7 @@ pub struct MyError {
#[non_exhaustive] #[non_exhaustive]
pub enum MyErrorKind { pub enum MyErrorKind {
Config, Config,
Fetch, PreInstall,
Compile,
Install, Install,
PostInstall, PostInstall,
} }
@ -53,15 +52,9 @@ impl Display for MyError {
"Could not read configuration file: {}", "Could not read configuration file: {}",
self.source().unwrap() self.source().unwrap()
), ),
MyErrorKind::Fetch => write!( MyErrorKind::PreInstall => write!(
f, f,
"Could not fetch with command {}: {}", "Could not do the pre_install with command {}: {}",
self.cmd,
self.source().unwrap()
),
MyErrorKind::Compile => write!(
f,
"Could not compile with command {}: {}",
self.cmd, self.cmd,
self.source().unwrap() self.source().unwrap()
), ),

View File

@ -69,7 +69,7 @@ impl Display for Summary {
pub fn run(opt: &Opt) -> io::Result<Summary> { pub fn run(opt: &Opt) -> io::Result<Summary> {
let updater = Updater::from_config(opt)?; let updater = Updater::from_config(opt)?;
if updater.systems.is_empty() { if updater.packagers.is_empty() {
let package_folder = get_packages_folder(&opt)?; let package_folder = get_packages_folder(&opt)?;
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,