From 0292a7e2b5e28486380ea1c5eef1ccbd8ca1365b Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Thu, 14 Dec 2017 21:48:20 -0800 Subject: [PATCH] tools/catalyst-auto-{x86,amd64}: refactor post_build for remote buildhost. Signed-off-by: Robin H. Johnson --- tools/catalyst-auto-amd64.conf | 28 ++++++++++++++++++++-------- tools/catalyst-auto-x86.conf | 32 ++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/tools/catalyst-auto-amd64.conf b/tools/catalyst-auto-amd64.conf index a6082de7..53dac821 100644 --- a/tools/catalyst-auto-amd64.conf +++ b/tools/catalyst-auto-amd64.conf @@ -84,31 +84,43 @@ pre_build() { } post_build() { + cmd=( + rsync + -e 'ssh -i /root/.ssh/id_rsa' + -a + --omit-dir-times + --delay-updates + ) + case $HOSTNAME in + nightheron) DEST=${BUILD_DESTDIR_BASE} ;; + *) DEST=${ARCH}@nightheron.gentoo.org:${BUILD_DESTDIR_BASE} ;; + esac pushd ${BUILD_SRCDIR_BASE}/default >/dev/null - mkdir -p ${BUILD_DESTDIR_BASE} + mkdir -p ${TMPDIR}/empty + "${cmd[@]}" ${TMPDIR}/empty ${DEST} for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} stage{3,4}*${TIMESTAMP}*${EXTENSIONS} ); do if [ -f $file ]; then - cp $file* ${BUILD_DESTDIR_BASE} + "${cmd[@]}" ${file}* ${DEST} fi done if [ -f *${DATESTAMP}*.iso ]; then - cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE} + "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST} elif [ -f *${TIMESTAMP}*.iso ]; then - cp *${TIMESTAMP}*.iso* ${BUILD_DESTDIR_BASE} + "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST} fi popd >/dev/null pushd ${BUILD_SRCDIR_BASE}/hardened >/dev/null - mkdir -p ${BUILD_DESTDIR_BASE}/hardened + "${cmd[@]}" ${TMPDIR}/empty ${DEST}/hardened for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} stage{3,4}*${TIMESTAMP}*${EXTENSIONS} ); do if [ -f $file ]; then - cp $file* ${BUILD_DESTDIR_BASE}/hardened + "${cmd[@]}" $file* ${DEST}/hardened fi done if [ -f *${DATESTAMP}*.iso ]; then - cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE}/hardened + "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST}/hardened elif [ -f *${TIMESTAMP}*.iso ]; then - cp *${TIMESTAMP}*.iso* ${BUILD_DESTDIR_BASE}/hardened + "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST}/hardened fi } diff --git a/tools/catalyst-auto-x86.conf b/tools/catalyst-auto-x86.conf index 4d49b8b4..6ec010ce 100644 --- a/tools/catalyst-auto-x86.conf +++ b/tools/catalyst-auto-x86.conf @@ -55,27 +55,43 @@ pre_build() { } post_build() { + cmd=( + rsync + -e 'ssh -i /root/.ssh/id_rsa' + -a + --omit-dir-times + --delay-updates + ) + case $HOSTNAME in + nightheron) DEST=${BUILD_DESTDIR_BASE} ;; + *) DEST=${ARCH}@nightheron.gentoo.org:${BUILD_DESTDIR_BASE} ;; + esac pushd ${BUILD_SRCDIR_BASE}/default >/dev/null - mkdir -p ${BUILD_DESTDIR_BASE} - for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} ); do + mkdir -p ${TMPDIR}/empty + "${cmd[@]}" ${TMPDIR}/empty ${DEST} + for file in $(ls stage{3,4}*{${DATESTAMP},${TIMESTAMP}}*${EXTENSIONS} ); do if [ -f $file ]; then - cp $file* ${BUILD_DESTDIR_BASE} + "${cmd[@]}" ${file}* ${DEST} fi done if [ -f *${DATESTAMP}*.iso ]; then - cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE} + "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST} + elif [ -f *${TIMESTAMP}*.iso ]; then + "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST} fi popd >/dev/null pushd ${BUILD_SRCDIR_BASE}/hardened >/dev/null - mkdir -p ${BUILD_DESTDIR_BASE}/hardened - for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} ); do + "${cmd[@]}" ${TMPDIR}/empty ${DEST}/hardened + for file in $(ls stage{3,4}*{${DATESTAMP},${TIMESTAMP}}*${EXTENSIONS} ); do if [ -f $file ]; then - cp $file* ${BUILD_DESTDIR_BASE}/hardened + "${cmd[@]}" $file* ${DEST}/hardened fi done if [ -f *${DATESTAMP}*.iso ]; then - cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE}/hardened + "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST}/hardened + elif [ -f *${TIMESTAMP}*.iso ]; then + "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST}/hardened fi }