Skip to content

Improve handling of semver incompatible crates/packages

Rust allows a dependency tree to use different versions of a crate, including semver-incompatible versions. This should be reflected in determining what dependencies need to be packaged to support a crate.

Similarly, Debian may have multiple semver-incompatible versions of crates packaged in order to ease transitions from one semver version to another.

This MR updates the Packages parsing, reporting of packaged versions, and calculation of dependencies to take these factors into account.

As an example of the difference, here are the before/after for Alacritty v0.12.2.

Before MR Table: Packaged version is not what is required
Crate Required version Packaged version
ahash ^0.7.0 0.8.3
alacritty-config ^0.1.1 0.1.0
alacritty-config-derive ^0.2.1 0.2.0
alacritty-terminal ^0.19.1 0.17.0
arrayvec ^0.5.1 0.7.2
base64 ^0.13.0 0.21.2
bitflags ^1 2.3.2
clap ^3.2.1 4.0.32
clap-derive =3.2.18 4.0.21
clap-lex ^0.2.2 0.3.0
fst ^0.4.0 0.3.5
glutin ^0.30.4 0.29.1
hyphenation ^0.8.4 0.7.1
memoffset ^0.7 0.6.5
miniz-oxide ^0.5.0 0.6.2
mint ^0.5.6 0.5.5
nix ^0.24.1 0.26.2
notify ^5.1.0 5.0.0
print-bytes ^0.6 0.5.0
proc-macro-error-attr =1.0.4 1.0.3
regex-automata ^0.1.9 0.1.8
serde-derive =1.0.144 1.0.152
spin ^0.5.0 0.9.5
syn ^1.0.45 2.0.18
textwrap ^0.15.0 0.16.0
thiserror-impl =1.0.35 1.0.38
vec-map ^0.8.2 0.8.1
wayland-client ^0.29.5 0.29.4
wayland-commons ^0.29.5 0.29.4
wayland-scanner ^0.29.5 0.29.4
wayland-server ^0.29.5 0.29.4
wayland-sys ^0.29.5 0.29.4
winit ^0.28.2 0.27.5
x11rb ^0.10.0 0.8.1

Table: Required crate is not packaged at all

Crate Required version
ab_glyph ^0.2.17
atomic_polyfill ^1
bytemuck_derive ^1.2.1
clippy ^0.0
cloudflare_zlib_sys ^0.3.0
libz_ng_sys ^1.1.8
rustc_rayon ^0.4
rustc_std_workspace_alloc ^1.0.0
simd_adler32 ^0.3
x11rb_protocol ^0.10.0
ERROR missing_dependencies > ERROR: there were 44 missing dependencies
After MR Table: Packaged version is not what is required
Crate Required version Packaged versions
alacritty-config ^0.1.1 0.1.0
alacritty-config-derive ^0.2.1 0.2.0
alacritty-terminal ^0.19.1 0.17.0
base64 ^0.13.0 0.21.2
clap-lex ^0.2.2 0.3.0
fst ^0.4.0 0.3.5
glutin ^0.30.4 0.29.1
hyphenation ^0.8.4 0.7.1
memmap2 ^0.5.8 0.5.7
memoffset ^0.7 0.6.5
miniz-oxide ^0.5.0 0.6.2
mint ^0.5.6 0.5.5
mio ~0.7 0.8.4, 0.6.23
nix ^0.24.1 0.26.2
nix ^0.25 0.26.2
nix ^0.24 0.26.2
notify ^5.1.0 5.0.0
print-bytes ^0.6 0.5.0
proc-macro-error-attr =1.0.4 1.0.3
regex-automata ^0.1.9 0.1.8
serde-derive =1.0.144 1.0.152
spin ^0.5.0 0.9.5
terminal-size ^0.1.12 0.2.6
textwrap ^0.15.0 0.16.0
thiserror-impl =1.0.35 1.0.38
vec-map ^0.8.2 0.8.1
wayland-client ^0.29.5 0.29.4
wayland-commons ^0.29.5 0.29.4
wayland-scanner ^0.29.5 0.29.4
wayland-server ^0.29.5 0.29.4
wayland-sys ^0.29.5 0.29.4
winit ^0.28.2 0.27.5
x11rb ^0.10.0 0.8.1

Table: Required crate is not packaged at all

Crate Required version
ab_glyph ^0.2.17
atomic_polyfill ^1
bytemuck_derive ^1.2.1
clippy ^0.0
cloudflare_zlib_sys ^0.3.0
libz_ng_sys ^1.1.8
rustc_rayon ^0.4
rustc_std_workspace_alloc ^1.0.0
simd_adler32 ^0.3
x11rb_protocol ^0.10.0
ERROR missing_dependencies > ERROR: there were 43 missing dependencies

As a diff (ignore whitespace due to the change in width of the third column):

--- before.txt	2023-07-02 20:34:20.131604545 -0400
+++ after.txt	2023-07-02 20:43:58.264119820 -0400
@@ -1,31 +1,30 @@
 Table: Packaged version is not what is required

-| Crate                   | Required version | Packaged version |
-|-------------------------|------------------|------------------|
-| ahash                   | ^0.7.0           | 0.8.3            |
+| Crate                   | Required version | Packaged versions |
+|-------------------------|------------------|-------------------|
 | alacritty-config        | ^0.1.1           | 0.1.0            |
 | alacritty-config-derive | ^0.2.1           | 0.2.0            |
 | alacritty-terminal      | ^0.19.1          | 0.17.0           |
-| arrayvec                | ^0.5.1           | 0.7.2            |
 | base64                  | ^0.13.0          | 0.21.2           |
-| bitflags                | ^1               | 2.3.2            |
-| clap                    | ^3.2.1           | 4.0.32           |
-| clap-derive             | =3.2.18          | 4.0.21           |
 | clap-lex                | ^0.2.2           | 0.3.0            |
 | fst                     | ^0.4.0           | 0.3.5            |
 | glutin                  | ^0.30.4          | 0.29.1           |
 | hyphenation             | ^0.8.4           | 0.7.1            |
+| memmap2                 | ^0.5.8           | 0.5.7             |
 | memoffset               | ^0.7             | 0.6.5            |
 | miniz-oxide             | ^0.5.0           | 0.6.2            |
 | mint                    | ^0.5.6           | 0.5.5            |
+| mio                     | ~0.7             | 0.8.4, 0.6.23     |
 | nix                     | ^0.24.1          | 0.26.2           |
+| nix                     | ^0.25            | 0.26.2            |
+| nix                     | ^0.24            | 0.26.2            |
 | notify                  | ^5.1.0           | 5.0.0            |
 | print-bytes             | ^0.6             | 0.5.0            |
 | proc-macro-error-attr   | =1.0.4           | 1.0.3            |
 | regex-automata          | ^0.1.9           | 0.1.8            |
 | serde-derive            | =1.0.144         | 1.0.152          |
 | spin                    | ^0.5.0           | 0.9.5            |
-| syn                     | ^1.0.45          | 2.0.18           |
+| terminal-size           | ^0.1.12          | 0.2.6             |
 | textwrap                | ^0.15.0          | 0.16.0           |
 | thiserror-impl          | =1.0.35          | 1.0.38           |
 | vec-map                 | ^0.8.2           | 0.8.1            |
Edited by James McCoy

Merge request reports