I haven't used Google App Engine for a while and I just needed to deploy for one line change in my code. I was prompted about the update of SDK when I tried to push the code. It can be ignored, but I always update SDK when the newer version is around.
I wrote the following Bash script to do that for that one line change:
This script downloads the latest version, checks the SHA1 (which I never bothered when I did update manually), removes the existing version, then unzip at current directory. It doesn't check versions and only works for Python on Linux SDK.
It could be buggy since I ran it virtually once and it did what I expected after I finished the code. So, basically, I didn't test it. Use at your own risk.
Used to do those steps manually, it didn't really take much time, less a minute (for typing commands) I would guess, but it's a boring task whenever Google App Engine SDK gets new update and that's quite frequent. As of 1.7.3, since the beginning of 2012 (v1.6.2), it's the ninth release of the year. Roughly one release per month.
I wasted quite some time to do such task, not anymore. I didn't even need to search for download page (didn't have it bookmarked), only need to run that script from now on when am told new version is available.
I wrote the following Bash script to do that for that one line change:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Written by Yu-Jie Lin | |
# Public domain | |
# Gist: https://gist.github.com/livibetter/4035274 | |
# Blog: http://blog.yjl.im/2012/11/google-app-engine-sdk-update-script.html | |
DL_PAGE="https://developers.google.com/appengine/downloads" | |
TMPFILE="$(mktemp)" | |
wget "$DL_PAGE" -O "$TMPFILE" | |
do_exit() { | |
rm "$TMPFILE" | |
trap - INT EXIT | |
exit $1 | |
} | |
trap do_exit INT EXIT | |
DL_URL="$(egrep -m1 -o 'http[^"]+google_appengine_[.0-9]+\.zip' "$TMPFILE")" | |
DL_FILE="${DL_URL##*/}" | |
DL_SHA1="$(egrep -m1 -A2 'google_appengine.*\.zip' "$TMPFILE" | egrep -o '[a-f0-9]{40}')" | |
echo "URL : $DL_URL" | |
echo "SHA1: $DL_SHA1" | |
echo | |
if [[ ( -z $DL_URL ) || ( -z $DL_FILE ) || ( -z $DL_SHA1 ) ]]; then | |
echo "Can't parse out required information to download." >&2 | |
do_exit 1 | |
fi | |
if wget "$DL_URL"; then | |
SHA1="$(sha1sum "$DL_FILE" | egrep -o '[a-f0-9]{40}')" | |
if [[ "$DL_SHA1" != "$SHA1" ]]; then | |
echo "$DL_FILE $SHA1" >&2 | |
echo "Hashes do not match." >&2 | |
do_exit 1 | |
fi | |
rm -rf google_appengine | |
if unzip "$DL_FILE"; then | |
rm "$DL_FILE" | |
fi | |
fi | |
This script downloads the latest version, checks the SHA1 (which I never bothered when I did update manually), removes the existing version, then unzip at current directory. It doesn't check versions and only works for Python on Linux SDK.
It could be buggy since I ran it virtually once and it did what I expected after I finished the code. So, basically, I didn't test it. Use at your own risk.
Used to do those steps manually, it didn't really take much time, less a minute (for typing commands) I would guess, but it's a boring task whenever Google App Engine SDK gets new update and that's quite frequent. As of 1.7.3, since the beginning of 2012 (v1.6.2), it's the ninth release of the year. Roughly one release per month.
I wasted quite some time to do such task, not anymore. I didn't even need to search for download page (didn't have it bookmarked), only need to run that script from now on when am told new version is available.
0 comments:
Post a Comment