Skip to content

Commit

Permalink
make inline checksums optional but default
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskij committed Jan 2, 2025
1 parent b2d6159 commit eeb1c56
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ use anyhow::{anyhow, Context as _};
use cargo::core::registry::PackageRegistry;
use cargo::core::resolver::features::HasDevUnits;
use cargo::core::resolver::CliFeatures;
use cargo::core::GitReference;
use cargo::core::{Package, PackageId, PackageSet, Resolve, Workspace};
use cargo::core::{GitReference, Package, PackageId, PackageSet, Resolve, Workspace};
use cargo::ops;
use cargo::util::{important_paths, CargoResult};
use cargo::{CliResult, GlobalContext};
Expand Down Expand Up @@ -152,8 +151,12 @@ struct Args {
#[structopt(short = "R")]
reproducible: bool,

/// Don't emit inline checksums
#[structopt(short = "c", long)]
no_checksums: bool,

/// Legacy Overrides: Use legacy override syntax
#[structopt(short = "l", long = "--legacy-overrides")]
#[structopt(short, long)]
legacy_overrides: bool,
}

Expand Down Expand Up @@ -230,13 +233,23 @@ fn real_main(options: Args, gctx: &mut GlobalContext) -> CliResult {
None
} else if src_id.is_registry() {
// this package appears in a crate registry
Some(format!(
" crate://{}/{}/{}{} \\\n",
CRATES_IO_URL,
pkg.name(),
pkg.version(),
get_checksum(&package_set, pkg)
))
if options.no_checksums {
Some(format!(
" crate://{}/{}/{} \\\n",
CRATES_IO_URL,
pkg.name(),
pkg.version()
))
}
else {
Some(format!(
" crate://{}/{}/{}{} \\\n",
CRATES_IO_URL,
pkg.name(),
pkg.version(),
get_checksum(&package_set, pkg)
))
}
} else if src_id.is_path() {
// we don't want to spit out path based
// entries since they're within the crate
Expand Down

0 comments on commit eeb1c56

Please sign in to comment.