scripts/copy_buildsync: try to exclude rsync tempfile

In-progress uploads are named .<filename>.<rsynctemp> and were
mistakenly recognized by copy_buildsync.sh as targets to sweep to the
mirrors. When it did, it deleted the file causing the in-progress upload
to fail.

Since the script is run by cron every 15 minutes, this would lead to a
large portion of the generated installation media to fail to upload, and
worse there is no pattern to it -- it just happens whenever an upload
spans the 15 minute boundary.

The fix is to ignore hidden files and to tell rsync (via the filter
rules) to exclude them from its sweep to the mirrors.

Closes: https://bugs.gentoo.org/670458
Signed-off-by: Matt Turner <mattst88@gentoo.org>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Matt Turner 2018-11-20 22:43:38 -08:00
parent 2bf63fc4a4
commit c9ad265f80

View file

@ -70,14 +70,14 @@ copy_arch_to_outgoing() {
fi
# Copying
for i in $(find ${indir} -type f | egrep -- '-20[0123][0-9]{5}(([0-9]{6})|(T[0-9]{6}Z))?' | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' | sort -ur); do
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
#echo "Doing $i"
t="${outdir}/${i}"
mkdir -p ${t} 2>/dev/null
rsync "${RSYNC_OPTS[@]}" --temp-dir=${tmpdir} --partial-dir=${tmpdir} ${indir}/ --filter "S *${i}*" --filter 'S **/' --filter 'H *' ${t}
rsync "${RSYNC_OPTS[@]}" --temp-dir=${tmpdir} --partial-dir=${tmpdir} ${indir}/ --filter '- **/.*' --filter "S *${i}*" --filter 'S **/' --filter 'H *' ${t}
rc=$?
if [ $rc -eq 0 ]; then
find ${indir} -type f -name "*${i}*" -print0 | xargs -0 --no-run-if-empty $DEBUGP rm $VERBOSEP -f
find ${indir} -not -path '*/\.*' -type f -name "*${i}*" -print0 | xargs -0 --no-run-if-empty $DEBUGP rm $VERBOSEP -f
else
echo "Not deleting ${indir}/*${i}*, rsync failed!" 1>&2
fail=1