Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brings back fix for kind tarballs due to license file overwrites #2294

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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