tarball: include .cargo/config.toml again

The problem worked around by commit e4674cd7b5 (.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
This commit is contained in:
Johannes Altmanninger
2026-01-13 16:17:38 +01:00
parent 1affa7a16e
commit 081c469f6f
3 changed files with 12 additions and 5 deletions

3
.gitattributes vendored
View File

@@ -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

View File

@@ -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

View File

@@ -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