Skip to content

Commit

Permalink
Minor sync/remove.sh progress/newline adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
dzuelke committed May 30, 2024
1 parent 6767f65 commit 38c49c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
9 changes: 3 additions & 6 deletions support/build/_util/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ pushd "$manifests_tmp" > /dev/null

echo "Fetching manifests, excluding given removals... " >&2
s5cmd "${S5CMD_OPTIONS[@]}" cp ${S3_REGION:+--source-region "$S3_REGION"} "${excludes[@]}" "s3://${S3_BUCKET}/${S3_PREFIX}*.composer.json" "$manifests_tmp" || { echo -e "\nFailed to fetch manifests! See message above for errors." >&2; exit 1; }
echo "...done, now performing a sync of the differences.
" >&2

# we now simply treat this as a sync of packages between two folders, passing sync.sh the local and the remote
echo -e "\nNow performing a sync of the differences:\n" >&2

# we now simply treat this as a sync of packages between two folders, passing sync.sh the local dir as source and the remote as destination
# the "source" repository will have our matched manifests removed

"${here}/sync.sh" -s "$manifests_tmp" "$S3_BUCKET" "$S3_PREFIX" "$S3_REGION" "$S3_BUCKET" "$S3_PREFIX" "$S3_REGION"

echo "Removal complete.
" >&2
13 changes: 5 additions & 8 deletions support/build/_util/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ EOF

read -p "${prompt} [yN] " proceed

[[ ! $proceed =~ [yY](es)* ]] && exit
[[ ! $proceed =~ [yY](es)* ]] && { echo -e "Sync aborted.\n" >&2; exit; }

echo "" >&2

Expand Down Expand Up @@ -297,19 +297,16 @@ fi
if $wipe; then
echo "Removing packages.json..." >&2
AWS_REGION=$dst_region s5cmd "${S5CMD_OPTIONS[@]}" rm "s3://${dst_bucket}/${dst_prefix}packages.json" || { echo -e "\nFailed to remove repository! See message above for errors." >&2; exit 1; }
echo "" >&2
else
echo -n "Generating and uploading packages.json... " >&2
out=$(cd "$dst_tmp"; S3_BUCKET=$dst_bucket S3_PREFIX=$dst_prefix S3_REGION=$dst_region "$here/mkrepo.sh" --upload *.composer.json 2>&1) || { echo -e "failed! Error:\n$out\n\nIn case of transient errors, the repository must be re-generated manually." >&2; exit 1; }
echo "done!
" >&2
echo "Generating and uploading packages.json..." >&2
out=$(cd "$dst_tmp"; S3_BUCKET=$dst_bucket S3_PREFIX=$dst_prefix S3_REGION=$dst_region "$here/mkrepo.sh" --upload *.composer.json 2>&1) || { echo -e "\nFailed to generate/upload repository! Error:\n$out\n\nIn case of transient errors, the repository must be re-generated manually." >&2; exit 1; }
fi
echo "" >&2

if (( ${#run_dists_rm[@]} )); then
echo "Removing ${#run_dists_rm[@]} dists from destination..." >&2
printf -- "%s\n" "${run_dists_rm[@]}" | s5cmd "${S5CMD_OPTIONS[@]}" run || { echo -e "\nOne or more operation(s) failed. In case of transient errors, failed removals must be performed manually." >&2; exit 1; }
echo "" >&2
fi

echo "Sync complete.
" >&2
echo -e "Sync complete.\n" >&2

0 comments on commit 38c49c5

Please sign in to comment.