diff --git a/.clippy.toml b/.clippy.toml index ea0d9fbbb..d473696d3 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,4 +1,4 @@ -msrv = "1.66.0" # MSRV +msrv = "1.67.1" # MSRV warn-on-all-wildcard-imports = true allow-expect-in-tests = true allow-unwrap-in-tests = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f675254a9..f7e0ad637 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: - name: No-default features run: cargo test --workspace --no-default-features msrv: - name: "Check MSRV: 1.66.0" + name: "Check MSRV: 1.67.0" runs-on: ubuntu-latest steps: - name: Checkout repository @@ -57,7 +57,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.66.0 # MSRV + toolchain: 1.67.1 # MSRV - uses: Swatinem/rust-cache@v2 - name: Default features run: cargo check --workspace --all-targets @@ -107,7 +107,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.66.0 # MSRV + toolchain: 1.67.1 # MSRV components: clippy - uses: Swatinem/rust-cache@v2 - name: Install SARIF tools diff --git a/Cargo.lock b/Cargo.lock index dc07a0b57..1b6122da7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -96,6 +105,19 @@ dependencies = [ "tempfile", ] +[[package]] +name = "async-compression" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + [[package]] name = "atty" version = "0.2.14" @@ -113,12 +135,33 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base16ct" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + [[package]] name = "base64ct" version = "1.6.0" @@ -158,6 +201,12 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + [[package]] name = "camino" version = "1.1.4" @@ -189,7 +238,6 @@ dependencies = [ "clap", "clap-cargo", "concolor-control", - "crates-index", "difflib", "dirs-next", "dunce", @@ -206,9 +254,11 @@ dependencies = [ "predicates", "quick-error", "regex", + "reqwest", "semver", "serde", "snapbox", + "tame-index", "termcolor", "time", "toml", @@ -415,27 +465,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crates-index" -version = "0.19.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65aa5fcd68f892b56202f15a18a53308b2d489b728958dbce48d2d1f3bbaa685" -dependencies = [ - "git2", - "hex", - "home", - "memchr", - "num_cpus", - "rayon", - "rustc-hash", - "semver", - "serde", - "serde_derive", - "serde_json", - "smol_str", - "toml", -] - [[package]] name = "crates-io" version = "0.36.1" @@ -540,7 +569,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "socket2", + "socket2 0.4.9", "winapi", ] @@ -570,6 +599,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + [[package]] name = "difflib" version = "0.4.0" @@ -671,6 +706,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_logger" version = "0.10.0" @@ -777,6 +821,66 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -801,6 +905,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + [[package]] name = "git-conventional" version = "0.12.3" @@ -868,6 +978,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -909,9 +1038,6 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hkdf" @@ -940,6 +1066,40 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + [[package]] name = "humantime" version = "2.1.0" @@ -956,6 +1116,44 @@ dependencies = [ "serde", ] +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + [[package]] name = "idna" version = "0.3.0" @@ -1013,6 +1211,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + [[package]] name = "is-terminal" version = "0.4.7" @@ -1066,9 +1270,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libgit2-sys" @@ -1143,6 +1347,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1152,6 +1362,17 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "miow" version = "0.5.0" @@ -1186,6 +1407,15 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.17.2" @@ -1200,9 +1430,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.26.0+1.1.1u" +version = "111.27.0+1.1.1v" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efc62c9f12b22b8f5208c23a7200a442b2e5999f8bdf80233852122b5a4f6f37" +checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" dependencies = [ "cc", ] @@ -1289,6 +1519,18 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project-lite" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.10.2" @@ -1452,6 +1694,47 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +[[package]] +name = "reqwest" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20b9b67e2ca7dd9e9f9285b759de30ff538aab981abaaf7bc9bd90b84a0126c3" +dependencies = [ + "async-compression", + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -1463,10 +1746,25 @@ dependencies = [ ] [[package]] -name = "rustc-hash" -version = "1.1.0" +name = "ring" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" @@ -1482,6 +1780,37 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustls" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.13" @@ -1512,6 +1841,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "sec1" version = "0.7.2" @@ -1575,6 +1914,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.10.6" @@ -1614,6 +1965,15 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + [[package]] name = "smol_str" version = "0.2.0" @@ -1664,6 +2024,22 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spki" version = "0.7.2" @@ -1674,6 +2050,12 @@ dependencies = [ "der", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.10.0" @@ -1697,6 +2079,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tame-index" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1289c3fa1251d5433fdbbe927f744a9465f9fb418465e45cef4255f7272dea" +dependencies = [ + "camino", + "home", + "http", + "memchr", + "reqwest", + "semver", + "serde", + "serde_json", + "smol_str", + "thiserror", + "toml", + "twox-hash", +] + [[package]] name = "tar" version = "0.4.38" @@ -1777,10 +2179,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "a79d09ac6b08c1ab3906a2f7cc2e81a0e27c7ae89c63812df75e52bef0751e07" dependencies = [ + "deranged", "itoa", "serde", "time-core", @@ -1795,9 +2198,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "75c65469ed6b3a4809d987a41eb1dc918e9bc1d92211cbad7ae82931846f7451" dependencies = [ "time-core", ] @@ -1817,6 +2220,46 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2 0.5.3", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.7.4" @@ -1851,6 +2294,38 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "trycmd" version = "0.14.16" @@ -1867,6 +2342,16 @@ dependencies = [ "toml_edit", ] +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "typenum" version = "1.16.0" @@ -1903,6 +2388,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -1951,6 +2442,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1982,6 +2482,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.86" @@ -2011,6 +2523,22 @@ version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +[[package]] +name = "web-sys" +version = "0.3.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + [[package]] name = "winapi" version = "0.3.9" @@ -2198,6 +2726,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "zeroize" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index f8d0a70c1..41d1f2436 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ resolver = "2" [workspace.package] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.66.0" # MSRV +rust-version = "1.67.1" # MSRV include = [ "build.rs", "src/**/*", @@ -13,7 +13,7 @@ include = [ "LICENSE*", "README.md", "benches/**/*", - "examples/**/*" + "examples/**/*", ] [package] @@ -35,12 +35,12 @@ rustdoc-args = ["--cfg", "docsrs"] [package.metadata.release] pre-release-replacements = [ - {file="README.md", search="Current release: [a-z0-9\\.-]+", replace="Current release: {{version}}"} , - {file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1}, - {file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1}, - {file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1}, - {file="CHANGELOG.md", search="", replace="\n## [Unreleased] - ReleaseDate\n", exactly=1}, - {file="CHANGELOG.md", search="", replace="\n[Unreleased]: https://github.com/crate-ci/cargo-release/compare/{{tag_name}}...HEAD", exactly=1}, + { file = "README.md", search = "Current release: [a-z0-9\\.-]+", replace = "Current release: {{version}}" }, + { file = "CHANGELOG.md", search = "Unreleased", replace = "{{version}}", min = 1 }, + { file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}", exactly = 1 }, + { file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}", min = 1 }, + { file = "CHANGELOG.md", search = "", replace = "\n## [Unreleased] - ReleaseDate\n", exactly = 1 }, + { file = "CHANGELOG.md", search = "", replace = "\n[Unreleased]: https://github.com/crate-ci/cargo-release/compare/{{tag_name}}...HEAD", exactly = 1 }, ] [features] @@ -59,7 +59,7 @@ vendored-openssl = ["git2/vendored-openssl"] [dependencies] cargo_metadata = "0.15" -crates-index = "0.19" +tame-index = "0.5" git2 = { version = "0.17.2", default-features = false } toml_edit = "0.19.10" toml = "0.7.4" @@ -88,6 +88,11 @@ anyhow = "1.0.71" concolor-control = { version = "0.0.7", features = ["auto"] } git-conventional = "0.12.3" +[dependencies.reqwest] +version = "0.11" +default-features = false +features = ["blocking", "rustls-tls", "gzip"] + [dev-dependencies] assert_fs = "1.0" predicates = "3.0" diff --git a/src/error.rs b/src/error.rs index 6d5dccd66..f7b68ee1d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -31,7 +31,8 @@ process_error_from!(anyhow::Error); process_error_from!(std::io::Error); process_error_from!(semver::Error); process_error_from!(ignore::Error); -process_error_from!(crates_index::Error); +process_error_from!(tame_index::Error); +process_error_from!(reqwest::Error); process_error_from!(cargo_metadata::Error); process_error_from!(toml::ser::Error); process_error_from!(toml_edit::ser::Error); diff --git a/src/ops/cargo.rs b/src/ops/cargo.rs index 1d8356868..8a13b5c77 100644 --- a/src/ops/cargo.rs +++ b/src/ops/cargo.rs @@ -111,7 +111,7 @@ pub fn publish( } pub fn wait_for_publish( - index: &mut crates_index::Index, + index: &mut crate::steps::index::CratesIoIndex, name: &str, version: &str, timeout: std::time::Duration, @@ -122,9 +122,6 @@ pub fn wait_for_publish( let sleep_time = std::time::Duration::from_secs(1); let mut logged = false; loop { - if let Err(e) = index.update() { - log::debug!("crate index update failed with {}", e); - } if is_published(index, name, version) { break; } else if timeout < now.elapsed() { @@ -145,12 +142,21 @@ pub fn wait_for_publish( Ok(()) } -pub fn is_published(index: &crates_index::Index, name: &str, version: &str) -> bool { - let crate_data = index.crate_(name); - crate_data - .iter() - .flat_map(|c| c.versions().iter()) - .any(|v| v.version() == version) +pub fn is_published( + index: &mut crate::steps::index::CratesIoIndex, + name: &str, + version: &str, +) -> bool { + match index.has_krate_version(name, version) { + Ok(has_krate_version) => has_krate_version.unwrap_or(false), + Err(err) => { + // For both http and git indices, this _might_ be an error that goes away in + // a future call, but at least printing out something should give the user + // an indication something is amiss + log::warn!("failed to read metadata for {name}: {err:#}"); + false + } + } } pub fn set_workspace_version( diff --git a/src/steps/hook.rs b/src/steps/hook.rs index 744896961..44d10b267 100644 --- a/src/steps/hook.rs +++ b/src/steps/hook.rs @@ -47,7 +47,7 @@ pub struct HookStep { impl HookStep { pub fn run(&self) -> Result<(), CliError> { git::git_version()?; - let index = crates_index::Index::new_cargo_default()?; + let mut index = crate::steps::index::CratesIoIndex::open()?; if self.dry_run { let _ = @@ -87,7 +87,7 @@ impl HookStep { { let version = &pkg.initial_version; if !crate::ops::cargo::is_published( - &index, + &mut index, crate_name, &version.full_version_string, ) { diff --git a/src/steps/index.rs b/src/steps/index.rs new file mode 100644 index 000000000..a1dacd350 --- /dev/null +++ b/src/steps/index.rs @@ -0,0 +1,75 @@ +pub struct CratesIoIndex { + index: tame_index::SparseIndex, + client: reqwest::blocking::Client, + etags: Vec<(String, String)>, +} + +impl CratesIoIndex { + #[inline] + pub(crate) fn open() -> Result { + let index = tame_index::SparseIndex::new(tame_index::IndexLocation::new( + tame_index::IndexUrl::CratesIoSparse, + ))?; + let client = reqwest::blocking::ClientBuilder::new() + .http2_prior_knowledge() + .build()?; + + Ok(Self { + index, + client, + etags: Vec::new(), + }) + } + + /// Determines if the specified crate exists in the crates.io index + pub(crate) fn has_krate(&mut self, name: &str) -> Result { + Ok(self.has_krate_version(name, "")?.unwrap_or(false)) + } + + /// Determines if the specified crate version exists in the crates.io index + pub(crate) fn has_krate_version( + &mut self, + name: &str, + version: &str, + ) -> Result, crate::error::CliError> { + let etag = self + .etags + .iter() + .find_map(|(krate, etag)| (krate == name).then_some(etag.as_str())) + .unwrap_or(""); + + let krate_name = name.try_into()?; + let req = self.index.make_remote_request(krate_name, Some(etag))?; + let res = self.client.execute(req.try_into()?)?; + + // Grab the etag if it exists for future requests + if let Some(etag) = res.headers().get(reqwest::header::ETAG) { + if let Ok(etag) = etag.to_str() { + if let Some(i) = self.etags.iter().position(|(krate, _)| krate == name) { + self.etags[i].1 = etag.to_owned(); + } else { + self.etags.push((name.to_owned(), etag.to_owned())); + } + } + } + + let mut builder = tame_index::external::http::Response::builder() + .status(res.status()) + .version(res.version()); + + builder + .headers_mut() + .unwrap() + .extend(res.headers().iter().map(|(k, v)| (k.clone(), v.clone()))); + + let body = res.bytes()?; + let response = builder + .body(body.to_vec()) + .map_err(|e| tame_index::Error::from(tame_index::error::HttpError::from(e)))?; + + let index_krate = self + .index + .parse_remote_response(krate_name, response, false)?; + Ok(index_krate.map(|ik| ik.versions.iter().any(|iv| iv.version == version))) + } +} diff --git a/src/steps/mod.rs b/src/steps/mod.rs index d393a821d..69506c6ad 100644 --- a/src/steps/mod.rs +++ b/src/steps/mod.rs @@ -4,6 +4,7 @@ pub mod changes; pub mod commit; pub mod config; pub mod hook; +pub mod index; pub mod owner; pub mod plan; pub mod publish; @@ -213,7 +214,7 @@ pub fn verify_monotonically_increasing( pub fn verify_rate_limit( pkgs: &[plan::PackageRelease], - index: &crates_index::Index, + index: &mut index::CratesIoIndex, dry_run: bool, level: log::Level, ) -> Result { @@ -227,7 +228,7 @@ pub fn verify_rate_limit( for pkg in pkgs { if pkg.config.registry().is_none() && pkg.config.publish() { let crate_name = pkg.meta.name.as_str(); - if index.crate_(crate_name).is_some() { + if index.has_krate(crate_name)? { existing += 1; } else { new += 1; diff --git a/src/steps/publish.rs b/src/steps/publish.rs index a839e2ed3..78a5cbda9 100644 --- a/src/steps/publish.rs +++ b/src/steps/publish.rs @@ -80,13 +80,16 @@ impl PublishStep { let mut pkgs = plan::plan(pkgs)?; - let mut index = crates_index::Index::new_cargo_default()?; + let mut index = crate::steps::index::CratesIoIndex::open()?; for pkg in pkgs.values_mut() { if pkg.config.registry().is_none() && pkg.config.release() { let crate_name = pkg.meta.name.as_str(); let version = pkg.planned_version.as_ref().unwrap_or(&pkg.initial_version); - if crate::ops::cargo::is_published(&index, crate_name, &version.full_version_string) - { + if crate::ops::cargo::is_published( + &mut index, + crate_name, + &version.full_version_string, + ) { let _ = crate::ops::shell::warn(format!( "disabled due to previous publish ({}), skipping {}", version.full_version_string, crate_name @@ -131,7 +134,8 @@ impl PublishStep { )?; failed |= !super::verify_metadata(&selected_pkgs, dry_run, log::Level::Error)?; - failed |= !super::verify_rate_limit(&selected_pkgs, &index, dry_run, log::Level::Error)?; + failed |= + !super::verify_rate_limit(&selected_pkgs, &mut index, dry_run, log::Level::Error)?; // STEP 1: Release Confirmation super::confirm("Publish", &selected_pkgs, self.no_confirm, dry_run)?; @@ -156,7 +160,7 @@ impl PublishStep { pub fn publish( ws_meta: &cargo_metadata::Metadata, pkgs: &[plan::PackageRelease], - index: &mut crates_index::Index, + index: &mut crate::steps::index::CratesIoIndex, dry_run: bool, ) -> Result<(), CliError> { for pkg in pkgs { diff --git a/src/steps/release.rs b/src/steps/release.rs index ecde41e4b..e0f30ef2a 100644 --- a/src/steps/release.rs +++ b/src/steps/release.rs @@ -46,7 +46,7 @@ pub struct ReleaseStep { impl ReleaseStep { pub fn run(&self) -> Result<(), CliError> { git::git_version()?; - let mut index = crates_index::Index::new_cargo_default()?; + let mut index = crate::steps::index::CratesIoIndex::open()?; if self.dry_run { let _ = @@ -73,7 +73,7 @@ impl ReleaseStep { pkg.bump(level_or_version, self.metadata.as_deref())?; } } - if index.crate_(&pkg.meta.name).is_some() { + if index.has_krate(&pkg.meta.name)? { // Already published, skip it. Use `cargo release owner` for one-time updates pkg.ensure_owners = false; } @@ -101,7 +101,7 @@ impl ReleaseStep { && !explicitly_excluded { let version = &pkg.initial_version; - if !cargo::is_published(&index, crate_name, &version.full_version_string) { + if !cargo::is_published(&mut index, crate_name, &version.full_version_string) { log::debug!( "enabled {}, v{} is unpublished", crate_name, @@ -155,7 +155,7 @@ impl ReleaseStep { if pkg.config.publish() && pkg.config.registry().is_none() { let version = pkg.planned_version.as_ref().unwrap_or(&pkg.initial_version); let crate_name = pkg.meta.name.as_str(); - if !cargo::is_published(&index, crate_name, &version.full_version_string) { + if !cargo::is_published(&mut index, crate_name, &version.full_version_string) { let _ = crate::ops::shell::warn(format!( "disabled by user, skipping {} v{} despite being unpublished", crate_name, version.full_version_string, @@ -198,7 +198,7 @@ impl ReleaseStep { if pkg.config.registry().is_none() { let version = pkg.planned_version.as_ref().unwrap_or(&pkg.initial_version); let crate_name = pkg.meta.name.as_str(); - if cargo::is_published(&index, crate_name, &version.full_version_string) { + if cargo::is_published(&mut index, crate_name, &version.full_version_string) { let _ = crate::ops::shell::error(format!( "{} {} is already published", crate_name, version.full_version_string @@ -231,7 +231,8 @@ impl ReleaseStep { )?; failed |= !super::verify_metadata(&selected_pkgs, dry_run, log::Level::Error)?; - failed |= !super::verify_rate_limit(&selected_pkgs, &index, dry_run, log::Level::Error)?; + failed |= + !super::verify_rate_limit(&selected_pkgs, &mut index, dry_run, log::Level::Error)?; // STEP 1: Release Confirmation super::confirm("Release", &selected_pkgs, self.no_confirm, dry_run)?; diff --git a/src/steps/replace.rs b/src/steps/replace.rs index a91b066c8..6a5b71cd1 100644 --- a/src/steps/replace.rs +++ b/src/steps/replace.rs @@ -43,7 +43,7 @@ pub struct ReplaceStep { impl ReplaceStep { pub fn run(&self) -> Result<(), CliError> { git::git_version()?; - let index = crates_index::Index::new_cargo_default()?; + let mut index = crate::steps::index::CratesIoIndex::open()?; if self.dry_run { let _ = @@ -83,7 +83,7 @@ impl ReplaceStep { { let version = &pkg.initial_version; if !crate::ops::cargo::is_published( - &index, + &mut index, crate_name, &version.full_version_string, ) {