Skip to content
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

fix: constraints on virtual packages were ignored #795

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

baszalmstra
Copy link
Collaborator

If there was a package that had a constraint on a virtual package, e.g.:

"constrains": ["__cuda >=12.1"],

and the virtual dependency was never explicitly required it was silently ignored. So even though your system would only support cuda 11.8 the solver could select a version of a package that required a higher version.

This PR solves this by adding explicit requirements on each specified virtual package. This behavior is also added for libsolv.

@baszalmstra baszalmstra requested review from wolfv and tdejager July 25, 2024 14:12
@baszalmstra baszalmstra force-pushed the fix/virtual_package_constrains branch from da8d5b9 to 3374345 Compare July 25, 2024 14:28
@nichmor
Copy link
Contributor

nichmor commented Jul 29, 2024

What would be the error message if I don't have any cuda in my system_requirements, but the package still have a constrain on it? Would it make sense to add this scenario as a test-case?

@baszalmstra
Copy link
Collaborator Author

There would be no error. Because at that point there is no virtual package. It basically acts as a constrains on a non-existing package. We already have a test for that. :)

@tdejager tdejager merged commit ae65df4 into conda:main Jul 29, 2024
15 checks passed
@tdejager tdejager deleted the fix/virtual_package_constrains branch July 29, 2024 14:50
baszalmstra added a commit that referenced this pull request Aug 2, 2024
## 🤖 New release
* `rattler`: 0.27.2 -> 0.27.3 (✓ API compatible changes)
* `rattler_cache`: 0.1.4 -> 0.1.5 (✓ API compatible changes)
* `rattler_conda_types`: 0.26.3 -> 0.27.0 (⚠️ API breaking changes)
* `rattler_package_streaming`: 0.21.7 -> 0.22.0 (⚠️ API breaking
changes)
* `rattler_networking`: 0.20.10 -> 0.21.0 (⚠️ API breaking changes)
* `rattler_lock`: 0.22.16 -> 0.22.17 (✓ API compatible changes)
* `rattler_repodata_gateway`: 0.21.3 -> 0.21.4 (✓ API compatible
changes)
* `rattler_solve`: 1.0.0 -> 1.0.1 (✓ API compatible changes)
* `rattler_index`: 0.19.21 -> 0.19.22 (✓ API compatible changes)
* `rattler_shell`: 0.21.3 -> 0.21.4
* `rattler_virtual_packages`: 1.0.0 -> 1.0.1

### ⚠️ `rattler_conda_types` breaking changes

```
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.0/src/lints/enum_variant_added.ron

Failed in:
  variant ParseChannelError:InvalidName in C:\Users\bas\AppData\Local\Temp\.tmpZUBw8C\rattler\crates\rattler_conda_types\src\channel\mod.rs:391

--- failure enum_variant_missing: pub enum variant removed or renamed ---

Description:
A publicly-visible enum has at least one variant that is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.0/src/lints/enum_variant_missing.ron

Failed in:
  variant ParseMatchSpecError::InvalidNumberOfColons, previously in file C:\Users\bas\AppData\Local\Temp\.tmpiIwxAW\rattler_conda_types\src\match_spec\parse.rs:59
```

### ⚠️ `rattler_package_streaming` breaking changes

```
--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.0/src/lints/function_missing.ron

Failed in:
  function rattler_package_streaming::read::extract_conda, previously in file C:\Users\bas\AppData\Local\Temp\.tmpiIwxAW\rattler_package_streaming\src\read.rs:47
```

### ⚠️ `rattler_networking` breaking changes

