1 |
commit: 9fa4c8f32c637c88bf5c0b7b3259781aba1f68a6 |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 21 06:55:35 2018 +0000 |
4 |
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 21 19:13:02 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=9fa4c8f3 |
7 |
|
8 |
scripts/copy_buildsync: cleanup excludes of tempfile |
9 |
|
10 |
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> |
11 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
12 |
|
13 |
scripts/copy_buildsync.sh | 37 ++++++++++++++++++++++++++++++++----- |
14 |
1 file changed, 32 insertions(+), 5 deletions(-) |
15 |
|
16 |
diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh |
17 |
index 6c6085ff..815d21de 100755 |
18 |
--- a/scripts/copy_buildsync.sh |
19 |
+++ b/scripts/copy_buildsync.sh |
20 |
@@ -62,7 +62,7 @@ EOF |
21 |
# Copy artifacts for an arch to the outgoing directory. |
22 |
copy_arch_to_outgoing() { |
23 |
local ARCH=$1 indir=$2 outdir=$3 tmpdir=$4 |
24 |
- local i t rc |
25 |
+ local i t rc timestamps |
26 |
|
27 |
if [[ ! -d ${indir} ]]; then |
28 |
# Nothing to do for this arch. |
29 |
@@ -70,21 +70,48 @@ copy_arch_to_outgoing() { |
30 |
fi |
31 |
|
32 |
# Copying |
33 |
- 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 |
34 |
+ timestamps=( $( |
35 |
+ find "${indir}" \ |
36 |
+ -regextype posix-egrep \ |
37 |
+ -type f \ |
38 |
+ -regex '.*-20[0123][0-9]{5}(([0-9]{6})|(T[0-9]{6}Z))?.*' \ |
39 |
+ \( -not -path '*/\.*' \) \ |
40 |
+ | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' \ |
41 |
+ | sort -ur |
42 |
+ ) ) |
43 |
+ |
44 |
+ for i in "${timestamps[@]}" ; do |
45 |
#echo "Doing $i" |
46 |
t="${outdir}/${i}" |
47 |
mkdir -p ${t} 2>/dev/null |
48 |
- rsync "${RSYNC_OPTS[@]}" --temp-dir=${tmpdir} --partial-dir=${tmpdir} ${indir}/ --filter '- **/.*' --filter "S *${i}*" --filter 'S **/' --filter 'H *' ${t} |
49 |
+ rsync \ |
50 |
+ "${RSYNC_OPTS[@]}" \ |
51 |
+ --temp-dir="${tmpdir}" \ |
52 |
+ --partial-dir="${tmpdir}" \ |
53 |
+ --filter '- **/.*' \ |
54 |
+ --filter "S *${i}*" \ |
55 |
+ --filter 'S **/' \ |
56 |
+ --filter 'H *' \ |
57 |
+ ${indir}/ \ |
58 |
+ ${t} |
59 |
rc=$? |
60 |
if [ $rc -eq 0 ]; then |
61 |
- find ${indir} -not -path '*/\.*' -type f -name "*${i}*" -print0 | xargs -0 --no-run-if-empty $DEBUGP rm $VERBOSEP -f |
62 |
+ find "${indir}" \ |
63 |
+ -type f \ |
64 |
+ -name "*${i}*" \ |
65 |
+ \( -not -path '*/\.*' \) \ |
66 |
+ -print0 \ |
67 |
+ | xargs -0 --no-run-if-empty \ |
68 |
+ "$DEBUGP" rm "$VERBOSEP" -f |
69 |
else |
70 |
echo "Not deleting ${indir}/*${i}*, rsync failed!" 1>&2 |
71 |
fail=1 |
72 |
fi |
73 |
done |
74 |
find "${outdir}" \ |
75 |
- -depth -mindepth 1 -type d \ |
76 |
+ -depth \ |
77 |
+ -mindepth 1 \ |
78 |
+ -type d \ |
79 |
-exec rmdir --ignore-fail-on-non-empty {} + |
80 |
} |