[hooks] force ConnectionTimeout=5 on ssh sockets for buildfail hook

This commit is contained in:
Fabio Erculiani 2011-11-27 12:38:20 +01:00
parent f324f967d1
commit e9a7a33f69

View File

@ -3,6 +3,7 @@
# MATTER_PORTAGE_FAILED_PACKAGE_NAME = CPV of failed package # MATTER_PORTAGE_FAILED_PACKAGE_NAME = CPV of failed package
DATE_DIR=$(date +%Y-%m-%d) DATE_DIR=$(date +%Y-%m-%d)
SSH_ARGS="-o ConnectTimeout=5"
BUILD_LOG=$(echo -n "${MATTER_PORTAGE_BUILD_LOG_DIR}/${MATTER_PORTAGE_FAILED_PACKAGE_NAME}"*.log) BUILD_LOG=$(echo -n "${MATTER_PORTAGE_BUILD_LOG_DIR}/${MATTER_PORTAGE_FAILED_PACKAGE_NAME}"*.log)
if [ -z "${BUILD_LOG}" ]; then if [ -z "${BUILD_LOG}" ]; then
@ -16,7 +17,11 @@ fi
REMOTE_DIR="~/tinderbox/${DATE_DIR}/$(uname -m)/${MATTER_PORTAGE_FAILED_PACKAGE_NAME}" REMOTE_DIR="~/tinderbox/${DATE_DIR}/$(uname -m)/${MATTER_PORTAGE_FAILED_PACKAGE_NAME}"
echo "Uploading ${BUILD_LOG} to tinderbox.sabayon.org..." echo "Uploading ${BUILD_LOG} to tinderbox.sabayon.org..."
ssh entropy@tinderbox.sabayon.org mkdir -p "${REMOTE_DIR}" ssh ${SSH_ARGS} entropy@tinderbox.sabayon.org mkdir -p "${REMOTE_DIR}"
if [ "${?}" != "0" ]; then
echo "cannot connect to tinderbox"
exit 1
fi
tmp_path=$(mktemp --suffix=.emerge.info.txt) tmp_path=$(mktemp --suffix=.emerge.info.txt)
emerge --info =${MATTER_PORTAGE_FAILED_PACKAGE_NAME} > "${tmp_path}" emerge --info =${MATTER_PORTAGE_FAILED_PACKAGE_NAME} > "${tmp_path}"
@ -25,13 +30,13 @@ if [ "${?}" != "0" ]; then
exit ${?} exit ${?}
fi fi
chmod 640 "${tmp_path}" chmod 640 "${tmp_path}"
scp "${tmp_path}" entropy@tinderbox.sabayon.org:"${REMOTE_DIR}"/ scp ${SSH_ARGS} "${tmp_path}" entropy@tinderbox.sabayon.org:"${REMOTE_DIR}"/
if [ "${?}" != "0" ]; then if [ "${?}" != "0" ]; then
rm "${tmp_path}" rm "${tmp_path}"
exit 1 exit 1
fi fi
rm "${tmp_path}" rm "${tmp_path}"
scp "${BUILD_LOG}" entropy@tinderbox.sabayon.org:"${REMOTE_DIR}"/ || exit 1 scp ${SSH_ARGS} "${BUILD_LOG}" entropy@tinderbox.sabayon.org:"${REMOTE_DIR}"/ || exit 1
exit 0 exit 0