```
--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.0/src/lints/function_missing.ron

Failed in:
  function rattler_networking::redact_known_secrets_from_url, previously in file C:\Users\bas\AppData\Local\Temp\.tmpiIwxAW\rattler_networking\src\redaction.rs:24

--- failure pub_module_level_const_missing: pub module-level const is missing ---

Description:
A public const is missing, renamed, or changed from const to static.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.0/src/lints/pub_module_level_const_missing.ron

Failed in:
  DEFAULT_REDACTION_STR in file C:\Users\bas\AppData\Local\Temp\.tmpiIwxAW\rattler_networking\src\redaction.rs:5

--- failure trait_missing: pub trait removed or renamed ---

Description:
A publicly-visible trait cannot be imported by its prior path. A `pub use` may have been removed, or the trait itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.0/src/lints/trait_missing.ron

Failed in:
  trait rattler_networking::Redact, previously in file C:\Users\bas\AppData\Local\Temp\.tmpiIwxAW\rattler_networking\src\redaction.rs:44
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `rattler`
<blockquote>

##
[0.27.3](baszalmstra/rattler@rattler-v0.27.2...rattler-v0.27.3)
- 2024-08-02

### Other
- mark some crates 1.0
([#789](https://github.com/baszalmstra/rattler/pull/789))
</blockquote>

## `rattler_cache`
<blockquote>

##
[0.1.5](baszalmstra/rattler@rattler_cache-v0.1.4...rattler_cache-v0.1.5)
- 2024-08-02

### Other
- mark some crates 1.0
([#789](https://github.com/baszalmstra/rattler/pull/789))
</blockquote>

## `rattler_conda_types`
<blockquote>

##
[0.27.0](baszalmstra/rattler@rattler_conda_types-v0.26.3...rattler_conda_types-v0.27.0)
- 2024-08-02

### Fixed
- redact secrets in the `canonical_name` functions
([#801](https://github.com/baszalmstra/rattler/pull/801))
- make `base_url` of `Channel` always contain a trailing slash
([#800](https://github.com/baszalmstra/rattler/pull/800))
- parse channel in matchspec string
([#792](https://github.com/baszalmstra/rattler/pull/792))
- constraints on virtual packages were ignored
([#795](https://github.com/baszalmstra/rattler/pull/795))
- url parsing for namelessmatchspec and cleanup functions
([#790](https://github.com/baszalmstra/rattler/pull/790))

### Other
- mark some crates 1.0
([#789](https://github.com/baszalmstra/rattler/pull/789))
</blockquote>

## `rattler_package_streaming`
<blockquote>

##
[0.22.0](baszalmstra/rattler@rattler_package_streaming-v0.21.7...rattler_package_streaming-v0.22.0)
- 2024-08-02

### Fixed
- redact secrets in the `canonical_name` functions
([#801](https://github.com/baszalmstra/rattler/pull/801))
- Fallback to fully reading the package stream when downloading before
attempting decompression
([#797](https://github.com/baszalmstra/rattler/pull/797))

### Other
- mark some crates 1.0
([#789](https://github.com/baszalmstra/rattler/pull/789))
</blockquote>

## `rattler_networking`
<blockquote>

##
[0.21.0](baszalmstra/rattler@rattler_networking-v0.20.10...rattler_networking-v0.21.0)
- 2024-08-02

### Fixed
- redact secrets in the `canonical_name` functions
([#801](https://github.com/baszalmstra/rattler/pull/801))
</blockquote>

## `rattler_lock`
<blockquote>

##
[0.22.17](baszalmstra/rattler@rattler_lock-v0.22.16...rattler_lock-v0.22.17)
- 2024-08-02

### Other
- mark some crates 1.0
([#789](https://github.com/baszalmstra/rattler/pull/789))
</blockquote>

## `rattler_repodata_gateway`
<blockquote>

##
[0.21.4](baszalmstra/rattler@rattler_repodata_gateway-v0.21.3...rattler_repodata_gateway-v0.21.4)
- 2024-08-02

### Fixed
- redact secrets in the `canonical_name` functions
([#801](https://github.com/baszalmstra/rattler/pull/801))

### Other
- mark some crates 1.0
([#789](https://github.com/baszalmstra/rattler/pull/789))
</blockquote>

## `rattler_solve`
<blockquote>

##
[1.0.1](baszalmstra/rattler@rattler_solve-v1.0.0...rattler_solve-v1.0.1)
- 2024-08-02

### Fixed
- constraints on virtual packages were ignored
([#795](https://github.com/baszalmstra/rattler/pull/795))
</blockquote>

## `rattler_index`
<blockquote>

##
[0.19.22](baszalmstra/rattler@rattler_index-v0.19.21...rattler_index-v0.19.22)
- 2024-08-02

### Other
- mark some crates 1.0
([#789](https://github.com/baszalmstra/rattler/pull/789))
</blockquote>

## `rattler_shell`
<blockquote>

##
[0.21.4](baszalmstra/rattler@rattler_shell-v0.21.3...rattler_shell-v0.21.4)
- 2024-08-02

### Other
- updated the following local packages: rattler_conda_types
</blockquote>

## `rattler_virtual_packages`
<blockquote>

##
[1.0.1](baszalmstra/rattler@rattler_virtual_packages-v1.0.0...rattler_virtual_packages-v1.0.1)
- 2024-08-02

### Other
- updated the following local packages: rattler_conda_types
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Signed-off-by: Bas Zalmstra <bas@prefix.dev>
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.

4 participants