Skip to content

Commit

Permalink
chore: better names and messages to tell diff from full
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc committed Oct 15, 2023
1 parent be237f5 commit 052de38
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/setupHooks/installCargoArtifactsHook.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
compressAndInstallCargoArtifactsDir() {
compressAndInstallCargoArtifactsDirFull() {
local dir="${1:?destination directory not defined}"
local cargoTargetDir="${2:?cargoTargetDir not defined}"

mkdir -p "${dir}"

local dest="${dir}/target.tar.zst"
echo "compressing ${cargoTargetDir} to ${dest}"
echo "compressing full content of ${cargoTargetDir} to ${dest}"
(
export SOURCE_DATE_EPOCH=1
tar --sort=name \
Expand All @@ -19,14 +19,14 @@ compressAndInstallCargoArtifactsDir() {
)
}

compressAndInstallCargoArtifactsDirIncremental() {
compressAndInstallCargoArtifactsDirDiff() {
local dir="${1:?destination directory not defined}"
local cargoTargetDir="${2:?cargoTargetDir not defined}"

mkdir -p "${dir}"

local dest="${dir}/target.tar.zst"
echo "compressing ${cargoTargetDir} to ${dest}"
echo "compressing new content of ${cargoTargetDir} to ${dest}"
(
export SOURCE_DATE_EPOCH=1
touch -d @${SOURCE_DATE_EPOCH} "${TMPDIR}/.crane.source-date-epoch"
Expand Down Expand Up @@ -92,15 +92,15 @@ prepareAndInstallCargoArtifactsDir() {
# If no artifcats were inherited in the first place,
# it's both faster and safer (mtime handlings bugs), to use
# a full snapshot.
if [ -n "${cargoArtifacts}" ];then
compressAndInstallCargoArtifactsDir "${dir}" "${cargoTargetDir}"
if [ -z "${cargoArtifacts}" ];then
compressAndInstallCargoArtifactsDirFull "${dir}" "${cargoTargetDir}"
else
compressAndInstallCargoArtifactsDirIncremental "${dir}" "${cargoTargetDir}"
compressAndInstallCargoArtifactsDirDiff "${dir}" "${cargoTargetDir}"
fi
;;

"use-zstd-full")
compressAndInstallCargoArtifactsDir "${dir}" "${cargoTargetDir}"
compressAndInstallCargoArtifactsDirFull "${dir}" "${cargoTargetDir}"
;;

"use-symlink")
Expand Down

0 comments on commit 052de38

Please sign in to comment.