diff options
| -rw-r--r-- | .github/workflows/autobot.yaml | 7 | ||||
| -rw-r--r-- | .github/workflows/ci.yaml | 6 | ||||
| -rw-r--r-- | .github/workflows/clippy.yaml | 22 | ||||
| -rw-r--r-- | .github/workflows/docker.yaml | 6 | ||||
| -rw-r--r-- | Cargo.lock | 566 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | crates/discord-bot/Cargo.toml | 10 | ||||
| -rw-r--r-- | crates/discord-bot/src/commands/track.rs | 29 | ||||
| -rw-r--r-- | crates/discord-bot/src/config.rs | 51 | ||||
| -rw-r--r-- | crates/discord-bot/src/consts.rs | 5 | ||||
| -rw-r--r-- | crates/discord-bot/src/jobs.rs | 22 | ||||
| -rw-r--r-- | crates/discord-bot/src/lib.rs | 3 | ||||
| -rw-r--r-- | crates/git-tracker/Cargo.toml | 4 | ||||
| -rw-r--r-- | crates/git-tracker/src/lib.rs | 239 | ||||
| -rw-r--r-- | crates/git-tracker/src/managed_repository.rs | 95 | ||||
| -rw-r--r-- | crates/git-tracker/src/tracker.rs | 109 | ||||
| -rw-r--r-- | crates/nixpkgs-tracker-http/Cargo.toml | 4 | ||||
| -rw-r--r-- | flake.lock | 16 | ||||
| -rw-r--r-- | flake.nix | 7 | ||||
| -rw-r--r-- | nix/package.nix | 56 | ||||
| -rw-r--r-- | nix/static.nix | 22 |
21 files changed, 649 insertions, 632 deletions
diff --git a/.github/workflows/autobot.yaml b/.github/workflows/autobot.yaml index fe92dfa..0457591 100644 --- a/.github/workflows/autobot.yaml +++ b/.github/workflows/autobot.yaml @@ -15,14 +15,15 @@ jobs: pull-requests: write steps: - - uses: dependabot/fetch-metadata@v2 + - name: Fetch metadata + uses: dependabot/fetch-metadata@v2 id: metadata with: github-token: ${{ github.token }} - name: Enable auto-merge - if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' + if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' }} run: gh pr merge --auto --squash "$PR" env: - GH_TOKEN: ${{ github.token }} PR: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 120e109..de120c0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,18 +6,20 @@ on: paths: - "**.nix" - "**.rs" - - ".github/workflows/ci.yaml" - "Cargo.lock" - "Cargo.toml" - "flake.lock" + + - ".github/workflows/ci.yaml" pull_request: paths: - "**.nix" - "**.rs" - - ".github/workflows/ci.yaml" - "Cargo.lock" - "Cargo.toml" - "flake.lock" + + - ".github/workflows/ci.yaml" workflow_dispatch: jobs: diff --git a/.github/workflows/clippy.yaml b/.github/workflows/clippy.yaml index 92677e3..31929df 100644 --- a/.github/workflows/clippy.yaml +++ b/.github/workflows/clippy.yaml @@ -3,17 +3,23 @@ name: Clippy on: push: paths: - - '**.rs' - - '.github/workflows/clippy.yaml' - - 'Cargo.lock' - - 'Cargo.toml' + - "**.rs" + - "Cargo.lock" + - "Cargo.toml" + - "flake.lock" + - "flake.nix" + + - ".github/workflows/clippy.yaml" branches: [main] pull_request: paths: - - '**.rs' - - '.github/workflows/clippy.yaml' - - 'Cargo.lock' - - 'Cargo.toml' + - "**.rs" + - "Cargo.lock" + - "Cargo.toml" + - "flake.lock" + - "flake.nix" + + - ".github/workflows/clippy.yaml" workflow_dispatch: jobs: diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 8aaf56c..a9a76d1 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -6,18 +6,20 @@ on: paths: - "**.nix" - "**.rs" - - ".github/workflows/docker.yaml" - "Cargo.lock" - "Cargo.toml" - "flake.lock" + + - ".github/workflows/docker.yaml" pull_request: paths: - "**.nix" - "**.rs" - - ".github/workflows/docker.yaml" - "Cargo.lock" - "Cargo.toml" - "flake.lock" + + - ".github/workflows/docker.yaml" workflow_dispatch: jobs: @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aho-corasick" @@ -43,9 +43,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -64,27 +64,27 @@ checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -92,22 +92,22 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" dependencies = [ "serde", ] [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] @@ -118,23 +118,23 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -157,9 +157,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -190,15 +190,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -227,13 +227,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.98" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] [[package]] @@ -257,9 +257,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "command_attr" @@ -284,15 +284,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -338,7 +338,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -402,9 +402,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" dependencies = [ "log", "regex", @@ -460,15 +460,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide", @@ -491,9 +491,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -505,9 +505,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -515,44 +515,44 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -598,9 +598,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "git-tracker" @@ -617,7 +617,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", "libgit2-sys", "log", @@ -653,9 +653,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -677,6 +677,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] name = "hermit-abi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -717,9 +723,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http 1.1.0", @@ -727,22 +733,22 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -758,9 +764,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -782,16 +788,16 @@ dependencies = [ [[package]] name = "hyper" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "httparse", "itoa", "pin-project-lite", @@ -808,7 +814,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.28", + "hyper 0.14.30", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -816,47 +822,46 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.3.1", + "hyper 1.4.1", "hyper-util", - "rustls 0.23.10", + "rustls 0.23.14", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", "tower-service", - "webpki-roots 0.26.1", + "webpki-roots 0.26.6", ] [[package]] name = "hyper-util" -version = "0.1.4" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d8d52be92d09acc2e01dddb7fde3ad983fc6489c7db4837e605bc3fca4cb63e" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.0", - "hyper 1.3.1", + "http-body 1.0.1", + "hyper 1.4.1", "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -893,25 +898,25 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.2.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.0", ] [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" @@ -921,18 +926,18 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "0cb94a0ffd3f3ee755c20f7d8752f45cac88605a4dcf808abcff72873296ec7b" dependencies = [ "wasm-bindgen", ] @@ -945,9 +950,9 @@ checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libgit2-sys" @@ -964,9 +969,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.18" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "libc", @@ -998,9 +1003,9 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1010,9 +1015,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", @@ -1035,18 +1040,18 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi", "libc", @@ -1080,18 +1085,18 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl-probe" @@ -1101,9 +1106,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -1141,26 +1146,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] name = "pin-project-lite" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1174,9 +1159,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "powerfmt" @@ -1186,15 +1171,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro2" -version = "1.0.84" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -1205,23 +1193,24 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "memchr", "unicase", ] [[package]] name = "quinn" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 1.1.0", - "rustls 0.23.10", + "rustc-hash", + "rustls 0.23.14", + "socket2", "thiserror", "tokio", "tracing", @@ -1236,8 +1225,8 @@ dependencies = [ "bytes", "rand", "ring", - "rustc-hash 2.0.0", - "rustls 0.23.10", + "rustc-hash", + "rustls 0.23.14", "slab", "thiserror", "tinyvec", @@ -1246,22 +1235,22 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" dependencies = [ "libc", "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1298,18 +1287,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", @@ -1319,9 +1308,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -1330,9 +1319,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -1348,7 +1337,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.28", + "hyper 0.14.30", "hyper-rustls 0.24.2", "ipnet", "js-sys", @@ -1389,12 +1378,12 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", - "hyper 1.3.1", - "hyper-rustls 0.27.2", + "hyper 1.4.1", + "hyper-rustls 0.27.3", "hyper-util", "ipnet", "js-sys", @@ -1404,8 +1393,8 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.10", - "rustls-pemfile 2.1.2", + "rustls 0.23.14", + "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", "serde_json", @@ -1418,7 +1407,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.1", + "webpki-roots 0.26.6", "windows-registry", ] @@ -1445,23 +1434,17 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -1489,21 +1472,21 @@ dependencies = [ "log", "ring", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] [[package]] name = "rustls" -version = "0.23.10" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] @@ -1519,19 +1502,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-webpki" @@ -1545,9 +1527,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -1615,9 +1597,9 @@ dependencies = [ [[package]] name = "serde_cow" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e84ce5596a72f0c4c60759a10ff8c22d5eaf227b0dc2789c8746193309058b" +checksum = "1e7bbbec7196bfde255ab54b65e34087c0849629280028238e67ee25d6a4b7da" dependencies = [ "serde", ] @@ -1630,16 +1612,17 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -1665,7 +1648,7 @@ dependencies = [ "arrayvec", "async-trait", "base64 0.22.1", - "bitflags 2.5.0", + "bitflags 2.6.0", "bytes", "chrono", "command_attr", @@ -1705,6 +1688,12 @@ dependencies = [ ] [[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] name = "signal-hook-registry" version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1767,9 +1756,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1784,9 +1773,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -1837,14 +1826,15 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1864,7 +1854,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] @@ -1900,9 +1890,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -1938,7 +1928,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] @@ -1968,7 +1958,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.10", + "rustls 0.23.14", "rustls-pki-types", "tokio", ] @@ -1986,14 +1976,14 @@ dependencies = [ "tokio", "tokio-rustls 0.25.0", "tungstenite", - "webpki-roots 0.26.1", + "webpki-roots 0.26.6", ] [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -2003,31 +1993,10 @@ dependencies = [ ] [[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - -[[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -2049,7 +2018,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] @@ -2063,9 +2032,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" +checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" [[package]] name = "try-lock" @@ -2108,13 +2077,13 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typesize" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb704842c709bc76f63e99e704cb208beeccca2abbabd0d9aec02e48ca1cee0f" +checksum = "5dece5c06268af6a9ff4541788601e560a4284ffebfb357f713d676f13b964db" dependencies = [ "chrono", "dashmap", - "hashbrown", + "hashbrown 0.14.5", "mini-moka", "parking_lot", "secrecy", @@ -2132,7 +2101,7 @@ checksum = "905e88c2a4cc27686bd57e495121d451f027e441388a67f773be729ad4be1ea8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] @@ -2146,21 +2115,21 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -2173,9 +2142,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -2209,9 +2178,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" @@ -2240,34 +2209,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "ef073ced962d62984fb38a36e5fdc1a2b23c9e0e1fa0689bb97afa4202ef6887" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "c4bfab14ef75323f4eb75fa52ee0a3fb59611977fd3240da19b2cf36ff85030e" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "65471f79c1022ffa5291d33520cbbb53b7687b01c2f8e83b57d102eed7ed479d" dependencies = [ "cfg-if", "js-sys", @@ -2277,9 +2247,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "a7bec9830f60924d9ceb3ef99d55c155be8afa76954edffbb5936ff4509474e7" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2287,28 +2257,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "4c74f6e152a76a2ad448e223b0fc0b6b5747649c3d769cc6bf45737bf97d0ed6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "a42f6c679374623f295a8623adfe63d9284091245c3504bde47c17a3ce2777d9" [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" dependencies = [ "futures-util", "js-sys", @@ -2319,9 +2289,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "44188d185b5bdcae1052d08bcbcf9091a5524038d4572cc4f4f2bb9d5554ddd9" dependencies = [ "js-sys", "wasm-bindgen", @@ -2335,20 +2305,20 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.1" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ "rustls-pki-types", ] [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2409,6 +2379,15 @@ dependencies = [ ] [[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2540,6 +2519,27 @@ dependencies = [ ] [[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -15,7 +15,7 @@ license = "MIT" git-tracker = { path = "./crates/git-tracker" } nixpkgs-tracker-http = { path = "./crates/nixpkgs-tracker-http" } -log = "0.4.22" +log = "0.4" [workspace.lints.rust] unsafe_code = "forbid" diff --git a/crates/discord-bot/Cargo.toml b/crates/discord-bot/Cargo.toml index e45d30e..4eff6ac 100644 --- a/crates/discord-bot/Cargo.toml +++ b/crates/discord-bot/Cargo.toml @@ -14,14 +14,14 @@ name = "nixpkgs-tracker-bot" path = "src/main.rs" [dependencies] -dotenvy = "0.15.7" -env_logger = "0.11.5" -eyre = "0.6.12" +dotenvy = "0.15" +env_logger = "0.11" +eyre = "0.6" git-tracker.workspace = true log.workspace = true nixpkgs-tracker-http.workspace = true -serenity = { version = "0.12.2", features = ["unstable_discord_api"] } -tokio = { version = "1.40.0", features = [ +serenity = { version = "0.12", features = ["unstable_discord_api"] } +tokio = { version = "1.40", features = [ "macros", "rt-multi-thread", "signal" diff --git a/crates/discord-bot/src/commands/track.rs b/crates/discord-bot/src/commands/track.rs index f071ebf..0f0e0be 100644 --- a/crates/discord-bot/src/commands/track.rs +++ b/crates/discord-bot/src/commands/track.rs @@ -1,4 +1,4 @@ -use crate::{config::Config, consts::NIXPKGS_REMOTE, http::GitHubClientExt}; +use crate::{config::Config, http::GitHubClientExt}; use std::sync::Arc; @@ -70,25 +70,18 @@ where return Ok(()); }; - let status_results = git_tracker::collect_statuses_in( - &config.nixpkgs_path, - &commit_sha, - &config.nixpkgs_branches, - )?; - - // find branches containing our PR and trim the remote ref prefix - let found_branches: Vec<String> = status_results + let repository = config.repository(); + let branch_results = repository.branches_contain_sha(config.nixpkgs_branches(), &commit_sha)?; + let fields: Vec<_> = branch_results .iter() - .filter(|&(_, has_pr)| *has_pr) - .map(|(branch_name, _)| { - // remove the ref prefix that we add in our Config struct - let start_pos = format!("{NIXPKGS_REMOTE}/").len(); - branch_name[start_pos..].to_string() + .map(|(name, has_commit)| { + let emoji = if *has_commit { "✅" } else { "❌" }; + (*name, emoji, true) }) .collect(); // if we didn't find any, bail - if found_branches.is_empty() { + if fields.is_empty() { let response = CreateInteractionResponseFollowup::new() .content("This PR has been merged...but I can't seem to find it anywhere. I might not be tracking it's base branch"); command.create_followup(&ctx, response).await?; @@ -100,11 +93,7 @@ where .title(format!("Nixpkgs PR #{} Status", pull_request.number)) .url(&pull_request.html_url) .description(&pull_request.title) - .fields( - found_branches - .iter() - .map(|branch_name| (branch_name, "✅", true)), - ); + .fields(fields); if let Some(merged_at) = pull_request.merged_at { if let Ok(timestamp) = Timestamp::parse(&merged_at) { diff --git a/crates/discord-bot/src/config.rs b/crates/discord-bot/src/config.rs index 5076eb9..afc7845 100644 --- a/crates/discord-bot/src/config.rs +++ b/crates/discord-bot/src/config.rs @@ -1,25 +1,21 @@ -use crate::consts::NIXPKGS_REMOTE; +use git_tracker::TrackedRepository; -use std::env; +use std::{env, path::PathBuf, sync::Arc}; + +const DEFAULT_NIXPKGS_URL: &str = "https://github.com/NixOS/nixpkgs"; + +const DEFAULT_NIXPKGS_REMOTE: &str = "origin"; /// The Discord client's configuration #[derive(Clone, Debug)] pub struct Config { - /// Path to clone a new or use an existing nixpkgs repository - pub nixpkgs_path: String, - // A comma separated list of nixpkgs branch to track commits for - pub nixpkgs_branches: Vec<String>, + /// Comma separated list of nixpkgs branch to track commits for + nixpkgs_branches: Vec<String>, + /// Repository tracker + repository: Arc<TrackedRepository>, } impl Config { - /// Take in a comma separated list and split it into a [`Vec<String>`] - fn split_string_list(branches: &str) -> Vec<String> { - branches - .split(',') - .map(|branch| format!("{NIXPKGS_REMOTE}/{}", branch.trim())) - .collect() - } - /// Create a new instance of [`Config`] based on variables from the environment /// /// # Errors @@ -27,12 +23,33 @@ impl Config { /// Will return [`Err`] if a variable is not found pub fn from_env() -> Result<Self, env::VarError> { let nixpkgs_path = env::var("BOT_NIXPKGS_PATH")?; - let nixpkgs_branches_raw = env::var("BOT_NIXPKGS_BRANCHES")?; - let nixpkgs_branches = Self::split_string_list(&nixpkgs_branches_raw); + + let nixpkgs_branches = env::var("BOT_NIXPKGS_BRANCHES")? + .split(',') + .map(ToString::to_string) + .collect(); + + let nixpkgs_remote = + env::var("BOT_NIXPKGS_REMOTE").unwrap_or(DEFAULT_NIXPKGS_REMOTE.to_string()); + let nixpkgs_url = env::var("BOT_NIXPKGS_URL").unwrap_or(DEFAULT_NIXPKGS_URL.to_string()); + + let repository = TrackedRepository::new( + PathBuf::from(nixpkgs_path.clone()), + nixpkgs_url, + nixpkgs_remote, + ); Ok(Self { - nixpkgs_path, nixpkgs_branches, + repository: Arc::new(repository), }) } + + pub fn repository(&self) -> &TrackedRepository { + &self.repository + } + + pub fn nixpkgs_branches(&self) -> &Vec<String> { + &self.nixpkgs_branches + } } diff --git a/crates/discord-bot/src/consts.rs b/crates/discord-bot/src/consts.rs deleted file mode 100644 index 9396da0..0000000 --- a/crates/discord-bot/src/consts.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// URL to the nixpkgs repository -pub const NIXPKGS_URL: &str = "https://github.com/NixOS/nixpkgs"; - -/// The Git remote for upstream nixpkgs in our local copy -pub const NIXPKGS_REMOTE: &str = "origin"; diff --git a/crates/discord-bot/src/jobs.rs b/crates/discord-bot/src/jobs.rs index 40d34cc..f35c471 100644 --- a/crates/discord-bot/src/jobs.rs +++ b/crates/discord-bot/src/jobs.rs @@ -1,9 +1,8 @@ -use crate::{config::Config, consts::NIXPKGS_REMOTE, consts::NIXPKGS_URL}; +use crate::config::Config; -use std::{path::Path, time::Duration}; +use std::time::Duration; use eyre::Result; -use git_tracker::ManagedRepository; use log::error; const TTL_SECS: u64 = 60 * 5; // 5 minutes @@ -13,20 +12,19 @@ const TTL_SECS: u64 = 60 * 5; // 5 minutes /// # Errors /// /// Will return [`Err`] if any jobs fail -pub fn dispatch(config: Config) -> Result<()> { - let managed_repository = ManagedRepository { - path: Path::new(&config.nixpkgs_path).to_path_buf(), - tracked_branches: config.nixpkgs_branches, - upstream_remote_url: NIXPKGS_URL.to_string(), - upstream_remote_name: NIXPKGS_REMOTE.to_string(), - }; +pub fn dispatch(config: &Config) -> Result<()> { + let repository = config.repository(); + if repository.open().is_err() { + repository.clone_repository()?; + } + repository.fetch()?; - managed_repository.fetch_or_update()?; + let repository_clone = repository.clone(); tokio::spawn(async move { loop { tokio::time::sleep(Duration::from_secs(TTL_SECS)).await; - if let Err(why) = managed_repository.fetch_or_update() { + if let Err(why) = repository_clone.fetch() { error!("Could not fetch or update repository!\n{why:?}"); }; } diff --git a/crates/discord-bot/src/lib.rs b/crates/discord-bot/src/lib.rs index 7ac2e98..3248db5 100644 --- a/crates/discord-bot/src/lib.rs +++ b/crates/discord-bot/src/lib.rs @@ -6,7 +6,6 @@ use serenity::prelude::{Client, GatewayIntents, TypeMapKey}; mod commands; mod config; -mod consts; mod handler; mod jobs; @@ -76,7 +75,7 @@ pub async fn client() -> Result<Client> { }); // run our jobs - jobs::dispatch(config)?; + jobs::dispatch(&config)?; Ok(client) } diff --git a/crates/git-tracker/Cargo.toml b/crates/git-tracker/Cargo.toml index 3027769..14af5d0 100644 --- a/crates/git-tracker/Cargo.toml +++ b/crates/git-tracker/Cargo.toml @@ -9,9 +9,9 @@ repository.workspace = true publish = false [dependencies] -git2 = { version = "0.19.0", default-features = false, features = ["https"] } +git2 = { version = "0.19", default-features = false, features = ["https"] } log.workspace = true -thiserror = "1.0.64" +thiserror = "1.0" [lints] workspace = true diff --git a/crates/git-tracker/src/lib.rs b/crates/git-tracker/src/lib.rs index 0bf17dc..e2feb32 100644 --- a/crates/git-tracker/src/lib.rs +++ b/crates/git-tracker/src/lib.rs @@ -1,35 +1,210 @@ -//! A library that helps you track commits and branches in a Git repository -use log::trace; - -mod managed_repository; -mod tracker; -pub use managed_repository::ManagedRepository; -pub use tracker::Tracker; - -/// Collect the status of the commit SHA [`commit_sha`] in each of the nixpkgs -/// branches in [`branches`], using the repository at path [`repository_path`] -/// -/// NOTE: `branches` should contain the full ref (i.e., `origin/main`) -/// -/// # Errors -/// -/// Will return [`Err`] if we can't start tracking a repository at the given path, -/// or if we can't determine if the branch has given commit -pub fn collect_statuses_in( - repository_path: &str, - commit_sha: &str, - branches: &Vec<String>, -) -> Result<Vec<(String, bool)>, tracker::Error> { - // start tracking nixpkgs - let tracker = Tracker::from_path(repository_path)?; - - // check to see what branches it's in - let mut status_results = Vec::new(); - for branch_name in branches { - trace!("Checking for commit in {branch_name}"); - let has_pr = tracker.branch_contains_sha(branch_name, commit_sha)?; - status_results.push((branch_name.to_string(), has_pr)); +//! Library for helping you track commits and branches in a Git repository +use std::path::PathBuf; + +use git2::{ + BranchType, FetchOptions, FetchPrune, Oid, Reference, RemoteCallbacks, RemoteUpdateFlags, + Repository, +}; +use log::{debug, info, trace}; + +/// Used when logging Git transfer progress +const INCREMENT_TO_LOG: i32 = 5; + +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error("libgit2 error")] + Git(#[from] git2::Error), + #[error("i/o error")] + IOError(#[from] std::io::Error), +} + +/// Helper struct for tracking Git objects +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +pub struct TrackedRepository { + /// Path to repository + path: PathBuf, + /// URL of the Git remote + remote_url: String, + /// Name of the remote referring to `remote_url` + remote_name: String, +} + +impl TrackedRepository { + #[must_use] + pub fn new(path: PathBuf, remote_url: String, remote_name: String) -> Self { + Self { + path, + remote_url, + remote_name, + } + } + + /// Open a [`Repository`] + /// + /// # Errors + /// + /// Will return [`Err`] if the repository cannot be opened + pub fn open(&self) -> Result<Repository, Error> { + trace!("Opening repository at {}", self.path.display()); + Ok(Repository::open(&self.path)?) + } + + /// Clone a (small) fresh copy of your repository + /// + /// # Errors + /// + /// Will return [`Err`] if the path, repository, or remote cannot be created + pub fn clone_repository(&self) -> Result<(), Error> { + // Setup a bare repository to save space + info!("Creating repository at {}", self.path.display()); + std::fs::create_dir_all(&self.path)?; + let repository = Repository::init_bare(&self.path)?; + + debug!("Adding remote {} for {}", self.remote_name, self.remote_url,); + repository.remote(&self.remote_name, &self.remote_url)?; + self.fetch()?; + + Ok(()) + } + + #[allow(clippy::cast_possible_truncation, clippy::cast_precision_loss)] + fn fetch_options<'a>() -> FetchOptions<'a> { + let mut rc = RemoteCallbacks::new(); + + // Log transfer progress + let mut current_percentage = 1; + rc.transfer_progress(move |stats| { + if stats.received_objects() == stats.total_objects() { + // HACK: Avoid dividing by zero + // I have no idea how this can ever be zero but ok + let total_deltas = stats.total_deltas(); + if total_deltas == 0 { + return true; + } + + let percentage = + (stats.indexed_deltas() as f32 / stats.total_deltas() as f32 * 100.0) as i32; + if percentage != current_percentage && percentage % INCREMENT_TO_LOG == 0 { + info!( + "Resolving deltas {}/{}\r", + stats.indexed_deltas(), + stats.total_deltas() + ); + current_percentage = percentage; + } + } else if stats.total_objects() > 0 { + let percentage = + (stats.received_objects() as f32 / stats.total_objects() as f32 * 100.0) as i32; + if percentage != current_percentage && percentage % INCREMENT_TO_LOG == 0 { + info!( + "Received {}/{} objects ({}) in {} bytes\r", + stats.received_objects(), + stats.total_objects(), + stats.indexed_objects(), + stats.received_bytes() + ); + current_percentage = percentage; + } + } + + true + }); + + // Log ref updates + rc.update_tips(|refname, orig_oid, new_oid| { + if orig_oid.is_zero() { + info!("[new] {:20} {}", new_oid, refname); + } else { + info!("[updated] {:10}..{:10} {}", orig_oid, new_oid, refname); + } + true + }); + + let mut fetch_options = FetchOptions::new(); + // Make sure we prune on fetch + fetch_options.prune(FetchPrune::On).remote_callbacks(rc); + + fetch_options + } + + /// Fetch the tracked remote + /// + /// # Errors + /// + /// Will return [`Err`] if the repository cannot be opened, the remote cannot be found, the + /// refs cannot be fetched, or the tips of the refs cannot be updated + pub fn fetch(&self) -> Result<(), Error> { + let repository = self.open()?; + + let mut remote = repository.find_remote(&self.remote_name)?; + + info!("Fetching repository"); + remote.download(&[] as &[&str], Some(&mut Self::fetch_options()))?; + remote.disconnect()?; + + debug!("Updating tips"); + remote.update_tips( + None, + RemoteUpdateFlags::UPDATE_FETCHHEAD, + git2::AutotagOption::None, + None, + )?; + + Ok(()) } - Ok(status_results) + /// Check if a [`Reference`] contains a given Git object + /// + /// # Errors + /// + /// Will return [`Err`] if the repository cannot be opened, HEAD cannot be resolved, or the + /// relation between commits cannot be resolved + pub fn ref_contains_object(&self, reference: &Reference, commit: Oid) -> Result<bool, Error> { + trace!( + "Checking for commit {commit} in {}", + reference.name().unwrap_or("<branch>") + ); + let repository = self.open()?; + let head = reference.peel_to_commit()?; + + // NOTE: we have to check this as `Repository::graph_descendant_of()` (like the name says) + // only finds *descendants* of it's parent commit, and will not tell us if the parent commit + // *is* the child commit. i have no idea why i didn't think of this, but that's why this + // comment is here now + if head.id() == commit { + return Ok(true); + } + + let has_commit = repository.graph_descendant_of(head.id(), commit)?; + + Ok(has_commit) + } + + /// Check if multiple [`Reference`]s contain a commit SHA + /// + /// # Errors + /// + /// Will return [`Err`] if an [`Oid`] could not be resolved from the commit SHA + /// or when it can't be determined if a reference contains a commit + pub fn branches_contain_sha<'a>( + &self, + branch_names: impl IntoIterator<Item = &'a String>, + commit_sha: &str, + ) -> Result<Vec<(&'a String, bool)>, Error> { + let repository = self.open()?; + let commit = Oid::from_str(commit_sha)?; + + let mut results = vec![]; + for branch_name in branch_names { + let branch = repository.find_branch( + &format!("{}/{branch_name}", self.remote_name), + BranchType::Remote, + )?; + + let has_commit = self.ref_contains_object(&branch.into_reference(), commit)?; + results.push((branch_name, has_commit)); + } + + Ok(results) + } } diff --git a/crates/git-tracker/src/managed_repository.rs b/crates/git-tracker/src/managed_repository.rs deleted file mode 100644 index 0a41bd0..0000000 --- a/crates/git-tracker/src/managed_repository.rs +++ /dev/null @@ -1,95 +0,0 @@ -use git2::{AutotagOption, FetchOptions, RemoteCallbacks, RemoteUpdateFlags, Repository}; -use log::{debug, info, trace, warn}; -use std::{io::Write, path::PathBuf}; - -// much of this is shamelessly lifted from -// https://github.com/rust-lang/git2-rs/blob/9a5c9706ff578c936be644dd1e8fe155bdc4d129/examples/pull.rs - -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error("libgit2 error")] - Git(#[from] git2::Error), -} - -pub struct ManagedRepository { - pub path: PathBuf, - pub tracked_branches: Vec<String>, - pub upstream_remote_url: String, - pub upstream_remote_name: String, -} - -impl ManagedRepository { - /// basic set of options for fetching from remotes - fn fetch_options<'a>() -> FetchOptions<'a> { - let mut remote_callbacks = RemoteCallbacks::new(); - remote_callbacks.transfer_progress(|progress| { - if progress.received_objects() == progress.total_objects() { - trace!( - "Resolving deltas {}/{}\r", - progress.indexed_deltas(), - progress.total_deltas() - ); - } else { - trace!( - "Received {}/{} objects ({}) in {} bytes\r", - progress.received_objects(), - progress.total_objects(), - progress.indexed_objects(), - progress.received_bytes() - ); - } - std::io::stdout().flush().ok(); - true - }); - - let mut fetch_opts = FetchOptions::new(); - fetch_opts.remote_callbacks(remote_callbacks); - - fetch_opts - } - - /// Update the given branches in the [`repository`] using the nixpkgs remote - fn update_branches_in(&self, repository: &Repository) -> Result<(), Error> { - let mut remote = repository.find_remote(&self.upstream_remote_name)?; - // download all the refs - remote.download(&self.tracked_branches, Some(&mut Self::fetch_options()))?; - remote.disconnect()?; - // and (hopefully) update what they refer to for later - remote.update_tips( - None, - RemoteUpdateFlags::UPDATE_FETCHHEAD, - AutotagOption::Auto, - None, - )?; - - Ok(()) - } - - /// Fetch the repository or update it if it exists - /// - /// # Errors - /// Will return [`Err`] if the repository cannot be opened, cloned, or updated - pub fn fetch_or_update(&self) -> Result<(), Error> { - // Open our repository or clone it if it doesn't exist - let repository = if self.path.exists() { - Repository::open(self.path.as_path())? - } else { - warn!( - "Couldn't find repository at {}! Cloning a fresh one from {}", - self.path.display(), - self.upstream_remote_url - ); - Repository::clone(&self.upstream_remote_url, self.path.as_path())?; - info!("Finished cloning to {}", self.path.display()); - - // bail early as we already have a fresh copy - return Ok(()); - }; - - debug!("Updating repository at {}", self.path.display()); - self.update_branches_in(&repository)?; - debug!("Finished updating!"); - - Ok(()) - } -} diff --git a/crates/git-tracker/src/tracker.rs b/crates/git-tracker/src/tracker.rs deleted file mode 100644 index e6a3f54..0000000 --- a/crates/git-tracker/src/tracker.rs +++ /dev/null @@ -1,109 +0,0 @@ -use std::path::Path; - -use git2::{Branch, BranchType, Commit, ErrorCode, Oid, Reference, Repository}; - -/// Helper struct for tracking Git objects -pub struct Tracker { - repository: Repository, -} - -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error("libgit2 error")] - Git(#[from] git2::Error), - #[error("Repository path not found at `{0}`")] - RepositoryPathNotFound(String), -} - -impl Tracker { - /// Create a new [`Tracker`] using the repository at [`path`] - /// - /// # Errors - /// - /// Will return [`Err`] if the repository can not be opened - pub fn from_path(path: &str) -> Result<Self, Error> { - let repository_path = Path::new(path); - if repository_path.exists() { - let repository = Repository::open(repository_path)?; - Ok(Self { repository }) - } else { - Err(Error::RepositoryPathNotFound(path.to_string())) - } - } - - /// Finds a branch of name [`name`] - /// - /// # Errors - /// - /// Will return [`Err`] if the branch cannot be found locally - pub fn branch_by_name(&self, name: &str) -> Result<Branch, Error> { - Ok(self.repository.find_branch(name, BranchType::Remote)?) - } - - /// Finds a commit with a SHA match [`sha`] - /// - /// # Errors - /// - /// Will return [`Err`] if [`sha`] cannot be converted an [`Oid`] or - /// a commit matching it cannot be found - pub fn commit_by_sha(&self, sha: &str) -> Result<Commit, Error> { - let oid = Oid::from_str(sha)?; - let commit = self.repository.find_commit(oid)?; - - Ok(commit) - } - - /// Check if [`Reference`] [`ref`] contains [`Commit`] [`commit`] - /// - /// # Errors - /// - /// Will return [`Err`] if the reference cannot be resolved to a commit or the descendants - /// of the reference cannot be resolved - pub fn ref_contains_commit( - &self, - reference: &Reference, - commit: &Commit, - ) -> Result<bool, Error> { - let head = reference.peel_to_commit()?; - - // NOTE: we have to check this as `Repository::graph_descendant_of()` (like the name says) - // only finds *descendants* of it's parent commit, and will not tell us if the parent commit - // *is* the child commit. i have no idea why i didn't think of this, but that's why this - // comment is here now - let is_head = head.id() == commit.id(); - - let has_commit = self - .repository - .graph_descendant_of(head.id(), commit.id())?; - - Ok(is_head || has_commit) - } - - /// Check if a [`Branch`] named [`branch_name`] has a commit with the SHA [`commit_sha`] - /// - /// # Errors - /// - /// Will return [`Err`] if the commit SHA cannot be resolved to an object id, the branch name cannot - /// be resolved to a branch, or the descendants of the resolved branch cannot be resolved - pub fn branch_contains_sha(&self, branch_name: &str, commit_sha: &str) -> Result<bool, Error> { - let commit = match self.commit_by_sha(commit_sha) { - Ok(commit) => commit, - Err(why) => { - // NOTE: we assume commits not found are just not in the branch *yet*, not an error - // this is because github decides to report merge commit shas for unmerged PRs...yeah - if let Error::Git(git_error) = &why { - if git_error.code() == ErrorCode::NotFound { - return Ok(false); - } - } - - return Err(why); - } - }; - - let branch = self.branch_by_name(branch_name)?; - let has_pr = self.ref_contains_commit(&branch.into_reference(), &commit)?; - - Ok(has_pr) - } -} diff --git a/crates/nixpkgs-tracker-http/Cargo.toml b/crates/nixpkgs-tracker-http/Cargo.toml index ca95804..c4bcf46 100644 --- a/crates/nixpkgs-tracker-http/Cargo.toml +++ b/crates/nixpkgs-tracker-http/Cargo.toml @@ -10,13 +10,13 @@ publish = false [dependencies] log.workspace = true -reqwest = { version = "0.12.8", default-features = false, features = [ +reqwest = { version = "0.12", default-features = false, features = [ "charset", "http2", "rustls-tls", "json" ] } -serde = { version = "1.0.210", features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } [lints] workspace = true @@ -1,5 +1,20 @@ { "nodes": { + "nix-filter": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1726206720, @@ -18,6 +33,7 @@ }, "root": { "inputs": { + "nix-filter": "nix-filter", "nixpkgs": "nixpkgs", "treefmt-nix": "treefmt-nix" } @@ -4,6 +4,8 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nix-filter.url = "github:numtide/nix-filter"; + # Inputs below this are optional # `inputs.treefmt-nix.follows = ""` @@ -17,6 +19,7 @@ { self, nixpkgs, + nix-filter, treefmt-nix, }: let @@ -102,11 +105,11 @@ pkgs = nixpkgsFor.${system}; packages' = self.packages.${system}; - staticWith = pkgs.callPackage ./nix/static.nix { }; + staticWith = pkgs.callPackage ./nix/static.nix { inherit nix-filter self; }; containerize = pkgs.callPackage ./nix/containerize.nix { }; in { - nixpkgs-tracker-bot = pkgs.callPackage ./nix/package.nix { }; + nixpkgs-tracker-bot = pkgs.callPackage ./nix/package.nix { inherit nix-filter self; }; default = packages'.nixpkgs-tracker-bot; diff --git a/nix/package.nix b/nix/package.nix index b216242..e1eeaef 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,21 +1,26 @@ { lib, - rustPlatform, + stdenv, openssl, pkg-config, + rustPlatform, + + self, + nix-filter, lto ? true, optimizeSize ? false, }: + rustPlatform.buildRustPackage { pname = "nixpkgs-tracker-bot"; - inherit ((lib.importTOML ../Cargo.toml).workspace.package) version; + version = self.shortRev or self.dirtyShortRev or "unknown"; - src = lib.fileset.toSource { - root = ../.; - fileset = lib.fileset.unions [ - (lib.fileset.gitTracked ../crates) - ../Cargo.toml - ../Cargo.lock + src = nix-filter.lib.filter { + root = self; + include = [ + "crates" + "Cargo.toml" + "Cargo.lock" ]; }; @@ -26,28 +31,31 @@ rustPlatform.buildRustPackage { env = let - toRustFlags = lib.mapAttrs' ( - name: - lib.nameValuePair "CARGO_BUILD_RELEASE_${ - lib.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] name) - }" - ); + rustFlags = + lib.optionalAttrs lto { + lto = "thin"; + } + // lib.optionalAttrs optimizeSize { + codegen-units = 1; + opt-level = "s"; + panic = "abort"; + strip = "symbols"; + }; in - lib.optionalAttrs lto (toRustFlags { - lto = "thin"; - }) - // lib.optionalAttrs optimizeSize (toRustFlags { - codegen-units = 1; - opt-level = "s"; - panic = "abort"; - strip = "symbols"; - }); + { + CARGO_BUILD_RUSTFLAGS = toString ( + lib.mapAttrsToList (name: value: "-C ${name}=${toString value}") rustFlags + ); + } + // lib.optionalAttrs stdenv.hostPlatform.isStatic { + OPENSSL_STATIC = 1; + }; meta = { description = "A Discord app for tracking nixpkgs pull requests"; homepage = "https://github.com/getchoo/nixpkgs-tracker-bot"; - mainProgram = "nixpkgs-tracker-bot"; license = lib.licenses.mit; maintainers = [ lib.maintainers.getchoo ]; + mainProgram = "nixpkgs-tracker-bot"; }; } diff --git a/nix/static.nix b/nix/static.nix index 8def285..5c7f528 100644 --- a/nix/static.nix +++ b/nix/static.nix @@ -1,4 +1,9 @@ -{ pkgsCross }: +{ + pkgsCross, + nix-filter, + self, +}: + let crossPkgsFor = with pkgsCross; { x86_64 = musl64.pkgsStatic; @@ -6,11 +11,16 @@ let }; in { arch }: + let crossPkgs = crossPkgsFor.${arch}; in -(crossPkgs.callPackage ./package.nix { optimizeSize = true; }).overrideAttrs (old: { - passthru = old.passthru or { } // { - inherit crossPkgs; - }; -}) +(crossPkgs.callPackage ./package.nix { + inherit nix-filter self; + optimizeSize = true; +}).overrideAttrs + (old: { + passthru = old.passthru or { } // { + inherit crossPkgs; + }; + }) |
