commit: 0292a7e2b5e28486380ea1c5eef1ccbd8ca1365b
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 15 05:48:20 2017 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Dec 15 05:48:20 2017 +0000
URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=0292a7e2
tools/catalyst-auto-{x86,amd64}: refactor post_build for remote buildhost.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
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
}