debian/version: dpkg-compatible version comparison
Implement the documented dpkg ordering algorithm (Debian Policy 5.6.1): numeric epoch, then upstream/revision compared as alternating non-digit and digit chunks, with '~' ordering before anything including the empty chunk and letters before non-letters in non-digit chunks. Adds Ord/PartialOrd for DebianVersion, a free compare() and a later_than() convenience. Unit tests port all vectors from dpkg's scripts/t/Dpkg_Version.t plus Ubuntu-flavored cases (security uploads, ~ppa1 backports). Differential gate: every vector cross-checked against real 'dpkg --compare-versions' for <<, <=, =, >= and >>.
This commit is contained in:
@@ -111,7 +111,7 @@ Exit codes matter: e.g. unsatisfied build-deps ⇒ exit 3.
|
||||
| Tool | Used for | Complexity to replace natively | Strategy |
|
||||
|---|---|---|---|
|
||||
| `dpkg-parsechangelog` | source/version/maintainer/distribution/timestamp | **Low** — documented format; crates exist (`debian-changelog`, `deb822-parser` ecosystem) | Replaced (see §11, [`metadata.rs`](../src/build/metadata.rs)) |
|
||||
| `dpkg-version` compare | epoch/upstream/revision ordering | **Low** — small well-specified algorithm; crate `debversion` | Splitting/validation replaced; ordering still Phase 2 |
|
||||
| `dpkg-version` compare | epoch/upstream/revision ordering | **Low** — small well-specified algorithm; crate `debversion` | **Replaced** (§11, [`debian/version.rs`](../src/debian/version.rs): `Ord`/`compare`/`later_than`) |
|
||||
| `dpkg-architecture` | arch ↔ triplet tables, multiarch tuple, env dump | **Low-medium** — embed cputable/ostable/tupletable/abitable data (stable for years) | **Replaced** (§11, [`debian/arch.rs`](../src/debian/arch.rs)) |
|
||||
| `dpkg-checkbuilddeps` | deps vs installed status | **Medium** — `Dpkg::Deps` grammar (alternatives, arch qualifiers, `<profiles>` restrictions, versioned Provides subtleties, Multi-Arch facts) + status-file scan | Phase 2; keep `apt-get build-dep`/subprocess until then |
|
||||
| `dpkg-genbuildinfo` | `.buildinfo` | **Medium** — deb822 emit + status snapshot + checksums | Native (see §11, [`buildinfo.rs`](../src/build/buildinfo.rs)) |
|
||||
|
||||
Reference in New Issue
Block a user