From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-871296-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 5CCC459CA5
	for <garchives@archives.gentoo.org>; Sun, 20 Mar 2016 22:39:50 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D431B21C08E;
	Sun, 20 Mar 2016 22:39:49 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 7D18C21C08E
	for <gentoo-commits@lists.gentoo.org>; Sun, 20 Mar 2016 22:39:49 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id A384B340961
	for <gentoo-commits@lists.gentoo.org>; Sun, 20 Mar 2016 22:39:48 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 769D8822
	for <gentoo-commits@lists.gentoo.org>; Sun, 20 Mar 2016 22:39:46 +0000 (UTC)
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org>
Message-ID: <1458508247.a1b63fb90eddf827e465205f1f853236032ba2e3.vapier@gentoo>
Subject: [gentoo-commits] proj/releng:master commit in: scripts/
X-VCS-Repository: proj/releng
X-VCS-Files: scripts/copy_buildsync.sh
X-VCS-Directories: scripts/
X-VCS-Committer: vapier
X-VCS-Committer-Name: Mike Frysinger
X-VCS-Revision: a1b63fb90eddf827e465205f1f853236032ba2e3
X-VCS-Branch: master
Date: Sun, 20 Mar 2016 22:39:46 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 673f401e-9cc7-4d4c-8e83-95f7e163ac89
X-Archives-Hash: 17dbdb3790a7433b191871baab139ac6

commit:     a1b63fb90eddf827e465205f1f853236032ba2e3
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 21:10:47 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 21:10:47 2016 +0000
URL:        https://gitweb.gentoo.org/proj/releng.git/commit/?id=a1b63fb9

copy_buildsync.sh: convert code to use funcs

This makes the code a bit easier to follow and break up.

 scripts/copy_buildsync.sh | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh
index 6105197..a9c18a0 100755
--- a/scripts/copy_buildsync.sh
+++ b/scripts/copy_buildsync.sh
@@ -34,7 +34,21 @@ VERBOSEP=
 [ -n "$VERBOSE" ] && RSYNC_OPTS+=( -v )
 [ -n "$VERBOSEP" ] && VERBOSEP="-v"
 
-for ARCH in "${ARCHES[@]}"; do
+usage() {
+	cat <<EOF
+Usage: $0
+
+Move releases from the incoming upload directory to the outgoing release
+directory so they can be pushed out to mirrors.
+Also update the "latest" links/files so people can easily find the current
+version for any particular arch/release.
+EOF
+	exit 1
+}
+
+process_arch() {
+	local ARCH=$1
+
 	rc=0
 	fail=0
 
@@ -147,7 +161,18 @@ for ARCH in "${ARCHES[@]}"; do
 	else
 		echo "There was some failure for $ARCH during the weekly sync. Not doing cleanup for fear of dataloss." 1>&2
 	fi
+}
 
-done
+main() {
+	if [[ $# -ne 0 ]]; then
+		usage
+	fi
+
+	local arch
+	for arch in "${ARCHES[@]}"; do
+		process_arch "${arch}"
+	done
+}
+main "$@"
 
 # vim:ts=2 sw=2 noet ft=sh: