summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/management/commands/import_signatures.py39
-rw-r--r--templates/packages/details.html8
-rw-r--r--templates/packages/details_depend.html1
-rw-r--r--templates/packages/details_requiredby.html7
-rw-r--r--templates/todolists/view.html2
5 files changed, 39 insertions, 18 deletions
diff --git a/devel/management/commands/import_signatures.py b/devel/management/commands/import_signatures.py
index 8a4ce873..ce1aba90 100644
--- a/devel/management/commands/import_signatures.py
+++ b/devel/management/commands/import_signatures.py
@@ -7,6 +7,7 @@ Import signatures from a given GPG keyring.
Usage: ./manage.py generate_keyring <keyring_path>
"""
+from collections import namedtuple
from datetime import datetime
import logging
import subprocess
@@ -42,6 +43,16 @@ class Command(BaseCommand):
import_signatures(args[0])
+
+SignatureData = namedtuple('SignatureData',
+ ('signer', 'signee', 'created', 'expires', 'valid'))
+
+
+def get_date(epoch_string):
+ '''Convert a epoch string into a python 'date' object (not datetime).'''
+ return datetime.utcfromtimestamp(int(epoch_string)).date()
+
+
def parse_sigdata(data):
nodes = {}
edges = []
@@ -60,12 +71,14 @@ def parse_sigdata(data):
if nodes[current_pubkey] is None:
nodes[current_pubkey] = uid
if parts[0] == 'sig':
- created = datetime.utcfromtimestamp(int(parts[5]))
+ signer = parts[4]
+ created = get_date(parts[5])
expires = None
if parts[6]:
- expires = datetime.utcfromtimestamp(int(parts[6]))
+ expires = get_date(parts[6])
valid = parts[1] != '-'
- edge = (parts[4], current_pubkey, created, expires, valid)
+ edge = SignatureData(signer, current_pubkey,
+ created, expires, valid)
edges.append(edge)
return nodes, edges
@@ -86,19 +99,25 @@ def import_signatures(keyring):
# now prune the data down to what we actually want.
# prune edges not in nodes, remove duplicates, and self-sigs
pruned_edges = set(edge for edge in edges
- if edge[0] in nodes and edge[0] != edge[1])
+ if edge.signer in nodes and edge.signer != edge.signee)
logger.info("creating or finding %d signatures", len(pruned_edges))
- created_ct = 0
+ created_ct = updated_ct = 0
with transaction.commit_on_success():
for edge in pruned_edges:
- _, created = PGPSignature.objects.get_or_create(
- signer=edge[0], signee=edge[1],
- created=edge[2], expires=edge[3],
- defaults={ 'valid': edge[4] })
+ sig, created = PGPSignature.objects.get_or_create(
+ signer=edge.signer, signee=edge.signee,
+ created=edge.created, expires=edge.expires,
+ defaults={ 'valid': edge.valid })
+ if sig.valid != edge.valid:
+ sig.valid = edge.valid
+ sig.save()
+ updated_ct = 1
if created:
created_ct += 1
- logger.info("created %d signatures", created_ct)
+ sig_ct = PGPSignature.objects.all().count()
+ logger.info("%d total signatures in database", sig_ct)
+ logger.info("created %d, updated %d signatures", created_ct, updated_ct)
# vim: set ts=4 sw=4 et:
diff --git a/templates/packages/details.html b/templates/packages/details.html
index fd7bea4d..091e57ec 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -185,13 +185,7 @@
<h3 title="Packages that require {{ pkg.pkgname }}">
Required By ({{rqdby|length}})</h3>
{% if rqdby %}<ul>
- {% for req in rqdby %}
- <li>{% pkg_details_link req.pkg %}
- {% if req.depname != pkg.pkgname %}<span class="virtual-dep">(requires {{ req.depname }})</span>{% endif %}
- {% if req.pkg.repo.testing %}<span class="testing-dep">(testing)</span>{% endif %}
- {% if req.optional %}<span class="opt-dep">(optional)</span>{% endif %}
- </li>
- {% endfor %}
+ {% for req in rqdby %}{% include "packages/details_requiredby.html" %}{% endfor %}
</ul>{% endif %}
</div>
{% endwith %}
diff --git a/templates/packages/details_depend.html b/templates/packages/details_depend.html
index 0226dd25..8b6e85c9 100644
--- a/templates/packages/details_depend.html
+++ b/templates/packages/details_depend.html
@@ -9,6 +9,7 @@
{% else %}
{% pkg_details_link depend.pkg %}{{ depend.dep.depvcmp|default:"" }}
{% if depend.pkg.repo.testing %} <span class="testing-dep">(testing)</span>{% endif %}
+{% if depend.pkg.repo.staging %} <span class="staging-dep">(staging)</span>{% endif %}
{% endifequal %}
{% if depend.dep.optional %} <span class="opt-dep">(optional)</span>{% endif %}
{% if depend.dep.description %}- <span class="dep-desc">{{ depend.dep.description }}</span>{% endif %}
diff --git a/templates/packages/details_requiredby.html b/templates/packages/details_requiredby.html
new file mode 100644
index 00000000..c7697289
--- /dev/null
+++ b/templates/packages/details_requiredby.html
@@ -0,0 +1,7 @@
+{% load package_extras %}
+<li>{% pkg_details_link req.pkg %}
+{% if req.depname != pkg.pkgname %}<span class="virtual-dep">(requires {{ req.depname }})</span>{% endif %}
+{% if req.pkg.repo.testing %}<span class="testing-dep">(testing)</span>{% endif %}
+{% if req.pkg.repo.staging %}<span class="staging-dep">(staging)</span>{% endif %}
+{% if req.optional %}<span class="opt-dep">(optional)</span>{% endif %}
+</li>
diff --git a/templates/todolists/view.html b/templates/todolists/view.html
index 8c9361cc..2ed7b78c 100644
--- a/templates/todolists/view.html
+++ b/templates/todolists/view.html
@@ -78,7 +78,7 @@ $(document).ready(function() {
$(".results").tablesorter({
widgets: ['zebra'],
sortList: [[2,0], [0,0]],
- headers: { 4: { sorter: 'todostatus' } }
+ headers: { 5: { sorter: 'todostatus' } }
});
});
</script>