summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-11-04 17:31:35 +0100
committerDan McGee <dan@archlinux.org>2011-11-04 17:31:35 +0100
commite565fde00f56c7a01ff55a204a0a56d3ce4bf8b4 (patch)
tree6581a30065c3c44b1c17fabbff4e7a6c4215cb02
parent8ba68aed370c2369bebaaca4d4158b6c40223c0f (diff)
downloadarchweb-e565fde00f56c7a01ff55a204a0a56d3ce4bf8b4.tar.gz
archweb-e565fde00f56c7a01ff55a204a0a56d3ce4bf8b4.tar.xz
Signoff email: prune empty content
Don't send the email at all if there are no packages even in the repository, and don't print empty sections. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/management/commands/signoff_report.py4
-rw-r--r--templates/packages/signoff_report.txt13
2 files changed, 11 insertions, 6 deletions
diff --git a/packages/management/commands/signoff_report.py b/packages/management/commands/signoff_report.py
index 3431dad..3357bc1 100644
--- a/packages/management/commands/signoff_report.py
+++ b/packages/management/commands/signoff_report.py
@@ -69,6 +69,10 @@ def generate_report(email, repo_name):
new_cutoff = now - timedelta(hours=new_hours)
old_cutoff = now - timedelta(days=old_days)
+ if len(signoff_groups) == 0:
+ # no need to send an email at all
+ return
+
for group in signoff_groups:
spec = group.specification
if spec.known_bad:
diff --git a/templates/packages/signoff_report.txt b/templates/packages/signoff_report.txt
index 81020c8..046c2f1 100644
--- a/templates/packages/signoff_report.txt
+++ b/templates/packages/signoff_report.txt
@@ -14,27 +14,28 @@ pkgbase, architecture, and repository; e.g., one PKGBUILD produces one
package per architecture, even if it is a split package.)
-== New packages in [{{ repo|lower}}] in last {{ new_hours }} hours ({{ new|length }} total) ==
+{% if new %}== New packages in [{{ repo|lower}}] in last {{ new_hours }} hours ({{ new|length }} total) ==
{% for group in new %}
* {{ group.pkgbase }}-{{ group.version }} ({{ group.arch }}){% endfor %}
-{% regroup incomplete by target_repo as by_repo %}{% for target_repo in by_repo %}
+{% endif %}{% regroup incomplete by target_repo as by_repo %}{% for target_repo in by_repo %}
== Incomplete signoffs for [{{ target_repo.grouper|lower }}] ({{ target_repo.list|length }} total) ==
{% for group in target_repo.list %}
* {{ group.pkgbase }}-{{ group.version }} ({{ group.arch }})
{{ group.completed }}/{{ group.required }} signoffs{% endfor %}
{% endfor %}
-== Completed signoffs ({{ complete|length }} total) ==
+{% if complete %}== Completed signoffs ({{ complete|length }} total) ==
{% for group in complete %}
* {{ group.pkgbase }}-{{ group.version }} ({{ group.arch }}){% endfor %}
-== All packages in [{{ repo|lower }}] for more than {{ old_days }} days ({{ old|length }} total) ==
+{% endif %}{% if old %}== All packages in [{{ repo|lower }}] for more than {{ old_days }} days ({{ old|length }} total) ==
{% for group in old %}
* {{ group.pkgbase }}-{{ group.version }} ({{ group.arch }}), since {{ group.last_update|date }}{% endfor %}
-{% endautoescape %}
-== Top five in signoffs in last {{ new_hours }} hours ==
+
+{% endif %}== Top five in signoffs in last {{ new_hours }} hours ==
{% for leader in leaders %}
{{ forloop.counter }}. {{ leader.user }} - {{ leader.count }} signoffs{% endfor %}
+{% endautoescape %}