From 4f4f0e56ae23befa79f6f3e8bf6aa1bfce184183 Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 07:56:31 +0000 Subject: [PATCH 1/9] modular install.sh --- install.sh | 423 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 292 insertions(+), 131 deletions(-) diff --git a/install.sh b/install.sh index 8bf286a..3121c2c 100755 --- a/install.sh +++ b/install.sh @@ -1,132 +1,293 @@ #!/bin/bash -set -e -clear - -#Adapted from https://github.com/tailsjoin/tailsjoin/blob/master/tailsjoin-fullnode.sh - -# Check for root. -if [[ $(id -u) = "0" ]]; then - echo " -YOU SHOULD NOT RUN THIS SCRIPT AS ROOT! -YOU WILL BE PROMPTED FOR THE ADMIN PASS WHEN NEEDED. -" - read -p "PRESS ENTER TO EXIT SCRIPT, AND RUN AGAIN AS NON-ROOT USER. " - exit 0 -fi - - -# Make sure user has chosen the correct script. -echo " - THIS SCRIPT WILL INSTALL JOINMARKET-CS AND DEPENDENCIES. - ADMIN PASS WILL BE REQUIRED MULTIPLE TIMES. -" -read -p "PRESS ENTER TO CONTINUE. " -clear - -# Update apt-get sources. -echo " -ENTER PASSWORD TO UPDATE SOURCES. -" -sudo apt-get update -clear - - -# Install dependencies for building libsodium. -echo " -ENTER PASSWORD TO INSTALL: python-virtualenv curl python-dev python-pip git build-essential automake pkg-config libtool libffi-dev libssl-dev -" -sudo apt-get install -y python-virtualenv curl python-dev python-pip git build-essential automake pkg-config libtool libffi-dev libssl-dev -clear - -# Get libsodium, sig, and import key. -echo " -DOWNLOADING LIBSODIUM SOURCE AND SIGNING KEY... -" -gpg --keyserver pgp.mit.edu --recv-keys 54A2B8892CC3D6A597B92B6C210627AABA709FE1 -echo "54A2B8892CC3D6A597B92B6C210627AABA709FE1:6" | gpg --import-ownertrust - -curl -L -O http://download.libsodium.org/libsodium/releases/libsodium-1.0.12.tar.gz -O http://download.libsodium.org/libsodium/releases/libsodium-1.0.12.tar.gz.sig -clear - - -# Verify download. -echo " -VERIFYING THE DOWNLOAD... -" -gpg --verify libsodium-1.0.12.tar.gz.sig libsodium-1.0.12.tar.gz -echo " -PLEASE REVIEW THE TEXT ABOVE. -IT WILL EITHER SAY GOOD SIG OR BAD SIG. -" -read -p "IS IT A GOOD SIG? (y/n) " x -if [[ "$x" = "n" || "$x" = "N" ]]; then - echo " -YOU REJECTED THE LIBSODIUM SIGNATURE, GIVING UP... -" - srm -drv libsodium* - exit 0 -fi -clear - - -# Build and install libsodium. -tar xf libsodium*.tar.gz -rm -rf libsodium*.tar.gz* - -echo " -BUILDING LIBSODIUM... -" -cd libsodium-1.0.12/ && ./configure && make -echo " -LIBSODIUM SUCCESSFULLY BUILT. ENTER PASSWORD TO INSTALL. -" -sudo make install -cd .. -rm -rf libsodium* -clear - -# Verify the signature on joinmarket-clientserver -# Currently commented out - doesn't apply if you've already downloaded the repo -# either as zip or clone; can check valid signature on github (OK?) -#gpg --keyserver pgp.mit.edu --recv-keys 46689728A9F64B391FA871B7B3AE09F1E9A3197A -#echo "46689728A9F64B391FA871B7B3AE09F1E9A3197A:6" | gpg --import-ownertrust - -#Todo: handle signing by another key and check the release tag, not commit. -#git verify-commit HEAD || { -# echo 'Latest code commit does not have a valid signature; quitting' -# exit 0 -#} - -#Run the python installation of joinmarket-clientserver; -#note that this is a 'full' installation, which is the default -#for an ordinary user; this should be enhanced to allow custom -#installation styles. -#Installs into a virtualenv, so instructions to run must be included. -if ! mkdir venv; then - echo "virtualenv directory already exists; assuming valid." -fi -virtualenv jmvenv -source jmvenv/bin/activate -#required for older pips, e.g. on Ubuntu 14.04 -pip install --upgrade setuptools -#Doing manually instead of as in setupall.py -cd jmbase -pip install . -cd .. -cd jmdaemon -pip install . -cd .. -cd jmbitcoin -pip install . -cd .. -cd jmclient -pip install . -cd .. - -# Final notes. -echo " - JOINMARKET SUCCESSFULLY INSTALLED. - BEFORE RUNNING SCRIPTS, TYPE: - source jmvenv/bin/activate - FROM THIS DIRECTORY, TO ACTIVATE THE VIRTUALENV. -" -read -p "PRESS ENTER TO EXIT SCRIPT. " -exit 0; + +# jm_source="$PWD/.." +# jm_root="${jm_source}/jmvenv" +# jm_deps="${jm_source}/deps" + +gpg_verify_key () +{ + gpg --keyid-format long <"$1" | grep "$2" +} + +gpg_add_to_keyring () +{ + gpg --dearmor <"$1" >>"${jm_deps}/keyring.gpg" +} + +gpg_verify_sig () +{ + gpg --no-default-keyring --keyring "${jm_deps}/keyring.gpg" --verify "$1" +} + +deb_deps_check () +{ + apt-cache policy ${deb_deps[@]} +} + +deb_deps_install () +{ + deb_deps=( 'python-virtualenv' 'curl' 'python-dev' 'python-pip' 'build-essential' 'automake' 'pkg-config' 'libtool' ) + if ! deb_deps_check; then + clear + echo " + sudo password required to run : + + \`apt-get install ${deb_deps[@]}\` + " + if ! sudo apt-get install ${deb_deps[@]}; then + return 1 + fi + fi +} + +check_skip_build () +{ + if ! mkdir "$1"; then + read -p "Directory ${1} exists. Remove and recreate? (y/n) " q + if [[ "${q}" =~ Y|y ]]; then + rm -rf "./${1}" + return 1 + else + echo "skipping ${1}..." + return 0 + fi + fi + return 1 +} + +venv_setup () +{ + if check_skip_build 'jmvenv'; then + return 0 + fi + virtualenv -p python2 jmvenv +} + +openssl_get () +{ + for file in "${openssl_lib_tar}" "${openssl_lib_sha}" "${openssl_lib_sig}"; do + curl -L -O "${openssl_url}/${file}" + done + curl -L "${openssl_signer_key_url}" -o openssl_signer.key +} + +openssl_build () +{ + ./config shared --prefix="${jm_root}" + make -j + if ! make test; then + return 1 + fi +} + +openssl_install () +{ + openssl_version='openssl-1.0.2l' + openssl_lib_tar="${openssl_version}.tar.gz" + openssl_lib_sha="${openssl_lib_tar}.sha256" + openssl_lib_sig="${openssl_lib_tar}.asc" + openssl_url='https://www.openssl.org/source' + openssl_signer_key_url='https://pgp.mit.edu/pks/lookup?op=get&search=0xD9C4D26D0E604491' + openssl_signer_key_id='2048R/D9C4D26D0E604491' + openssl_root="${jm_deps}/openssl" + + if check_skip_build 'openssl'; then + return 0 + fi + pushd openssl + openssl_get + if ! grep $(sha256sum "${openssl_lib_tar}") "${openssl_lib_sha}"; then + return 1 + fi + if gpg_verify_key openssl_signer.key "${openssl_signer_key_id}"; then + gpg_add_to_keyring openssl_signer.key + else + return 1 + fi + if gpg_verify_sig "${openssl_lib_sig}"; then + tar xaf "${openssl_lib_tar}" + else + return 1 + fi + pushd "${openssl_version}" + if openssl_build; then + make install + else + return 1 + fi + popd + popd +} + +# add '--disable-docs' to libffi ./configure so makeinfo isn't needed +# https://github.com/libffi/libffi/pull/190/commits/fa7a257113e2cfc963a0be9dca5d7b4c73999dcc +libffi_patch_disable_docs () +{ + cat <<'EOF' > Makefile.am.patch +56c56,59 +< info_TEXINFOS = doc/libffi.texi +--- +> info_TEXINFOS = +> if BUILD_DOCS +> #info_TEXINFOS += doc/libffi.texi +> endif +EOF + + cat <<'EOF' > configure.ac.patch +545a546,552 +> AC_ARG_ENABLE(docs, +> AC_HELP_STRING([--disable-docs], +> [Disable building of docs (default: no)]), +> [enable_docs=no], +> [enable_docs=yes]) +> AM_CONDITIONAL(BUILD_DOCS, [test x$enable_docs = xyes]) +> +EOF + patch Makefile.am Makefile.am.patch + patch configure.ac configure.ac.patch +} + +libffi_build () +{ + ./autogen.sh + ./configure --disable-docs --enable-shared --prefix="${jm_root}" + make -j + if ! make check; then + return 1 + fi +} + +libffi_install () +{ + libffi_version='libffi-3.2.1' + libffi_lib_tar="v3.2.1.tar.gz" + libffi_lib_sha='96d08dee6f262beea1a18ac9a3801f64018dc4521895e9198d029d6850febe23' + libffi_url="https://github.com/libffi/libffi/archive" + + if check_skip_build 'libffi'; then + return 0 + fi + pushd libffi + curl -L -O "${libffi_url}/${libffi_lib_tar}" + if sha256sum -c <<<"${libffi_lib_sha} ${libffi_lib_tar}"; then + tar xaf "${libffi_lib_tar}" + else + return 1 + fi + pushd "${libffi_version}" + if ! libffi_patch_disable_docs; then + return 1 + fi + if libffi_build; then + make install + else + return 1 + fi + popd + popd +} + +libsodium_get () +{ + for file in "${sodium_lib_tar}" "${sodium_lib_sig}"; do + curl -L -O "${sodium_url}/${file}" + done + curl -L "${sodium_signer_key_url}" -o libsodium_signer.key +} + +libsodium_build () +{ + ./autogen.sh + ./configure --enable-shared --prefix="${jm_root}" + make -j + if ! make check; then + return 1 + fi +} + +libsodium_install () +{ + sodium_version='libsodium-1.0.13' + sodium_lib_tar="${sodium_version}.tar.gz" + sodium_lib_sig="${sodium_lib_tar}.sig" + sodium_url='https://download.libsodium.org/libsodium/releases' + sodium_signer_key_url='https://pgp.mit.edu/pks/lookup?op=get&search=0x210627AABA709FE1' + sodium_signer_key_id='4096R/62F25B592B6F76DA' + + if check_skip_build 'libsodium'; then + return 0 + fi + pushd libsodium + libsodium_get + if gpg_verify_key libsodium_signer.key "${sodium_signer_key_id}"; then + gpg_add_to_keyring libsodium_signer.key + else + return 1 + fi + if gpg_verify_sig "${sodium_lib_sig}"; then + tar xaf "${sodium_lib_tar}" + else + return 1 + fi + pushd "${sodium_version}" + if libsodium_build; then + make install + else + return 1 + fi + popd + popd +} + +joinmarket_install () +{ + jm_pkgs=( 'jmbase' 'jmdaemon' 'jmbitcoin' 'jmclient' ) + for pkg in ${jm_pkgs[@]}; do + pushd "${pkg}" + pip install . + popd + done +} + +main () +{ + jm_source="$PWD" + jm_root="${jm_source}/jmvenv" + jm_deps="${jm_source}/deps" + export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${jm_root}/lib/pkgconfig" + + if ! deb_deps_install; then + echo "Dependecies could not be installed. Exiting." + return 1 + fi + if ! venv_setup; then + echo "Joinmarket virtualenv could not be setup. Exiting." + fi + source "${jm_root}/bin/activate" + mkdir -p deps + pushd deps + rm -f ./keyring.gpg + if ! openssl_install; then + echo "Openssl was not built. Exiting." + return 1 + fi + if ! libffi_install; then + echo "Libffi was not built. Exiting." + return 1 + fi + if ! libsodium_install; then + echo "Libsodium was not built. Exiting." + fi + popd + if ! joinmarket_install; then + echo "Joinmarket was not installed. Exiting." + fi + deactivate + echo "Joinmarket successfully installed + Before executing scripts or tests, run: + + \`source jmvenv/bin/activate\` + + from this directiry, to acticate virtualenv." +} +main From 69d274f02144d807fb19c38fe6569dc7d141226c Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 09:22:18 +0000 Subject: [PATCH 2/9] add run_tests.sh run_tests.sh run_tests.sh run_tests.sh, remove duplicate from install.sh add uninstall first to install.sh, check virtualenv sourced in tests fix install.sh skip, don't install docs with openssl remove openssl files before (re)installing, fail on JM install package failure --- install.sh | 27 ++++++++++++++++++-------- test/run_tests.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 8 deletions(-) create mode 100755 test/run_tests.sh diff --git a/install.sh b/install.sh index 3121c2c..6258097 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,5 @@ #!/bin/bash -# jm_source="$PWD/.." -# jm_root="${jm_source}/jmvenv" -# jm_deps="${jm_source}/deps" - gpg_verify_key () { gpg --keyid-format long <"$1" | grep "$2" @@ -46,6 +42,7 @@ check_skip_build () read -p "Directory ${1} exists. Remove and recreate? (y/n) " q if [[ "${q}" =~ Y|y ]]; then rm -rf "./${1}" + mkdir -p "./${1}" return 1 else echo "skipping ${1}..." @@ -60,7 +57,8 @@ venv_setup () if check_skip_build 'jmvenv'; then return 0 fi - virtualenv -p python2 jmvenv + rm -rf "${jm_source}/deps" + virtualenv -p python2 "${jm_source}/jmvenv" } openssl_get () @@ -75,6 +73,14 @@ openssl_build () { ./config shared --prefix="${jm_root}" make -j + rm -rf "${jm_root}/ssl" \ + "${jm_root}/lib/engines" \ + "${jm_root}/lib/pkgconfig/openssl.pc" \ + "${jm_root}/lib/pkgconfig/libssl.pc" \ + "${jm_root}/lib/pkgconfig/libcrypto.pc" \ + "${jm_root}/include/openssl" \ + "${jm_root}/bin/c_rehash" \ + "${jm_root}/bin/openssl" if ! make test; then return 1 fi @@ -111,7 +117,7 @@ openssl_install () fi pushd "${openssl_version}" if openssl_build; then - make install + make install_sw else return 1 fi @@ -151,6 +157,7 @@ libffi_build () { ./autogen.sh ./configure --disable-docs --enable-shared --prefix="${jm_root}" + make uninstall make -j if ! make check; then return 1 @@ -198,7 +205,8 @@ libsodium_get () libsodium_build () { ./autogen.sh - ./configure --enable-shared --prefix="${jm_root}" + ./configure --enable-shared --prefix="${jm_root}" + make uninstall make -j if ! make check; then return 1 @@ -244,7 +252,7 @@ joinmarket_install () jm_pkgs=( 'jmbase' 'jmdaemon' 'jmbitcoin' 'jmclient' ) for pkg in ${jm_pkgs[@]}; do pushd "${pkg}" - pip install . + pip install . || return 1 popd done } @@ -277,10 +285,13 @@ main () fi if ! libsodium_install; then echo "Libsodium was not built. Exiting." + return 1 fi popd if ! joinmarket_install; then echo "Joinmarket was not installed. Exiting." + deactivate + return 1 fi deactivate echo "Joinmarket successfully installed diff --git a/test/run_tests.sh b/test/run_tests.sh new file mode 100755 index 0000000..9945216 --- /dev/null +++ b/test/run_tests.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +run_jm_tests () +{ + if [[ -z "${VIRTUAL_ENV}" ]]; then + echo "Source JM virtualenv before running tests: + + \`source ./jmvenv/bin/activate\`" + return 1 + fi + jm_source="${VIRTUAL_ENV}/.." + + pushd "${jm_source}" + git clone git://github.com/Joinmarket-Org/miniircd.git + if ! pip install -r ./requirements-dev.txt; then + echo "Packages in 'requirements-dev.txt' could not be installed. Exiting." + return 1 + fi + if [[ ! -L ./joinmarket.cfg && -e ./joinmarket.cfg ]]; then + mv ./joinmarket.cfg ./joinmarket.cfg.bak + echo "file 'joinmarket.cfg' moved to 'joinmarket.cfg.bak'" + fi + for dir in '/dev/shm' '/tmp' "${jm_source}/test"; do + if [[ -d "${dir}" && -r "${dir}" ]]; then + jm_test_datadir="${dir}/jm_test_home/.bitcoin" + break + fi + done + if [[ -z "${jm_test_datadir}" ]]; then + echo "No candidate directory for test files. Exiting." + return 1 + fi + unlink ./joinmarket.cfg + ln -s ./test/regtest_joinmarket.cfg ./joinmarket.cfg + orig_umask="$(umask -p)" + umask 077 + rm -rf "${jm_test_datadir}" + mkdir -p "${jm_test_datadir}" + cp -f ./test/bitcoin.conf "${jm_test_datadir}/bitcoin.conf" + ${orig_umask} + echo "datadir=${jm_test_datadir}" >> "${jm_test_datadir}/bitcoin.conf" + python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcpwd=123456abcdef --btcconf=${jm_test_datadir}/bitcoin.conf --btcuser=bitcoinrpc --nirc=2 --ignore jmclient/test/test_wallets.py --ignore test/test_segwit.py + unlink ./joinmarket.cfg + if read bitcoind_pid <"${jm_test_datadir}/bitcoind.pid"; then + pkill -15 ${bitcoind_pid} || pkill -9 ${bitcoind_pid} + fi + rm -rf "${jm_test_datadir}" +} +run_jm_tests From ad7309e486a0d23bfcc4e4499ee34de619719163 Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 12:14:38 +0000 Subject: [PATCH 3/9] .travis.yml uses install.sh and run_tests.sh only grep for keyid on gpg verify. algorithm appears differently on different gpg versions --- .travis.yml | 54 +++++++++++++++-------------------------------------- install.sh | 4 ++-- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57985a0..92f4f0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,49 +2,25 @@ sudo: required dist: trusty language: python python: - - "2.7_with_system_site_packages" + - "2.7_with_system_site_packages" before_install: - - sudo apt-get install -y curl - - sudo apt-get install -y python-dev - - sudo apt-get install -y libssl-dev - - sudo apt-add-repository ppa:bitcoin/bitcoin -y - - sudo apt-get update -q - - sudo apt-get install --no-install-recommends --no-upgrade -qq bitcoind - - sudo apt-get install -y build-essential - - sudo apt-get install -y automake - - sudo apt-get install -y pkg-config - - sudo apt-get install -y libtool - - sudo apt-get install -y libffi-dev + - sudo apt-add-repository ppa:bitcoin/bitcoin -y + - sudo apt-get update -q + - sudo apt-get install --no-install-recommends --no-upgrade -qq bitcoind + install: - - pip install -r requirements-dev.txt - - python setupall.py --daemon - - python setupall.py --client-bitcoin + - ./install.sh + +before_script: + - source jmvenv/bin/activate + script: -#install and test libsodium - - git clone git://github.com/jedisct1/libsodium.git - - cd libsodium - - git checkout tags/1.0.4 - - ./autogen.sh - - ./configure - - make check - - sudo make install - - cd .. -#set up joinmarket.cfg - - cp test/regtest_joinmarket.cfg joinmarket.cfg -#install miniircd - - git clone git://github.com/Joinmarket-Org/miniircd.git -#setup bitcoin config file - - mkdir /home/travis/.bitcoin - - cp test/bitcoin.conf /home/travis/.bitcoin/. - - chmod 600 /home/travis/.bitcoin/bitcoin.conf - - mkdir logs - - mkdir wallets - - python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcpwd=123456abcdef --btcconf=/home/travis/.bitcoin/bitcoin.conf --btcuser=bitcoinrpc --nirc=2 --ignore jmclient/test/test_wallets.py --ignore test/test_segwit.py + - ./test/run_tests.sh + after_success: - - coveralls + - coveralls + branches: only: - - master - - segwitwallets - + - test_travis diff --git a/install.sh b/install.sh index 6258097..7570dee 100755 --- a/install.sh +++ b/install.sh @@ -94,7 +94,7 @@ openssl_install () openssl_lib_sig="${openssl_lib_tar}.asc" openssl_url='https://www.openssl.org/source' openssl_signer_key_url='https://pgp.mit.edu/pks/lookup?op=get&search=0xD9C4D26D0E604491' - openssl_signer_key_id='2048R/D9C4D26D0E604491' + openssl_signer_key_id='D9C4D26D0E604491' openssl_root="${jm_deps}/openssl" if check_skip_build 'openssl'; then @@ -220,7 +220,7 @@ libsodium_install () sodium_lib_sig="${sodium_lib_tar}.sig" sodium_url='https://download.libsodium.org/libsodium/releases' sodium_signer_key_url='https://pgp.mit.edu/pks/lookup?op=get&search=0x210627AABA709FE1' - sodium_signer_key_id='4096R/62F25B592B6F76DA' + sodium_signer_key_id='62F25B592B6F76DA' if check_skip_build 'libsodium'; then return 0 From 15433df28d237cfe33fa6f15bda887131b99a0b6 Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 15:36:54 +0300 Subject: [PATCH 4/9] add test result files to gitignore change .travis.yml indentation to 2 spaces (whoops) remove whitespace --- .gitignore | 11 ++++++++++- .travis.yml | 24 +++++++++--------------- install.sh | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 8bf11e5..99aef2e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,13 @@ htmlcov/ scripts/joinmarket.cfg scripts/cmttools/commitments.json scripts/blacklist - +alicekey +alicepubkey +bobkey +commitments_debug.txt +deps/ +jmvenv/ +logs/ +miniircd/ +nums_basepoints.txt +schedulefortesting diff --git a/.travis.yml b/.travis.yml index 92f4f0d..4a2f5c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,25 +2,19 @@ sudo: required dist: trusty language: python python: - - "2.7_with_system_site_packages" - + - "2.7_with_system_site_packages" before_install: - - sudo apt-add-repository ppa:bitcoin/bitcoin -y - - sudo apt-get update -q - - sudo apt-get install --no-install-recommends --no-upgrade -qq bitcoind - + - sudo apt-add-repository ppa:bitcoin/bitcoin -y + - sudo apt-get update -q + - sudo apt-get install --no-install-recommends --no-upgrade -qq bitcoind install: - - ./install.sh - + - ./install.sh before_script: - - source jmvenv/bin/activate - + - source jmvenv/bin/activate script: - - ./test/run_tests.sh - + - ./test/run_tests.sh after_success: - - coveralls - + - coveralls branches: only: - - test_travis + - test_travis diff --git a/install.sh b/install.sh index 7570dee..ca57320 100755 --- a/install.sh +++ b/install.sh @@ -298,7 +298,7 @@ main () Before executing scripts or tests, run: \`source jmvenv/bin/activate\` - + from this directiry, to acticate virtualenv." } main From 28507bdbe637981360dbf33a8c8d7c64b54da02c Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 16:52:29 +0300 Subject: [PATCH 5/9] change travis test branch to master --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a2f5c9..fc9d5e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,4 +17,4 @@ after_success: - coveralls branches: only: - - test_travis + - master From 9e65d2e31f823ee12ec7cd6d0d7c6e3b5f4c4189 Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 18:10:14 +0300 Subject: [PATCH 6/9] dependency check can find missing packages --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ca57320..b386892 100755 --- a/install.sh +++ b/install.sh @@ -17,13 +17,13 @@ gpg_verify_sig () deb_deps_check () { - apt-cache policy ${deb_deps[@]} + apt-cache policy ${deb_deps[@]} | grep "Installed.*none" } deb_deps_install () { deb_deps=( 'python-virtualenv' 'curl' 'python-dev' 'python-pip' 'build-essential' 'automake' 'pkg-config' 'libtool' ) - if ! deb_deps_check; then + if deb_deps_check; then clear echo " sudo password required to run : From 80278535552c06459f35627fecd3d4e2909f935f Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 18:58:15 +0300 Subject: [PATCH 7/9] add exports and upgrade pip versions for older operating systems --- install.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install.sh b/install.sh index b386892..724a534 100755 --- a/install.sh +++ b/install.sh @@ -59,6 +59,10 @@ venv_setup () fi rm -rf "${jm_source}/deps" virtualenv -p python2 "${jm_source}/jmvenv" + source "${jm_source}/jmvenv/bin/activate" + pip install --upgrade pip + pip install --upgrade setuptools + deactivate } openssl_get () @@ -263,6 +267,8 @@ main () jm_root="${jm_source}/jmvenv" jm_deps="${jm_source}/deps" export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${jm_root}/lib/pkgconfig" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${jm_root}/lib" + export C_INCLUDE_PATH="${C_INCLUDE_PATH}:${jm_root}/include" if ! deb_deps_install; then echo "Dependecies could not be installed. Exiting." From 10f20ed44ddcd2c070fe24b7afcc6a99f91836db Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sat, 26 Aug 2017 23:28:28 +0300 Subject: [PATCH 8/9] add exports and pkg-config paths to run_tests.sh, use curl instead of git to fetch miniircd, only run cov tests on travis runs --- test/run_tests.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/run_tests.sh b/test/run_tests.sh index 9945216..edb1f95 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -9,9 +9,15 @@ run_jm_tests () return 1 fi jm_source="${VIRTUAL_ENV}/.." + export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${VIRTUAL_ENV}/lib/pkgconfig" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VIRTUAL_ENV}/lib" + export C_INCLUDE_PATH="${C_INCLUDE_PATH}:${VIRTUAL_ENV}/include" pushd "${jm_source}" - git clone git://github.com/Joinmarket-Org/miniircd.git + curl -L https://github.com/JoinMarket-Org/miniircd/archive/master.tar.gz -o miniircd.tar.gz + rm -rf ./miniircd + mkdir -p miniircd + tar xaf miniircd.tar.gz -C ./miniircd --strip-components=1 if ! pip install -r ./requirements-dev.txt; then echo "Packages in 'requirements-dev.txt' could not be installed. Exiting." return 1 @@ -39,7 +45,7 @@ run_jm_tests () cp -f ./test/bitcoin.conf "${jm_test_datadir}/bitcoin.conf" ${orig_umask} echo "datadir=${jm_test_datadir}" >> "${jm_test_datadir}/bitcoin.conf" - python -m py.test --cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html --btcpwd=123456abcdef --btcconf=${jm_test_datadir}/bitcoin.conf --btcuser=bitcoinrpc --nirc=2 --ignore jmclient/test/test_wallets.py --ignore test/test_segwit.py + python -m py.test ${HAS_JOSH_K_SEAL_OF_APPROVAL+'--cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html'} --btcpwd=123456abcdef --btcconf=${jm_test_datadir}/bitcoin.conf --btcuser=bitcoinrpc --nirc=2 --ignore jmclient/test/test_wallets.py --ignore test/test_segwit.py unlink ./joinmarket.cfg if read bitcoind_pid <"${jm_test_datadir}/bitcoind.pid"; then pkill -15 ${bitcoind_pid} || pkill -9 ${bitcoind_pid} From f3e321a7dd11e621d7d6547685915ac5a3be524f Mon Sep 17 00:00:00 2001 From: fivepiece Date: Sun, 27 Aug 2017 21:17:32 +0300 Subject: [PATCH 9/9] fail on virtualenv setup, fix cov test run on travis --- install.sh | 5 +++-- test/run_tests.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 724a534..9ba303d 100755 --- a/install.sh +++ b/install.sh @@ -58,8 +58,8 @@ venv_setup () return 0 fi rm -rf "${jm_source}/deps" - virtualenv -p python2 "${jm_source}/jmvenv" - source "${jm_source}/jmvenv/bin/activate" + virtualenv -p python2 "${jm_source}/jmvenv" || return 1 + source "${jm_source}/jmvenv/bin/activate" || return 1 pip install --upgrade pip pip install --upgrade setuptools deactivate @@ -276,6 +276,7 @@ main () fi if ! venv_setup; then echo "Joinmarket virtualenv could not be setup. Exiting." + return 1 fi source "${jm_root}/bin/activate" mkdir -p deps diff --git a/test/run_tests.sh b/test/run_tests.sh index edb1f95..f619564 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -45,7 +45,7 @@ run_jm_tests () cp -f ./test/bitcoin.conf "${jm_test_datadir}/bitcoin.conf" ${orig_umask} echo "datadir=${jm_test_datadir}" >> "${jm_test_datadir}/bitcoin.conf" - python -m py.test ${HAS_JOSH_K_SEAL_OF_APPROVAL+'--cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html'} --btcpwd=123456abcdef --btcconf=${jm_test_datadir}/bitcoin.conf --btcuser=bitcoinrpc --nirc=2 --ignore jmclient/test/test_wallets.py --ignore test/test_segwit.py + python -m py.test ${HAS_JOSH_K_SEAL_OF_APPROVAL+--cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html} --btcpwd=123456abcdef --btcconf=${jm_test_datadir}/bitcoin.conf --btcuser=bitcoinrpc --nirc=2 --ignore jmclient/test/test_wallets.py --ignore test/test_segwit.py unlink ./joinmarket.cfg if read bitcoind_pid <"${jm_test_datadir}/bitcoind.pid"; then pkill -15 ${bitcoind_pid} || pkill -9 ${bitcoind_pid}