Skip to content

Cargo: decouple crate from main Cargo.toml workspace#7525

Merged
rbradford merged 7 commits intocloud-hypervisor:mainfrom
phip1611:workspace
Dec 9, 2025
Merged

Cargo: decouple crate from main Cargo.toml workspace#7525
rbradford merged 7 commits intocloud-hypervisor:mainfrom
phip1611:workspace

Conversation

@phip1611
Copy link
Member

@phip1611 phip1611 commented Nov 27, 2025

This is my solution for #7524 which we discussed in todays Cloud Hypervisor office hour. I think it improves certain things:

TL;DR improvements

  • more fearless refactorings: cargo test|check|clippy now run on the whole workspace by default (without explicit --all/--workspace)
  • main Cargo.toml is not so overwhelming anymore
  • We got rid of a lot of repetitions in CI files (no more -D warnings all the time)
  • cleaned up technical debt of unused build.rs scripts

More info in ticket or commit message.

Steps

  • add new workspace member cloud-hypervisor
  • move ./src to new workspace member
  • move ./tests to new workspace member
  • move relevant parts from Cargo.toml to new workspace member

@phip1611
Copy link
Member Author

From today's cloud hypervisor office meeting: Yes, it is a great improvement, we want to go that way (Rob)

@phip1611 phip1611 force-pushed the workspace branch 2 times, most recently from 4d0b9d2 to 544c9ab Compare November 27, 2025 18:48
@phip1611 phip1611 marked this pull request as ready for review November 27, 2025 18:48
@phip1611 phip1611 requested a review from a team as a code owner November 27, 2025 18:48
@phip1611 phip1611 force-pushed the workspace branch 5 times, most recently from 378de4b to 0259156 Compare November 28, 2025 08:05
@phip1611
Copy link
Member Author

phip1611 commented Nov 28, 2025

ping @RuoqingHe - I needed to take special care for the riscv job: bc4a2bd

@phip1611 phip1611 force-pushed the workspace branch 4 times, most recently from 796c055 to bc4a2bd Compare November 28, 2025 08:15
@phip1611 phip1611 self-assigned this Dec 2, 2025
Copy link
Member

@alyssais alyssais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the direction. :)

@phip1611 phip1611 force-pushed the workspace branch 5 times, most recently from 7615b35 to cc3bd62 Compare December 5, 2025 12:00
let target_cmd_path = format!("{target_artifact_dir}/{cmd}");

let full_path = workspace_root.join(&target_cmd_path);
String::from(full_path.to_str().unwrap())
Copy link
Member

@alyssais alyssais Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought, not a blocker at all: I wonder if we could use e.g. env!("CARGO_BIN_EXE_cloud-hypervisor") and get rid of this function. It should at least work for the code in tests/, but I'm not sure if it would be set when the test_infra crate is built, so if not it would require the two other users of this function to be adjusted to take an executable path as a parameter passed by code in tests/.

@rbradford rbradford added this pull request to the merge queue Dec 9, 2025
Merged via the queue into cloud-hypervisor:main with commit 0be7d1b Dec 9, 2025
48 of 49 checks passed
@phip1611 phip1611 deleted the workspace branch December 9, 2025 19:22
phip1611 added a commit to phip1611/cloud-hypervisor that referenced this pull request Dec 17, 2025
This is the first commit of the cherry-pick from [0].

[0] cloud-hypervisor#7525

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/cloud-hypervisor that referenced this pull request Dec 17, 2025
This is the last commit of the cherry-pick from [1].

`cargo rustc` is incompatible with virtual manifests, so the CI needs to
 use cargo build instead. However, passing `RUSTFLAGS="-D warnings"` via
 the environment would propagate to all dependencies, and some of them
 currently fail to build under ``-D warnings` due to issues like [0]:

```
error: creating a mutable reference to mutable static
  --> src/temp.rs:97:5
   |
97 |     DIRS.pop()
   |     ^^^^^^^^^^ mutable reference to mutable static
```

To resolve this, apply ``-D warnings` only to the `cargo clippy`
commands (which apply to our workspace only) and avoid enforcing it for
the entire cargo build.

[0]: https://github.com/cloud-hypervisor/cloud-hypervisor/actions/runs/19962283528/job/57245376263?pr=7525
[1]: cloud-hypervisor#7525

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/cloud-hypervisor that referenced this pull request Dec 17, 2025
This is the first commit of the cherry-pick from [0].

[0] cloud-hypervisor#7525

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/cloud-hypervisor that referenced this pull request Dec 17, 2025
This is the last commit of the cherry-pick from [1].

`cargo rustc` is incompatible with virtual manifests, so the CI needs to
 use cargo build instead. However, passing `RUSTFLAGS="-D warnings"` via
 the environment would propagate to all dependencies, and some of them
 currently fail to build under ``-D warnings` due to issues like [0]:

```
error: creating a mutable reference to mutable static
  --> src/temp.rs:97:5
   |
97 |     DIRS.pop()
   |     ^^^^^^^^^^ mutable reference to mutable static
```

To resolve this, apply ``-D warnings` only to the `cargo clippy`
commands (which apply to our workspace only) and avoid enforcing it for
the entire cargo build.

