Skip to content

Commit 7a10972

Browse files
committed
Add orphan not reproducible developer report
Fixes: #289
1 parent d7d3a6e commit 7a10972

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

devel/reports.py

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ def __str__(self):
2525
return format_html(link % (self.href, self.title, self.desc))
2626

2727

28+
def linkify_non_reproducible_packages(statuses):
29+
'''Adds diffoscope/log attribute to non reproducible packages'''
30+
31+
pkgs = []
32+
for status in statuses:
33+
pkg = status.pkg
34+
35+
# Diffoscope url
36+
url = f'https://reproducible.archlinux.org/api/v0/builds/{status.build_id}/diffoscope'
37+
pkg.diffoscope = Linkify(url, 'Diffoscope of package', 'diffoscope')
38+
39+
# Build log
40+
url = f'https://reproducible.archlinux.org/api/v0/builds/{status.build_id}/log'
41+
pkg.log = Linkify(url, 'Logs of package', 'log')
42+
pkgs.append(pkg)
43+
44+
return pkgs
45+
46+
2847
class DeveloperReport(object):
2948
def __init__(self,
3049
slug,
@@ -183,22 +202,18 @@ def non_existing_dependencies(packages):
183202

184203

185204
def non_reproducible_packages(packages):
186-
pkgs = []
187205
statuses = RebuilderdStatus.objects.select_related().filter(status=RebuilderdStatus.BAD, pkg__pkgname__in=packages.values('pkgname'))
206+
return linkify_non_reproducible_packages(statuses)
188207

189-
for status in statuses:
190-
pkg = status.pkg
191208

192-
# Diffoscope url
193-
url = f'https://reproducible.archlinux.org/api/v0/builds/{status.build_id}/diffoscope'
194-
pkg.diffoscope = Linkify(url, 'Diffoscope of package', 'diffoscope')
195-
196-
# Build log
197-
url = f'https://reproducible.archlinux.org/api/v0/builds/{status.build_id}/log'
198-
pkg.log = Linkify(url, 'Logs of package', 'log')
199-
pkgs.append(pkg)
209+
def orphan_non_reproducible_packages(packages):
210+
owned = PackageRelation.objects.all().values('pkgbase')
211+
required = Depend.objects.all().values('name')
200212

201-
return pkgs
213+
statuses = RebuilderdStatus.objects.select_related().filter(status=RebuilderdStatus.BAD)
214+
orphans = packages.exclude(pkgbase__in=owned).exclude(pkgname__in=required)
215+
statuses = statuses.filter(pkg__in=orphans)
216+
return linkify_non_reproducible_packages(statuses)
202217

203218

204219
def orphan_dependencies(packages):
@@ -291,6 +306,15 @@ def orphan_dependencies(packages):
291306
['diffoscope', 'log'],
292307
['diffoscope', 'log'])
293308

309+
ORPHAN_REBUILDERD_PACKAGES = DeveloperReport(
310+
'orphan-non-reproducible-packages',
311+
'Orphan non Reproducible package',
312+
'Orphan packages that are not reproducible on our reproducible.archlinux.org test environment',
313+
orphan_non_reproducible_packages,
314+
['diffoscope', 'log'],
315+
['diffoscope', 'log'],
316+
personal=False)
317+
294318
REPORT_REQUIRED_ORPHAN = DeveloperReport(
295319
'required-orphan',
296320
'Required orphan packages',
@@ -312,4 +336,5 @@ def available_reports():
312336
REPORT_SIGNATURE,
313337
REPORT_SIG_TIME,
314338
NON_EXISTING_DEPENDENCIES,
315-
REBUILDERD_PACKAGES, )
339+
REBUILDERD_PACKAGES,
340+
ORPHAN_REBUILDERD_PACKAGES, )

0 commit comments

Comments
 (0)