rattler-build icon indicating copy to clipboard operation
rattler-build copied to clipboard

Hash mismatch when creating noarch packages for multiple target platforms

Open Hofer-Julian opened this issue 4 months ago • 7 comments

In our pixi tests we create the same package for multiple target platforms. With rattler-build version >= 0.37, installing one of these packages fails with a hash mismatch if it's a noarch package.

Here is a minimal reproducer:

# recipe.yaml
package:
  name: pixi-editor
  version: "0.1.3"

build:
  noarch: generic

Then run the following commands:

rattler-build build --target-platform linux-64 --recipe-dir recipe
rattler-build build --target-platform win-64 --recipe-dir recipe
pixi global install --channel ./output pixi-editor

Hofer-Julian avatar Aug 29 '25 12:08 Hofer-Julian

I think the problem here is that the build string is identical and something breaks down in the indexing, perhaps.

One way to work around it would be to change the build string like this:

build:
  string: ${{ hash }}_${{ "win" if target_platform == "win-64" else "unix" }}

wolfv avatar Aug 29 '25 13:08 wolfv

I think the problem here is that the build string is identical and something breaks down in the indexing, perhaps.

One way to work around it would be to change the build string like this:

build:
  string: ${{ hash }}_${{ "win" if target_platform == "win-64" else "unix" }}

I assume that will become a bit verbose with four target platform, right? https://github.com/prefix-dev/pixi/blob/1721cc4133d3e9e4571bf0d1740f5716d40315e7/tests/data/channels/update-channels.py#L13

Hofer-Julian avatar Aug 29 '25 16:08 Hofer-Julian

I'm not sure I understand why it needs to be built for different target platforms if it's noarch in the first place? :)

wolfv avatar Aug 29 '25 17:08 wolfv

I'm not sure I understand why it needs to be built for different target platforms if it's noarch in the first place? :)

Yeah, I could just remove the noarch for these recipes as a workaround

Hofer-Julian avatar Aug 30 '25 15:08 Hofer-Julian

I meant the other way around - you only need to build the package once and not for all the target platforms.

wolfv avatar Aug 30 '25 16:08 wolfv

I meant the other way around - you only need to build the package once and not for all the target platforms.

Most recipes have multiple outputs. How would the script handle recipes that contain both noarch and arch-specific packages?

Hofer-Julian avatar Aug 30 '25 17:08 Hofer-Julian

The noarch packages might have different hashes but have the same names and thus would be rejected from being uploaded. Or you could skip buolding the noarch package on the platforms that you don't want

wolfv avatar Aug 30 '25 17:08 wolfv