[Reproducible-commits] [misc] 01/01: fix the ssh mail check and also have it warn when rsync fails (e.g. due to missing files)

Ximin Luo infinity0 at debian.org
Thu Jun 2 18:10:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository misc.

commit 0784694ce15f5d68729ced9c2c0532e6c2b3616c
Author: Ximin Luo <infinity0 at debian.org>
Date:   Thu Jun 2 20:09:52 2016 +0200

    fix the ssh mail check and also have it warn when rsync fails (e.g. due to missing files)
---
 reports/bin/get-latest-data | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/reports/bin/get-latest-data b/reports/bin/get-latest-data
index 4f1d701..56cc026 100755
--- a/reports/bin/get-latest-data
+++ b/reports/bin/get-latest-data
@@ -30,7 +30,9 @@ done
 shift `expr $OPTIND - 1`
 
 week="${week:-$prev_week}"
-mailbase="${mailbase:-master.debian.org:/srv/mail-archives/lists}"
+defaultmailbase="master.debian.org:/srv/mail-archives/lists"
+othermailbase="alioth.debian.org:/home/groups/reproducible/mirror"
+mailbase="${mailbase:-$defaultmailbase}"
 
 week_end=$((week_1_end + (week - 1)*7*24*3600))
 week_start=$((week_end - 7*24*3600))
@@ -68,19 +70,29 @@ month_at_end="$(date -u +%Y%m -d@$week_end)"
 month_at_start="$(date -u +%Y%m -d@$week_start)"
 rm -f uploads.mbox
 
+warn_emails() {
+	test "$mailbase" "$1" "$defaultmailbase" || return 0
+	echo -e >&2 "  \e[1;31mAsk a DD to run bin/sync-to-alioth.\e[0m After they do this, re-run this script but as: "
+	echo >&2 "    $0 -m $othermailbase"
+}
+
 get_emails() {
-	ssh $mailbase true || echo "Please ask a DD to run bin/sync-to-alioth to fetch the mail archives and provide them on alioth where you can get them."
 	if [ "$1" = "$current_month" ]; then
 		rsync -v "$mailbase/debian-devel-changes/debian-devel-changes.$1" "debian-devel-changes.$1.snapshot"
 		cat "debian-devel-changes.$1.snapshot" >> uploads.mbox
-
 	else
 		rsync -v "$mailbase/debian-devel-changes/debian-devel-changes.$1.xz" "debian-devel-changes.$1.xz"
 		xzcat "debian-devel-changes.$1.xz" >> uploads.mbox
 	fi
 }
-test "$month_at_start" != "$month_at_end" && get_emails "$month_at_start"
-get_emails "$month_at_end"
+if ssh "${mailbase%:*}" true; then
+	if "$month_at_start" != "$month_at_end"; then
+		get_emails "$month_at_start" || warn_emails !=
+	fi
+	get_emails "$month_at_end" || warn_emails !=
+else
+	warn_emails =
+fi
 
 echo >&2 "- bug reports that were modified (will ssh to alioth.debian.org)"
 query_select="SELECT DISTINCT bugs.id FROM bugs_usertags, bugs"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/misc.git



More information about the Reproducible-commits mailing list