From 0abc6e14656a74047598c9f06fdab0a413f45ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mamy=20Andr=C3=A9-Ratsimbazafy?= Date: Thu, 31 Oct 2019 15:18:35 +0100 Subject: [PATCH] download and unpack functions are now libraries callable from any scripts --- download_test_vectors.sh | 25 ++++++++----------------- scripts/download_functions.sh | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 scripts/download_functions.sh diff --git a/download_test_vectors.sh b/download_test_vectors.sh index 4ad16d2..afea071 100644 --- a/download_test_vectors.sh +++ b/download_test_vectors.sh @@ -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 diff --git a/scripts/download_functions.sh b/scripts/download_functions.sh new file mode 100644 index 0000000..6fa3617 --- /dev/null +++ b/scripts/download_functions.sh @@ -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 + } +}