download and unpack functions are now libraries callable from any scripts

This commit is contained in:
Mamy André-Ratsimbazafy 2019-10-31 15:18:35 +01:00
parent 032cdb4eca
commit 0abc6e1465
No known key found for this signature in database
GPG Key ID: 7B88AD1FE79492E1
2 changed files with 28 additions and 17 deletions

View File

@ -1,26 +1,17 @@
#!/bin/bash
dl_version() {
[[ -z "$1" ]] && { echo "usage: dl_version() vX.Y.Z"; exit 1; }
set -eu
[[ -d "tarballs/$1" ]] || {
mkdir -p "tarballs/$1"
pushd "tarballs/$1"
curl -L --remote-name-all "https://github.com/ethereum/eth2.0-spec-tests/releases/download/$1/{general,minimal,mainnet}.tar.gz"
popd
}
}
unpack_version() {
[[ -z "$1" ]] && { echo "usage: unpack_version() vX.Y.Z"; exit 1; }
[[ -d "tests-$1" ]] || {
cat "tarballs/$1"/{general,minimal,mainnet}.tar.gz | tar --one-top-level="tests-$1" --strip-components 1 -xvzf - -i
}
}
source scripts/download_functions.sh
dl_version v0.8.3
dl_version v0.9.0
echo "Ignore the warnings \"unknown extended header keyword 'SCHILY.{dev,ino,nlink}'\" on Linux."
# tar: Ignoring unknown extended header keyword 'SCHILY.dev'
# tar: Ignoring unknown extended header keyword 'SCHILY.ino'
# tar: Ignoring unknown extended header keyword 'SCHILY.nlink'
echo "Those are due to the test vectors being packed with OSX BSD tar."
unpack_version v0.8.3
unpack_version v0.9.0

View File

@ -0,0 +1,20 @@
#!/bin/bash
dl_version() {
[[ -z "$1" ]] && { echo "usage: dl_version() vX.Y.Z"; exit 1; }
[[ -d "tarballs/$1" ]] || {
mkdir -p "tarballs/$1"
pushd "tarballs/$1"
curl -L --remote-name-all "https://github.com/ethereum/eth2.0-spec-tests/releases/download/$1/{general,minimal,mainnet}.tar.gz"
popd
}
}
unpack_version() {
[[ -z "$1" ]] && { echo "usage: unpack_version() vX.Y.Z"; exit 1; }
[[ -d "tests-$1" ]] || {
cat "tarballs/$1"/{general,minimal,mainnet}.tar.gz | tar --one-top-level="tests-$1" --strip-components 1 -xzf - -i
}
}