From 3495c9a5b41336637dbe3d606236d990fd142ac2 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Fri, 15 Jul 2016 19:13:53 -0500 Subject: [PATCH 1/2] output log file when lbrycrd build fails --- reproducible_build.sh | 47 ++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/reproducible_build.sh b/reproducible_build.sh index 3faa177d7..d333875ac 100755 --- a/reproducible_build.sh +++ b/reproducible_build.sh @@ -30,6 +30,7 @@ CLEAN=false BUILD_DEPENDENCIES=true BUILD_LBRYCRD=true TIMEOUT=false +THREE_MB=3145728 while getopts :crldoth:w:d: FLAG; do case $FLAG in @@ -151,14 +152,19 @@ function wait_and_echo() { # and wait until it completed function background() { $1 >> "$2" 2>&1 & - wait_and_echo $! "$3" + BACKGROUND_PID=$! + wait_and_echo $BACKGROUND_PID "$3" } function cleanup() { rv=$? # cat the log file if it exists if [ -f "$2" ]; then - cat "$2" + echo + echo "Output of log file $2" + echo + tail -c $THREE_MB "$1" + echo fi # delete the build directory rm -rf "$1" @@ -166,6 +172,22 @@ function cleanup() { exit $rv } +function cat_and_exit() { + rv=$? + # cat the log file if it exists + if [ -f "$1" ]; then + echo + echo "Output of log file $1" + echo + # log size is limited to 4MB on travis + # so hopefully the last 3MB is enough + # to debug whatever went wrong + tail -c $THREE_MB "$1" + echo + fi + exit $rv +} + function brew_if_not_installed() { if ! brew ls | grep $1 --quiet; then brew install $1 @@ -298,20 +320,19 @@ function build_lbrycrd() { else cd "${SOURCE_DIR}" fi - ./autogen.sh + ./autogen.sh > "${LBRYCRD_LOG}" 2>&1 LDFLAGS="-L${OPENSSL_PREFIX}/lib/ -L${BDB_PREFIX}/lib/ -L${LIBEVENT_PREFIX}/lib/ -static-libstdc++" CPPFLAGS="-I${OPENSSL_PREFIX}/include -I${BDB_PREFIX}/include -I${LIBEVENT_PREFIX}/include/" if [ "${OS_NAME}" = "osx" ]; then - ./configure --without-gui --enable-cxx --enable-static --disable-shared --with-pic \ - --with-boost="${BOOST_PREFIX}" \ - LDFLAGS="${LDFLAGS}" \ - CPPFLAGS="${CPPFLAGS}" + OPTIONS="--enable-cxx --enable-static --disable-shared --with-pic" else - ./configure --without-gui --with-boost="${BOOST_PREFIX}" \ - LDFLAGS="${LDFLAGS}" \ - CPPFLAGS="${CPPFLAGS}" + OPTIONS="" fi - make + ./configure --without-gui ${OPTIONS} \ + --with-boost="${BOOST_PREFIX}" \ + LDFLAGS="${LDFLAGS}" \ + CPPFLAGS="${CPPFLAGS}" >> "${LBRYCRD_LOG}" 2>&1 + background make "${LBRYCRD_LOG}" "Waiting for lbrycrd to finish building" # tests don't work on OSX. Should definitely figure out why # that is but, for now, not letting that stop the rest # of the build @@ -344,5 +365,7 @@ set -u if [ "${BUILD_LBRYCRD}" = true ]; then LBRYCRD_LOG="${LOG_DIR}/lbrycrd_build.log" echo "Building lbrycrd. tail -f ${LBRYCRD_LOG} to see the details and monitor progress" - background build_lbrycrd "${LBRYCRD_LOG}" "Waiting for lbrycrd to finish building" + trap 'cat_and_exit "${LBRYCRD_LOG}"' INT TERM EXIT + build_lbrycrd + trap - INT TERM EXIT fi From 5fb9f4cba6b06be9941d5391a29503406a69b82c Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Fri, 15 Jul 2016 20:59:20 -0500 Subject: [PATCH 2/2] misc fixes --- reproducible_build.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/reproducible_build.sh b/reproducible_build.sh index d333875ac..f47a3d88f 100755 --- a/reproducible_build.sh +++ b/reproducible_build.sh @@ -198,7 +198,9 @@ function install_brew_packages() { brew update > /dev/null brew_if_not_installed autoconf brew_if_not_installed automake - brew_if_not_installed libtool + # something weird happened where glibtoolize was failing to find + # sed, and reinstalling fixes it. + brew reinstall -s libtool brew_if_not_installed pkg-config brew_if_not_installed protobuf brew_if_not_installed gmp @@ -234,6 +236,7 @@ function build_dependencies() { if [ ! -d "${LBRYCRD_DEPENDENCIES}" ]; then git clone https://github.com/lbryio/lbrycrd-dependencies.git "${LBRYCRD_DEPENDENCIES}" fi + # TODO: if the repo exists, make sure its clean: revert to head. mkdir -p "${LOG_DIR}" build_dependency "${BDB_PREFIX}" "${LOG_DIR}/bdb_build.log" build_bdb @@ -288,7 +291,9 @@ function build_boost() { function build_libevent() { LIBEVENT_LOG="$1" - git clone https://github.com/libevent/libevent.git + if [ ! -d libevent ]; then + git clone https://github.com/libevent/libevent.git + fi cd libevent echo "Building libevent. tail -f ${LIBEVENT_LOG} to see the details and monitor progress" ./autogen.sh > "${LIBEVENT_LOG}" 2>&1