diff --git a/examples/mamba/recipe.yaml b/examples/mamba/recipe.yaml index 1cb6489df..cbb25ccad 100644 --- a/examples/mamba/recipe.yaml +++ b/examples/mamba/recipe.yaml @@ -25,12 +25,6 @@ outputs: script: - ${{ "build_mamba.sh" if unix }} - ${{ "build_mamba.bat" if win }} - run_exports: - - ${{ pin_subpackage('libmamba', max_pin='x.x') }} - ignore_run_exports: - - spdlog - - python - # - ${{ "python" if win }} requirements: build: - ${{ compiler('cxx') }} @@ -54,6 +48,13 @@ outputs: - zstd run: - libsolv >=0.7.23 + run_exports: + - ${{ pin_subpackage('libmamba', max_pin='x.x') }} + ignore_run_exports: + by_name: + - spdlog + - python + # - ${{ "python" if win }} test: commands: - if: unix @@ -81,10 +82,6 @@ outputs: - ${{ "build_mamba.sh" if unix }} - ${{ "build_mamba.bat" if win }} string: py_sup${{ python | version_to_buildstring }}h${{ hash }}_${{ build_number }} - run_exports: - - ${{ pin_subpackage('libmambapy', max_pin='x.x') }} - ignore_run_exports: - - spdlog requirements: build: - ${{ compiler('cxx') }} @@ -112,7 +109,11 @@ outputs: run: - python - ${{ pin_subpackage('libmamba', exact=True) }} - + run_exports: + - ${{ pin_subpackage('libmambapy', max_pin='x.x') }} + ignore_run_exports: + by_name: + - spdlog test: imports: - libmambapy diff --git a/src/recipe/custom_yaml.rs b/src/recipe/custom_yaml.rs index 8f7e06cd6..958f7702d 100644 --- a/src/recipe/custom_yaml.rs +++ b/src/recipe/custom_yaml.rs @@ -3,7 +3,7 @@ use std::{collections::BTreeMap, fmt, hash::Hash, ops, path::PathBuf}; -use indexmap::IndexMap; +use indexmap::{IndexMap, IndexSet}; use marked_yaml::{types::MarkedScalarNode, Span}; use url::Url; @@ -1086,6 +1086,16 @@ where } } +impl TryConvertNode> for RenderedNode +where + RenderedNode: TryConvertNode, + RenderedScalarNode: TryConvertNode, +{ + fn try_convert(&self, name: &str) -> Result, PartialParsingError> { + TryConvertNode::>::try_convert(self, name).map(|v| v.into_iter().collect()) + } +} + impl TryConvertNode> for RenderedNode where RenderedNode: TryConvertNode, diff --git a/src/recipe/parser.rs b/src/recipe/parser.rs index 3d4d65924..d6dd9569d 100644 --- a/src/recipe/parser.rs +++ b/src/recipe/parser.rs @@ -27,10 +27,12 @@ mod test; pub use self::{ about::About, - build::{Build, RunExports}, + build::Build, output::find_outputs_from_src, package::{OutputPackage, Package}, - requirements::{Compiler, Dependency, PinSubpackage, Requirements}, + requirements::{ + Compiler, Dependency, IgnoreRunExports, PinSubpackage, Requirements, RunExports, + }, script::{Script, ScriptContent}, source::{Checksum, GitSource, GitUrl, PathSource, Source, UrlSource}, test::{PackageContent, Test}, diff --git a/src/recipe/parser/build.rs b/src/recipe/parser/build.rs index 1321ed2c1..a5c95fc89 100644 --- a/src/recipe/parser/build.rs +++ b/src/recipe/parser/build.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use rattler_conda_types::{package::EntryPoint, NoArchKind, NoArchType, PackageName}; +use rattler_conda_types::{package::EntryPoint, NoArchKind, NoArchType}; use serde::{Deserialize, Serialize}; use super::Dependency; @@ -9,8 +9,7 @@ use crate::{ _partialerror, recipe::{ custom_yaml::{ - HasSpan, RenderedMappingNode, RenderedNode, RenderedScalarNode, RenderedSequenceNode, - TryConvertNode, + HasSpan, RenderedMappingNode, RenderedNode, RenderedScalarNode, TryConvertNode, }, error::{ErrorKind, PartialParsingError}, }, @@ -30,12 +29,6 @@ pub struct Build { /// The build script can be either a list of commands or a path to a script. By /// default, the build script is set to `build.sh` or `build.bat` on Unix and Windows respectively. pub(super) script: Script, - /// A recipe can choose to ignore certain run exports of its dependencies - pub(super) ignore_run_exports: Vec, - /// A recipe can choose to ignore all run exports of coming from some packages - pub(super) ignore_run_exports_from: Vec, - /// The recipe can specify a list of run exports that it provides - pub(super) run_exports: RunExports, /// A noarch package runs on any platform. It can be either a python package or a generic package. pub(super) noarch: NoArchType, /// For a Python noarch package to have executables it is necessary to specify the python entry points. @@ -65,25 +58,6 @@ impl Build { &self.script } - /// Get run exports. - pub const fn run_exports(&self) -> &RunExports { - &self.run_exports - } - - /// Get the ignore run exports. - /// - /// A recipe can choose to ignore certain run exports of its dependencies - pub fn ignore_run_exports(&self) -> &[PackageName] { - self.ignore_run_exports.as_slice() - } - - /// Get the ignore run exports from. - /// - /// A recipe can choose to ignore all run exports of coming from some packages - pub fn ignore_run_exports_from(&self) -> &[PackageName] { - self.ignore_run_exports_from.as_slice() - } - /// Get the noarch type. pub const fn noarch(&self) -> &NoArchType { &self.noarch @@ -127,18 +101,9 @@ impl TryConvertNode for RenderedMappingNode { build.skip = conds.iter().any(|&v| v); } "script" => build.script = value.try_convert(key_str)?, - "ignore_run_exports" => { - build.ignore_run_exports = value.try_convert(key_str)?; - } - "ignore_run_exports_from" => { - build.ignore_run_exports_from = value.try_convert(key_str)?; - } "noarch" => { build.noarch = value.try_convert(key_str)?; } - "run_exports" => { - build.run_exports = value.try_convert(key_str)?; - } "entry_points" => { if let Some(NoArchKind::Generic) = build.noarch.kind() { return Err(_partialerror!( @@ -224,17 +189,6 @@ impl RunExports { } } -impl TryConvertNode for RenderedNode { - fn try_convert(&self, name: &str) -> Result { - match self { - RenderedNode::Scalar(s) => s.try_convert(name), - RenderedNode::Sequence(seq) => seq.try_convert(name), - RenderedNode::Mapping(map) => map.try_convert(name), - RenderedNode::Null(_) => Ok(RunExports::default()), - } - } -} - impl TryConvertNode for RenderedScalarNode { fn try_convert(&self, name: &str) -> Result { let mut run_exports = RunExports::default(); @@ -246,59 +200,6 @@ impl TryConvertNode for RenderedScalarNode { } } -impl TryConvertNode for RenderedSequenceNode { - fn try_convert(&self, name: &str) -> Result { - let mut run_exports = RunExports::default(); - - for node in self.iter() { - let deps = node.try_convert(name)?; - run_exports.weak = deps; - } - - Ok(run_exports) - } -} - -impl TryConvertNode for RenderedMappingNode { - fn try_convert(&self, name: &str) -> Result { - let mut run_exports = RunExports::default(); - - for (key, value) in self.iter() { - let key_str = key.as_str(); - match key_str { - "noarch" => { - run_exports.noarch = value.try_convert(key_str)?; - } - "strong" => { - let deps = value.try_convert(key_str)?; - run_exports.strong = deps; - } - "strong_constrains" => { - let deps = value.try_convert(key_str)?; - run_exports.strong_constrains = deps; - } - "weak" => { - let deps = value.try_convert(key_str)?; - run_exports.weak = deps; - } - "weak_constrains" => { - let deps = value.try_convert(key_str)?; - run_exports.weak_constrains = deps; - } - invalid => { - return Err(_partialerror!( - *key.span(), - ErrorKind::InvalidField(invalid.to_owned().into()), - help = format!("fields for {name} should be one of: `weak`, `strong`, `noarch`, `strong_constrains`, or `weak_constrains`") - )); - } - } - } - - Ok(run_exports) - } -} - impl TryConvertNode for RenderedNode { fn try_convert(&self, name: &str) -> Result { self.as_scalar() diff --git a/src/recipe/parser/requirements.rs b/src/recipe/parser/requirements.rs index bbb9778be..64418916a 100644 --- a/src/recipe/parser/requirements.rs +++ b/src/recipe/parser/requirements.rs @@ -1,10 +1,12 @@ //! Parsing for the requirements section of the recipe. +use indexmap::IndexSet; use std::{fmt, str::FromStr}; -use rattler_conda_types::MatchSpec; +use rattler_conda_types::{MatchSpec, PackageName}; use serde::{Deserialize, Serialize}; +use crate::recipe::custom_yaml::RenderedSequenceNode; use crate::{ _partialerror, recipe::{ @@ -24,7 +26,7 @@ pub struct Requirements { /// The environment will thus be resolved with the appropriate platform /// that is currently running (e.g. on linux-64 it will be resolved with linux-64). /// Typically things like compilers, build tools, etc. are installed here. - #[serde(default)] + #[serde(default, skip_serializing_if = "Vec::is_empty")] pub build: Vec, /// Requirements at _host_ time are requirements that the final executable is going /// to _link_ against. The environment will be resolved with the target_platform @@ -32,18 +34,26 @@ pub struct Requirements { /// host environment will be resolved with linux-aarch64). /// /// Typically things like libraries, headers, etc. are installed here. - #[serde(default)] + #[serde(default, skip_serializing_if = "Vec::is_empty")] pub host: Vec, /// Requirements at _run_ time are requirements that the final executable is going /// to _run_ against. The environment will be resolved with the target_platform /// at runtime. - #[serde(default)] + #[serde(default, skip_serializing_if = "Vec::is_empty")] pub run: Vec, /// Constrains are optional runtime requirements that are used to constrain the /// environment that is resolved. They are not installed by default, but when /// installed they will have to conform to the constrains specified here. - #[serde(default)] + #[serde(default, skip_serializing_if = "Vec::is_empty")] pub run_constrained: Vec, + + /// The recipe can specify a list of run exports that it provides. + #[serde(default, skip_serializing_if = "RunExports::is_empty")] + pub run_exports: RunExports, + + /// Ignore run-exports by name or from certain packages + #[serde(default, skip_serializing_if = "IgnoreRunExports::is_empty")] + pub ignore_run_exports: IgnoreRunExports, } impl Requirements { @@ -67,6 +77,16 @@ impl Requirements { self.run_constrained.as_slice() } + /// Get run exports. + pub const fn run_exports(&self) -> &RunExports { + &self.run_exports + } + + /// Get run exports that are ignored. + pub const fn ignore_run_exports(&self) -> &IgnoreRunExports { + &self.ignore_run_exports + } + /// Get all requirements at build time (combines build and host requirements) pub fn build_time(&self) -> impl Iterator { self.build.iter().chain(self.host.iter()) @@ -110,6 +130,8 @@ impl TryConvertNode for RenderedMappingNode { let mut host = Vec::new(); let mut run = Vec::new(); let mut run_constrained = Vec::new(); + let mut run_exports = RunExports::default(); + let mut ignore_run_exports = IgnoreRunExports::default(); for (key, value) in self.iter() { let key_str = key.as_str(); @@ -118,6 +140,12 @@ impl TryConvertNode for RenderedMappingNode { "host" => host = value.try_convert(key_str)?, "run" => run = value.try_convert(key_str)?, "run_constrained" => run_constrained = value.try_convert(key_str)?, + "run_exports" => { + run_exports = value.try_convert(key_str)?; + } + "ignore_run_exports" => { + ignore_run_exports = value.try_convert(key_str)?; + } invalid_key => { return Err(_partialerror!( *key.span(), @@ -132,6 +160,8 @@ impl TryConvertNode for RenderedMappingNode { host, run, run_constrained, + run_exports, + ignore_run_exports, }) } } @@ -381,6 +411,211 @@ impl TryConvertNode for RenderedScalarNode { }) } } +/// Run exports are applied to downstream packages that depend on this package. +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct RunExports { + /// Noarch run exports are the only ones looked at when building noarch packages. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub noarch: Vec, + /// Strong run exports apply from the build and host env to the run env. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub strong: Vec, + /// Strong run constrains add run_constrains from the build and host env. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub strong_constrains: Vec, + /// Weak run exports apply from the host env to the run env. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub weak: Vec, + /// Weak run constrains add run_constrains from the host env. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub weak_constrains: Vec, +} + +impl RunExports { + /// Check if all fields are empty + pub fn is_empty(&self) -> bool { + self.noarch.is_empty() + && self.strong.is_empty() + && self.strong_constrains.is_empty() + && self.weak.is_empty() + && self.weak_constrains.is_empty() + } + + /// Get all run exports from all configurations + pub fn all(&self) -> impl Iterator { + self.noarch + .iter() + .chain(self.strong.iter()) + .chain(self.strong_constrains.iter()) + .chain(self.weak.iter()) + .chain(self.weak_constrains.iter()) + } + + /// Get the noarch run exports. + pub fn noarch(&self) -> &[Dependency] { + self.noarch.as_slice() + } + + /// Get the strong run exports. + pub fn strong(&self) -> &[Dependency] { + self.strong.as_slice() + } + + /// Get the strong run constrains. + pub fn strong_constrains(&self) -> &[Dependency] { + self.strong_constrains.as_slice() + } + + /// Get the weak run exports. + pub fn weak(&self) -> &[Dependency] { + self.weak.as_slice() + } + + /// Get the weak run constrains. + pub fn weak_constrains(&self) -> &[Dependency] { + self.weak_constrains.as_slice() + } +} + +impl TryConvertNode for RenderedNode { + fn try_convert(&self, name: &str) -> Result { + match self { + RenderedNode::Scalar(s) => s.try_convert(name), + RenderedNode::Sequence(seq) => seq.try_convert(name), + RenderedNode::Mapping(map) => map.try_convert(name), + RenderedNode::Null(_) => Ok(RunExports::default()), + } + } +} + +impl TryConvertNode for RenderedScalarNode { + fn try_convert(&self, name: &str) -> Result { + let mut run_exports = RunExports::default(); + + let dep = self.try_convert(name)?; + run_exports.weak.push(dep); + + Ok(run_exports) + } +} + +impl TryConvertNode for RenderedSequenceNode { + fn try_convert(&self, name: &str) -> Result { + let mut run_exports = RunExports::default(); + + for node in self.iter() { + let deps = node.try_convert(name)?; + run_exports.weak = deps; + } + + Ok(run_exports) + } +} + +impl TryConvertNode for RenderedMappingNode { + fn try_convert(&self, name: &str) -> Result { + let mut run_exports = RunExports::default(); + + for (key, value) in self.iter() { + let key_str = key.as_str(); + match key_str { + "noarch" => { + run_exports.noarch = value.try_convert(key_str)?; + } + "strong" => { + let deps = value.try_convert(key_str)?; + run_exports.strong = deps; + } + "strong_constrains" => { + let deps = value.try_convert(key_str)?; + run_exports.strong_constrains = deps; + } + "weak" => { + let deps = value.try_convert(key_str)?; + run_exports.weak = deps; + } + "weak_constrains" => { + let deps = value.try_convert(key_str)?; + run_exports.weak_constrains = deps; + } + invalid => { + return Err(_partialerror!( + *key.span(), + ErrorKind::InvalidField(invalid.to_owned().into()), + help = format!("fields for {name} should be one of: `weak`, `strong`, `noarch`, `strong_constrains`, or `weak_constrains`") + )); + } + } + } + + Ok(run_exports) + } +} + +/// Run exports to ignore +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct IgnoreRunExports { + #[serde(default, skip_serializing_if = "IndexSet::is_empty")] + pub(super) by_name: IndexSet, + #[serde(default, skip_serializing_if = "IndexSet::is_empty")] + pub(super) from_package: IndexSet, +} + +impl IgnoreRunExports { + /// Returns the package names that should be ignored as run_exports. + pub fn by_name(&self) -> &IndexSet { + &self.by_name + } + + /// Returns the package names from who we should ignore any run_export requirement. + #[allow(clippy::wrong_self_convention)] + pub fn from_package(&self) -> &IndexSet { + &self.from_package + } + + /// Returns true if this instance is considered empty, e.g. no run_exports should be ignored at + /// all. + pub fn is_empty(&self) -> bool { + self.by_name.is_empty() && self.from_package.is_empty() + } +} + +impl TryConvertNode for RenderedNode { + fn try_convert(&self, name: &str) -> Result { + self.as_mapping() + .ok_or_else(|| _partialerror!(*self.span(), ErrorKind::ExpectedMapping)) + .and_then(|m| m.try_convert(name)) + } +} + +impl TryConvertNode for RenderedMappingNode { + fn try_convert(&self, name: &str) -> Result { + let mut ignore_run_exports = IgnoreRunExports::default(); + + for (key, value) in self.iter() { + let key_str = key.as_str(); + match key_str { + "by_name" => { + ignore_run_exports.by_name = value.try_convert(key_str)?; + } + "from_package" => { + ignore_run_exports.from_package = value.try_convert(key_str)?; + } + invalid => { + return Err(_partialerror!( + *key.span(), + ErrorKind::InvalidField(invalid.to_owned().into()), + help = format!( + "fields for {name} should be one of: `by_name`, or `from_package`" + ) + )); + } + } + } + + Ok(ignore_run_exports) + } +} #[cfg(test)] mod test { @@ -402,18 +637,13 @@ mod test { let requirements = Requirements { build: vec![Dependency::Compiler(compiler)], - host: vec![], - run: vec![], - run_constrained: vec![], + ..Default::default() }; insta::assert_yaml_snapshot!(requirements); let yaml = serde_yaml::to_string(&requirements).unwrap(); - assert_eq!( - yaml, - "build:\n- __COMPILER gcc\nhost: []\nrun: []\nrun_constrained: []\n" - ); + assert_eq!(yaml, "build:\n- __COMPILER gcc\n"); let deserialized: Requirements = serde_yaml::from_str(&yaml).unwrap(); insta::assert_yaml_snapshot!(deserialized); diff --git a/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde-2.snap b/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde-2.snap index a90dccaa0..780e4b561 100644 --- a/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde-2.snap +++ b/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde-2.snap @@ -4,7 +4,4 @@ expression: deserialized --- build: - __COMPILER gcc -host: [] -run: [] -run_constrained: [] diff --git a/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde.snap b/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde.snap index e227621f2..2a7ca2b07 100644 --- a/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde.snap +++ b/src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde.snap @@ -4,7 +4,4 @@ expression: requirements --- build: - __COMPILER gcc -host: [] -run: [] -run_constrained: [] diff --git a/src/recipe/snapshots/rattler_build__recipe__parser__tests__it_works.snap b/src/recipe/snapshots/rattler_build__recipe__parser__tests__it_works.snap index 50134fc2c..7abe7921c 100644 --- a/src/recipe/snapshots/rattler_build__recipe__parser__tests__it_works.snap +++ b/src/recipe/snapshots/rattler_build__recipe__parser__tests__it_works.snap @@ -85,15 +85,6 @@ Recipe { ], ), }, - ignore_run_exports: [], - ignore_run_exports_from: [], - run_exports: RunExports { - noarch: [], - strong: [], - strong_constrains: [], - weak: [], - weak_constrains: [], - }, noarch: NoArchType( None, ), @@ -268,6 +259,17 @@ Recipe { }, ), ], + run_exports: RunExports { + noarch: [], + strong: [], + strong_constrains: [], + weak: [], + weak_constrains: [], + }, + ignore_run_exports: IgnoreRunExports { + by_name: {}, + from_package: {}, + }, }, test: Test { imports: [], diff --git a/src/recipe/snapshots/rattler_build__recipe__parser__tests__jinja_sequence.snap b/src/recipe/snapshots/rattler_build__recipe__parser__tests__jinja_sequence.snap index 8095e016e..368dff6a2 100644 --- a/src/recipe/snapshots/rattler_build__recipe__parser__tests__jinja_sequence.snap +++ b/src/recipe/snapshots/rattler_build__recipe__parser__tests__jinja_sequence.snap @@ -12,21 +12,9 @@ build: skip: false script: - test succeeded - ignore_run_exports: [] - ignore_run_exports_from: [] - run_exports: - noarch: [] - strong: [] - strong_constrains: [] - weak: [] - weak_constrains: [] noarch: false entry_points: [] -requirements: - build: [] - host: [] - run: [] - run_constrained: [] +requirements: {} test: imports: [] commands: [] diff --git a/src/recipe/snapshots/rattler_build__recipe__parser__tests__recipe_windows.snap b/src/recipe/snapshots/rattler_build__recipe__parser__tests__recipe_windows.snap index c3c85c1e1..13ae7233e 100644 --- a/src/recipe/snapshots/rattler_build__recipe__parser__tests__recipe_windows.snap +++ b/src/recipe/snapshots/rattler_build__recipe__parser__tests__recipe_windows.snap @@ -85,15 +85,6 @@ Recipe { ], ), }, - ignore_run_exports: [], - ignore_run_exports_from: [], - run_exports: RunExports { - noarch: [], - strong: [], - strong_constrains: [], - weak: [], - weak_constrains: [], - }, noarch: NoArchType( None, ), @@ -249,6 +240,17 @@ Recipe { }, ), ], + run_exports: RunExports { + noarch: [], + strong: [], + strong_constrains: [], + weak: [], + weak_constrains: [], + }, + ignore_run_exports: IgnoreRunExports { + by_name: {}, + from_package: {}, + }, }, test: Test { imports: [], diff --git a/src/render/resolved_dependencies.rs b/src/render/resolved_dependencies.rs index ff0ee2782..f298b5345 100644 --- a/src/render/resolved_dependencies.rs +++ b/src/render/resolved_dependencies.rs @@ -478,12 +478,13 @@ pub async fn resolve_dependencies( .iter() .any(|m| Some(&rec.package_record.name) == m.name.as_ref()); - let ignore_run_exports_from = output.recipe.build().ignore_run_exports_from(); - if !ignore_run_exports_from.is_empty() { - res && !ignore_run_exports_from.contains(&rec.package_record.name) - } else { - res - } + let ignore_run_exports_from = output + .recipe + .requirements() + .ignore_run_exports() + .from_package(); + + res && !ignore_run_exports_from.contains(&rec.package_record.name) }) .map_err(ResolveError::CouldNotCollectRunExports)?; @@ -588,7 +589,7 @@ pub async fn resolve_dependencies( .collect::>()) }; - let run_exports = output.recipe.build().run_exports(); + let run_exports = output.recipe.requirements().run_exports(); let run_exports = if !run_exports.is_empty() { Some(RunExportsJson { diff --git a/src/render/snapshots/rattler_build__render__recipe__tests__render.snap b/src/render/snapshots/rattler_build__render__recipe__tests__render.snap index dd856dec3..04449871c 100644 --- a/src/render/snapshots/rattler_build__render__recipe__tests__render.snap +++ b/src/render/snapshots/rattler_build__render__recipe__tests__render.snap @@ -17,10 +17,6 @@ source: build: number: 0 string: h12341234_0 - script: ~ - ignore_run_exports: ~ - ignore_run_exports_from: ~ - run_exports: ~ noarch: false entry_points: [] requirements: diff --git a/src/snapshots/rattler_build__metadata__test__read_full_recipe-2.snap b/src/snapshots/rattler_build__metadata__test__read_full_recipe-2.snap index d9bb78357..f9d5f5e86 100644 --- a/src/snapshots/rattler_build__metadata__test__read_full_recipe-2.snap +++ b/src/snapshots/rattler_build__metadata__test__read_full_recipe-2.snap @@ -17,14 +17,6 @@ recipe: string: h60d57d3_0 skip: false script: [] - ignore_run_exports: [] - ignore_run_exports_from: [] - run_exports: - noarch: [] - strong: [] - strong_constrains: [] - weak: [] - weak_constrains: [] noarch: false entry_points: [] requirements: @@ -34,9 +26,6 @@ recipe: - perl - pkg-config - libtool - host: [] - run: [] - run_constrained: [] test: imports: [] commands: [] diff --git a/src/snapshots/rattler_build__metadata__test__read_full_recipe.snap b/src/snapshots/rattler_build__metadata__test__read_full_recipe.snap index f48b365d6..7fe87fb69 100644 --- a/src/snapshots/rattler_build__metadata__test__read_full_recipe.snap +++ b/src/snapshots/rattler_build__metadata__test__read_full_recipe.snap @@ -18,18 +18,9 @@ recipe: skip: false script: - python -m pip install . -vv --no-deps --no-build-isolation - ignore_run_exports: [] - ignore_run_exports_from: [] - run_exports: - noarch: [] - strong: [] - strong_constrains: [] - weak: [] - weak_constrains: [] noarch: python entry_points: [] requirements: - build: [] host: - pip - poetry-core >=1.0.0 @@ -39,7 +30,6 @@ recipe: - "pygments >=2.13.0,<3.0.0" - python ==3.10 - "typing_extensions >=4.0.0,<5.0.0" - run_constrained: [] test: imports: - rich diff --git a/src/snapshots/rattler_build__selectors__tests__flatten_selectors@selectors_flatten_2.yaml.snap b/src/snapshots/rattler_build__selectors__tests__flatten_selectors@selectors_flatten_2.yaml.snap index ff1609b63..5e3393f26 100644 --- a/src/snapshots/rattler_build__selectors__tests__flatten_selectors@selectors_flatten_2.yaml.snap +++ b/src/snapshots/rattler_build__selectors__tests__flatten_selectors@selectors_flatten_2.yaml.snap @@ -12,12 +12,6 @@ source: sha256: 63fd8a1dbec811e63d4f9b5e27757af45d08a219d0900c7c7a19e0b177a576b8 build: number: 0 - ignore_run_exports: - - libcurl - - libarchive - - libgcc-ng - - libstdcxx-ng - - spdlog requirements: build: - "{{ compiler(\"c\") }}" @@ -42,6 +36,13 @@ requirements: - openssl-static - reproc-cpp-static - reproc-static + ignore_run_exports: + by_name: + - libcurl + - libarchive + - libgcc-ng + - libstdcxx-ng + - spdlog test: commands: - test -f $PREFIX/bin/micromamba diff --git a/src/variant_config.rs b/src/variant_config.rs index 54e934811..5f17d65cb 100644 --- a/src/variant_config.rs +++ b/src/variant_config.rs @@ -599,7 +599,7 @@ impl VariantConfig { .run .iter() .chain(requirements.run_constrained.iter()) - .chain(parsed_recipe.build().run_exports().all()) + .chain(requirements.run_exports().all()) .try_for_each(|dep| -> Result<(), VariantError> { if let Dependency::PinSubpackage(pin_sub) = dep { let pin = pin_sub.pin_value(); diff --git a/test-data/recipes/run_exports/recipe.yaml b/test-data/recipes/run_exports/recipe.yaml index 340d272c6..ed51c8f1e 100644 --- a/test-data/recipes/run_exports/recipe.yaml +++ b/test-data/recipes/run_exports/recipe.yaml @@ -2,6 +2,6 @@ package: name: run_exports_test version: "1.0.0" -build: +requirements: run_exports: - ${{ pin_subpackage("run_exports_test", exact=True) }} diff --git a/test-data/rendered_recipes/curl_recipe.yaml b/test-data/rendered_recipes/curl_recipe.yaml index 9ec107f0e..7b56f9c0e 100644 --- a/test-data/rendered_recipes/curl_recipe.yaml +++ b/test-data/rendered_recipes/curl_recipe.yaml @@ -13,14 +13,6 @@ recipe: string: h60d57d3_0 skip: false script: [] - ignore_run_exports: [] - ignore_run_exports_from: [] - run_exports: - noarch: [] - strong: [] - strong_constrains: [] - weak: [] - weak_constrains: [] noarch: false entry_points: [] requirements: diff --git a/test-data/rendered_recipes/rich_recipe.yaml b/test-data/rendered_recipes/rich_recipe.yaml index 8e2166cfa..aef7cf5a9 100644 --- a/test-data/rendered_recipes/rich_recipe.yaml +++ b/test-data/rendered_recipes/rich_recipe.yaml @@ -14,14 +14,6 @@ recipe: skip: false script: - python -m pip install . -vv --no-deps --no-build-isolation - ignore_run_exports: [] - ignore_run_exports_from: [] - run_exports: - noarch: [] - strong: [] - strong_constrains: [] - weak: [] - weak_constrains: [] noarch: python entry_points: [] requirements: