Skip to content

Commit

Permalink
brings back fix for kind tarballs due to license file overwrites
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxesn committed Jul 6, 2023
1 parent 34d57b3 commit 4d981fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions build/lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,23 @@ function build::jq::update_in_place() {

cat $json_file | jq -S ''"$jq_query"'' > $json_file.tmp && mv $json_file.tmp $json_file
}

function build::common::copy_if_source_destination_different() {
local source=$1
local destination=$2

source_inode=$(stat -c %i $source)
destination_inode=""
if [ -d $destination ] && [ -e $destination/$(basename $source) ]; then
destination_inode=$(stat -c %i $destination/$(basename $source))
elif [ -f $destination ] && [ -e $destination ]; then
destination_inode=$(stat -c %i $destination)
fi

if [ -n "$destination_inode" ] && [ "$source_inode" = "$destination_inode" ]; then
echo "Source and destination are the same file"
exit 0
fi

cp -rf $source $destination
}
4 changes: 2 additions & 2 deletions build/lib/simple_create_tarballs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ function build::simple::tarball() {
TAR_FILE="${TAR_FILE_PREFIX}-${OS}-${ARCH}-${TAG}.tar.gz"

for path in "${LICENSE_PATHS[@]}"; do
build::common::echo_and_run cp -rf $path ${OUTPUT_BIN_DIR}/${OS}-${ARCH}/
build::common::echo_and_run build::common::copy_if_source_destination_different $path ${OUTPUT_BIN_DIR}/${OS}-${ARCH}/
done
for path in "${ATTRIBUTION_PATHS[@]}"; do
build::common::echo_and_run cp $path ${OUTPUT_BIN_DIR}/${OS}-${ARCH}/
build::common::echo_and_run build::common::copy_if_source_destination_different $path ${OUTPUT_BIN_DIR}/${OS}-${ARCH}/
done
build::common::create_tarball ${TAR_PATH}/${TAR_FILE} ${OUTPUT_BIN_DIR}/${OS}-${ARCH} .
done
Expand Down

0 comments on commit 4d981fd

Please sign in to comment.