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

Side by Side Diff: third_party/JSON/get_and_build_json_pm.sh

Issue 15736030: Add JSON.pm to third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check SHA-1 hash Created 7 years, 6 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
OLDNEW
(Empty)
1 #!/bin/bash
2 # Download and build JSON.pm
3 # Homepage:
4 # http://search.cpan.org/~makamaka/JSON-2.58/lib/JSON.pm
5 SRC_URL='http://www.cpan.org/authors/id/M/MA/MAKAMAKA/JSON-2.58.tar.gz'
6 FILENAME="$(basename $SRC_URL)"
7 SHA1_FILENAME="$FILENAME.sha1"
8 BUILD_DIR='JSON-2.58'
9 INSTALL_DIR="$(pwd)/out"
10
11 curl --remote-name "$SRC_URL"
12
13 # Check hash
14 # SHA-1 hash generated via:
15 # shasum JSON-2.58.tar.gz > JSON-2.58.tar.gz.sha1
16 if ! [ -f "$SHA1_FILENAME" ]
17 then
18 echo "SHA-1 hash file $SHA1_FILENAME not found, could not verify archive"
19 exit 1
20 fi
21
22 # Check that hash file contains hash for archive
23 HASHFILE_REGEX="^[0-9a-f]{40} $FILENAME" # 40-digit hash, followed by filename
24 if ! grep --extended-regex --line-regex --silent \
25 "$HASHFILE_REGEX" "$SHA1_FILENAME"
26 then
27 echo "SHA-1 hash file $SHA1_FILENAME does not contain hash for $FILENAME," \
28 'could not verify archive'
29 echo 'Hash file contents are:'
30 cat "$SHA1_FILENAME"
31 exit 1
32 fi
33
34 if ! shasum --check "$SHA1_FILENAME"
35 then
36 echo 'SHA-1 hash does not match,' \
37 "archive file $FILENAME corrupt or compromised!"
38 exit 1
39 fi
40
41 # Extract and build
42 tar xvzf "$FILENAME"
43 cd "$BUILD_DIR"
44 perl Makefile.PL INSTALL_BASE="$INSTALL_DIR"
45 make
46 make test
47 make install
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698