From 081c469f6f111e7392b18f47de584707316379dd Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 13 Jan 2026 16:17:38 +0100 Subject: [PATCH] tarball: include .cargo/config.toml again The problem worked around by commit e4674cd7b5f (.cargo/config.toml: exclude from tarball, 2025-01-12) is as follows: our OBS packages are built by doing something like tar xf $tarball && tar xf $vendor_tarball except that the tool apparently break when a file is present in both tarballs. Our workaround is to not include .cargo/config.toml in the tarball. The workaround seems too broad. It need not affect all tarballs but only the ones used by OBS. We want to add xtask aliases to .cargo/config.toml. They will be used by CMake targets (sphinx-doc), so they should be available to tarball consumers. Restrict the scope of the workaround: add back .cargo/config.toml to the export, and allow opting in to this behavioer by passing a negative pathspec build_tools/make_tarball.sh :/!.cargo/config.toml --- .gitattributes | 3 --- build_tools/make_tarball.sh | 6 +++++- build_tools/make_vendor_tarball.sh | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitattributes b/.gitattributes index 54b0ed57a..582e8a79e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,9 +18,6 @@ /.github/* export-ignore /.builds export-ignore /.builds/* export-ignore -# to make cargo vendor work correctly -/.cargo/ export-ignore -/.cargo/config.toml export-ignore # for linguist, which drives GitHub's language statistics alpine.js linguist-vendored diff --git a/build_tools/make_tarball.sh b/build_tools/make_tarball.sh index 98d67b937..13b044bf0 100755 --- a/build_tools/make_tarball.sh +++ b/build_tools/make_tarball.sh @@ -3,6 +3,10 @@ # Script to generate a tarball # Outputs to $FISH_ARTEFACT_PATH or ~/fish_built by default +# Example usage: +# +# build_tools/make_tarball.sh :/!.cargo/config.toml + # Exit on error set -e @@ -14,7 +18,7 @@ path=${FISH_ARTEFACT_PATH:-~/fish_built}/$prefix.tar.xz git archive \ --prefix="$prefix/" \ - HEAD | + HEAD "$@" | xz >"$path" # Output what we did, and the sha256 hash diff --git a/build_tools/make_vendor_tarball.sh b/build_tools/make_vendor_tarball.sh index 65012cf7d..e24fd8ba6 100755 --- a/build_tools/make_vendor_tarball.sh +++ b/build_tools/make_vendor_tarball.sh @@ -42,8 +42,14 @@ rm -f "$path" "$path".xz PREFIX_TMPDIR=$(mktemp -d) cd "$PREFIX_TMPDIR" +# Add .cargo/config.toml. This means that the caller may need to remove that file from the tarball. +# See e4674cd7b5f (.cargo/config.toml: exclude from tarball, 2025-01-12) + mkdir .cargo -cargo vendor --manifest-path "$wd/Cargo.toml" >> .cargo/config.toml +{ + cat "$wd"/.cargo/config.toml + cargo vendor --manifest-path "$wd/Cargo.toml" +} > .cargo/config.toml tar cfvJ "$path".xz vendor .cargo