forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement hash-checking on downloaded dependencies
Dependencies will be checked at extraction-time, and have their checksums stored in deps/checksums/. The deps/jlchecksum command tests a given filename against the checksums stored in that file, supporting MD5 and SHA512 checksums for all recorded files. SHA512 is preferred, with MD5 available as a fallback in the case that `shasum` is not available. If the hashes do not match, an error is thrown and compilation is halted. If a file is asked for and no hash has been given for that file, the hash is generated for both SHA512 and MD5, and stored
- Loading branch information
1 parent
6de4d3b
commit 183dffb
Showing
43 changed files
with
171 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4628df9eeae10ae5f0c486f1ac982fce |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
df8828886682681e2984bf1a1e01d88aaa30edda8801c29445c2d2d37395407748634beb76df6244f9319738ee8c5c7362616a781f715b819ac8c2e3be5d1552 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
90ba42eae70b517ebdb72921cb4186df |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
30bee66edc31d1144d029a4c6c4b03f08782bdcbe1b9627e0c3df8d142121111e9c9dd875158345918931815341a2338cd889a010939016509a7cfdd1e829426 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f773f34079a9c24807da6bc2e72fe6df |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4876b0babb89bbcc39e92b63d4537b860e9cd0b8a188937d3ba815041b7261623cdac25c91c8bef20ebce4271f822307c492cf6c9f22ec3d740218405337a515 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8284891e3e311829b8e44ac813d0c9ef |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9c129ce24514467cfe492cf2fed8e2c4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3e86aa8ab9810b4fbac54a40fc93a717a55c642520858c0db215a5324c1e495b4d8fcec9620251cca8e4e5f9afa34bc14364d7f785880a0700469d0201827929 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
29b533ed4311161267bff1a9a97e2953 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
e116196eb60077565050995b060049747a3c72e743eea21c6c9fb68414adc533d456d19e1ca241f08895cca97a38511477bdc7d2e0cae38d149c83cb9d6896ad |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cb61be3be7254eae39684612c524740d |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
e59d54166dc2df9f6e6abd68658c3624082feabe445215256fead47a8944c41578d11c2b4ba57eac174587a45e445b2aabd867db24fd9e951842513cf914f60b |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0a05ca9c7b3bfddc8278e7c40791a1c2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1d88b6376ba8c15cceafd3381de1d181a974b921b72b31dd89c297e5771e8d665aa3c121ef2504a70e7b0bb562b1e0612ac2a02121c412d27df06c4d687507c4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a082867cbca5e898371a97bb27b31fea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f42ce1fa02962d25f94e21c79837f0eac1f8fc8d5c7804b7413926be8739ae0e8da33c63b5cebad17b3b6caae495ace0ef2e54dd2f194a0870e85c48172382dc |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
59006e659ffb33f5222a7b79d4cd071e |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
806ee0321ceac4d0bdcdad581208e8589d13f688124dfa75f484242fe299b8d423f6bd0172d674a01daf57b4f1e1a9751f5f331e734639917aa24f427b2f5e2c |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0da56a466a2a5c6502fb4d4353196ac6 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6e18be3730a99c6df4868174409c688e43d037a53b58accaab019e9f13799dc61fa4428748b4a498939c425399307ecbf725a069382b856e3c53b95169e597aa |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fb4ea2f6fbbe45bf032cd36e586883ce |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bfe04f2bfac9f9e47c37f0b23ed2f264d8d3d3d6f1392fe9d794ee13cad216b3740979e922e4276fb65c1ccdc836fce48812cb5459ecdd2a89a621036a35d7c1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
40564e1dc390f9844f1711c08b08e391 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ee2c3ac63bf0c2359bf08fc3ee094c19 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0312a1ac813c51737e7d2b40fa771a73adb796ef962bbbd81ffd5e18a16b13346dd20875710e29f5304146750253d7d3755dc4c7b28c1b3b6cd527a6a7affd14 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
b58ad6312e9c9a284fd72de7b6a0a076 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
590ffc77377e3d40f91bd91156554140da0f3eee334098cfdbd53d427173cd4374eca0f8f9a167054ea88bdcc1b3a685a6ecdc5fd70f3df0ad267d569049db79 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
34b03e26a7240c640978a4d3b87849a3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
db1fa3ac4572869dbdf4c887fa6112419464accbfb311d9c9ca8bcde8882208001963dbbeb6afa350ca0d72c13fdda0ab7c6bc464de93d9af0889a0b361c0f97 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5087261514b4b5814a39c3d3a36eb6ef |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0b228c7058b1d32104648a77b37720fd942cd53942d542dccc5662f6012b8d4487d5d1512a68319e73fda05640330611c9ea41ed7d94a0d109056f471a79dfc6 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1c9a276af932b5599157f96e945391f0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bdc369b967f1d9db36d228fb291a436611d19c2f7df64a265a5c748f797763b8d66e161fd0ecd60a8a9f28fa3bc7d22d61e619c9a16c5a26c71923e2b1802145 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2462346301fac2994c34f5574d6c3ca7 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3bec2388298c201d9d6992cdd36330f1109d26a37b3411ba633f006f40da9e494ba0565051b763a7d3014e6113cd1e7754e6b95d5cbb2d7b50cee55193f0fdc1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
44d667c142d7cda120332623eab69f40 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ece209d4c7ec0cb58ede791444dc754e0d10811cbbdebe3df61c0fd9f9f9867c1c3ccd5f1827f847c005e24eef34fb5bf87b5d3f894d75da04f1797538290e4a |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/bash | ||
# | ||
# usage: jlchecksum <filename> | ||
# | ||
|
||
if [ -z "$1" ]; then | ||
echo "Usage: ./jlchecksum <filename>" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Get the directory of this script | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# Get the basename of the file we're trying to checksum | ||
BASENAME=$(basename $1) | ||
|
||
# Print out a hash, and wrap around if we're longer than 64 characters | ||
print_hash() | ||
{ | ||
if [ ${#1} -gt 64 ]; then | ||
NUM_LINES=$(( (${#1} + 63) / 64)) | ||
for (( i=0; i<$NUM_LINES; i++ )); do | ||
echo " ${1:$((i*64)):64}" | ||
done | ||
else | ||
echo " $1" >&2 | ||
fi | ||
} | ||
|
||
checksum_error() | ||
{ | ||
echo "===============================================================================" >&2 | ||
echo "ERROR: $CHECKSUM_TYPE checksum failure on $BASENAME, should be:" >&2 | ||
print_hash "$TRUE_CHECKSUM" | ||
echo "But calculating with \`$CHECKSUM_PROG\` is actually:" >&2 | ||
print_hash "$CURR_CHECKSUM" | ||
echo "===============================================================================" >&2 | ||
exit 2 | ||
} | ||
|
||
find_checksum() | ||
{ | ||
if [ ! -f "$DIR/checksums/$BASENAME/$CHECKSUM_TYPE" ]; then | ||
echo "WARNING: $CHECKSUM_TYPE checksum for $BASENAME not found in deps/checksums/, autogenerating..." >&2 | ||
|
||
# Generate as many checksum types as we can | ||
mkdir -p checksums/$BASENAME | ||
if [ ! -z "$MD5_PROG" ]; then | ||
echo $(eval $MD5_PROG) > "$DIR/checksums/$BASENAME/md5" | ||
fi | ||
if [ ! -z "$SHA512_PROG" ]; then | ||
echo $(eval $SHA512_PROG) > "$DIR/checksums/$BASENAME/sha512" | ||
fi | ||
fi | ||
|
||
TRUE_CHECKSUM=$(cat "$DIR/checksums/$BASENAME/$CHECKSUM_TYPE") | ||
} | ||
|
||
# These are the programs we run to hash a file | ||
SHA512_PROG="" | ||
MD5_PROG="" | ||
find_checksum_progs() | ||
{ | ||
if [ ! -z $(which shasum) ]; then | ||
SHA512_PROG="shasum -a 512 $BASENAME | awk '{ print \$1; }'" | ||
fi | ||
|
||
if [ ! -z $(which md5sum) ]; then | ||
MD5_PROG="md5sum $BASENAME | awk '{ print \$1; }'" | ||
elif [ ! -z $(which md5) ]; then | ||
MD5_PROG="md5 -q $BASENAME" | ||
fi | ||
} | ||
|
||
|
||
# Search for checksum programs and store them into SHA512_PROG, MD5_PROG, etc... | ||
find_checksum_progs | ||
|
||
# Choose final checksumming program, preferring SHA512 over MD5 | ||
if [ ! -z "$SHA512_PROG" ]; then | ||
CHECKSUM_TYPE="sha512" | ||
CHECKSUM_PROG=$SHA512_PROG | ||
elif [ ! -z "$MD5_PROG" ]; then | ||
CHECKSUM_TYPE="md5" | ||
CHECKSUM_PROG=$MD5_PROG | ||
else | ||
echo "WARNING: No checksumming programs found, cannot verify downloads" >&2 | ||
exit 0 | ||
fi | ||
|
||
# Find true checksum | ||
find_checksum "$CHECKSUM_TYPE" | ||
|
||
# Calculate actual checksum | ||
CURR_CHECKSUM=$(eval $CHECKSUM_PROG) | ||
|
||
# Make sure they're the same. If not, error out! | ||
if [ "$TRUE_CHECKSUM" != "$CURR_CHECKSUM" ]; then | ||
checksum_error | ||
fi |