49 lines
1015 B
Plaintext
49 lines
1015 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# Usage:
|
||
|
# ./update-release commit-sha
|
||
|
|
||
|
set -euo pipefail
|
||
|
IFS=$'\n\t'
|
||
|
|
||
|
print_usage() {
|
||
|
echo " Usage:"
|
||
|
echo " ./update-release commit-sha"
|
||
|
echo ""
|
||
|
echo "Update the source-build-reference-packages package to the upstream commit sha"
|
||
|
}
|
||
|
|
||
|
positional_args=()
|
||
|
while [[ "$#" -gt 0 ]]; do
|
||
|
arg="${1}"
|
||
|
case "${arg}" in
|
||
|
-h|--help)
|
||
|
print_usage
|
||
|
exit 0
|
||
|
;;
|
||
|
*)
|
||
|
positional_args+=("$1")
|
||
|
shift
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
|
||
|
spec_file=dotnet-build-reference-packages.spec
|
||
|
|
||
|
commit_sha=${positional_args[0]:-}
|
||
|
if [[ -z ${commit_sha} ]]; then
|
||
|
echo "error: missing commit sha"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
set -x
|
||
|
|
||
|
sed -i -E "s|^%global commit [a-f0-9]+$|%global commit ${commit_sha}|" "$spec_file"
|
||
|
sed -i -E "s|^(Release: +[[:digit:]]+\.)([[:digit:]]{8})git|\1$(date '+%4Y%m%d')git|" "$spec_file"
|
||
|
|
||
|
spectool -g "${spec_file}"
|
||
|
|
||
|
comment="Update to upstream commit ${commit_sha:0:7}"
|
||
|
|
||
|
rpmdev-bumpspec --comment="$comment" $spec_file
|