debversion-0.5.0/.cargo_vcs_info.json0000644000000001360000000000100131760ustar { "git": { "sha1": "77e98fb5775148a06250393f3444fe017b7c74ed" }, "path_in_vcs": "" }debversion-0.5.0/.codespellrc000064400000000000000000000000461046102023000142660ustar 00000000000000[codespell] ignore-words-list = crate debversion-0.5.0/.github/CODEOWNERS000064400000000000000000000000121046102023000147120ustar 00000000000000* @jelmer debversion-0.5.0/.github/FUNDING.yml000064400000000000000000000000171046102023000151410ustar 00000000000000github: jelmer debversion-0.5.0/.github/dependabot.yaml000064400000000000000000000010751046102023000163220ustar 00000000000000# Keep GitHub Actions up to date with GitHub's Dependabot... # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem version: 2 updates: - package-ecosystem: "cargo" directory: "/" schedule: interval: "weekly" rebase-strategy: "disabled" - package-ecosystem: "github-actions" directory: "/" schedule: interval: weekly debversion-0.5.0/.github/workflows/auto-merge.yml000064400000000000000000000011341046102023000201520ustar 00000000000000name: Dependabot auto-merge on: pull_request_target permissions: pull-requests: write contents: write jobs: dependabot: runs-on: ubuntu-latest if: ${{ github.actor == 'dependabot[bot]' }} steps: - name: Dependabot metadata id: metadata uses: dependabot/fetch-metadata@v2 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs run: gh pr merge --auto --squash "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} debversion-0.5.0/.github/workflows/disperse.yml000064400000000000000000000002741046102023000177270ustar 00000000000000--- name: Disperse configuration "on": - push jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: jelmer/action-disperse-validate@v2 debversion-0.5.0/.github/workflows/publish.yaml000064400000000000000000000010511046102023000177120ustar 00000000000000on: push: tags: - 'v*' # Push events to every tag not containing / workflow_dispatch: name: Publish jobs: publish: name: Publish runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v5 - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - run: cargo publish --token ${CRATES_TOKEN} env: CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} debversion-0.5.0/.github/workflows/rust.yml000064400000000000000000000032321046102023000171030ustar 00000000000000--- name: Rust "on": push: pull_request: env: CARGO_TERM_COLOR: always jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: python-version: '3.x' - run: | python -m pip install python_debian - name: Build run: cargo build --verbose - name: Install cargo-all-features run: cargo install cargo-all-features - name: Run tests run: cargo test-all-features - name: Check formatting run: cargo fmt -- --check test-minimal-versions: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: python-version: '3.x' - run: | python -m pip install python_debian - name: Install cargo-hack run: cargo install cargo-hack - name: Install cargo-minimal-versions run: cargo install cargo-minimal-versions - name: Test with minimal versions (all features) run: cargo minimal-versions test --all-features test-maximal-versions: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: python-version: '3.x' - run: | python -m pip install python_debian - name: Update to maximal versions run: cargo update - name: Install cargo-all-features run: cargo install cargo-all-features - name: Test with maximal versions run: cargo test-all-features debversion-0.5.0/.gitignore000064400000000000000000000000271046102023000137550ustar 00000000000000/target /Cargo.lock *~ debversion-0.5.0/CODE_OF_CONDUCT.md000064400000000000000000000125451046102023000145740ustar 00000000000000 # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html [Mozilla CoC]: https://github.com/mozilla/diversity [FAQ]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations debversion-0.5.0/Cargo.lock0000644000001520040000000000100111530ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "async-channel" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener 2.5.3", "futures-core", ] [[package]] name = "async-channel" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" dependencies = [ "concurrent-queue", "event-listener-strategy", "futures-core", "pin-project-lite", ] [[package]] name = "async-executor" version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8" dependencies = [ "async-task", "concurrent-queue", "fastrand 2.3.0", "futures-lite 2.6.1", "pin-project-lite", "slab", ] [[package]] name = "async-global-executor" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.5.0", "async-executor", "async-io 2.6.0", "async-lock 3.4.1", "blocking", "futures-lite 2.6.1", "once_cell", ] [[package]] name = "async-io" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock 2.8.0", "autocfg", "cfg-if", "concurrent-queue", "futures-lite 1.13.0", "log", "parking", "polling 2.8.0", "rustix 0.37.28", "slab", "socket2", "waker-fn", ] [[package]] name = "async-io" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" dependencies = [ "autocfg", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.6.1", "parking", "polling 3.11.0", "rustix 1.1.2", "slab", "windows-sys 0.61.2", ] [[package]] name = "async-lock" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener 2.5.3", ] [[package]] name = "async-lock" version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" dependencies = [ "event-listener 5.4.1", "event-listener-strategy", "pin-project-lite", ] [[package]] name = "async-std" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b" dependencies = [ "async-channel 1.9.0", "async-global-executor", "async-io 2.6.0", "async-lock 3.4.1", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", "futures-lite 2.6.1", "gloo-timers", "kv-log-macro", "log", "memchr", "once_cell", "pin-project-lite", "pin-utils", "slab", "wasm-bindgen-futures", ] [[package]] name = "async-task" version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "atoi" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ "num-traits", ] [[package]] name = "atomic-waker" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] [[package]] name = "blocking" version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" dependencies = [ "async-channel 2.5.0", "async-task", "futures-io", "futures-lite 2.6.1", "piper", ] [[package]] name = "bumpalo" version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" version = "1.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2" dependencies = [ "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ "num-traits", ] [[package]] name = "concurrent-queue" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", ] [[package]] name = "cpufeatures" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crc" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" dependencies = [ "crc-catalog", ] [[package]] name = "crc-catalog" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crossbeam-queue" version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", ] [[package]] name = "debversion" version = "0.5.0" dependencies = [ "chrono", "lazy-regex", "num-bigint", "pyo3", "serde", "sqlx", ] [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", "subtle", ] [[package]] name = "displaydoc" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "dotenvy" version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" dependencies = [ "serde", ] [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", "windows-sys 0.61.2", ] [[package]] name = "etcetera" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" dependencies = [ "cfg-if", "home", "windows-sys 0.48.0", ] [[package]] name = "event-listener" version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" version = "5.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" dependencies = [ "concurrent-queue", "parking", "pin-project-lite", ] [[package]] name = "event-listener-strategy" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ "event-listener 5.4.1", "pin-project-lite", ] [[package]] name = "fastrand" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] [[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" [[package]] name = "foldhash" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "form_urlencoded" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] [[package]] name = "futures-channel" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", ] [[package]] name = "futures-core" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-intrusive" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", "parking_lot", ] [[package]] name = "futures-io" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ "fastrand 1.9.0", "futures-core", "futures-io", "memchr", "parking", "pin-project-lite", "waker-fn", ] [[package]] name = "futures-lite" version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" dependencies = [ "fastrand 2.3.0", "futures-core", "futures-io", "parking", "pin-project-lite", ] [[package]] name = "futures-sink" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-io", "futures-sink", "futures-task", "memchr", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "generic-array" version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" dependencies = [ "typenum", "version_check", ] [[package]] name = "getrandom" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", "wasi", ] [[package]] name = "gloo-timers" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" dependencies = [ "futures-channel", "futures-core", "js-sys", "wasm-bindgen", ] [[package]] name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "allocator-api2", "equivalent", "foldhash", ] [[package]] name = "hashbrown" version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "hashlink" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ "hashbrown 0.15.5", ] [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hermit-abi" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] [[package]] name = "hmac" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ "digest", ] [[package]] name = "home" version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" dependencies = [ "windows-sys 0.61.2", ] [[package]] name = "icu_collections" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] name = "icu_locale_core" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", "tinystr", "writeable", "zerovec", ] [[package]] name = "icu_normalizer" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", "icu_provider", "smallvec", "zerovec", ] [[package]] name = "icu_normalizer_data" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", "zerotrie", "zerovec", ] [[package]] name = "idna" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", "utf8_iter", ] [[package]] name = "idna_adapter" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", ] [[package]] name = "indexmap" version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", "hashbrown 0.16.0", ] [[package]] name = "indoc" version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" dependencies = [ "rustversion", ] [[package]] name = "instant" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] [[package]] name = "io-lifetimes" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] [[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" dependencies = [ "once_cell", "wasm-bindgen", ] [[package]] name = "kv-log-macro" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" dependencies = [ "log", ] [[package]] name = "lazy-regex" version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60c7310b93682b36b98fa7ea4de998d3463ccbebd94d935d6b48ba5b6ffa7126" dependencies = [ "lazy-regex-proc_macros", "once_cell", "regex", ] [[package]] name = "lazy-regex-proc_macros" version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ba01db5ef81e17eb10a5e0f2109d1b3a3e29bac3070fdbd7d156bf7dbd206a1" dependencies = [ "proc-macro2", "quote", "regex", "syn", ] [[package]] name = "libc" version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libredox" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" dependencies = [ "bitflags 2.10.0", "libc", "redox_syscall", ] [[package]] name = "linux-raw-sys" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litemap" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" [[package]] name = "lock_api" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ "scopeguard", ] [[package]] name = "log" version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" dependencies = [ "value-bag", ] [[package]] name = "md-5" version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ "cfg-if", "digest", ] [[package]] name = "memchr" version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "memoffset" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] [[package]] name = "num-bigint" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", ] [[package]] name = "num-integer" version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ "num-traits", ] [[package]] name = "num-traits" version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "parking" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", "windows-link", ] [[package]] name = "percent-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "piper" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", "fastrand 2.3.0", "futures-io", ] [[package]] name = "polling" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", "log", "pin-project-lite", "windows-sys 0.48.0", ] [[package]] name = "polling" version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" dependencies = [ "cfg-if", "concurrent-queue", "hermit-abi 0.5.2", "pin-project-lite", "rustix 1.1.2", "windows-sys 0.61.2", ] [[package]] name = "portable-atomic" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "potential_utf" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" dependencies = [ "zerovec", ] [[package]] name = "ppv-lite86" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] [[package]] name = "proc-macro2" version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37a6df7eab65fc7bee654a421404947e10a0f7085b6951bf2ea395f4659fb0cf" dependencies = [ "indoc", "libc", "memoffset", "once_cell", "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", "unindent", ] [[package]] name = "pyo3-build-config" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f77d387774f6f6eec64a004eac0ed525aab7fa1966d94b42f743797b3e395afb" dependencies = [ "target-lexicon", ] [[package]] name = "pyo3-ffi" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dd13844a4242793e02df3e2ec093f540d948299a6a77ea9ce7afd8623f542be" dependencies = [ "libc", "pyo3-build-config", ] [[package]] name = "pyo3-macros" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaf8f9f1108270b90d3676b8679586385430e5c0bb78bb5f043f95499c821a71" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", "syn", ] [[package]] name = "pyo3-macros-backend" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70a3b2274450ba5288bc9b8c1b69ff569d1d61189d4bff38f8d22e03d17f932b" dependencies = [ "heck", "proc-macro2", "pyo3-build-config", "quote", "syn", ] [[package]] name = "quote" version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", ] [[package]] name = "rand_chacha" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", ] [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] [[package]] name = "redox_syscall" version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags 2.10.0", ] [[package]] name = "regex" version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "ring" version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", "getrandom", "libc", "untrusted", "windows-sys 0.52.0", ] [[package]] name = "rustix" version = "0.37.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "519165d378b97752ca44bbe15047d5d3409e875f39327546b42ac81d7e18c1b6" dependencies = [ "bitflags 1.3.2", "errno", "io-lifetimes", "libc", "linux-raw-sys 0.3.8", "windows-sys 0.48.0", ] [[package]] name = "rustix" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags 2.10.0", "errno", "libc", "linux-raw-sys 0.11.0", "windows-sys 0.61.2", ] [[package]] name = "rustls" version = "0.23.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a9586e9ee2b4f8fab52a0048ca7334d7024eef48e2cb9407e3497bb7cab7fa7" dependencies = [ "once_cell", "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] [[package]] name = "rustls-pki-types" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" dependencies = [ "zeroize", ] [[package]] name = "rustls-webpki" version = "0.103.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" dependencies = [ "ring", "rustls-pki-types", "untrusted", ] [[package]] name = "rustversion" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", "serde_derive", ] [[package]] name = "serde_core" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", "serde_core", ] [[package]] name = "sha2" version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", "digest", ] [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "slab" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ "serde", ] [[package]] name = "socket2" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", ] [[package]] name = "sqlx" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" dependencies = [ "sqlx-core", "sqlx-macros", "sqlx-postgres", ] [[package]] name = "sqlx-core" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" dependencies = [ "async-io 1.13.0", "async-std", "base64", "bytes", "crc", "crossbeam-queue", "either", "event-listener 5.4.1", "futures-core", "futures-intrusive", "futures-io", "futures-util", "hashbrown 0.15.5", "hashlink", "indexmap", "log", "memchr", "once_cell", "percent-encoding", "rustls", "serde", "serde_json", "sha2", "smallvec", "thiserror", "tracing", "url", "webpki-roots 0.26.11", ] [[package]] name = "sqlx-macros" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", "syn", ] [[package]] name = "sqlx-macros-core" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" dependencies = [ "async-std", "dotenvy", "either", "heck", "hex", "once_cell", "proc-macro2", "quote", "serde", "serde_json", "sha2", "sqlx-core", "sqlx-postgres", "syn", "url", ] [[package]] name = "sqlx-postgres" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" dependencies = [ "atoi", "base64", "bitflags 2.10.0", "byteorder", "crc", "dotenvy", "etcetera", "futures-channel", "futures-core", "futures-util", "hex", "hkdf", "hmac", "home", "itoa", "log", "md-5", "memchr", "once_cell", "rand", "serde", "serde_json", "sha2", "smallvec", "sqlx-core", "stringprep", "thiserror", "tracing", "whoami", ] [[package]] name = "stable_deref_trait" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stringprep" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" dependencies = [ "unicode-bidi", "unicode-normalization", "unicode-properties", ] [[package]] name = "subtle" version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "synstructure" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "target-lexicon" version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c" [[package]] name = "thiserror" version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tinystr" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", ] [[package]] name = "tinyvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" dependencies = [ "tinyvec_macros", ] [[package]] name = "tinyvec_macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tracing" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tracing-core" version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", ] [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unicode-bidi" version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" [[package]] name = "unicode-normalization" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-properties" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unindent" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" [[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", "percent-encoding", "serde", ] [[package]] name = "utf8_iter" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "value-bag" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "waker-fn" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasite" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" version = "0.4.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" dependencies = [ "cfg-if", "js-sys", "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" dependencies = [ "bumpalo", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "webpki-roots" version = "0.26.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" dependencies = [ "webpki-roots 1.0.3", ] [[package]] name = "webpki-roots" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8" dependencies = [ "rustls-pki-types", ] [[package]] name = "whoami" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" dependencies = [ "libredox", "wasite", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets 0.48.5", ] [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets 0.52.6", ] [[package]] name = "windows-sys" version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] [[package]] name = "windows-targets" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm 0.48.5", "windows_aarch64_msvc 0.48.5", "windows_i686_gnu 0.48.5", "windows_i686_msvc 0.48.5", "windows_x86_64_gnu 0.48.5", "windows_x86_64_gnullvm 0.48.5", "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "writeable" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "yoke" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", "yoke-derive", "zerofrom", ] [[package]] name = "yoke-derive" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", "syn", "synstructure", ] [[package]] name = "zerocopy" version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "zerofrom" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", "syn", "synstructure", ] [[package]] name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" [[package]] name = "zerotrie" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" dependencies = [ "displaydoc", "yoke", "zerofrom", ] [[package]] name = "zerovec" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" dependencies = [ "yoke", "zerofrom", "zerovec-derive", ] [[package]] name = "zerovec-derive" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", "syn", ] debversion-0.5.0/Cargo.toml0000644000000033650000000000100112030ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" name = "debversion" version = "0.5.0" authors = ["Jelmer Vernooij "] build = false autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Debian version parsing, manipulation and comparison" homepage = "https://github.com/jelmer/debversion-rs" documentation = "https://docs.rs/debversion" readme = "README.md" keywords = [ "debian", "version", "dpkg", ] categories = ["parser-implementations"] license = "Apache-2.0" repository = "https://github.com/jelmer/debversion-rs" [features] default = [] python-debian = ["dep:pyo3"] serde = ["dep:serde"] sqlx = ["sqlx/postgres"] [lib] name = "debversion" path = "src/lib.rs" [dependencies.chrono] version = "0.4.38" features = ["alloc"] default-features = false [dependencies.lazy-regex] version = "3" [dependencies.num-bigint] version = "0.4.6" [dependencies.pyo3] version = ">=0.27, <0.28" optional = true [dependencies.serde] version = "^1" optional = true [dependencies.sqlx] version = "0.8.2" features = ["postgres"] optional = true default-features = false [dev-dependencies.pyo3] version = ">=0.27, <0.28" features = ["auto-initialize"] [dev-dependencies.sqlx] version = "0.8.2" features = ["runtime-async-std-rustls"] default-features = false debversion-0.5.0/Cargo.toml.orig000064400000000000000000000021131046102023000146520ustar 00000000000000[package] name = "debversion" version = "0.5.0" edition = "2021" authors = [ "Jelmer Vernooij ",] license = "Apache-2.0" description = "Debian version parsing, manipulation and comparison" repository = "https://github.com/jelmer/debversion-rs" documentation = "https://docs.rs/debversion" keywords = ["debian", "version", "dpkg"] homepage = "https://github.com/jelmer/debversion-rs" categories = ["parser-implementations"] [features] default = [] sqlx = [ "sqlx/postgres",] python-debian = [ "dep:pyo3",] serde = [ "dep:serde",] [dependencies] chrono = { version = "0.4.38", default-features = false, features = ["alloc"] } lazy-regex = "3" num-bigint = "0.4.6" [dependencies.pyo3] version = ">=0.27, <0.28" optional = true [dependencies.sqlx] version = "0.8.2" optional = true default-features = false features = [ "postgres",] [dependencies.serde] version = "^1" optional = true [dev-dependencies.sqlx] version = "0.8.2" default-features = false features = [ "runtime-async-std-rustls",] [dev-dependencies.pyo3] version = ">=0.27, <0.28" features = [ "auto-initialize",] debversion-0.5.0/README.md000064400000000000000000000023501046102023000132450ustar 00000000000000# debian version handling in rust This simple crate provides a struct for parsing, validating, manipulating and comparing Debian version strings. It aims to follow the version specification as described in Debian policy 5.6.12 and consistent with the behaviour of ``dpkg``. Example: ```rust use debversion::Version; let version: Version = "1.0-1".parse().unwrap(); assert_eq!(version.epoch, None); assert_eq!(version.upstream_version, "1.0"); assert_eq!(version.debian_revision.as_deref(), Some("1")); let version1: Version = "1.0-0".parse().unwrap(); let version2: Version = "1.0".parse().unwrap(); assert_eq!(version1, version2); let version1: Version = "1.0-1".parse().unwrap(); let version2: Version = "1.0~alpha1-1".parse().unwrap(); assert!(version2 < version1); ``` ## Features ### sqlx The `sqlx` feature adds serialization support for the postgres [debversion extension](https://pgxn.org/dist/debversion/) when using sqlx. ### python-debian The `python-debian` feature provides conversion support between the debversion Rust type and the ``Version`` class provided by ``python-debian``, when using [pyo3](https://github.com/pyo3/pyo3). ### serde The `serde` feature enables serialization to and from simple strings when using serde. debversion-0.5.0/disperse.toml000064400000000000000000000000531046102023000144770ustar 00000000000000tag-name = "v$VERSION" release-timeout = 5 debversion-0.5.0/src/lib.rs000064400000000000000000001034241046102023000136750ustar 00000000000000#![deny(missing_docs)] #![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))] // Until we drop support for PyO3 0.22 #![allow(deprecated)] use lazy_regex::{regex_captures, regex_replace}; use num_bigint::BigInt; use std::cmp::Ordering; use std::str::FromStr; pub mod upstream; pub mod vcs; pub mod vendor; /// A Debian version string /// /// #[derive(Debug, Clone)] pub struct Version { /// The epoch of the version, if any pub epoch: Option, /// The upstream version pub upstream_version: String, /// The Debian revision, if any pub debian_revision: Option, } fn non_digit_cmp(va: &str, vb: &str) -> Ordering { fn order(x: char) -> i32 { match x { '~' => -1, '0'..='9' => unreachable!(), 'A'..='Z' | 'a'..='z' => x as i32, _ => x as i32 + 256, } } va.chars() .map(order) .chain(std::iter::repeat(0)) .zip(vb.chars().map(order).chain(std::iter::repeat(0))) .take(va.len().max(vb.len())) .find_map(|(a, b)| match a.cmp(&b) { Ordering::Equal => None, other => Some(other), }) .unwrap_or(Ordering::Equal) } #[test] fn test_non_digit_cmp() { assert_eq!(non_digit_cmp("a", "b"), Ordering::Less); assert_eq!(non_digit_cmp("b", "a"), Ordering::Greater); assert_eq!(non_digit_cmp("a", "a"), Ordering::Equal); assert_eq!(non_digit_cmp("a", "-"), Ordering::Less); assert_eq!(non_digit_cmp("a", "+"), Ordering::Less); assert_eq!(non_digit_cmp("a", ""), Ordering::Greater); assert_eq!(non_digit_cmp("", "a"), Ordering::Less); assert_eq!(non_digit_cmp("", ""), Ordering::Equal); assert_eq!(non_digit_cmp("~", ""), Ordering::Less); assert_eq!(non_digit_cmp("~~", "~"), Ordering::Less); assert_eq!(non_digit_cmp("~~", "~~a"), Ordering::Less); assert_eq!(non_digit_cmp("~~a", "~"), Ordering::Less); assert_eq!(non_digit_cmp("~", "a"), Ordering::Less); // Test special characters that exercise the arithmetic on line 36 assert_eq!(non_digit_cmp("!", "@"), Ordering::Less); // ! = 33, @ = 64 + 256 = 320 assert_eq!(non_digit_cmp("@", "!"), Ordering::Greater); assert_eq!(non_digit_cmp("#", "$"), Ordering::Less); // # = 35, $ = 36 assert_eq!(non_digit_cmp("|", "}"), Ordering::Less); // | = 124, } = 125 } fn drop_leading_zeroes(s: &str) -> &str { // Drop leading zeroes while the next character is a digit let bytes = s.as_bytes(); let mut start = 0; while start + 1 < bytes.len() && bytes[start] == b'0' && bytes[start + 1].is_ascii_digit() { start += 1; } &s[start..] } fn version_cmp_part(mut a: &str, mut b: &str) -> Ordering { while !a.is_empty() || !b.is_empty() { // First, create a for the non-digit leading part of each string let a_non_digit = &a[..a .chars() .position(|c| c.is_ascii_digit()) .unwrap_or(a.len())]; let b_non_digit = &b[..b .chars() .position(|c| c.is_ascii_digit()) .unwrap_or(b.len())]; // Compare the non-digit leading part match non_digit_cmp(a_non_digit, b_non_digit) { Ordering::Equal => (), ordering => return ordering, } // Remove the non-digit leading part from the strings a = &a[a_non_digit.len()..]; b = &b[b_non_digit.len()..]; // Then, create a slice for the digit part of each string let a_digit = &a[..a .chars() .position(|c| !c.is_ascii_digit()) .unwrap_or(a.len())]; let b_digit = &b[..b .chars() .position(|c| !c.is_ascii_digit()) .unwrap_or(b.len())]; // Compare the digit part let ordering = match (a_digit.len(), b_digit.len()) { (0, 0) => Ordering::Equal, (0, _) => Ordering::Less, (_, 0) => Ordering::Greater, // For small numbers that fit in u64, avoid BigInt allocation (a_len, b_len) if a_len <= 19 && b_len <= 19 => { match (a_digit.parse::(), b_digit.parse::()) { (Ok(a_num), Ok(b_num)) => a_num.cmp(&b_num), // Fallback to BigInt if parsing fails (shouldn't happen with valid version strings) _ => a_digit .parse::() .unwrap() .cmp(&b_digit.parse::().unwrap()), } } // For very long digit sequences, use BigInt _ => a_digit .parse::() .unwrap() .cmp(&b_digit.parse::().unwrap()), }; match ordering { Ordering::Equal => (), ordering => return ordering, } // Remove the digit part from the strings a = &a[a_digit.len()..]; b = &b[b_digit.len()..]; } Ordering::Equal } impl Ord for Version { fn cmp(&self, other: &Self) -> std::cmp::Ordering { let self_norm = self.explicit(); let other_norm = other.explicit(); if self_norm.0 != other_norm.0 { return std::cmp::Ord::cmp(&self_norm.0, &other_norm.0); } match version_cmp_part(self_norm.1, other_norm.1) { Ordering::Equal => (), ordering => return ordering, } version_cmp_part(self_norm.2, other_norm.2) } } impl PartialOrd for Version { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } impl PartialEq for Version { fn eq(&self, other: &Self) -> bool { self.partial_cmp(other) == Some(std::cmp::Ordering::Equal) } } impl Eq for Version {} /// Error parsing a version string #[derive(Debug, PartialEq, Eq)] pub struct ParseError(String); impl std::fmt::Display for ParseError { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.0) } } impl std::error::Error for ParseError {} impl FromStr for Version { type Err = ParseError; fn from_str(text: &str) -> Result { let (_, epoch, upstream_version, debian_revision) = if let Some(c) = regex_captures!( r"^(?:(\d+):)?([A-Za-z0-9.+:~-]+?)(?:-([A-Za-z0-9+.~]+))?$", text ) { c } else { return Err(ParseError(format!("Invalid version string: {}", text))); }; let epoch = Some(epoch) .filter(|e| !e.is_empty()) .map(|e| { e.parse() .map_err(|e| ParseError(format!("Error parsing epoch: {}", e))) }) .transpose()?; let debian_revision = if debian_revision.is_empty() { None } else { Some(debian_revision.to_string()) }; Ok(Version { epoch, upstream_version: upstream_version.to_string(), debian_revision, }) } } impl std::fmt::Display for Version { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { if let Some(epoch) = self.epoch.as_ref() { write!(f, "{}:", epoch)?; } f.write_str(&self.upstream_version)?; if let Some(debian_revision) = self.debian_revision.as_ref() { write!(f, "-{}", debian_revision)?; } Ok(()) } } impl std::hash::Hash for Version { fn hash(&self, state: &mut H) { ( self.epoch, self.upstream_version.as_str(), self.debian_revision.as_deref(), ) .hash(state); } } impl Version { /// Return explicit tuple of this version /// /// This will return an explicit 0 for epochs and debian revisions /// that are not set. fn explicit(&self) -> (u32, &str, &str) { ( self.epoch.unwrap_or(0), self.upstream_version.as_str(), self.debian_revision.as_deref().unwrap_or("0"), ) } /// Is this a binNMU? /// /// A binNMU is a binary-only NMU (Non-Maintainer Upload) where the source package is not /// changed. /// /// Note that this checks for the presence of the `+b[:digit:]` suffix, which is not part of the Debian /// Policy Manual, but it is commonly used to indicate a binNMU. /// /// # Examples /// /// ``` /// use debversion::Version; /// assert!("1.0+b1".parse::().unwrap().is_bin_nmu()); /// assert!("1.0-1+b1".parse::().unwrap().is_bin_nmu()); /// assert!(!"1.0-1".parse::().unwrap().is_bin_nmu()); /// assert!(!"1.0".parse::().unwrap().is_bin_nmu()); /// ``` pub fn is_bin_nmu(&self) -> bool { self.bin_nmu_count().is_some() } /// Return the binNMU count of this version /// /// This will return the binNMU count of this version, or None if this is not a binNMU. pub fn bin_nmu_count(&self) -> Option { fn bin_nmu_suffix(s: &str) -> Option { s.split_once("+b").and_then(|(_, rest)| rest.parse().ok()) } if let Some(debian_revision) = self.debian_revision.as_ref() { bin_nmu_suffix(debian_revision) } else { bin_nmu_suffix(self.upstream_version.as_str()) } } /// Create a binNMU version from this version /// /// This will increment the binNMU suffix by one, or add a `+b1` suffix if there is no binNMU /// suffix. pub fn increment_bin_nmu(self) -> Version { fn increment_bin_nmu_suffix(s: &str) -> String { match s.split_once("+b") { Some((prefix, rest)) => match rest.parse::() { Ok(num) => format!("{}+b{}", prefix, num + 1), Err(_) => format!("{}+b1", s), }, None => format!("{}+b1", s), } } if let Some(debian_revision) = self.debian_revision.as_ref() { Version { epoch: self.epoch, upstream_version: self.upstream_version, debian_revision: Some(increment_bin_nmu_suffix(debian_revision)), } } else { Version { epoch: self.epoch, upstream_version: increment_bin_nmu_suffix(&self.upstream_version), debian_revision: self.debian_revision, } } } /// Check if this version is a sourceful NMU /// /// A sourceful NMU is a Non-Maintainer Upload where the source package is changed. /// This is indicated by the presence of a `+nmu[:digit:]` suffix. /// This is not part of the Debian Policy Manual, but it is commonly used to indicate a /// sourceful NMU. pub fn is_nmu(&self) -> bool { self.nmu_count().is_some() } /// Return the sourceful NMU count of this version /// /// This will return the sourceful NMU count of this version, or None if this is not a /// sourceful NMU. pub fn nmu_count(&self) -> Option { fn nmu_suffix(s: &str) -> Option { s.split_once("+nmu").and_then(|(_, rest)| rest.parse().ok()) } if let Some(debian_revision) = self.debian_revision.as_ref() { nmu_suffix(debian_revision) } else { nmu_suffix(self.upstream_version.as_str()) } } /// Return canonicalized version of this version /// /// # Examples /// /// ``` /// use debversion::Version; /// assert_eq!("1.0-0".parse::().unwrap().canonicalize(), "1.0".parse::().unwrap()); /// assert_eq!("1.0-1".parse::().unwrap().canonicalize(), "1.0-1".parse::().unwrap()); /// ``` pub fn canonicalize(&self) -> Version { let epoch = match self.epoch { Some(0) => None, epoch => epoch, }; let upstream_version_stripped = drop_leading_zeroes(&self.upstream_version); let upstream_version = if upstream_version_stripped == self.upstream_version { self.upstream_version.clone() } else { upstream_version_stripped.to_string() }; let debian_revision = match self.debian_revision.as_ref() { Some(r) if r.chars().all(|c| c == '0') => None, None => None, Some(revision) => { let stripped = drop_leading_zeroes(revision); if stripped == revision { Some(revision.clone()) } else { Some(stripped.to_string()) } } }; Version { epoch, upstream_version, debian_revision, } } /// Increment the Debian revision. /// /// For native packages, increment the upstream version number. /// For other packages, increment the debian revision. pub fn increment_debian(&mut self) { if let Some(ref mut debian_revision) = self.debian_revision { *debian_revision = regex_replace!(r"\d+$", debian_revision, |x: &str| { (x.parse::().unwrap() + 1).to_string() }) .into_owned(); } else { self.upstream_version = regex_replace!(r"\d+$", &self.upstream_version, |x: &str| { (x.parse::().unwrap() + 1).to_string() }) .into_owned(); } } /// Return true if this is a native package pub fn is_native(&self) -> bool { self.debian_revision.is_none() } } #[cfg(feature = "sqlx")] use sqlx::{postgres::PgTypeInfo, Postgres}; #[cfg(feature = "sqlx")] impl sqlx::Type for Version { fn type_info() -> PgTypeInfo { PgTypeInfo::with_name("debversion") } } #[cfg(feature = "sqlx")] impl sqlx::Encode<'_, Postgres> for Version { fn encode_by_ref( &self, buf: &mut sqlx::postgres::PgArgumentBuffer, ) -> Result> { let version_str = self.to_string(); sqlx::Encode::::encode_by_ref(&version_str.as_str(), buf) } } #[cfg(feature = "sqlx")] impl sqlx::Decode<'_, Postgres> for Version { fn decode( value: sqlx::postgres::PgValueRef<'_>, ) -> Result> { let s: &str = sqlx::Decode::::decode(value)?; Ok(s.parse::()?) } } #[cfg(all(feature = "sqlx", test))] mod sqlx_tests { #[test] fn type_info() { use super::Version; use sqlx::postgres::PgTypeInfo; use sqlx::Type; assert_eq!(PgTypeInfo::with_name("debversion"), Version::type_info()); } } #[cfg(feature = "python-debian")] use pyo3::prelude::*; #[cfg(feature = "python-debian")] impl FromPyObject<'_, '_> for Version { type Error = PyErr; fn extract(ob: pyo3::Borrowed<'_, '_, PyAny>) -> PyResult { let debian_support = Python::import(ob.py(), "debian.debian_support")?; let version_cls = debian_support.getattr("Version")?; if !ob.is_instance(&version_cls)? { return Err(pyo3::exceptions::PyTypeError::new_err("Expected a Version")); } Ok(Version { epoch: ob .getattr("epoch")? .extract::>()? .map(|s| s.parse().unwrap()), upstream_version: ob.getattr("upstream_version")?.extract::()?, debian_revision: ob.getattr("debian_revision")?.extract::>()?, }) } } #[cfg(feature = "python-debian")] impl<'py> IntoPyObject<'py> for Version { type Target = PyAny; type Output = Bound<'py, Self::Target>; type Error = PyErr; fn into_pyobject(self, py: Python<'py>) -> Result { let debian_support = py.import("debian.debian_support").unwrap(); let version_cls = debian_support.getattr("Version").unwrap(); version_cls.call1((self.to_string(),)) } } #[cfg(feature = "python-debian")] mod python_tests { #[test] fn test_from_pyobject() { use super::Version; use pyo3::prelude::*; use std::ffi::CString; Python::with_gil(|py| { let globals = pyo3::types::PyDict::new(py); globals .set_item( "debian_support", py.import("debian.debian_support").unwrap(), ) .unwrap(); let v = py .eval( &CString::new("debian_support.Version('1.0-1')").unwrap(), Some(&globals), None, ) .unwrap() .extract::() .unwrap(); assert_eq!( v, Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: Some("1".to_string()) } ); }); } #[test] fn test_to_pyobject() { use super::Version; use pyo3::prelude::*; Python::with_gil(|py| { let v = Version { epoch: Some(1), upstream_version: "1.0".to_string(), debian_revision: Some("1".to_string()), }; let v = v.into_pyobject(py).unwrap(); let expected: Version = "1:1.0-1".parse().unwrap(); assert_eq!(v.get_type().name().unwrap(), "Version"); assert_eq!(v.unbind().extract::(py).unwrap(), expected); }); } #[test] fn test_from_pyobject_error() { use super::Version; use pyo3::prelude::*; use std::ffi::CString; Python::with_gil(|py| { // Test that extracting from a non-Version object fails let string_obj = py .eval(&CString::new("'not a version'").unwrap(), None, None) .unwrap(); let result = string_obj.extract::(); assert!(result.is_err()); }); } } #[cfg(feature = "serde")] impl serde::Serialize for Version { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(&self.to_string()) } } #[cfg(feature = "serde")] impl<'de> serde::Deserialize<'de> for Version { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let concatenated: String = String::deserialize(deserializer)?; concatenated.parse().map_err(serde::de::Error::custom) } } /// Trait for converting an argument into a Version pub trait AsVersion { /// Convert the argument into a Version fn into_version(self) -> Result; } impl AsVersion for &str { fn into_version(self) -> Result { self.parse() } } impl AsVersion for String { fn into_version(self) -> Result { self.parse() } } impl AsVersion for Version { fn into_version(self) -> Result { Ok(self) } } #[cfg(test)] mod tests { use super::{version_cmp_part, ParseError, Version}; use std::cmp::Ordering; #[test] fn test_canonicalize() { assert_eq!( "1.0-1".parse::().unwrap().canonicalize(), "1.0-1".parse::().unwrap() ); assert_eq!( "1.0-0".parse::().unwrap().canonicalize(), "1.0".parse::().unwrap() ); assert_eq!( "0:1.0-2".parse::().unwrap().canonicalize(), "1.0-2".parse::().unwrap() ); assert_eq!( "0001.0-0".parse::().unwrap().canonicalize(), "1.0".parse::().unwrap() ); assert_eq!( "000.1".parse::().unwrap().canonicalize(), "0.1".parse::().unwrap() ); } #[test] fn test_explicit() { assert_eq!( (0, "1.0", "1"), "1.0-1".parse::().unwrap().explicit() ); assert_eq!( (1, "1.0", "1"), "1:1.0-1".parse::().unwrap().explicit() ); assert_eq!( (0, "1.0", "0"), "1.0".parse::().unwrap().explicit() ); assert_eq!( (0, "1.0", "0"), "1.0-0".parse::().unwrap().explicit() ); assert_eq!( (1, "1.0", "0"), "1:1.0-0".parse::().unwrap().explicit() ); assert_eq!( (0, "000.1", "0"), "000.1".parse::().unwrap().explicit() ); } macro_rules! assert_cmp( ($a:expr, $b:expr, $cmp:tt) => { assert_eq!($a.parse::().unwrap().cmp(&$b.parse::().unwrap()), std::cmp::Ordering::$cmp); } ); #[test] fn test_version_cmp_part() { assert_eq!(version_cmp_part("1.0", "1.0"), Ordering::Equal); assert_eq!(version_cmp_part("0.1", "0.1"), Ordering::Equal); assert_eq!(version_cmp_part("000.1", "0.1"), Ordering::Equal); assert_eq!(version_cmp_part("1.0", "2.0"), Ordering::Less); assert_eq!(version_cmp_part("1.0", "0.0"), Ordering::Greater); assert_eq!(version_cmp_part("10.0", "2.0"), Ordering::Greater); assert_eq!(version_cmp_part("1.0~rc1", "1.0"), Ordering::Less); } #[test] fn test_cmp() { assert_cmp!("1.0-1", "1.0-1", Equal); assert_cmp!("1.0-1", "1.0-2", Less); assert_cmp!("1.0-2", "1.0-1", Greater); assert_cmp!("1.0-1", "1.0", Greater); assert_cmp!("1.0", "1.0-1", Less); assert_cmp!("2.50.0", "10.0.1", Less); // Epoch assert_cmp!("1:1.0-1", "1.0-1", Greater); assert_cmp!("1.0-1", "1:1.0-1", Less); assert_cmp!("1:1.0-1", "1:1.0-1", Equal); assert_cmp!("1:1.0-1", "2:1.0-1", Less); assert_cmp!("2:1.0-1", "1:1.0-1", Greater); // ~ symbol assert_cmp!("1.0~rc1-1", "1.0-1", Less); assert_cmp!("1.0-1", "1.0~rc1-1", Greater); assert_cmp!("1.0~rc1-1", "1.0~rc1-1", Equal); assert_cmp!("1.0~rc1-1", "1.0~rc2-1", Less); assert_cmp!("1.0~rc2-1", "1.0~rc1-1", Greater); // letters assert_cmp!("1.0a-1", "1.0-1", Greater); assert_cmp!("1.0-1", "1.0a-1", Less); assert_cmp!("1.0a-1", "1.0a-1", Equal); // Bug 27 assert_cmp!("23.13.9-7", "0.6.45-2", Greater); } #[test] fn test_parse() { assert_eq!( Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: Some("1".to_string()) }, "1.0-1".parse().unwrap() ); assert_eq!( Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: None }, "1.0".parse().unwrap() ); assert_eq!( Version { epoch: Some(1), upstream_version: "1.0".to_string(), debian_revision: Some("1".to_string()) }, "1:1.0-1".parse().unwrap() ); assert_eq!( "1:;a".parse::().unwrap_err(), ParseError("Invalid version string: 1:;a".to_string()) ); } #[test] fn test_parse_error_display() { let error = ParseError("test error message".to_string()); assert_eq!(format!("{}", error), "test error message"); assert_eq!(error.to_string(), "test error message"); } #[test] fn test_to_string() { assert_eq!( "1.0-1", Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: Some("1".to_string()) } .to_string() ); assert_eq!( "1.0", Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: None, } .to_string() ); } #[test] fn test_eq() { assert_eq!( "1.0-1".parse::().unwrap(), "1.0-1".parse::().unwrap() ); } #[test] fn test_hash() { use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; let mut hasher1 = DefaultHasher::new(); let mut hasher2 = DefaultHasher::new(); let mut hasher3 = DefaultHasher::new(); "1.0-1".parse::().unwrap().hash(&mut hasher1); "1.0-1".parse::().unwrap().hash(&mut hasher2); "0:1.0-1".parse::().unwrap().hash(&mut hasher3); let hash1 = hasher1.finish(); let hash2 = hasher2.finish(); let hash3 = hasher3.finish(); assert_eq!(hash1, hash2); assert_ne!(hash1, hash3); } #[test] fn to_string() { assert_eq!( "1.0-1", Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: Some("1".to_string()) } .to_string() ); assert_eq!( "1.0", Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: None, } .to_string() ); assert_eq!( "1:1.0", Version { epoch: Some(1), upstream_version: "1.0".to_string(), debian_revision: None, } .to_string() ); } #[test] fn partial_eq() { assert!("1.0-1" .parse::() .unwrap() .eq(&"1.0-1".parse::().unwrap())); } #[test] fn increment() { let mut v = "1.0-1".parse::().unwrap(); v.increment_debian(); assert_eq!("1.0-2".parse::().unwrap(), v); let mut v = "1.0".parse::().unwrap(); v.increment_debian(); assert_eq!("1.1".parse::().unwrap(), v); let mut v = "1.0ubuntu1".parse::().unwrap(); v.increment_debian(); assert_eq!("1.0ubuntu2".parse::().unwrap(), v); let mut v = "1.0-0ubuntu1".parse::().unwrap(); v.increment_debian(); assert_eq!("1.0-0ubuntu2".parse::().unwrap(), v); } #[test] fn is_native() { assert!(!"1.0-1".parse::().unwrap().is_native()); assert!("1.0".parse::().unwrap().is_native()); assert!(!"1.0-0".parse::().unwrap().is_native()); } #[test] fn test_is_binnmu() { assert!("1.0+b1".parse::().unwrap().is_bin_nmu()); assert!("1.0-1+b1".parse::().unwrap().is_bin_nmu()); assert!(!"1.0-1".parse::().unwrap().is_bin_nmu()); assert!(!"1.0".parse::().unwrap().is_bin_nmu()); } #[test] fn test_bin_nmu_count() { assert_eq!( Some(1), "1.0+b1".parse::().unwrap().bin_nmu_count() ); assert_eq!( Some(1), "1.0-1+b1".parse::().unwrap().bin_nmu_count() ); assert_eq!(None, "1.0-1".parse::().unwrap().bin_nmu_count()); assert_eq!(None, "1.0".parse::().unwrap().bin_nmu_count()); } #[test] fn test_increment_bin_nmu() { assert_eq!( "1.0+b2".parse::().unwrap(), "1.0+b1".parse::().unwrap().increment_bin_nmu() ); assert_eq!( "1.0-1+b2".parse::().unwrap(), "1.0-1+b1".parse::().unwrap().increment_bin_nmu() ); assert_eq!( "1.0+b1".parse::().unwrap(), "1.0".parse::().unwrap().increment_bin_nmu() ); assert_eq!( "1.0-1+b1".parse::().unwrap(), "1.0-1".parse::().unwrap().increment_bin_nmu() ); } #[test] fn test_nmu_count() { assert_eq!(Some(1), "1.0+nmu1".parse::().unwrap().nmu_count()); assert_eq!( Some(1), "1.0-1+nmu1".parse::().unwrap().nmu_count() ); assert_eq!(None, "1.0-1".parse::().unwrap().nmu_count()); assert_eq!(None, "1.0".parse::().unwrap().nmu_count()); } #[test] fn test_is_nmu() { assert!("1.0+nmu1".parse::().unwrap().is_nmu()); assert!("1.0-1+nmu1".parse::().unwrap().is_nmu()); assert!(!"1.0-1".parse::().unwrap().is_nmu()); assert!(!"1.0".parse::().unwrap().is_nmu()); } #[test] fn test_comparing_very_long_versions() { // These are actual version numbers seen in actual apt repositories let a = "1:11.1.0~++20210314110124+1fdec59bffc1-1~exp1~20210314220751.162"; let b = "1:11.1.0~++20211011013104+1fdec59bffc1-1~exp1~20211011133507.6"; assert_cmp!(a, b, Less); } #[test] fn test_drop_leading_zeroes() { use super::drop_leading_zeroes; // Test basic cases assert_eq!(drop_leading_zeroes("1.0"), "1.0"); assert_eq!(drop_leading_zeroes("001.0"), "1.0"); assert_eq!(drop_leading_zeroes("000.1"), "0.1"); // Test edge cases for missed mutants assert_eq!(drop_leading_zeroes("0"), "0"); assert_eq!(drop_leading_zeroes("00"), "0"); assert_eq!(drop_leading_zeroes("0a"), "0a"); assert_eq!(drop_leading_zeroes("01a"), "1a"); // Test single character assert_eq!(drop_leading_zeroes("a"), "a"); // Test empty string assert_eq!(drop_leading_zeroes(""), ""); } #[test] fn test_version_cmp_part_edge_cases() { // Test cases that should hit the missed mutants in version_cmp_part // Test empty strings assert_eq!(version_cmp_part("", ""), Ordering::Equal); assert_eq!(version_cmp_part("", "1"), Ordering::Less); assert_eq!(version_cmp_part("1", ""), Ordering::Greater); // Test digit comparison edge cases assert_eq!(version_cmp_part("1", "1"), Ordering::Equal); assert_eq!(version_cmp_part("01", "1"), Ordering::Equal); // Test very long digit sequences to hit BigInt path let long_a = "123456789012345678901234567890"; let long_b = "123456789012345678901234567891"; assert_eq!(version_cmp_part(long_a, long_b), Ordering::Less); // Test mixed digit/non-digit sequences assert_eq!(version_cmp_part("1a2", "1a3"), Ordering::Less); assert_eq!(version_cmp_part("1a2", "1b1"), Ordering::Less); // Test tilde handling assert_eq!(version_cmp_part("1~", "1"), Ordering::Less); assert_eq!(version_cmp_part("~1", "1"), Ordering::Less); } #[test] fn test_canonicalize_edge_cases() { // Test cases that should hit missed mutants in canonicalize // Test epoch handling let v1 = Version { epoch: Some(0), upstream_version: "1.0".to_string(), debian_revision: None, }; let canonical = v1.canonicalize(); assert_eq!(canonical.epoch, None); // Test debian revision all zeros let v2 = Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: Some("000".to_string()), }; let canonical2 = v2.canonicalize(); assert_eq!(canonical2.debian_revision, None); // Test debian revision with leading zeros let v3 = Version { epoch: None, upstream_version: "1.0".to_string(), debian_revision: Some("001".to_string()), }; let canonical3 = v3.canonicalize(); assert_eq!(canonical3.debian_revision, Some("1".to_string())); // Test upstream version with leading zeros let v4 = Version { epoch: None, upstream_version: "001.0".to_string(), debian_revision: None, }; let canonical4 = v4.canonicalize(); assert_eq!(canonical4.upstream_version, "1.0"); // Test unchanged cases let v5 = Version { epoch: Some(1), upstream_version: "1.0".to_string(), debian_revision: Some("1".to_string()), }; let canonical5 = v5.canonicalize(); assert_eq!(canonical5.upstream_version, "1.0"); assert_eq!(canonical5.debian_revision, Some("1".to_string())); } #[test] fn test_partial_eq_false() { // Test PartialEq returning false to catch the missed mutant assert!("1.0-1" .parse::() .unwrap() .ne(&"1.0-2".parse::().unwrap())); assert!("1.0-1" .parse::() .unwrap() .ne(&"2.0-1".parse::().unwrap())); assert!("1:1.0-1" .parse::() .unwrap() .ne(&"2:1.0-1".parse::().unwrap())); } #[test] fn test_non_digit_cmp_edge_cases() { use super::non_digit_cmp; // Test tilde vs regular chars assert_eq!(non_digit_cmp("~", "a"), Ordering::Less); assert_eq!(non_digit_cmp("~", "A"), Ordering::Less); assert_eq!(non_digit_cmp("~", "!"), Ordering::Less); // Test special character ordering assert_eq!(non_digit_cmp("!", "@"), Ordering::Less); assert_eq!(non_digit_cmp("@", "A"), Ordering::Greater); assert_eq!(non_digit_cmp("Z", "["), Ordering::Less); // Test empty strings assert_eq!(non_digit_cmp("", ""), Ordering::Equal); assert_eq!(non_digit_cmp("", "a"), Ordering::Less); assert_eq!(non_digit_cmp("a", ""), Ordering::Greater); } } debversion-0.5.0/src/upstream.rs000064400000000000000000000404331046102023000147670ustar 00000000000000//! Utilities for working with upstream versions. use std::borrow::Cow; static DFSG_REGEX: &lazy_regex::Lazy = lazy_regex::regex!(r"^(.*)([\+~])(dfsg|ds)([0-9]*)$"); const DFSG_DEFAULT_STYLE: &str = "+ds"; /// Strip the DFSG suffix from a version. /// /// # Example /// ``` /// use debversion::upstream::strip_dfsg_suffix; /// let version = "1.2.3+dfsg1"; /// assert_eq!(strip_dfsg_suffix(version), Some("1.2.3")); /// ``` pub fn strip_dfsg_suffix(version: &str) -> Option<&str> { if let Some(m) = DFSG_REGEX.captures(version) { Some(m.get(1).unwrap().as_str()) } else { None } } /// Add a dfsg suffix to an version version string. /// /// Allow old_upstream_version to be passed in so optionally the format can be /// kept consistent. /// /// # Example /// ``` /// use debversion::upstream::add_dfsg_suffix; /// assert_eq!(add_dfsg_suffix("1.2.3", None), "1.2.3+ds"); /// assert_eq!(add_dfsg_suffix("1.2.3", Some("1.2.2+dfsg1")), "1.2.3+dfsg1"); /// assert_eq!(add_dfsg_suffix("1.2.3", Some("1.2.2+ds1")), "1.2.3+ds1"); /// assert_eq!(add_dfsg_suffix("1.2.3", Some("1.2.3")), "1.2.3+ds"); /// ``` pub fn add_dfsg_suffix(upstream_version: &str, old_upstream_version: Option<&str>) -> String { let style = if let Some(m) = old_upstream_version.and_then(|d| DFSG_REGEX.captures(d)) { let part2 = m.get(2).unwrap().as_str(); let part3 = m.get(3).unwrap().as_str(); let part4 = m.get(4).unwrap().as_str(); Cow::Owned(if part4.is_empty() { format!("{}{}", part2, part3) } else { format!("{}{}1", part2, part3) }) } else { Cow::Borrowed(DFSG_DEFAULT_STYLE) }; format!("{}{}", upstream_version, style) } #[derive(Debug, Clone, PartialEq)] /// VCS snapshot information. pub enum VcsSnapshot { /// Git snapshot information. Git { /// Date of the snapshot. date: Option, /// SHA of the snapshot, usually the first 7 characters. sha: Option, /// Snapshot number. snapshot: Option, }, /// Bazaar snapshot information. Bzr { /// Revision number, possibly dotted. revno: String, }, /// Subversion snapshot information. Svn { /// Revision number. revno: usize, }, } impl VcsSnapshot { /// Convert the VCS snapshot information to a suffix. fn to_suffix(&self) -> String { match self { VcsSnapshot::Git { date, sha, snapshot, } => match (sha.as_deref(), snapshot, date.as_ref()) { (Some(sha), Some(snapshot), Some(date)) => { let gitid = &sha[..sha.len().min(7)]; format!("git{}.{}.{}", date.format("%Y%m%d"), snapshot, gitid) } (Some(sha), None, Some(date)) => { let gitid = &sha[..sha.len().min(7)]; format!("git{}.{}", date.format("%Y%m%d"), gitid) } (Some(sha), _, None) => { let gitid = &sha[..sha.len().min(7)]; format!("git{}", gitid) } (None, _, Some(date)) => { format!("git{}", date.format("%Y%m%d")) } (None, _, None) => "git".to_string(), }, VcsSnapshot::Bzr { revno } => format!("bzr{}", revno), VcsSnapshot::Svn { revno } => format!("svn{}", revno), } } } /// Direction to add the snapshot. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Direction { /// Snapshot predates the version. Before, /// Snapshot postdates the version. After, } impl From<&str> for Direction { fn from(s: &str) -> Self { match s { "~" => Direction::Before, "+" => Direction::After, _ => panic!("Invalid direction"), } } } impl Direction { /// Convert direction to its string representation pub const fn as_str(&self) -> &'static str { match self { Direction::Before => "~", Direction::After => "+", } } } impl From for &str { fn from(d: Direction) -> Self { d.as_str() } } /// Get the revision from a version string. /// /// # Example /// ``` /// use debversion::upstream::{get_revision, Direction, VcsSnapshot}; /// assert_eq!(get_revision("1.2.3+bzr123"), ("1.2.3", Some((Direction::After, VcsSnapshot::Bzr /// { revno: "123".to_string() })))); /// assert_eq!(get_revision("1.2.3+git20210101.abcdefa"), ("1.2.3", /// Some((Direction::After, VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, /// 1).unwrap()), sha: Some("abcdefa".to_string()), snapshot: None })))); /// assert_eq!(get_revision("1.2.3+git20210101.1.abcdefa"), ("1.2.3", /// Some((Direction::After, VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, /// 1).unwrap()), sha: Some("abcdefa".to_string()), snapshot: Some(1) })))); /// assert_eq!(get_revision("1.2.3+svn123"), ("1.2.3", Some((Direction::After, /// VcsSnapshot::Svn { revno: 123 })))); /// ``` pub fn get_revision(version_string: &str) -> (&str, Option<(Direction, VcsSnapshot)>) { if let Some((_, b, s, r)) = lazy_regex::regex_captures!(r"^(.*)([\+~])bzr(\d+)$", version_string) { ( b, Some(( s.into(), VcsSnapshot::Bzr { revno: r.to_string(), }, )), ) } else if let Some((_, b, s, d, i)) = lazy_regex::regex_captures!(r"^(.*)([\+~-])git(\d{8})\.([a-f0-9]{7})$", version_string) { ( b, Some(( s.into(), VcsSnapshot::Git { date: chrono::NaiveDate::parse_from_str(d, "%Y%m%d").ok(), sha: Some(i.to_string()), snapshot: None, }, )), ) } else if let Some((_, b, s, d, r, i)) = lazy_regex::regex_captures!( r"^(.*)([\+~-])git(\d{8})\.(\d+)\.([a-f0-9]{7})$", version_string ) { ( b, Some(( s.into(), VcsSnapshot::Git { date: chrono::NaiveDate::parse_from_str(d, "%Y%m%d").ok(), sha: Some(i.to_string()), snapshot: r.parse().ok(), }, )), ) } else if let Some((_, b, s, r)) = lazy_regex::regex_captures!(r"^(.*)([\+~-])svn(\d+)$", version_string) { ( b, Some(( s.into(), VcsSnapshot::Svn { revno: r.parse().unwrap(), }, )), ) } else { (version_string, None) } } /// Update the revision in a upstream version string. /// /// # Arguments /// * `version_string` - Original version string /// * `sep` - Separator to use when adding snapshot /// * `vcs_snapshot` - VCS snapshot information /// /// # Example /// ``` /// use debversion::upstream::{upstream_version_add_revision, VcsSnapshot}; /// assert_eq!(upstream_version_add_revision("1.2.3", VcsSnapshot::Bzr { revno: /// "123".to_string() }, None), "1.2.3+bzr123"); /// assert_eq!(upstream_version_add_revision("1.2.3+bzr123", VcsSnapshot::Bzr { revno: /// "124".to_string() }, None), "1.2.3+bzr124"); /// assert_eq!(upstream_version_add_revision("1.2.3", VcsSnapshot::Git { date: /// Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: None, snapshot: None }, None), /// "1.2.3+git20210101"); /// assert_eq!(upstream_version_add_revision("1.2.3+git20210101.abcdefa", /// VcsSnapshot::Git { date: None, sha: Some("abcdefa".to_string()), snapshot: None }, None), /// "1.2.3+gitabcdefa"); /// ``` pub fn upstream_version_add_revision( version_string: &str, mut vcs_snapshot: VcsSnapshot, sep: Option, ) -> String { let plain_version = strip_dfsg_suffix(version_string).unwrap_or(version_string); let (base_version, current_sep, current_vcs) = match get_revision(plain_version) { (base_version, Some((sep, current_vcs))) => (base_version, Some(sep), Some(current_vcs)), (base_version, None) => (base_version, None, None), }; let sep = sep.or(current_sep).unwrap_or(Direction::After); if let ( VcsSnapshot::Git { date, sha, snapshot, }, Some(VcsSnapshot::Git { date: c_date, sha: c_sha, snapshot: c_snapshot, }), ) = (&mut vcs_snapshot, current_vcs.as_ref()) { if snapshot.is_none() { *snapshot = if date.as_ref() == c_date.as_ref() && sha.as_ref() != c_sha.as_ref() { c_snapshot.map(|s| s + 1) } else { Some(1) }; } if c_date.is_none() { *date = None; } if c_sha.is_none() { *sha = None; } } let sep = sep.as_str(); format!("{}{}{}", base_version, sep, vcs_snapshot.to_suffix()) } #[cfg(test)] mod tests { #[test] fn test_strip_dfsg_suffix() { assert_eq!(super::strip_dfsg_suffix("1.2.3+dfsg1"), Some("1.2.3")); assert_eq!(super::strip_dfsg_suffix("1.2.3+ds1"), Some("1.2.3")); assert_eq!(super::strip_dfsg_suffix("1.2.3"), None); } #[test] fn test_add_dfsg_suffix() { assert_eq!(super::add_dfsg_suffix("1.2.3", None), "1.2.3+ds"); assert_eq!( super::add_dfsg_suffix("1.2.3", Some("1.2.3+dfsg1")), "1.2.3+dfsg1" ); assert_eq!( super::add_dfsg_suffix("1.2.3", Some("1.2.3+ds1")), "1.2.3+ds1" ); assert_eq!(super::add_dfsg_suffix("1.2.3", Some("1.2.3")), "1.2.3+ds"); } #[test] fn test_to_suffix() { assert_eq!( "git", super::VcsSnapshot::Git { date: None, sha: None, snapshot: None, } .to_suffix() ); assert_eq!( "git20210101", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: None, snapshot: None, } .to_suffix() ); assert_eq!( "gitabcdefa", super::VcsSnapshot::Git { date: None, sha: Some("abcdefa".to_string()), snapshot: None, } .to_suffix() ); assert_eq!( "git20210101.abcdefa", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: Some("abcdefa".to_string()), snapshot: None, } .to_suffix() ); assert_eq!( "git20210101.1.abcdefa", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: Some("abcdefa".to_string()), snapshot: Some(1), } .to_suffix() ); assert_eq!( "bzr123", super::VcsSnapshot::Bzr { revno: "123".to_string(), } .to_suffix() ); assert_eq!("svn123", super::VcsSnapshot::Svn { revno: 123 }.to_suffix()); } #[test] fn test_upstream_version_add_new_suffix_bzr() { assert_eq!( "1.2.3+bzr123", super::upstream_version_add_revision( "1.2.3", super::VcsSnapshot::Bzr { revno: "123".to_string() }, None ) ); } #[test] fn test_upstream_version_add_existing_suffix_bzr() { assert_eq!( "1.2.3+bzr124", super::upstream_version_add_revision( "1.2.3+bzr123", super::VcsSnapshot::Bzr { revno: "124".to_string() }, None ) ); } #[test] fn test_upstream_version_add_new_suffix_git() { assert_eq!( "1.2.3+git20210101", super::upstream_version_add_revision( "1.2.3", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: None, snapshot: None, }, None ) ); } #[test] fn test_upstream_version_add_existing_suffix_git() { assert_eq!( super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: Some("abcdefa".to_string()), snapshot: None, }, super::get_revision("1.2.3+git20210101.abcdefa") .1 .unwrap() .1 ); assert_eq!( "1.2.3+gitabcdefa", super::upstream_version_add_revision( "1.2.3+git20210101.1.abcdefa", super::VcsSnapshot::Git { date: None, sha: Some("abcdefa".to_string()), snapshot: None, }, None ) ); } #[test] fn test_upstream_version_add_new_suffix_svn() { assert_eq!( "1.2.3+svn123", super::upstream_version_add_revision( "1.2.3", super::VcsSnapshot::Svn { revno: 123 }, None ) ); } #[test] fn test_upstream_version_add_existing_suffix_svn() { assert_eq!( super::VcsSnapshot::Svn { revno: 123 }, super::get_revision("1.2.3+svn123").1.unwrap().1 ); assert_eq!( "1.2.3+svn124", super::upstream_version_add_revision( "1.2.3+svn123", super::VcsSnapshot::Svn { revno: 124 }, None ) ); } #[test] fn test_upstream_version_add_revision_git_snapshot_increment() { // Test the missed mutants in line 273-274 around snapshot increment logic // Test when dates are equal but SHAs are different - should increment snapshot let result = super::upstream_version_add_revision( "1.2.3+git20210101.1.abcdefa", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: Some("bcdefgh".to_string()), snapshot: None, }, None, ); // The SHA is truncated to 7 characters, so "bcdefgh" becomes "bcdefgh" assert_eq!("1.2.3+git20210101.2.bcdefgh", result); // Test when dates are different - should reset snapshot to 1 let result2 = super::upstream_version_add_revision( "1.2.3+git20210101.5.abcdefa", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 2).unwrap()), sha: Some("bcdefgh".to_string()), snapshot: None, }, None, ); assert_eq!("1.2.3+git20210102.1.bcdefgh", result2); // Test when dates are equal and SHAs are equal - should reset snapshot to 1 let result3 = super::upstream_version_add_revision( "1.2.3+git20210101.1.abcdefa", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()), sha: Some("abcdefa".to_string()), snapshot: None, }, None, ); // Since date == date and sha == sha (NOT !=), condition is false, so snapshot = Some(1) assert_eq!("1.2.3+git20210101.1.abcdefa", result3); // Test different dates should set snapshot to 1 (not increment) let result4 = super::upstream_version_add_revision( "1.2.3+git20210101.3.abcdefa", super::VcsSnapshot::Git { date: Some(chrono::NaiveDate::from_ymd_opt(2021, 1, 3).unwrap()), sha: Some("bcdefgh".to_string()), snapshot: None, }, None, ); assert_eq!("1.2.3+git20210103.1.bcdefgh", result4); } } debversion-0.5.0/src/vcs.rs000064400000000000000000000027101046102023000137160ustar 00000000000000//! Version Control System (VCS) related utilities. use crate::Version; /// Mangle a version string to be used as a git tag. /// /// This function mangles a version string to be used as a git tag, /// following the Debian version mangling rules described in /// DEP-14 (https://dep-team.pages.debian.net/deps/dep14/). pub fn mangle_version_for_git(version: &Version) -> String { let version = version.to_string(); // See https://dep-team.pages.debian.net/deps/dep14/ let mut manipulated = version .replace('~', "_") .replace(':', "%") .replace("..", ".#."); if manipulated.ends_with('.') { manipulated.push('#'); } if let Some(prefix) = manipulated.strip_suffix(".lock") { manipulated = format!("{}#lock", prefix) } manipulated } #[cfg(test)] mod tests { use super::*; #[test] fn test_mangle_version_for_git() { assert_eq!(mangle_version_for_git(&"1.0.0".parse().unwrap()), "1.0.0"); assert_eq!( mangle_version_for_git(&"1.0.0~rc1".parse().unwrap()), "1.0.0_rc1" ); assert_eq!( mangle_version_for_git(&"2:1.0.0-1".parse().unwrap()), "2%1.0.0-1" ); assert_eq!( mangle_version_for_git(&"1.0.0..rc1".parse().unwrap()), "1.0.0.#.rc1" ); assert_eq!( mangle_version_for_git(&"1.0.0.lock".parse().unwrap()), "1.0.0#lock" ); } } debversion-0.5.0/src/vendor.rs000064400000000000000000000055111046102023000144220ustar 00000000000000//! Vendor enum and related functions. // Ideally we wouldn't have a list like this, but unfortunately we do. use std::borrow::Cow; /// Vendor enum. #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum Vendor { /// Debian Debian, /// Ubuntu (including derivatives) Ubuntu, /// Kali Linux Kali, } /// Error type for unknown vendor #[derive(Debug, Clone, PartialEq, Eq)] pub struct UnknownVendorError(Cow<'static, str>); impl std::fmt::Display for UnknownVendorError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Unknown vendor: {}", self.0) } } impl std::error::Error for UnknownVendorError {} impl std::str::FromStr for Vendor { type Err = UnknownVendorError; fn from_str(s: &str) -> Result { // Case-insensitive comparison match s.to_lowercase().as_str() { "debian" => Ok(Vendor::Debian), "ubuntu" => Ok(Vendor::Ubuntu), "kali" => Ok(Vendor::Kali), _ => Err(UnknownVendorError(Cow::Owned(s.to_string()))), } } } impl std::fmt::Display for Vendor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { Vendor::Debian => write!(f, "Debian"), Vendor::Ubuntu => write!(f, "Ubuntu"), Vendor::Kali => write!(f, "Kali"), } } } /// Get the initial Debian revision for a given vendor. pub const fn initial_debian_revision(vendor: Vendor) -> &'static str { match vendor { Vendor::Debian => "1", Vendor::Ubuntu => "0ubuntu1", Vendor::Kali => "0kali1", } } #[cfg(test)] mod tests { use super::*; #[test] fn test_vendor_from_str() { use std::str::FromStr; assert_eq!(Vendor::from_str("debian").unwrap(), Vendor::Debian); assert_eq!(Vendor::from_str("Debian").unwrap(), Vendor::Debian); assert_eq!(Vendor::from_str("ubuntu").unwrap(), Vendor::Ubuntu); assert_eq!(Vendor::from_str("Ubuntu").unwrap(), Vendor::Ubuntu); assert_eq!(Vendor::from_str("kali").unwrap(), Vendor::Kali); assert_eq!(Vendor::from_str("Kali").unwrap(), Vendor::Kali); assert!(Vendor::from_str("unknown").is_err()); assert_eq!( Vendor::from_str("unknown").unwrap_err().to_string(), "Unknown vendor: unknown" ); } #[test] fn test_vendor_display() { assert_eq!(Vendor::Debian.to_string(), "Debian"); assert_eq!(Vendor::Ubuntu.to_string(), "Ubuntu"); assert_eq!(Vendor::Kali.to_string(), "Kali"); } #[test] fn test_initial_debian_revision() { assert_eq!(initial_debian_revision(Vendor::Debian), "1"); assert_eq!(initial_debian_revision(Vendor::Ubuntu), "0ubuntu1"); assert_eq!(initial_debian_revision(Vendor::Kali), "0kali1"); } }