Skip to content

Commit

Permalink
switch to --noarch-build-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
hadim committed Nov 14, 2024
1 parent 60159af commit 83e420d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ e.g. `tar-bz2:<number>` (from 1 to 9) or `conda:<number>` (from -7 to
Skip packages that already exist in any channel


- `--noarch-platform <NOARCH_PLATFORM>`
- `--noarch-build-platform <NOARCH_BUILD_PLATFORM>`

Define a "noarch platform" for which the noarch packages will be built for. The noarch builds will be skipped on the other platforms

Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub fn get_tool_config(
.with_zstd_repodata_enabled(args.common.use_zstd)
.with_bz2_repodata_enabled(args.common.use_zstd)
.with_skip_existing(args.skip_existing)
.with_noarch_platform(args.noarch_platform)
.with_noarch_build_platform(args.noarch_build_platform)
.finish())
}

Expand Down Expand Up @@ -425,20 +425,20 @@ pub async fn skip_noarch(
mut outputs: Vec<Output>,
tool_configuration: &tool_configuration::Configuration,
) -> miette::Result<Vec<Output>> {
if let Some(noarch_platform) = tool_configuration.noarch_platform {
if let Some(noarch_build_platform) = tool_configuration.noarch_build_platform {
outputs.retain(|output| {
// Skip the build if:
// - target_platform is "noarch"
// and
// - build_platform != noarch_platform
// - build_platform != noarch_build_platform
let should_skip = output.build_configuration.target_platform == Platform::NoArch
&& output.build_configuration.build_platform.platform != noarch_platform;
&& output.build_configuration.build_platform.platform != noarch_build_platform;

if should_skip {
// The identifier should always be set at this point
tracing::info!(
"Skipping build because noarch_platform is set to {} for {}",
noarch_platform,
"Skipping build because noarch_build_platform is set to {} for {}",
noarch_build_platform,
output.identifier()
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub struct BuildOpts {
/// Define a "noarch platform" for which the noarch packages will be built
/// for. The noarch builds will be skipped on the other platforms.
#[arg(long, default_value = None, help_heading = "Modifying result")]
pub noarch_platform: Option<Platform>,
pub noarch_build_platform: Option<Platform>,

/// Extra metadata to include in about.json
#[arg(long, value_parser = parse_key_val)]
Expand Down
12 changes: 6 additions & 6 deletions src/tool_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct Configuration {
pub skip_existing: SkipExisting,

/// The noarch platform to use (noarch builds are skipped on other platforms)
pub noarch_platform: Option<Platform>,
pub noarch_build_platform: Option<Platform>,

/// The channel configuration to use when parsing channels.
pub channel_config: ChannelConfig,
Expand Down Expand Up @@ -118,7 +118,7 @@ pub struct ConfigurationBuilder {
use_zstd: bool,
use_bz2: bool,
skip_existing: SkipExisting,
noarch_platform: Option<Platform>,
noarch_build_platform: Option<Platform>,
channel_config: Option<ChannelConfig>,
compression_threads: Option<u32>,
}
Expand All @@ -142,7 +142,7 @@ impl ConfigurationBuilder {
use_zstd: true,
use_bz2: false,
skip_existing: SkipExisting::None,
noarch_platform: None,
noarch_build_platform: None,
channel_config: None,
compression_threads: None,
}
Expand Down Expand Up @@ -238,9 +238,9 @@ impl ConfigurationBuilder {
}

/// Define the noarch platform
pub fn with_noarch_platform(self, noarch_platform: Option<Platform>) -> Self {
pub fn with_noarch_build_platform(self, noarch_build_platform: Option<Platform>) -> Self {
Self {
noarch_platform,
noarch_build_platform,
..self
}
}
Expand Down Expand Up @@ -282,7 +282,7 @@ impl ConfigurationBuilder {
use_zstd: self.use_zstd,
use_bz2: self.use_bz2,
skip_existing: self.skip_existing,
noarch_platform: self.noarch_platform,
noarch_build_platform: self.noarch_build_platform,
channel_config,
compression_threads: self.compression_threads,
package_cache,
Expand Down

0 comments on commit 83e420d

Please sign in to comment.