mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-23 08:22:41 +03:00
3b4e0bffe1
* New name should better reflect that we are _installing to the output_ rather than copying from some location to another
26 lines
757 B
Bash
26 lines
757 B
Bash
prepareCargoTargetDirAndCopyToDir() {
|
|
# Allow for calling with customized parameters
|
|
# or fall back to defaults if none are provided
|
|
local dir="${1:-${out}}"
|
|
local cargoTargetDir="${2:-${CARGO_TARGET_DIR:-target}}"
|
|
local dest="${dir}/target.tar.zst"
|
|
|
|
echo "copying ${cargoTargetDir} to ${dest}"
|
|
|
|
export SOURCE_DATE_EPOCH=1
|
|
mkdir -p "${dir}"
|
|
|
|
# See: https://reproducible-builds.org/docs/archives/
|
|
tar --sort=name \
|
|
--mtime="@${SOURCE_DATE_EPOCH}" \
|
|
--owner=0 \
|
|
--group=0 \
|
|
--numeric-owner \
|
|
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
|
|
-c "${cargoTargetDir}" | @zstd@ -o "${dest}"
|
|
}
|
|
|
|
if [ "1" = "${doCopyTargetToOutput-}" ]; then
|
|
postInstallHooks+=(prepareCargoTargetDirAndCopyToDir)
|
|
fi
|