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

`target_directory` refuses to overwrite files

Open baszalmstra opened this issue 8 months ago • 3 comments

The following recipe.yaml errors:

package:
  name: icu
  version: "75.1"

source:
  - url: https://github.com/unicode-org/icu/releases/download/release-75-1/icu4c-75_1-src.tgz
    sha256: cb968df3e4d2e87e8b11c49a5d01c787bd13b9545280fc6642f826527618caef
    patches:
      # Omit lib prefix on libraries.
      - if: osx
        then: mach-port-t.patch

  - url: https://github.com/unicode-org/icu/releases/download/release-75-1/icu4c-75_1-data.zip
    sha256: a5104212dc317a64f9b035723ea706f2f4fd5a0f37b7923fae7aeb9d1d0061b1
    target_directory: source/data

with:

× error File already exists: "F:\\projects\\icu-feedstock\\output\\bld\\rattler-build_icu_1745870626\\work\\source/data\\build.xml"
× error File already exists: "F:\\projects\\icu-feedstock\\output\\bld\\rattler-build_icu_1745870626\\work\\source/data\\BUILDRULES.py"
× error File already exists: "F:\\projects\\icu-feedstock\\output\\bld\\rattler-build_icu_1745870626\\work\\source/data\\cldr-icu-readme.txt"

The first source checkout already contains a folder called source/data to which the second source is extracted. I like that this yields an error because it clarifies that files will be overwritten, but currently, there is no workaround. I see three solutions in order of preference.

  1. Apply a filter to the first source to exclude the other folder. This is currently only supported for the path source, would be very useful in this case.
  2. Allow indicating that files should be overwritten.
  3. Simply ignore any files that are already present

baszalmstra avatar Apr 28 '25 20:04 baszalmstra

I am not sure I like either option too much.

Wouldn't it be better to let the user figure out how to fix it as part of the build script?

wolfv avatar Apr 29 '25 06:04 wolfv

E.g. use a different target_directory for the second download, and then move / copy / rename / delete files in the way they see fit?

wolfv avatar Apr 29 '25 07:04 wolfv

Perhaps but at least for configuring this in yaml is easier than the manual step.

baszalmstra avatar Apr 29 '25 10:04 baszalmstra