From 184b39e159566e745342ae0fea08ceaa8bc7ce32 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 3 Sep 2015 08:34:22 -0300 Subject: Create a new function pkg_repo_rsync, it'll be also used for core pkgs --- tools/builder_common.sh | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'tools') diff --git a/tools/builder_common.sh b/tools/builder_common.sh index 6610a2a..8a4c784 100644 --- a/tools/builder_common.sh +++ b/tools/builder_common.sh @@ -1589,6 +1589,32 @@ finish() { echo ">>> Operation $0 has ended at $(date)" } +pkg_repo_rsync() { + local _repo_path="${1}" + + if [ -z "${DO_NOT_UPLOAD}" -o -z "${_repo_path}" -o ! -d "${_repo_path}" ]; then + return + fi + + if [ -z "${LOGFILE}" ]; then + local _logfile="/dev/null" + else + local _logfile="${LOGFILE}" + fi + + echo -n ">>> Sending updated repository to ${PKG_RSYNC_HOSTNAME}... " | tee -a ${_logfile} + if script -aq ${_logfile} rsync -ave "ssh -p ${PKG_RSYNC_SSH_PORT}" \ + --timeout=60 --delete-delay ${_repo_path} \ + ${PKG_RSYNC_USERNAME}@${PKG_RSYNC_HOSTNAME}:${PKG_RSYNC_DESTDIR} >/dev/null 2>&1 + then + echo "Done!" | tee -a ${_logfile} + else + echo "Failed!" | tee -a ${_logfile} + echo ">>> ERROR: An error occurred sending repo to remote hostname" + print_error_pfS + fi +} + poudriere_create_patch() { local _jail_patch="${SCRATCHDIR}/poudriere_jail.${GIT_REPO_BRANCH_OR_TAG}.patch" @@ -1896,20 +1922,7 @@ poudriere_bulk() { fi # ./ is intentional, it's a rsync trick to make it chdir to directory before send it - REPO_PATH="/usr/local/poudriere/data/packages/./${jail_name}-${POUDRIERE_PORTS_NAME}" - if [ -z "${DO_NOT_UPLOAD}" -a -d "${REPO_PATH}" ]; then - echo -n ">>> Sending updated repository to ${PKG_RSYNC_HOSTNAME}... " | tee -a ${LOGFILE} - if script -aq ${LOGFILE} rsync -ave "ssh -p ${PKG_RSYNC_SSH_PORT}" \ - --timeout=60 --delete-delay ${REPO_PATH} \ - ${PKG_RSYNC_USERNAME}@${PKG_RSYNC_HOSTNAME}:${PKG_RSYNC_DESTDIR} >/dev/null 2>&1 - then - echo "Done!" | tee -a ${LOGFILE} - else - echo "Failed!" | tee -a ${LOGFILE} - echo ">>> ERROR: An error occurred sending repo to remote hostname" - print_error_pfS - fi - fi + pkg_repo_rsync "/usr/local/poudriere/data/packages/./${jail_name}-${POUDRIERE_PORTS_NAME}" done } -- cgit v1.1