2020-04-20 18:07:29 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
source ci/_
|
|
|
|
|
|
|
|
commit_range="$(git merge-base HEAD origin/master)..HEAD"
|
|
|
|
parsed_update_args="$(
|
2020-12-12 09:27:59 -08:00
|
|
|
git log "$commit_range" --author "dependabot\[bot\]" --oneline -n1 |
|
2020-06-15 19:31:46 -07:00
|
|
|
grep -o '[Bb]ump.*$' |
|
|
|
|
sed -r 's/[Bb]ump ([^ ]+) from ([^ ]+) to ([^ ]+)/-p \1:\2 --precise \3/'
|
2020-04-20 18:07:29 -07:00
|
|
|
)"
|
2020-04-28 01:40:25 -07:00
|
|
|
# relaxed_parsed_update_args is temporal measure...
|
|
|
|
relaxed_parsed_update_args="$(
|
2020-12-12 09:27:59 -08:00
|
|
|
git log "$commit_range" --author "dependabot\[bot\]" --oneline -n1 |
|
2020-06-15 19:31:46 -07:00
|
|
|
grep -o '[Bb]ump.*$' |
|
|
|
|
sed -r 's/[Bb]ump ([^ ]+) from [^ ]+ to ([^ ]+)/-p \1 --precise \2/'
|
2020-04-28 01:40:25 -07:00
|
|
|
)"
|
2020-04-20 20:44:04 -07:00
|
|
|
package=$(echo "$parsed_update_args" | awk '{print $2}' | grep -o "^[^:]*")
|
2020-04-20 18:07:29 -07:00
|
|
|
if [[ -n $parsed_update_args ]]; then
|
2020-04-26 20:56:00 -07:00
|
|
|
# find other Cargo.lock files and update them, excluding the default Cargo.lock
|
2020-04-20 18:07:29 -07:00
|
|
|
# shellcheck disable=SC2086
|
2020-04-26 20:56:00 -07:00
|
|
|
for lock in $(git grep --files-with-matches '^name = "'$package'"$' :**/Cargo.lock); do
|
2020-04-28 01:40:25 -07:00
|
|
|
# it's possible our current versions are out of sync across lock files,
|
|
|
|
# in that case try to sync them up with $relaxed_parsed_update_args
|
2020-04-22 01:23:33 -07:00
|
|
|
_ scripts/cargo-for-all-lock-files.sh \
|
|
|
|
"$lock" -- \
|
2020-04-28 01:40:25 -07:00
|
|
|
update $parsed_update_args ||
|
|
|
|
_ scripts/cargo-for-all-lock-files.sh \
|
|
|
|
"$lock" -- \
|
|
|
|
update $relaxed_parsed_update_args
|
2020-04-22 01:23:33 -07:00
|
|
|
done
|
2020-04-20 18:07:29 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo --- ok
|