Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 92580f9

Browse files
Treehugger RobotGerrit Code Review
authored andcommitted
Merge "Minor tweaks to the sqlite upgrade script" into main
2 parents 8b437ed + ba4f683 commit 92580f9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

UPDATE-SOURCE.bash

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ source $script_dir/common-functions.sh
3232

3333
usage() {
3434
if [[ $# -gt 0 ]]; then echo "$*" >&2; fi
35-
echo "Usage: ${script_name} [-nF] [-u <url>] <year> <version>"
36-
echo " year the 4-digit year the sqlite version was released"
35+
echo "Usage: ${script_name} [-nF] [-u <url>] [-y <year>] <version>"
3736
echo " version the sqlite version as <major>.<minor>[.<patch>]"
3837
echo " the patch level defaults to 0"
3938
echo " -n dry-run: evaluate arguments but d not change anything"
4039
echo " -u url download the tarball from the specified url"
40+
echo " -y year the 4-digit year the sqlite version was released - required"
41+
echo " if a full url is not specified and the year is not this year"
4142
echo " -F force execution even if not in external/sqlite"
4243
echo
4344
echo "Example:"
@@ -47,29 +48,30 @@ usage() {
4748
dry_run=
4849
force=
4950
src_tarball_url=
50-
while getopts "hnFu:" option; do
51+
year=$(date +%Y)
52+
while getopts "hnFu:y:" option; do
5153
case $option in
5254
h) usage; exit 0;;
5355
n) dry_run=y;;
5456
u) src_tarball_url=$OPTARG;;
57+
y) year=$OPTARG;;
5558
F) force=y;;
5659
*) usage "unknown switch"; exit 1;;
5760
esac
5861
done
5962
shift $((OPTIND- 1))
6063

61-
if [[ $# -lt 2 ]]; then
64+
if [[ $# -lt 1 ]]; then
6265
usage; die "missing required arguments"
63-
elif [[ $# -gt 2 ]]; then
66+
elif [[ $# -gt 1 ]]; then
6467
die "extra arguments on command line"
6568
fi
66-
year=$1
67-
validate_year "$year" || die "invalid year"
68-
sqlite_release=$(normalize_release "$2") || die "invalid release"
69+
sqlite_release=$(normalize_release "$1") || die "invalid release"
6970

7071
sqlite_base="sqlite-autoconf-${sqlite_release}"
7172
sqlite_file="${sqlite_base}.tar.gz"
7273
if [[ -z $src_tarball_url ]]; then
74+
validate_year "$year" || die "invalid year"
7375
src_tarball_url="https://www.sqlite.org/$year/${sqlite_file}"
7476
fi
7577

0 commit comments

Comments
 (0)