Skip to content

Commit b26768d

Browse files
committed
Add rebuilderd status to the package details page
The reproducible status is now shown for logged in users, as the reproducible effort is still much experimental and so to not confuse not logged in users.
1 parent 12b1b0a commit b26768d

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

main/templatetags/details_link.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ def sec_link(package):
6767
return url.format(package.pkgname)
6868

6969

70+
@register.simple_tag
71+
def rebuilderd_diffoscope_link(rbstatus):
72+
url = "https://reproducible.archlinux.org/api/v0/builds/{}/diffoscope"
73+
return url.format(rbstatus.build_id)
74+
75+
76+
@register.simple_tag
77+
def rebuilderd_buildlog_link(rbstatus):
78+
url = "https://reproducible.archlinux.org/api/v0/builds/{}/build"
79+
return url.format(rbstatus.build_id)
80+
81+
7082
@register.simple_tag
7183
def pgp_key_link(key_id, link_text=None):
7284
return pgp.pgp_key_link(key_id, link_text)

packages/views/display.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django.shortcuts import get_object_or_404, redirect, render
77
from django.utils.timezone import now
88

9-
from main.models import Package, PackageFile, Arch, Repo, Soname
9+
from main.models import Package, PackageFile, Arch, Repo, Soname, RebuilderdStatus
1010
from main.utils import empty_response
1111
from mirrors.utils import get_mirror_url_for_download
1212
from ..models import Update
@@ -127,9 +127,15 @@ def details(request, name='', repo='', arch=''):
127127
pkg = Package.objects.select_related(
128128
'arch', 'repo', 'packager').get(pkgname=name,
129129
repo=repo_obj, arch=arch_obj)
130+
rbstatus = None
131+
try:
132+
rbstatus = RebuilderdStatus.objects.get(pkg=pkg)
133+
except RebuilderdStatus.DoesNotExist:
134+
pass
130135
if request.method == 'HEAD':
131136
return empty_response()
132-
return render(request, 'packages/details.html', {'pkg': pkg})
137+
return render(request, 'packages/details.html', {'pkg': pkg, 'rbstatus': rbstatus,
138+
'notreproducible': rbstatus.status == RebuilderdStatus.BAD if rbstatus else False})
133139
except Package.DoesNotExist:
134140
# attempt a variety of fallback options before 404ing
135141
options = (redirect_agnostic, split_package_details,

sitestatic/archweb.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#archnavbar { min-height: 40px !important; padding: 10px 15px !important; background: #333 !important; border-bottom: 5px #08c solid !important; }
1717
#archnavbarlogo { float: left !important; margin: 0 !important; padding: 0 !important; height: 40px !important; width: 190px !important; background: url('archnavbar/archlogo.png') no-repeat !important; }
1818
@media (-webkit-min-device-pixel-ratio: 1.2), (min--moz-device-pixel-ratio: 1.2), (-o-min-device-pixel-ratio: 2/1) {
19-
#archnavbarlogo { float: left !important; margin: 0 !important; padding: 0 !important; height: 40px !important; width: 190px !important; background: url(archnavbar/archlogo.svg) no-repeat !important;background-size:100% !important;
19+
#archnavbarlogo { float: left !important; margin: 0 !important; padding: 0 !important; height: 40px !important; width: 190px !important; background: url(archnavbar/archlogo.svg) no-repeat !important;background-size:100% !important;
2020
}
2121
}
2222

@@ -912,6 +912,18 @@ table.results {
912912
clear: both;
913913
}
914914

915+
#pkginfo #rebuilderdstatus {
916+
font-weight: bold;
917+
}
918+
919+
#pkginfo .rebuilderd-good {
920+
color: green;
921+
}
922+
923+
#pkginfo .rebuilderd-bad {
924+
color: red;
925+
}
926+
915927
#pkgdetails #pkgdeps {
916928
float: left;
917929
width: 48%;

templates/packages/package_details.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ <h4>Package Actions</h4>
2020
<a href="{% man_link pkg %}" title="List manpages in {{ pkg.pkgname }}">Manual Pages</a>
2121
</li>
2222
<li><a href="{% sec_link pkg %}" title="View security issues for {{ pkg.pkgname }}">Security Issues</a></li>
23+
{% if user.is_authenticated and notreproducible %}<tr>
24+
<li>
25+
<a href="{% rebuilderd_buildlog_link rbstatus %}" title="View build log for {{ pkg.pkgname }}">Build log</a> /
26+
<a href="{% rebuilderd_diffoscope_link rbstatus %}" title="View diffoscope result for {{ pkg.pkgname }}">Diffoscope</a>
27+
</li>
28+
{% endif %}
2329
{% if pkg.flag_date %}
2430
<li><span class="flagged">Flagged out-of-date on {{ pkg.flag_date|date }}</span></li>
2531
{% with tp=pkg.in_testing %}{% if tp %}
@@ -190,6 +196,15 @@ <h4>Versions Elsewhere</h4>
190196
<th>Last Updated:</th>
191197
<td>{{ pkg.last_update|date:"DATETIME_FORMAT" }} UTC{% if pkg.is_recent %} <span class="recent" title="Your mirror may not yet have this package version">({{ pkg.last_update|naturaltime }})</span>{% endif %}</td>
192198
</tr>
199+
{% if user.is_authenticated %}<tr>
200+
<th>Reproducible Status:</th>
201+
{% if rbstatus %}
202+
<td id="rebuilderdstatus" class="rebuilderd-{{ rbstatus.status_str|lower }}">{{ rbstatus.status_str }}</td>
203+
{% else %}
204+
<td id="rebuilderdstatus">Unknown</td>
205+
{% endif %}
206+
</tr>
207+
{% endif %}
193208
{% if user.is_authenticated %}{% with flag_request=pkg.flag_request %}{% if flag_request %}<tr>
194209
<th>Last Flag Request:</th>
195210
<td class="wrap">From {{ flag_request.who }} on {{ flag_request.created|date }}:<br/>

0 commit comments

Comments
 (0)