-
Notifications
You must be signed in to change notification settings - Fork 19
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
Update rpm, migrate to clap and add source_date_epoch flag #83
Conversation
413e677
to
8c99d56
Compare
@cat-in-136 |
@newpavlov To resolve #82, the prerequisite is that the next version of rpm-rs/rpm have been released so that the git path does not have to be written to the Cargo.toml dependency. Other than that, some trivial work is required, such as updating README.md. In other words, there is still some work to be done. On the other hand, if you remove the "source_date_epoch flag" and "closes #82" from this PR / branch, it is thought to be almost ready to merge. What you do with it is up to you. Because you are a committer of rpm-rs/rpm. Your clap branch Some other cargo subcommands actually have this behavior, but I'd like to stick with it for compatibility with previous behavior and because it works properly with |
I guess
Do you have suggestions how it can be fixed? Personally, I dislike the subcommand workaround as well, but I couldn't find an easy way to fix it. |
@newpavlov Here is the short snippet to do same thing as cargo-tauri does. use clap::Parser;
#[derive(Debug, Parser)]
#[command(name = "cargo")]
#[command(bin_name = "cargo")]
enum CargoCli {
Foobarbaz(FoobarbazArgs),
}
#[derive(Debug, Parser)]//<--- instead of clap::Args, use clap::Parser derive.
#[command(name = "cargo-foobarbaz")]
#[command(bin_name = "cargo-foobarbaz")]
#[command(author, version, about, long_about = None)]
struct FoobarbazArgs {
#[arg(long)]
foo: Option<String>,
}
fn main() {
let args = if let Some("foobarbaz") = std::env::args().nth(1).as_deref() {
CargoCli::parse()
} else {
CargoCli::Foobarbaz(FoobarbazArgs::parse())
};
println!("{args:?}");
} |
@cat-in-136 |
@newpavlov Can you check my review comment above? |
Do you mean the difference between calling |
I have already confirmed that the issue of let mut args = std::env::args();
let args = if let Some("generate-rpm") = args.nth(1).as_deref() {
let CargoWrapper::GenerateRpm(args) = CargoWrapper::parse();
args
} else {
Cli::parse()
}; |
Thanks a lot. |
Fix degrades of `--auto-req` caused by clap migration (#83)
While
clap
-based code is somewhat heavier thangetopts
, it's more powerful and results in cleaner and easier to maintain code.This PR also fixes a bunch of Clippy warnings and introduces the
source-date
flag necessary for reproducible builds.I am not completely sure I got the extra metadata stuff correctly, so it's better to double check it.
Closes #82