Skip to content

Commit 4110b84

Browse files
committed
Filter package specs while packaging
1 parent 653025f commit 4110b84

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/cargo/ops/cargo_package.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult<Vec<Fi
187187
spec.query(member_ids)?;
188188
}
189189
}
190-
let pkgs = ws.members_with_features(specs, &opts.cli_features)?;
190+
let mut pkgs = ws.members_with_features(specs, &opts.cli_features)?;
191+
192+
// In `members_with_features_old`, it will add "current" package (determined by the cwd)
193+
// So we need filter
194+
pkgs.retain(|(pkg, _feats)| specs.iter().any(|spec| spec.matches(pkg.package_id())));
191195

192196
if ws
193197
.lock_root()

tests/testsuite/package.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6533,10 +6533,6 @@ fn in_package_workspace_with_members_with_features_old() {
65336533

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

0 commit comments

Comments
 (0)