aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2018-11-20 22:55:35 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2018-11-20 22:55:35 -0800
commit544760570fc4b414b14d4eea128ac700b56d13f9 (patch)
treee8317548e8590a6bae217ba9112e2e3d385ae756 /scripts/copy_buildsync.sh
parentscripts/copy_buildsync: try to exclude rsync tempfile (diff)
downloadreleng-544760570fc4b414b14d4eea128ac700b56d13f9.tar.gz
releng-544760570fc4b414b14d4eea128ac700b56d13f9.tar.bz2
releng-544760570fc4b414b14d4eea128ac700b56d13f9.zip
scripts/copy_buildsync: cleanup excludes of tempfile
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'scripts/copy_buildsync.sh')
-rwxr-xr-xscripts/copy_buildsync.sh37
1 files changed, 32 insertions, 5 deletions
diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh
index 6c6085ff..815d21de 100755
--- a/scripts/copy_buildsync.sh
+++ b/scripts/copy_buildsync.sh
@@ -62,7 +62,7 @@ EOF
# Copy artifacts for an arch to the outgoing directory.
copy_arch_to_outgoing() {
local ARCH=$1 indir=$2 outdir=$3 tmpdir=$4
- local i t rc
+ local i t rc timestamps
if [[ ! -d ${indir} ]]; then
# Nothing to do for this arch.
@@ -70,21 +70,48 @@ copy_arch_to_outgoing() {
fi
# Copying
- for i in $(find ${indir} -not -path '*/\.*' -type f | egrep -- '-20[0123][0-9]{5}(([0-9]{6})|(T[0-9]{6}Z))?' | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' | sort -ur); do
+ timestamps=( $(
+ find "${indir}" \
+ -regextype posix-egrep \
+ -type f \
+ -regex '.*-20[0123][0-9]{5}(([0-9]{6})|(T[0-9]{6}Z))?.*' \
+ \( -not -path '*/\.*' \) \
+ | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' \
+ | sort -ur
+ ) )
+
+ for i in "${timestamps[@]}" ; do
#echo "Doing $i"
t="${outdir}/${i}"
mkdir -p ${t} 2>/dev/null
- rsync "${RSYNC_OPTS[@]}" --temp-dir=${tmpdir} --partial-dir=${tmpdir} ${indir}/ --filter '- **/.*' --filter "S *${i}*" --filter 'S **/' --filter 'H *' ${t}
+ rsync \
+ "${RSYNC_OPTS[@]}" \
+ --temp-dir="${tmpdir}" \
+ --partial-dir="${tmpdir}" \
+ --filter '- **/.*' \
+ --filter "S *${i}*" \
+ --filter 'S **/' \
+ --filter 'H *' \
+ ${indir}/ \
+ ${t}
rc=$?
if [ $rc -eq 0 ]; then
- find ${indir} -not -path '*/\.*' -type f -name "*${i}*" -print0 | xargs -0 --no-run-if-empty $DEBUGP rm $VERBOSEP -f
+ find "${indir}" \
+ -type f \
+ -name "*${i}*" \
+ \( -not -path '*/\.*' \) \
+ -print0 \
+ | xargs -0 --no-run-if-empty \
+ "$DEBUGP" rm "$VERBOSEP" -f
else
echo "Not deleting ${indir}/*${i}*, rsync failed!" 1>&2
fail=1
fi
done
find "${outdir}" \
- -depth -mindepth 1 -type d \
+ -depth \
+ -mindepth 1 \
+ -type d \
-exec rmdir --ignore-fail-on-non-empty {} +
}