Skip to content

Commit

Permalink
Filter package specs while packaging
Browse files Browse the repository at this point in the history
jneem committed Aug 30, 2024
1 parent 653025f commit 4110b84
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
@@ -187,7 +187,11 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult<Vec<Fi
spec.query(member_ids)?;
}
}
let pkgs = ws.members_with_features(specs, &opts.cli_features)?;
let mut pkgs = ws.members_with_features(specs, &opts.cli_features)?;

// In `members_with_features_old`, it will add "current" package (determined by the cwd)
// So we need filter
pkgs.retain(|(pkg, _feats)| specs.iter().any(|spec| spec.matches(pkg.package_id())));

if ws
.lock_root()
4 changes: 0 additions & 4 deletions tests/testsuite/package.rs
Original file line number Diff line number Diff line change
@@ -6533,10 +6533,6 @@ fn in_package_workspace_with_members_with_features_old() {

p.cargo("package -p li --no-verify")
.with_stderr_data(str![[r#"
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
[PACKAGING] foo v0.1.0 ([ROOT]/foo)
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
[WARNING] manifest has no documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
[PACKAGING] li v0.0.1 ([ROOT]/foo/li)

0 comments on commit 4110b84

Please sign in to comment.