Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1641)

Side by Side Diff: third_party/markupsafe/get_markupsafe.sh

Issue 23445019: Add MarkupSafe library to third_party (dependency for Jinja2 2.7) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/markupsafe/_speedups.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2 # Download and extract MarkupSafe
3 # Homepage:
4 # https://github.com/mitsuhiko/markupsafe
5 # Download page:
6 # https://pypi.python.org/pypi/MarkupSafe
7 PACKAGE='MarkupSafe'
8 VERSION='0.18'
9 PACKAGE_DIR='markupsafe'
10
11 CHROMIUM_FILES="README.chromium OWNERS get_markupsafe.sh"
12 EXTRA_FILES='LICENSE AUTHORS'
13 REMOVE_FILES='tests.py'
14
15 SRC_URL='https://pypi.python.org/packages/source/'
16 SRC_URL+="${PACKAGE:0:1}/$PACKAGE/$PACKAGE-$VERSION.tar.gz"
17 FILENAME="$(basename $SRC_URL)"
18 MD5_FILENAME="$FILENAME.md5"
19 SHA512_FILENAME="$FILENAME.sha512"
20 CHROMIUM_FILES+=" $MD5_FILENAME $SHA512_FILENAME"
21
22 BUILD_DIR="$PACKAGE-$VERSION"
23 THIRD_PARTY="$(dirname $(realpath $(dirname "${BASH_SOURCE[0]}")))"
24 INSTALL_DIR="$THIRD_PARTY/$PACKAGE_DIR"
25 OUT_DIR="$INSTALL_DIR/$BUILD_DIR/$PACKAGE_DIR"
26 OLD_DIR="$THIRD_PARTY/$PACKAGE_DIR.old"
27
28 function check_hashes {
29 # Hashes generated via:
30 # FILENAME=MarkupSafe-0.18.tar.gz
31 # md5sum "$FILENAME" > "$FILENAME.md5"
32 # sha512sum "$FILENAME" > "$FILENAME.sha512"
33 # unset FILENAME
34
35 # MD5
36 if ! [ -f "$MD5_FILENAME" ]
37 then
38 echo "MD5 hash file $MD5_FILENAME not found, could not verify archive"
39 exit 1
40 fi
41
42 # 32-digit hash, followed by filename
43 MD5_HASHFILE_REGEX="^[0-9a-f]{32} $FILENAME"
44 if ! grep --extended-regex --line-regex --silent \
45 "$MD5_HASHFILE_REGEX" "$MD5_FILENAME"
46 then
47 echo "MD5 hash file $MD5_FILENAME does not contain hash for $FILENAME," \
48 'could not verify archive'
49 echo 'Hash file contents are:'
50 cat "$MD5_FILENAME"
51 exit 1
52 fi
53
54 if ! md5sum --check "$MD5_FILENAME"
55 then
56 echo 'MD5 hash does not match,' \
57 "archive file $FILENAME corrupt or compromised!"
58 exit 1
59 fi
60
61 # SHA-512
62 if ! [ -f "$SHA512_FILENAME" ]
63 then
64 echo "SHA-512 hash file $SHA512_FILENAME not found," \
65 'could not verify archive'
66 exit 1
67 fi
68
69 # 128-digit hash, followed by filename
70 SHA512_HASHFILE_REGEX="^[0-9a-f]{128} $FILENAME"
71 if ! grep --extended-regex --line-regex --silent \
72 "$SHA512_HASHFILE_REGEX" "$SHA512_FILENAME"
73 then
74 echo "SHA-512 hash file $SHA512_FILENAME does not contain hash for" \
75 "$FILENAME, could not verify archive"
76 echo 'Hash file contents are:'
77 cat "$SHA512_FILENAME"
78 exit 1
79 fi
80
81 if ! sha512sum --check "$SHA512_FILENAME"
82 then
83 echo 'SHA-512 hash does not match,' \
84 "archive file $FILENAME corrupt or compromised!"
85 exit 1
86 fi
87 }
88
89
90 ################################################################################
91 # Body
92
93 cd "$INSTALL_DIR"
94 echo "Downloading $SRC_URL"
95 curl --remote-name "$SRC_URL"
96 check_hashes
97 tar xvzf "$FILENAME"
98 # Copy extra files over
99 for FILE in $CHROMIUM_FILES
100 do
101 cp "$FILE" "$OUT_DIR"
102 done
103
104 cd "$BUILD_DIR"
105 for FILE in $EXTRA_FILES
106 do
107 cp "$FILE" "$OUT_DIR"
108 done
109
110 cd "$OUT_DIR"
111 for FILE in $REMOVE_FILES
112 do
113 rm -fr "$FILE"
114 done
115
116 # Replace with new directory
117 cd ..
118 mv "$INSTALL_DIR" "$OLD_DIR"
119 mv "$PACKAGE_DIR" "$INSTALL_DIR"
120 cd "$INSTALL_DIR"
121 rm -fr "$OLD_DIR"
OLDNEW
« no previous file with comments | « third_party/markupsafe/_speedups.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698