-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement printing only missing (--missing) packages #16
base: main
Are you sure you want to change the base?
Conversation
This moves the triple-bool DebianInfo struct into a stricter CrateStatus enum and uses that throughout the db query interface to communicate the result. Additional changes: * move the status string into a std::fmt::Display implementation for CrateStatus. This allows a uniform representation everywhere. * ignore I/O and deserialization errors when trying to read the cache. This allows for a silent upgrade of the cache format, discarding entries of previous versions. If the cache target has permissions issues, this should show up when trying to write to it. Output for this commit of cargo-debstatus: ``` cargo-debstatus v0.4.0 (/home/david/github/cargo-debstatus) ├── anyhow v1.0.43 (in debian) ├── cargo_metadata v0.14.0 (in debian) ├── colored v2.0.0 (in debian) ├── crossbeam-channel v0.5.1 (in debian) ├── dirs v3.0.2 (outdated) ├── env_logger v0.9.0 (in debian) ├── indicatif v0.16.2 (in debian) ├── log v0.4.14 (in debian) ├── petgraph v0.6.0 (in debian) ├── postgres v0.19.1 │ ├── bytes v1.0.1 (in debian) │ ├── fallible-iterator v0.2.0 (in debian) │ ├── futures v0.3.16 (in debian) │ ├── log v0.4.14 (in debian) │ ├── tokio v1.10.0 (in debian) │ └── tokio-postgres v0.7.2 │ ├── async-trait v0.1.51 (in debian) │ ├── byteorder v1.4.3 (in debian) │ ├── bytes v1.0.1 (in debian) │ ├── fallible-iterator v0.2.0 (in debian) │ ├── futures v0.3.16 (in debian) │ ├── log v0.4.14 (in debian) │ ├── parking_lot v0.11.1 (outdated) │ ├── percent-encoding v2.1.0 (in debian) │ ├── phf v0.8.0 (outdated) │ ├── pin-project-lite v0.2.7 (in debian) │ ├── postgres-protocol v0.6.1 (in debian) │ ├── postgres-types v0.2.1 (in debian) │ ├── socket2 v0.4.1 (in debian) │ ├── tokio v1.10.0 (in debian) │ └── tokio-util v0.6.7 (outdated) ├── semver v1.0.4 (in debian) ├── serde v1.0.127 (in debian) ├── serde_json v1.0.66 (in debian) └── structopt v0.3.22 (in debian) ``` diff against output on `main`: ```diff --- /home/david/tmp/old 2022-10-05 20:07:57.456498093 +0100 +++ /home/david/tmp/new 2022-10-05 20:06:13.776008456 +0100 @@ -3,8 +3,7 @@ ├── cargo_metadata v0.14.0 (in debian) ├── colored v2.0.0 (in debian) ├── crossbeam-channel v0.5.1 (in debian) -├── dirs v3.0.2 -│ └── dirs-sys v0.3.6 (in debian) +├── dirs v3.0.2 (outdated) ├── env_logger v0.9.0 (in debian) ├── indicatif v0.16.2 (in debian) ├── log v0.4.14 (in debian) @@ -22,30 +21,15 @@ │ ├── fallible-iterator v0.2.0 (in debian) │ ├── futures v0.3.16 (in debian) │ ├── log v0.4.14 (in debian) -│ ├── parking_lot v0.11.1 -│ │ ├── instant v0.1.10 (in debian) -│ │ ├── lock_api v0.4.4 (in debian) -│ │ └── parking_lot_core v0.8.3 -│ │ ├── cfg-if v1.0.0 (in debian) -│ │ ├── instant v0.1.10 (in debian) -│ │ ├── libc v0.2.99 (in debian) -│ │ └── smallvec v1.6.1 (in debian) +│ ├── parking_lot v0.11.1 (outdated) │ ├── percent-encoding v2.1.0 (in debian) -│ ├── phf v0.8.0 -│ │ └── phf_shared v0.8.0 -│ │ └── siphasher v0.3.6 (in debian) +│ ├── phf v0.8.0 (outdated) │ ├── pin-project-lite v0.2.7 (in debian) │ ├── postgres-protocol v0.6.1 (in debian) │ ├── postgres-types v0.2.1 (in debian) │ ├── socket2 v0.4.1 (in debian) │ ├── tokio v1.10.0 (in debian) -│ └── tokio-util v0.6.7 -│ ├── bytes v1.0.1 (in debian) -│ ├── futures-core v0.3.16 (in debian) -│ ├── futures-sink v0.3.16 (in debian) -│ ├── log v0.4.14 (in debian) -│ ├── pin-project-lite v0.2.7 (in debian) -│ └── tokio v1.10.0 (in debian) +│ └── tokio-util v0.6.7 (outdated) ├── semver v1.0.4 (in debian) ├── serde v1.0.127 (in debian) ├── serde_json v1.0.66 (in debian) ```
This fixes kpcyrd#10. This depends and includes kpcyrd#15. ```shell ✦ ❯ cargo run -- debstatus --help [...] -a, --all Don't truncate dependencies that have already been displayed -d, --duplicate Show only dependencies which come in multiple versions (implies -i) -m, --missing Show only dependencies which are missing or are outdated [...] ✦ ❯ cargo run -- debstatus --missing [...] cargo-debstatus v0.4.0 (/home/david/github/cargo-debstatus) ├── postgres v0.19.1 │ └── tokio-postgres v0.7.2 ✦ ❯ cargo run -- debstatus --missing --no-indent [...] cargo-debstatus v0.4.0 (/home/david/github/cargo-debstatus) postgres v0.19.1 tokio-postgres v0.7.2 ✦ ❯ ```
c7b34d3
to
5f45ff0
Compare
rebased/deconflicted this and addressed rustfmt complaint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement. I have one thought on how to further improve this that it would be great to get feedback on.
pub enum CrateStatus { | ||
Available, | ||
AvailableInNew, | ||
Outdated, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Outdated here is a bit ambiguous, isn't there two cases here: Too new version in Debian, and Too old version in Debian?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't that be resolved like this:
pub enum CrateStatus {
Available,
AvailableInNew,
Outdated_Needs_Update,
Newer_Needs_Patching,
Missing,
}
and so on for the rest of the code. That's a feature I really'd like to see.
This fixes #10. This depends and includes #15.