commit:     62f25f4995cb2a7b37a4bce84bb781a9451d8e70
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 23:37:44 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 23:37:44 2016 +0000
URL:        https://gitweb.gentoo.org/proj/releng.git/commit/?id=62f25f49

copy_buildsync.sh: fix extension handling

The change to use a list of file extensions w/find doesn't actually work:
the [] operators sets up a group of chars to match, and it isn't split by
the comma char.  It's equiv to doing "*[,.2abfgrstxz]".

 scripts/copy_buildsync.sh | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh
index 1d45921..ac823fe 100755
--- a/scripts/copy_buildsync.sh
+++ b/scripts/copy_buildsync.sh
@@ -24,7 +24,16 @@ RSYNC_OPTS=(
        -aO
        --delay-updates
 )
-EXTENSIONS="[.tar.xz,.tar.bz2,.tar.gz,.tar,.sfs]"
+# Command line for `find` to figure out what files are release artifacts.
+EXTENSIONS=(
+       '('
+       -name '*.tar.xz' -o
+       -name '*.tar.bz2' -o
+       -name '*.tar.gz' -o
+       -name '*.tar' -o
+       -name '*.sfs'
+       ')'
+)
 
 OUT_STAGE3="latest-stage3.txt"
 OUT_ISO="latest-iso.txt"
@@ -101,7 +110,7 @@ process_arch() {
        # %T@
 
        iso_list="$(find 20* -name '*.iso' -printf '%h %f %h/%f\n' |grep -v 
hardened | sort -n)"
-       stage3_list=$(find 20* -name "stage3*${EXTENSIONS}" -printf '%h %f 
%h/%f\n' | grep -v hardened | sort -n)
+       stage3_list=$(find 20* -name "stage3*" -a "${EXTENSIONS[@]}" -printf 
'%h %f %h/%f\n' | grep -v hardened | sort -n)
        latest_iso_date="$(echo -e "${iso_list}" |awk '{print $1}' |cut -d/ -f1 
| tail -n1)"
        latest_stage3_date="$(echo -e "${stage3_list}" |awk '{print $1}' |cut 
-d/ -f1 | tail -n1)"
        header="$(echo -e "# Latest as of $(date -uR)\n# ts=$(date -u +%s)")"
@@ -144,10 +153,10 @@ process_arch() {
        fi
 
        # New variant preserve code
-       variants=$(find 20* \( -iname '*.iso' -o -iname "*${EXTENSIONS}" \) 
-printf '%f\n' | sed  -e 's,-20[012][0-9]\{5\}.*,,g' -r | sort | uniq)
+       variants=$(find 20* \( -iname '*.iso' -o "${EXTENSIONS[@]}" \) -printf 
'%f\n' | sed  -e 's,-20[012][0-9]\{5\}.*,,g' -r | sort | uniq)
        echo -n '' >"${tmpdir}"/.keep.${ARCH}.txt
        for v in $variants ; do
-               variant_path=$(find 20* -iname "${v}-20*" \( -name 
"*${EXTENSIONS}" -o -iname '*.iso' \) -print | sed -e "s,.*/$a/autobuilds/,,g" 
| sort -k1,1 -t/ | tail -n1 )
+               variant_path=$(find 20* -iname "${v}-20*" \( "${EXTENSIONS[@]}" 
-o -iname '*.iso' \) -print | sed -e "s,.*/$a/autobuilds/,,g" | sort -k1,1 -t/ 
| tail -n1 )
                if [ -z "${variant_path}" -o ! -e "${variant_path}" ]; then
                        echo "$ARCH: Variant ${v} is missing" 1>&2
                        continue

Reply via email to