[0]: https://github.com/cloud-hypervisor/cloud-hypervisor/actions/runs/19962283528/job/57245376263?pr=7525
[1]: cloud-hypervisor#7525

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Dec 17, 2025
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50. As our v49-based CHV version backported these changes
already, we need to adapt the Nix build of CHV.

[0] cloud-hypervisor/cloud-hypervisor#7525
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Dec 17, 2025
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50. As our v49-based CHV version backported these changes
already, we need to adapt the Nix build of CHV.

[0] cloud-hypervisor/cloud-hypervisor#7525

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Jan 6, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50. Since we updated our Cloud Hypervisor to v50 [1], we
need to adjust that here.

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Jan 6, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 pushed a commit to phip1611/libvirt-tests that referenced this pull request Jan 6, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Jan 6, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Jan 6, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Jan 6, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Jan 7, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded our Cloud Hypervisor patchset
to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/libvirt-tests that referenced this pull request Jan 7, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded our Cloud Hypervisor patchset
to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
github-merge-queue bot pushed a commit to cyberus-technology/libvirt-tests that referenced this pull request Jan 7, 2026
Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and
the main package was moved to the `./cloud-hypervisor` subdirectory. This change
is effective since v50, which we just upgraded our Cloud Hypervisor patchset
to [1].

[0] cloud-hypervisor/cloud-hypervisor#7525
[1] cyberus-technology/cloud-hypervisor#60

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
phip1611 added a commit to phip1611/nixpkgs that referenced this pull request Jan 20, 2026
Since v50.0, Cloud Hypervisor unit test "just works" without
restrictions [0]. Also, `--workspace` is no longer needed [1] in
theory, but we need it here to use `--exclude`.

We still need some excludes for certain platforms, tho.

[0] cloud-hypervisor/cloud-hypervisor#7487
[1] cloud-hypervisor/cloud-hypervisor#7525
MiniHarinn pushed a commit to MiniHarinn/nixpkgs that referenced this pull request Feb 2, 2026
Since v50.0, Cloud Hypervisor unit test "just works" without
restrictions [0]. Also, `--workspace` is no longer needed [1] in
theory, but we need it here to use `--exclude`.

We still need some excludes for certain platforms, tho.

[0] cloud-hypervisor/cloud-hypervisor#7487
[1] cloud-hypervisor/cloud-hypervisor#7525
stevenhorsman added a commit to stevenhorsman/cloud-hypervisor that referenced this pull request Feb 3, 2026
In kata-containers we use the api_client create, but it's currently
failing our cargo deny check due to missing license, and there aren't
any license files within the crate, so I haven't found a good way to
work around this.

Alternatively I'd be happy to add the license to the workspace crate
and then reference it here, but that seems to clash with the direction
of the project in cloud-hypervisor#7525.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
stevenhorsman added a commit to stevenhorsman/cloud-hypervisor that referenced this pull request Feb 3, 2026
In kata-containers we use the api_client crate, but it's currently
failing our cargo deny check due to missing license, and there aren't
any license files within the crate, so I haven't found a good way to
work around this.

Alternatively I'd be happy to add the license to the workspace crate
and then reference it here, but that seems to clash with the direction
of the project in cloud-hypervisor#7525.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
stevenhorsman added a commit to stevenhorsman/cloud-hypervisor that referenced this pull request Feb 3, 2026
In kata-containers we use the api_client crate, but it's currently
failing our cargo deny check due to missing license, and there aren't
any license files within the crate, so I haven't found a good way to
work around this.

Alternatively I'd be happy to add the license to the workspace crate
and then reference it here, but that seems to clash with the direction
of the project in cloud-hypervisor#7525.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
stevenhorsman added a commit to stevenhorsman/cloud-hypervisor that referenced this pull request Feb 3, 2026
In kata-containers we use the api_client crate, but it's currently
failing our cargo deny check due to missing license, and there aren't
any license files within the crate, so I haven't found a good way to
work around this.

Alternatively I'd be happy to add the license to the workspace crate
and then reference it here, but that seems to clash with the direction
of the project in cloud-hypervisor#7525.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
stevenhorsman added a commit to stevenhorsman/cloud-hypervisor that referenced this pull request Feb 3, 2026
In kata-containers we use the api_client crate, but it's currently
failing our cargo deny check due to missing license, and there aren't
any license files within the crate, so I haven't found a good way to
work around this.

Alternatively I'd be happy to add the license to the workspace crate
and then reference it here, but that seems to clash with the direction
of the project in cloud-hypervisor#7525.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2026
In kata-containers we use the api_client crate, but it's currently
failing our cargo deny check due to missing license, and there aren't
any license files within the crate, so I haven't found a good way to
work around this.

Alternatively I'd be happy to add the license to the workspace crate
and then reference it here, but that seems to clash with the direction
of the project in #7525.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
Mynacol pushed a commit to Mynacol/nixpkgs that referenced this pull request Feb 3, 2026
Since v50.0, Cloud Hypervisor unit test "just works" without
restrictions [0]. Also, `--workspace` is no longer needed [1] in
theory, but we need it here to use `--exclude`.

We still need some excludes for certain platforms, tho.

[0] cloud-hypervisor/cloud-hypervisor#7487
[1] cloud-hypervisor/cloud-hypervisor#7525
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants