2 # Download and extract Jinja2
4 # http://jinja.pocoo.org/
5 # Installation instructions:
6 # http://jinja.pocoo.org/docs/intro/#from-the-tarball-release
8 # https://pypi.python.org/pypi/Jinja2
13 CHROMIUM_FILES
="README.chromium OWNERS get_jinja2.sh"
14 EXTRA_FILES
='LICENSE AUTHORS'
15 REMOVE_FILES
='testsuite'
17 SRC_URL
='https://pypi.python.org/packages/source/'
18 SRC_URL
+="${PACKAGE:0:1}/$PACKAGE/$PACKAGE-$VERSION.tar.gz"
19 FILENAME
="$(basename $SRC_URL)"
20 MD5_FILENAME
="$FILENAME.md5"
21 SHA512_FILENAME
="$FILENAME.sha512"
22 CHROMIUM_FILES
+=" $MD5_FILENAME $SHA512_FILENAME"
24 BUILD_DIR
="$PACKAGE-$VERSION"
25 THIRD_PARTY
="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))"
26 INSTALL_DIR
="$THIRD_PARTY/$PACKAGE_DIR"
27 OUT_DIR
="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR"
28 OLD_DIR
="$THIRD_PARTY/$PACKAGE_DIR.old"
30 function check_hashes
{
31 # Hashes generated via:
32 # FILENAME=Jinja2-2.7.1.tar.gz
33 # md5sum "$FILENAME" > "$FILENAME.md5"
34 # sha512sum "$FILENAME" > "$FILENAME.sha512"
38 if ! [ -f "$MD5_FILENAME" ]
40 echo "MD5 hash file $MD5_FILENAME not found, could not verify archive"
44 # 32-digit hash, followed by filename
45 MD5_HASHFILE_REGEX
="^[0-9a-f]{32} $FILENAME"
46 if ! grep --extended-regex --line-regex --silent \
47 "$MD5_HASHFILE_REGEX" "$MD5_FILENAME"
49 echo "MD5 hash file $MD5_FILENAME does not contain hash for $FILENAME," \
50 'could not verify archive'
51 echo 'Hash file contents are:'
56 if ! md5sum --check "$MD5_FILENAME"
58 echo 'MD5 hash does not match,' \
59 "archive file $FILENAME corrupt or compromised!"
64 if ! [ -f "$SHA512_FILENAME" ]
66 echo "SHA-512 hash file $SHA512_FILENAME not found," \
67 'could not verify archive'
71 # 128-digit hash, followed by filename
72 SHA512_HASHFILE_REGEX
="^[0-9a-f]{128} $FILENAME"
73 if ! grep --extended-regex --line-regex --silent \
74 "$SHA512_HASHFILE_REGEX" "$SHA512_FILENAME"
76 echo "SHA-512 hash file $SHA512_FILENAME does not contain hash for" \
77 "$FILENAME, could not verify archive"
78 echo 'Hash file contents are:'
79 cat "$SHA512_FILENAME"
83 if ! sha512sum
--check "$SHA512_FILENAME"
85 echo 'SHA-512 hash does not match,' \
86 "archive file $FILENAME corrupt or compromised!"
92 ################################################################################
96 echo "Downloading $SRC_URL"
97 curl
--remote-name "$SRC_URL"
100 # Copy extra files over
101 for FILE
in $CHROMIUM_FILES
103 cp "$FILE" "$OUT_DIR"
107 for FILE
in $EXTRA_FILES
109 cp "$FILE" "$OUT_DIR"
113 for FILE
in $REMOVE_FILES
118 # Replace with new directory
120 mv "$INSTALL_DIR" "$OLD_DIR"
121 mv "$PACKAGE_DIR" "$INSTALL_DIR"