diff --git a/Cargo.lock b/Cargo.lock index ffbeb23..5fa3e52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,7 +39,7 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", - "h2 0.3.26", + "h2", "http 0.2.12", "httparse", "httpdate", @@ -303,9 +303,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "async-trait" @@ -318,12 +318,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "atty" version = "0.2.14" @@ -454,9 +448,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ "jobserver", "libc", @@ -477,9 +471,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -492,9 +486,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -502,9 +496,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -535,9 +529,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" @@ -574,9 +568,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" dependencies = [ "core-foundation-sys", "libc", @@ -690,9 +684,9 @@ dependencies = [ [[package]] name = "diesel" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf9649c05e0a9dbd6d0b0b8301db5182b972d0fd02f0a7c6736cf632d7c0fd5" +checksum = "ccf1bedf64cdb9643204a36dd15b19a6ce8e7aa7f7b105868e9f1fad5ffa7d12" dependencies = [ "chrono", "diesel_derives", @@ -852,9 +846,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "filetime" @@ -890,21 +884,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1027,8 +1006,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1062,25 +1043,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http 1.1.0", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.15.2" @@ -1121,9 +1083,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -1148,7 +1110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -1159,7 +1121,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "pin-project-lite", ] @@ -1213,8 +1175,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.7", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "httparse", "itoa", @@ -1231,32 +1192,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", + "http 1.2.0", "hyper 1.5.1", "hyper-util", "rustls", + "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-rustls", "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper 1.5.1", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.10" @@ -1266,7 +1212,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "hyper 1.5.1", "pin-project-lite", @@ -1482,7 +1428,7 @@ dependencies = [ "strum", "strum_macros", "tempfile", - "thiserror", + "thiserror 1.0.69", "untrusted 0.7.1", "url", "walkdir", @@ -1527,9 +1473,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ "once_cell", "wasm-bindgen", @@ -1549,9 +1495,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.167" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libredox" @@ -1690,23 +1636,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "native-tls" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nix" version = "0.29.0" @@ -1759,50 +1688,12 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[package]] -name = "openssl" -version = "0.10.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.90", -] - [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parking_lot" version = "0.12.3" @@ -1915,6 +1806,58 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quinn" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.6", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +dependencies = [ + "bytes", + "getrandom", + "rand", + "ring 0.17.8", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.6", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "quote" version = "1.0.37" @@ -1983,7 +1926,6 @@ dependencies = [ "nom", "rebuilderd-common", "regex", - "reqwest", "serde", "serde_json", "tar", @@ -2059,7 +2001,6 @@ dependencies = [ "in-toto", "nix", "rebuilderd-common", - "reqwest", "serde", "serde_json", "tempfile", @@ -2085,7 +2026,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2131,34 +2072,33 @@ checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64 0.22.1", "bytes", - "encoding_rs", "futures-channel", "futures-core", "futures-util", - "h2 0.4.7", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "hyper 1.5.1", "hyper-rustls", - "hyper-tls", "hyper-util", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", + "quinn", + "rustls", + "rustls-native-certs", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", - "tokio-native-tls", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -2205,6 +2145,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" + [[package]] name = "rustc_version" version = "0.4.1" @@ -2216,15 +2162,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.41" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2234,12 +2180,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "once_cell", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -2254,6 +2213,9 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -2313,9 +2275,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.11.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" dependencies = [ "bitflags", "core-foundation", @@ -2342,18 +2304,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -2535,27 +2497,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "system-configuration" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" -dependencies = [ - "bitflags", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tar" version = "0.4.43" @@ -2586,7 +2527,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +dependencies = [ + "thiserror-impl 2.0.6", ] [[package]] @@ -2600,11 +2550,22 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "thiserror-impl" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -2623,9 +2584,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -2641,11 +2602,26 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -2670,32 +2646,21 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -2875,9 +2840,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -2886,13 +2851,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.90", @@ -2901,9 +2865,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.47" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -2914,9 +2878,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2924,9 +2888,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -2937,9 +2901,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-streams" @@ -2956,9 +2920,19 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.74" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Dockerfile b/Dockerfile index 2b0501d..8b930c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM rust:alpine3.18 ENV RUSTFLAGS="-C target-feature=-crt-static" WORKDIR /usr/src/rebuilderd -RUN apk add --no-cache musl-dev openssl-dev shared-mime-info sqlite-dev xz-dev zstd-dev +RUN apk add --no-cache musl-dev shared-mime-info sqlite-dev xz-dev zstd-dev COPY . . RUN --mount=type=cache,target=/var/cache/buildkit \ CARGO_HOME=/var/cache/buildkit/cargo \ @@ -11,7 +11,7 @@ RUN --mount=type=cache,target=/var/cache/buildkit \ /var/cache/buildkit/target/release/rebuildctl / FROM alpine:3.18 -RUN apk add --no-cache libgcc openssl shared-mime-info sqlite-libs xz zstd-libs +RUN apk add --no-cache libgcc shared-mime-info sqlite-libs xz zstd-libs COPY --from=0 \ /rebuilderd /rebuildctl \ /usr/local/bin/ diff --git a/PKGBUILD b/PKGBUILD index b0a7c71..f60ef71 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,7 +8,7 @@ pkgdesc='Independent verification system of binary packages' url='https://github.com/kpcyrd/rebuilderd' arch=('x86_64') license=('GPL3') -depends=('openssl' 'shared-mime-info' 'xz' 'libzstd.so') +depends=('shared-mime-info' 'xz' 'libzstd.so') makedepends=('cargo' 'sqlite' 'scdoc') backup=('etc/rebuilderd.conf' 'etc/rebuilderd-sync.conf' diff --git a/README.md b/README.md index 3f0707d..5887c5c 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ cargo run --bin rebuilderd-worker -- \ ## Dependencies -Debian: pkg-config liblzma-dev libssl-dev libsqlite3-dev libzstd-dev +Debian: pkg-config liblzma-dev libsqlite3-dev libzstd-dev # Funding diff --git a/common/Cargo.toml b/common/Cargo.toml index 1b58df2..ee5eeb0 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -11,12 +11,12 @@ edition = "2021" [dependencies] anyhow = "1.0.58" -chrono = { version = "0.4.19", features=["serde"] } -clap = "4.5.21" +chrono = { version = "0.4.19", features = ["serde"] } +clap = { version = "4.5.21", features = ["derive"] } colored = "2.0.0" dirs-next = "2.0.0" log = "0.4.17" -reqwest = { version="0.12", features=["blocking", "json"] } -serde = { version="1.0.137", features=["derive"] } +reqwest = { version = "0.12", features = ["blocking", "json", "stream", "rustls-tls-native-roots"], default-features = false } +serde = { version = "1.0.137", features = ["derive"] } toml = "0.8" url = "2.2.2" diff --git a/common/src/api.rs b/common/src/api.rs index c23c615..30544cc 100644 --- a/common/src/api.rs +++ b/common/src/api.rs @@ -1,10 +1,8 @@ -use chrono::prelude::*; use crate::config::ConfigFile; use crate::errors::*; -use crate::{PkgRelease, PkgArtifact, PkgGroup, Status}; -use crate::auth; -use reqwest::{Client as HttpClient, RequestBuilder}; -use serde::{Serialize, Deserialize}; +use crate::{auth, http, PkgArtifact, PkgGroup, PkgRelease, Status}; +use chrono::prelude::*; +use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::collections::HashMap; use std::env; @@ -16,7 +14,7 @@ pub const SIGNUP_SECRET_HEADER: &str = "X-Signup-Secret"; pub struct Client { endpoint: Url, - client: HttpClient, + client: http::Client, is_default_endpoint: bool, auth_cookie: Option, worker_key: Option, @@ -26,7 +24,9 @@ pub struct Client { impl Client { pub fn new(config: ConfigFile, endpoint: Option) -> Result { let (endpoint, auth_cookie, is_default_endpoint) = if let Some(endpoint) = endpoint { - let cookie = config.endpoints.get(&endpoint) + let cookie = config + .endpoints + .get(&endpoint) .map(|e| e.cookie.to_string()); (endpoint, cookie, false) } else if let Some(endpoint) = config.http.endpoint { @@ -35,15 +35,18 @@ impl Client { ("http://127.0.0.1:8484".to_string(), None, true) }; - let mut endpoint = endpoint.parse::() + let mut endpoint = endpoint + .parse::() .with_context(|| anyhow!("Failed to parse endpoint as url: {:?}", endpoint))?; // If the url ends with a slash, remove it - endpoint.path_segments_mut().map_err(|_| anyhow!("Given endpoint url cannot be base"))? + endpoint + .path_segments_mut() + .map_err(|_| anyhow!("Given endpoint url cannot be base"))? .pop_if_empty(); debug!("Setting rebuilderd endpoint to {:?}", endpoint.as_str()); - let client = HttpClient::new(); + let client = http::client()?; Ok(Client { endpoint, client, @@ -57,12 +60,11 @@ impl Client { pub fn with_auth_cookie(&mut self) -> Result<&mut Self> { if let Ok(cookie_path) = env::var("REBUILDERD_COOKIE_PATH") { debug!("Found cookie path in environment: {:?}", cookie_path); - let auth_cookie = auth::read_cookie_from_file(cookie_path) - .context("Failed to load auth cookie")?; + let auth_cookie = + auth::read_cookie_from_file(cookie_path).context("Failed to load auth cookie")?; Ok(self.auth_cookie(auth_cookie)) } else if self.is_default_endpoint { - let auth_cookie = auth::find_auth_cookie() - .context("Failed to load auth cookie")?; + let auth_cookie = auth::find_auth_cookie().context("Failed to load auth cookie")?; Ok(self.auth_cookie(auth_cookie)) } else { Ok(self) @@ -94,7 +96,7 @@ impl Client { url } - pub fn get(&self, path: Cow<'static,str>) -> RequestBuilder { + pub fn get(&self, path: Cow<'static, str>) -> http::RequestBuilder { let mut req = self.client.get(self.url_join(&path)); if let Some(auth_cookie) = &self.auth_cookie { req = req.header(AUTH_COOKIE_HEADER, auth_cookie); @@ -108,7 +110,7 @@ impl Client { req } - pub fn post(&self, path: Cow<'static, str>) -> RequestBuilder { + pub fn post(&self, path: Cow<'static, str>) -> http::RequestBuilder { let mut req = self.client.post(self.url_join(&path)); if let Some(auth_cookie) = &self.auth_cookie { req = req.header(AUTH_COOKIE_HEADER, auth_cookie); @@ -123,7 +125,8 @@ impl Client { } pub async fn list_workers(&self) -> Result> { - let workers = self.get(Cow::Borrowed("api/v0/workers")) + let workers = self + .get(Cow::Borrowed("api/v0/workers")) .send() .await? .error_for_status()? @@ -143,7 +146,8 @@ impl Client { } pub async fn list_pkgs(&self, list: &ListPkgs) -> Result> { - let pkgs = self.get(Cow::Borrowed("api/v0/pkgs/list")) + let pkgs = self + .get(Cow::Borrowed("api/v0/pkgs/list")) .query(list) .send() .await? @@ -160,7 +164,8 @@ impl Client { bail!("Filter matched too many packages: {}", pkgs.len()); } - let pkg = pkgs.into_iter() + let pkg = pkgs + .into_iter() .next() .context("Filter didn't match any packages on this rebuilder")?; @@ -168,7 +173,8 @@ impl Client { } pub async fn fetch_log(&self, id: i32) -> Result> { - let log = self.get(Cow::Owned(format!("api/v0/builds/{}/log", id))) + let log = self + .get(Cow::Owned(format!("api/v0/builds/{}/log", id))) .send() .await? .error_for_status()? @@ -178,7 +184,8 @@ impl Client { } pub async fn fetch_diffoscope(&self, id: i32) -> Result> { - let log = self.get(Cow::Owned(format!("api/v0/builds/{}/diffoscope", id))) + let log = self + .get(Cow::Owned(format!("api/v0/builds/{}/diffoscope", id))) .send() .await? .error_for_status()? @@ -188,7 +195,8 @@ impl Client { } pub async fn fetch_attestation(&self, id: i32) -> Result> { - let attestation = self.get(Cow::Owned(format!("api/v0/builds/{}/attestation", id))) + let attestation = self + .get(Cow::Owned(format!("api/v0/builds/{}/attestation", id))) .send() .await? .error_for_status()? @@ -198,7 +206,8 @@ impl Client { } pub async fn list_queue(&self, list: &ListQueue) -> Result { - let pkgs = self.post(Cow::Borrowed("api/v0/queue/list")) + let pkgs = self + .post(Cow::Borrowed("api/v0/queue/list")) .json(list) .send() .await? @@ -220,7 +229,8 @@ impl Client { } pub async fn pop_queue(&self, query: &WorkQuery) -> Result { - let assignment = self.post(Cow::Borrowed("api/v0/queue/pop")) + let assignment = self + .post(Cow::Borrowed("api/v0/queue/pop")) .json(query) .send() .await? @@ -427,25 +437,41 @@ mod tests { #[test] fn test_endpoint_format_example_com() { - let client = Client::new(ConfigFile::default(), Some("https://example.com".into())).unwrap(); + let client = + Client::new(ConfigFile::default(), Some("https://example.com".into())).unwrap(); assert_eq!(client.endpoint, "https://example.com".parse().unwrap()); } #[test] fn test_endpoint_format_example_com_trailing_slash() { - let client = Client::new(ConfigFile::default(), Some("https://example.com/".into())).unwrap(); + let client = + Client::new(ConfigFile::default(), Some("https://example.com/".into())).unwrap(); assert_eq!(client.endpoint, "https://example.com".parse().unwrap()); } #[test] fn test_endpoint_format_example_com_with_path() { - let client = Client::new(ConfigFile::default(), Some("https://example.com/re/build".into())).unwrap(); - assert_eq!(client.endpoint, "https://example.com/re/build".parse().unwrap()); + let client = Client::new( + ConfigFile::default(), + Some("https://example.com/re/build".into()), + ) + .unwrap(); + assert_eq!( + client.endpoint, + "https://example.com/re/build".parse().unwrap() + ); } #[test] fn test_endpoint_format_example_com_with_path_trailing_slash() { - let client = Client::new(ConfigFile::default(), Some("https://example.com/re/build/".into())).unwrap(); - assert_eq!(client.endpoint, "https://example.com/re/build".parse().unwrap()); + let client = Client::new( + ConfigFile::default(), + Some("https://example.com/re/build/".into()), + ) + .unwrap(); + assert_eq!( + client.endpoint, + "https://example.com/re/build".parse().unwrap() + ); } } diff --git a/common/src/config.rs b/common/src/config.rs index 51fd227..d9bb420 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -27,8 +27,7 @@ pub fn load>(path: Option

) -> Result { } if let Some(path) = path { - let c = load_from(path)? - .ok_or_else(|| format_err!("Failed to read config file"))?; + let c = load_from(path)?.ok_or_else(|| format_err!("Failed to read config file"))?; config.update(c); } @@ -36,16 +35,15 @@ pub fn load>(path: Option

) -> Result { } fn config_path() -> Result { - let config_dir = dirs_next::config_dir() - .ok_or_else(|| format_err!("Failed to find config dir"))?; + let config_dir = + dirs_next::config_dir().ok_or_else(|| format_err!("Failed to find config dir"))?; Ok(config_dir.join("rebuilderd.conf")) } fn load_from>(path: P) -> Result> { if let Ok(buf) = fs::read_to_string(path.as_ref()) { debug!("loading config file {:?}", path.as_ref()); - let config = toml::from_str(&buf) - .context("Failed to load config")?; + let config = toml::from_str(&buf).context("Failed to load config")?; Ok(Some(config)) } else { Ok(None) diff --git a/common/src/errors.rs b/common/src/errors.rs index d694491..c448297 100644 --- a/common/src/errors.rs +++ b/common/src/errors.rs @@ -1,2 +1,2 @@ -pub use log::{trace, debug, info, warn, error}; -pub use anyhow::{Error, Context, Result, anyhow, format_err, bail}; +pub use anyhow::{anyhow, bail, format_err, Context, Error, Result}; +pub use log::{debug, error, info, trace, warn}; diff --git a/common/src/http.rs b/common/src/http.rs new file mode 100644 index 0000000..22cb5d0 --- /dev/null +++ b/common/src/http.rs @@ -0,0 +1,10 @@ +use crate::errors::*; +pub use reqwest::{Client, RequestBuilder}; +use std::time::Duration; + +pub fn client() -> Result { + Client::builder() + .read_timeout(Duration::from_secs(60)) + .build() + .map_err(Error::from) +} diff --git a/common/src/lib.rs b/common/src/lib.rs index 98d56f4..3c4755d 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,7 +1,7 @@ use crate::errors::*; -use colored::*; use chrono::NaiveDateTime; -use serde::{Serialize, Deserialize}; +use colored::*; +use serde::{Deserialize, Serialize}; use std::iter::FromIterator; use std::ops::Deref; use std::str::FromStr; @@ -10,6 +10,7 @@ pub mod api; pub mod auth; pub mod config; pub mod errors; +pub mod http; pub mod utils; #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] @@ -28,7 +29,14 @@ pub struct PkgRelease { } impl PkgRelease { - pub fn new(name: String, version: String, distro: String, suite: String, architecture: String, artifact_url: String) -> PkgRelease { + pub fn new( + name: String, + version: String, + distro: String, + suite: String, + architecture: String, + artifact_url: String, + ) -> PkgRelease { PkgRelease { name, version, @@ -66,7 +74,14 @@ pub struct PkgArtifact { } impl PkgGroup { - pub fn new(name: String, version: String, distro: String, suite: String, architecture: String, input_url: Option) -> PkgGroup { + pub fn new( + name: String, + version: String, + distro: String, + suite: String, + architecture: String, + input_url: Option, + ) -> PkgGroup { PkgGroup { name, version, @@ -113,8 +128,8 @@ pub enum Status { impl Status { pub fn fancy(&self) -> String { match self { - Status::Good => "GOOD ".green().to_string(), - Status::Bad => "BAD ".red().to_string(), + Status::Good => "GOOD ".green().to_string(), + Status::Bad => "BAD ".red().to_string(), Status::Unknown => "UNKWN".yellow().to_string(), } } @@ -125,8 +140,8 @@ impl Deref for Status { fn deref(&self) -> &'static str { match self { - Status::Good => "GOOD", - Status::Bad => "BAD", + Status::Good => "GOOD", + Status::Bad => "BAD", Status::Unknown => "UNKWN", } } diff --git a/common/src/utils.rs b/common/src/utils.rs index 0c3bd63..09d0896 100644 --- a/common/src/utils.rs +++ b/common/src/utils.rs @@ -58,7 +58,7 @@ mod tests { #[test] fn test_secs_to_human_12h_10m_30s() { - let x = secs_to_human(3600*12 + 600 + 30); + let x = secs_to_human(3600 * 12 + 600 + 30); assert_eq!(x, "12h 10m 30s"); } diff --git a/docs/setup-tails.md b/docs/setup-tails.md index 35aef4c..6ce817c 100644 --- a/docs/setup-tails.md +++ b/docs/setup-tails.md @@ -42,7 +42,7 @@ rust and compile rebuilderd from source: ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env -sudo apt install liblzma-dev pkg-config libzstd-dev libsqlite3-dev gcc libssl-dev +sudo apt install liblzma-dev pkg-config libzstd-dev libsqlite3-dev gcc git clone https://github.com/kpcyrd/rebuilderd cd rebuilderd make diff --git a/tools/Cargo.toml b/tools/Cargo.toml index abf4689..a53deeb 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -29,7 +29,6 @@ glob = "0.3.0" nom = "7.1.1" rebuilderd-common = { version= "=0.21.0", path="../common" } regex = "1.5.6" -reqwest = { version="0.12", features=["json"] } serde = { version="1.0.137", features=["derive"] } serde_json = "1.0.81" tar = "0.4.38" diff --git a/tools/src/main.rs b/tools/src/main.rs index d064ba0..a979d75 100644 --- a/tools/src/main.rs +++ b/tools/src/main.rs @@ -6,6 +6,7 @@ use env_logger::Env; use glob::Pattern; use rebuilderd_common::api::*; use rebuilderd_common::errors::*; +use rebuilderd_common::http; use rebuilderd_common::utils; use serde::Serialize; use std::borrow::Cow; @@ -43,10 +44,11 @@ pub async fn sync(client: &Client, sync: PkgsSync) -> Result<()> { sync.distro.as_str() }; + let http = http::client()?; let mut pkgs = match method { - "archlinux" => schedule::archlinux::sync(&sync).await?, - "debian" => schedule::debian::sync(&sync).await?, - "tails" => schedule::tails::sync(&sync).await?, + "archlinux" => schedule::archlinux::sync(&http, &sync).await?, + "debian" => schedule::debian::sync(&http, &sync).await?, + "tails" => schedule::tails::sync(&http, &sync).await?, unknown => bail!("No integrated sync for {:?}, use --sync-method or `pkgs sync-stdin` instead", unknown), }; pkgs.sort_by(|a, b| a.name.cmp(&b.name)); diff --git a/tools/src/schedule/archlinux.rs b/tools/src/schedule/archlinux.rs index a74219b..af5f127 100644 --- a/tools/src/schedule/archlinux.rs +++ b/tools/src/schedule/archlinux.rs @@ -4,6 +4,7 @@ use crate::schedule::{Pkg, fetch_url_or_path}; use nom::bytes::complete::take_till; use rebuilderd_common::{PkgGroup, PkgArtifact}; use rebuilderd_common::errors::*; +use rebuilderd_common::http; use std::collections::HashMap; use std::convert::TryInto; use std::io::prelude::*; @@ -124,7 +125,7 @@ pub fn extract_pkgs(bytes: &[u8]) -> Result> { Ok(pkgs) } -pub async fn sync(sync: &PkgsSync) -> Result> { +pub async fn sync(http: &http::Client, sync: &PkgsSync) -> Result> { let source = if sync.source.ends_with(".db") { warn!("Detected legacy configuration for source, use the new format instead: https://mirrors.kernel.org/archlinux/$repo/os/$arch"); "https://mirrors.kernel.org/archlinux/$repo/os/$arch" @@ -132,13 +133,11 @@ pub async fn sync(sync: &PkgsSync) -> Result> { &sync.source }; - let client = reqwest::Client::new(); - let mut bases: HashMap<_, PkgGroup> = HashMap::new(); for arch in &sync.architectures { let db = mirror_to_url(source, &sync.suite, arch, &format!("{}.db", sync.suite))?; - let bytes = fetch_url_or_path(&client, &db) + let bytes = fetch_url_or_path(http, &db) .await?; info!("Parsing index ({} bytes)...", bytes.len()); diff --git a/tools/src/schedule/debian.rs b/tools/src/schedule/debian.rs index 8bbfd30..251b1b9 100644 --- a/tools/src/schedule/debian.rs +++ b/tools/src/schedule/debian.rs @@ -3,19 +3,13 @@ use crate::schedule::{Pkg, fetch_url_or_path}; use xz2::read::XzDecoder; use rebuilderd_common::{PkgGroup, PkgArtifact}; use rebuilderd_common::errors::*; +use rebuilderd_common::http; use std::collections::HashMap; use std::io::BufReader; use std::io::prelude::*; pub const BIN_NMU_PREFIX: &str = "+b"; -// TODO: support more archs -pub fn any_architectures() -> Vec { - vec![ - String::from("amd64"), - ] -} - #[derive(Debug, Default)] pub struct SourcePkgBucket { pkgs: HashMap>, @@ -330,9 +324,7 @@ impl SyncState { } } -pub async fn sync(sync: &PkgsSync) -> Result> { - let client = reqwest::Client::new(); - +pub async fn sync(http: &http::Client, sync: &PkgsSync) -> Result> { if sync.releases.len() > 1 { bail!("Tracking multiple releases in the same rebuilder is currently unsupported"); } @@ -345,7 +337,7 @@ pub async fn sync(sync: &PkgsSync) -> Result> { // Downloading source package index let db_url = format!("{}/dists/{}/{}/source/Sources.xz", sync.source, release, sync.suite); - let bytes = fetch_url_or_path(&client, &db_url) + let bytes = fetch_url_or_path(http, &db_url) .await?; info!("Building map of all source packages"); @@ -358,7 +350,7 @@ pub async fn sync(sync: &PkgsSync) -> Result> { // Downloading binary package index let db_url = format!("{}/dists/{}/{}/binary-{}/Packages.xz", sync.source, release, sync.suite, arch); - let bytes = fetch_url_or_path(&client, &db_url) + let bytes = fetch_url_or_path(http, &db_url) .await?; for pkg in extract_pkg::(&bytes)? { diff --git a/tools/src/schedule/mod.rs b/tools/src/schedule/mod.rs index cb0ff54..8d76471 100644 --- a/tools/src/schedule/mod.rs +++ b/tools/src/schedule/mod.rs @@ -1,10 +1,10 @@ use crate::args::PkgsSync; use glob::Pattern; use rebuilderd_common::errors::*; -use reqwest::Client; +use rebuilderd_common::http; use std::fs; -pub async fn fetch_url_or_path(client: &Client, path: &str) -> Result> { +pub async fn fetch_url_or_path(client: &http::Client, path: &str) -> Result> { let bytes = if path.starts_with("https://") || path.starts_with("http://") { info!("Downloading {:?}...", path); client.get(path) diff --git a/tools/src/schedule/tails.rs b/tools/src/schedule/tails.rs index bd2e505..c6c23ca 100644 --- a/tools/src/schedule/tails.rs +++ b/tools/src/schedule/tails.rs @@ -2,11 +2,10 @@ use crate::args::PkgsSync; use url::Url; use rebuilderd_common::{PkgGroup, PkgArtifact}; use rebuilderd_common::errors::*; +use rebuilderd_common::http; use regex::Regex; -pub async fn sync(sync: &PkgsSync) -> Result> { - let client = reqwest::Client::new(); - +pub async fn sync(http: &http::Client, sync: &PkgsSync) -> Result> { let source = sync.source.parse::() .context("Failed to parse source as url")?; @@ -16,7 +15,7 @@ pub async fn sync(sync: &PkgsSync) -> Result> { .push(&sync.suite); info!("Downloading directory list from {}", url); - let directory_list = client.get(url) + let directory_list = http.get(url) .send() .await? .error_for_status()? diff --git a/worker/Cargo.toml b/worker/Cargo.toml index 99e0d4f..6b03fed 100644 --- a/worker/Cargo.toml +++ b/worker/Cargo.toml @@ -27,7 +27,6 @@ futures-util = "0.3.21" in-toto = "0.3" nix = { version = "0.29", features = ["process", "signal"] } rebuilderd-common = { version= "=0.21.0", path="../common" } -reqwest = { version="0.12", features = ["stream"] } serde = { version="1.0.137", features=["derive"] } serde_json = "1.0.81" tempfile = "3.3.0" diff --git a/worker/Dockerfile.alpine b/worker/Dockerfile.alpine index 847155b..7594d8e 100644 --- a/worker/Dockerfile.alpine +++ b/worker/Dockerfile.alpine @@ -1,7 +1,7 @@ FROM rust:alpine3.18 ENV RUSTFLAGS="-C target-feature=-crt-static" WORKDIR /usr/src/rebuilderd -RUN apk add --no-cache musl-dev openssl-dev pkgconfig +RUN apk add --no-cache musl-dev pkgconfig COPY . . RUN --mount=type=cache,target=/var/cache/buildkit \ CARGO_HOME=/var/cache/buildkit/cargo \ @@ -10,7 +10,7 @@ RUN --mount=type=cache,target=/var/cache/buildkit \ cp -v /var/cache/buildkit/alpine/target/release/rebuilderd-worker / FROM alpine:3.18 -RUN apk add --no-cache libgcc openssl +RUN apk add --no-cache libgcc COPY --from=0 /rebuilderd-worker /usr/local/bin/ ENV REBUILDERD_WORKER_BACKEND=alpine=/usr/local/libexec/rebuilderd/rebuilder-alpine.sh ENTRYPOINT ["rebuilderd-worker"] diff --git a/worker/Dockerfile.archlinux b/worker/Dockerfile.archlinux index 2a38f6e..3f25013 100644 --- a/worker/Dockerfile.archlinux +++ b/worker/Dockerfile.archlinux @@ -1,6 +1,6 @@ FROM archlinux WORKDIR /usr/src/rebuilderd -RUN pacman -Suy --noconfirm gcc pkgconf cargo openssl +RUN pacman -Suy --noconfirm gcc pkgconf cargo COPY . . RUN --mount=type=cache,target=/var/cache/buildkit \ CARGO_HOME=/var/cache/buildkit/cargo \ @@ -9,7 +9,7 @@ RUN --mount=type=cache,target=/var/cache/buildkit \ cp -v /var/cache/buildkit/archlinux/target/release/rebuilderd-worker / FROM archlinux -RUN pacman -Suy --noconfirm archlinux-repro openssl +RUN pacman -Suy --noconfirm archlinux-repro COPY --from=0 \ /usr/src/rebuilderd/worker/rebuilder-archlinux.sh \ /usr/local/libexec/rebuilderd/ diff --git a/worker/Dockerfile.debian b/worker/Dockerfile.debian index 015796d..788d0bc 100644 --- a/worker/Dockerfile.debian +++ b/worker/Dockerfile.debian @@ -1,6 +1,5 @@ FROM rust:bullseye WORKDIR /usr/src/rebuilderd -RUN apt-get update && apt-get install -y libssl-dev COPY . . RUN --mount=type=cache,target=/var/cache/buildkit \ CARGO_HOME=/var/cache/buildkit/cargo \ @@ -9,7 +8,7 @@ RUN --mount=type=cache,target=/var/cache/buildkit \ cp -v /var/cache/buildkit/debian/target/release/rebuilderd-worker / FROM debian:bullseye -RUN apt-get update && apt install -y libssl-dev git mmdebstrap diffoscope \ +RUN apt-get update && apt install -y git mmdebstrap diffoscope \ python3-apt python3-dateutil python3-requests python3-rstr python3-setuptools python3-httpx python3-tenacity \ debian-keyring debian-archive-keyring debian-ports-archive-keyring # this is a temporary solution diff --git a/worker/Dockerfile.tails b/worker/Dockerfile.tails index 611965d..8848739 100644 --- a/worker/Dockerfile.tails +++ b/worker/Dockerfile.tails @@ -1,6 +1,5 @@ FROM rust:bullseye WORKDIR /usr/src/rebuilderd -RUN apt-get update && apt-get install -y libssl-dev COPY . . RUN --mount=type=cache,target=/var/cache/buildkit \ CARGO_HOME=/var/cache/buildkit/cargo \ @@ -9,7 +8,7 @@ RUN --mount=type=cache,target=/var/cache/buildkit \ cp -v /var/cache/buildkit/debian/target/release/rebuilderd-worker / FROM debian:bullseye -RUN apt-get update && apt-get install -y libssl1.1 dpkg-dev sudo \ +RUN apt-get update && apt-get install -y dpkg-dev sudo \ psmisc git rake libvirt-daemon-system dnsmasq-base ebtables faketime pigz qemu-system-x86 qemu-utils vagrant vagrant-libvirt vmdb2 COPY --from=0 \ /usr/src/rebuilderd/worker/rebuilder-tails.sh \ diff --git a/worker/src/download.rs b/worker/src/download.rs index 90fe05f..1b2c5b5 100644 --- a/worker/src/download.rs +++ b/worker/src/download.rs @@ -1,5 +1,6 @@ use futures_util::StreamExt; use rebuilderd_common::errors::*; +use rebuilderd_common::http; use std::path::{Path, PathBuf}; use tokio::fs::File; use tokio::io::AsyncWriteExt; @@ -21,7 +22,7 @@ pub async fn download(url_str: &str, path: &Path) -> Result { let target = path.join(&filename); info!("Downloading {:?} to {:?}", url_str, target); - let client = reqwest::Client::new(); + let client = http::client()?; let mut stream = client.get(url) .send() .await?