Code review issue: https://gitlab.com/keys.openpgp.org/hagrid/-/merge_requests/214#note_2482960066
Changes:
- Remove "hagrid-delete" bin declaration from Cargo.toml.
- Remove "clap" dependency for "hagrid" crate in Cargo.toml as after
moving "hagrid-delete" to "hagridctl" "hagrid" crate does not use
"clap" any more.
- Remove "run-hagrid-delete" recipe with its "hagrid-delete" and
"delete" aliases from justfile.
- Update Cargo.lock.
- Create "delete" command for "hagridctl" by adding cli::Command::Delete
variant which previously were hagrid-delete::cli::Cli struct.
- Move "delete" module with command handler ("run" function) from
"hagrid" crate to hagridctl::delete.
- Extend hagridctl::cli::dispatch_cmd() function with processing of
cli::Command::Delete variant and call to hagridctl::delete::run.
- Move print_errors() from hagrid::delete::cli module to hagrdictl::cli.
- Move KeyDatabase instantiation from hagrid/src/main.rs into
hagridctl::delete::run command handler as this way of database
instantiation is specific to "delete" command.
Probably later we have to reconsider how we instantiate database for
all the commands to avoid reimplementing that functionality every time
and duplicating the code.
That move caused change in signature of hagridctl::delete::run
function. Now we pass base path instead of db reference.
Changes:
- Add "derive" and "unicode" features for "clap" in Cargo.toml.
- Remove dependency on "structopt" crate from Cargo.toml.
- Update Cargo.lock.
- Rename crate::delete::cli::Opt struct to Cli.
- Replace usage of #[structopt()] macros with #[derive(Parser)].
- Rename variables and function parameters from "opt" to "cli"
accordingly.
- Don't parse opt.query in dispatch_cmd function. As Opt.query field
type was replaced from String to Query in Cli.query new version of
Clap automatically determines value_parser and calls FromStr::from_str
implementation to convert str slice into field of type Query.
- Replace improrts of structopt::StructOpt with clap::Parser.
Changes:
- Add "derive" feature for "clap" in tester/Cargo.toml.
- Move about description from tester/src/cli.rs to "description" field in
tester/Cargo.toml. So, "clap" can access it via #[command(about)]
macro configuration.
- Update Cargo.lock.
- Replace in tester/src/cli.rs usage of clap::App from Clap 2.34.0
with clap::Parser derive macro based API, cli::Cli struct and cli::Command
enum.
- Remove "--config/-c <FILE>" option for "tester" as it wasn't used and
I believe it was a copy-paste from "hagridctl".
- Omit explicit specification of args name which resulted in upper
casing cmd option's parameters, e.g. "<cert count>" -> "<CERT_COUNT>".
- Replace in cli::dispatch_cmd() "if let" based logic with simple match
on cli::Command enum variants.
- Get rid of manual parsing of options' and commands' values in
cli::dispatch_cmd(). As it is hadled by derived
value_parser (https://docs.rs/clap/latest/clap/_derive/index.html#arg-attributes)
based on field types.
- Make "fprs_path" parameter of tester::generate::do_generate function
obligatory (previously it was Option<&Path>) as this argument has a
default value to "fingerprints.txt" which is populated by clap. So, it
never be None.
In addition, clean up logic related to optional "fprs_path" parameter
in tester::generate::do_generate function.
- Change signatures of the following functions to accept
"impl AsRef<Path>" instead of &Path or Option<&Path>:
- tester::generate::do_generate()
- tester::genreqs::do_genreqs()
That allows us to pass as function arguments anything from which Path
can be borrowed, e.g. PathBuf without the need to explicitly transform
the value at call site with calls like .as_path() or .as_deref().
- Replace in tester/src/main.rs cli::app().get_matches() (which is Clap
v2 API) with cli::Cli::parse() (Clap v4 API).
`cargo build` gives the following warnings:
warning: the following packages contain code that will be rejected by a future version of Rust: buf_redux v0.8.4, multipart v0.18.0, traitobject v0.1.0, typemap v0.3.3
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
which is when run with `cargo build --future-incompat-report` gives the
following:
warning: `hagrid` (bin "hagrid") generated 9 warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.91s
warning: the following packages contain code that will be rejected by a future version of Rust: buf_redux v0.8.4, multipart v0.18.0, traitobject v0.1.0, typemap v0.3.3
note:
To solve this problem, you can try the following approaches:
- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.
traitobject v0.1.0 has the following newer versions available: 0.1.1
- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):
- buf_redux@0.8.4
- Repository: https://github.com/abonander/buf_redux
- Detailed warning command: `cargo report future-incompatibilities --id 3 --package buf_redux@0.8.4`
- multipart@0.18.0
- Repository: http://github.com/abonander/multipart
- Detailed warning command: `cargo report future-incompatibilities --id 3 --package multipart@0.18.0`
- traitobject@0.1.0
- Repository: https://github.com/reem/rust-traitobject.git
- Detailed warning command: `cargo report future-incompatibilities --id 3 --package traitobject@0.1.0`
- typemap@0.3.3
- Repository: https://github.com/reem/rust-typemap
- Detailed warning command: `cargo report future-incompatibilities --id 3 --package typemap@0.3.3`
- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
note: this report can be shown with `cargo report future-incompatibilities --id 1`
In attempt to fix the warning I set explict dependency for "multipart"
crate.
Changes:
- Set explicit version of "multipart" dependency in Cargo.toml: "0" -> "0.18.0".
- Update Cargo.lock: `cargo build`
Starting with 1.18.0, the retain_userids method starts working
differently, returning an empty cert if no signed user ids or direct key
signature is left. Since we need this, we'll stay on 1.17.0 for now.
This update requires a forked version of rocket_i18n to accommodate for
a trivial renaming in rocket v0.5.0. Can be changed back to upstream if
https://github.com/Plume-org/rocket_i18n/pull/24 is merged.
This implements support for third-party userid certifications. To
prevent denial-of-service attacks, we only merge those certifications
that are attested by the key holder.
The key holder attests the certifications using an Attested Key
Signature containing the digests of the certifications in an Attested
Certifications subpacket as specified in RFC4880bis-10.
Fixes#124.