Skip to content

Commit

Permalink
Include arch into package summary versions table
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-turney committed May 3, 2024
1 parent ded3a99 commit 8729295
Show file tree
Hide file tree
Showing 41 changed files with 174 additions and 285 deletions.
9 changes: 7 additions & 2 deletions calm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ def read_one_package(packages, p, basedir, files, kind, strict):
else:
v = match.group(1)
r = match.group(2)
arch_tag = match.group(3)

# historically, V can contain a '-' (since we can use the fact
# we already know P to split unambiguously), but this is a bad
Expand Down Expand Up @@ -538,10 +537,16 @@ def read_one_package(packages, p, basedir, files, kind, strict):
t.mtime = os.path.getmtime(rp.abspath(basedir))
t.sha512 = sha512_file(rp.abspath(basedir))

# record the arch_tag (or what it would have been, if not omitted)
if kind == Kind.source:
t.arch = 'src'
else:
t.arch = rp.arch

tars[vr] = t

# it's an error to not have a corresponding pvr.hint in the same directory
hint_fn = '%s-%s%s.hint' % (p, vr, arch_tag)
hint_fn = '%s-%s%s.hint' % (p, vr, match.group(3))
hrp = RepoPath(rp.arch, rp.path, hint_fn)
if hrp not in files:
logging.error("package %s has packages for version %s, but no %s" % (p, vr, hint_fn))
Expand Down
43 changes: 22 additions & 21 deletions calm/pkg2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import sys
import textwrap
import time
import types
from typing import NamedTuple

import markdown
Expand Down Expand Up @@ -322,35 +323,35 @@ class PackageData(NamedTuple):
if not v.startswith('<p>'):
v = '<p>' + v + '</p>'
print('<tr><td><p><span class="detail">%s</span>:</p></td><td>%s</td></tr>' % (d, v), file=f)
print('</table>', file=f)
print('</table><br>', file=f)

# output per-arch package versions table
print('<ul>', file=f)
# output package versions table
versions_table = []
for arch in sorted(packages):
if p in packages[arch]:

print('<li><span class="detail">%s</span></li>' % arch, file=f)

print('<table class="pkgtable">', file=f)
print('<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>', file=f)

def tar_line(pn, p, v, arch, f):
size = int(math.ceil(p.tar(v).size / 1024))
def tar_line(pn, p, v, arch):
item = types.SimpleNamespace()
item.version = v
item.size = int(math.ceil(p.tar(v).size / 1024))
if p.kind == package.Kind.binary:
name = v
target = "%s-%s" % (p.orig_name, v)
else:
name = v + ' (source)'
target = "%s-%s-src" % (p.orig_name, v)
test = 'test' if 'test' in p.version_hints[v] else 'stable'
ts = tsformat(p.tar(v).mtime)
print('<tr><td>%s</td><td class="right">%d KiB</td><td>%s</td><td>[<a href="../%s/%s/%s">list of files</a>]</td><td>%s</td></tr>' % (name, size, ts, arch, pn, target, test), file=f)

for version in sorted(packages[arch][p].versions(), key=lambda v: SetupVersion(v)):
tar_line(p, packages[arch][p], version, arch, f)

print('</table><br>', file=f)
print('</ul>', file=f)
item.link = "../%s/%s/%s" % (arch, pn, target)
item.status = 'test' if 'test' in p.version_hints[v] else 'stable'
item.ts = tsformat(p.tar(v).mtime)
item.arch = p.tar(v).arch
return item

for version in packages[arch][p].versions():
versions_table.append(tar_line(p, packages[arch][p], version, arch))

print('<table class="pkgtable">', file=f)
print('<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>', file=f)
for i in sorted(versions_table, key=lambda i: (SetupVersion(i.version), i.arch)):
print('<tr><td>%s</td><td>%s</td><td class="right">%d KiB</td><td>%s</td><td>[<a href="%s">list of files</a>]</td><td>%s</td></tr>' % (i.version, i.arch, i.size, i.ts, i.link, i.status), file=f)
print('</table><br>', file=f)

print(textwrap.dedent('''\
</div>
Expand Down
9 changes: 3 additions & 6 deletions test/testdata/htdocs.expected/summary/arc-src.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ <h1>Source Package: arc</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Jari Aalto
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>4.32.7-10 (source)</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/arc-src/arc-4.32.7-10-src">list of files</a>]</td><td>stable</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>4.32.7-10</td><td>src</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/arc-src/arc-4.32.7-10-src">list of files</a>]</td><td>stable</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
9 changes: 3 additions & 6 deletions test/testdata/htdocs.expected/summary/arc.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ <h1>Package: arc</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Jari Aalto
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>4.32.7-10</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/arc/arc-4.32.7-10">list of files</a>]</td><td>stable</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>4.32.7-10</td><td>x86_64</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/arc/arc-4.32.7-10">list of files</a>]</td><td>stable</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
11 changes: 4 additions & 7 deletions test/testdata/htdocs.expected/summary/base-cygwin.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ <h1>Package: base-cygwin</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Corinna Vinschen
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>3.6-1</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/base-cygwin/base-cygwin-3.6-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>3.8-1</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/base-cygwin/base-cygwin-3.8-1">list of files</a>]</td><td>stable</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>3.6-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/base-cygwin/base-cygwin-3.6-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>3.8-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/base-cygwin/base-cygwin-3.8-1">list of files</a>]</td><td>stable</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
9 changes: 3 additions & 6 deletions test/testdata/htdocs.expected/summary/corrupt-src.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ <h1>Source Package: corrupt</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Blooey McFooey
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.0.0-1 (source)</td><td class="right">354 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/corrupt-src/corrupt-2.0.0-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.0.0-1</td><td>src</td><td class="right">354 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/corrupt-src/corrupt-2.0.0-1-src">list of files</a>]</td><td>stable</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
9 changes: 3 additions & 6 deletions test/testdata/htdocs.expected/summary/corrupt.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ <h1>Package: corrupt</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Blooey McFooey
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.0.0-1</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/corrupt/corrupt-2.0.0-1">list of files</a>]</td><td>stable</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.0.0-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/corrupt/corrupt-2.0.0-1">list of files</a>]</td><td>stable</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
13 changes: 5 additions & 8 deletions test/testdata/htdocs.expected/summary/cygwin-debuginfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ <h1>Package: cygwin-debuginfo</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Corinna Vinschen, Yaakov Selkowitz
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin-debuginfo/cygwin-debuginfo-2.2.0-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin-debuginfo/cygwin-debuginfo-2.2.1-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin-debuginfo/cygwin-debuginfo-2.3.0-0.3">list of files</a>]</td><td>test</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin-debuginfo/cygwin-debuginfo-2.2.0-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin-debuginfo/cygwin-debuginfo-2.2.1-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3</td><td>x86_64</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin-debuginfo/cygwin-debuginfo-2.3.0-0.3">list of files</a>]</td><td>test</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
13 changes: 5 additions & 8 deletions test/testdata/htdocs.expected/summary/cygwin-devel.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ <h1>Package: cygwin-devel</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Corinna Vinschen, Yaakov Selkowitz
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin-devel/cygwin-devel-2.2.0-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin-devel/cygwin-devel-2.2.1-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin-devel/cygwin-devel-2.3.0-0.3">list of files</a>]</td><td>test</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin-devel/cygwin-devel-2.2.0-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin-devel/cygwin-devel-2.2.1-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3</td><td>x86_64</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin-devel/cygwin-devel-2.3.0-0.3">list of files</a>]</td><td>test</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
13 changes: 5 additions & 8 deletions test/testdata/htdocs.expected/summary/cygwin-src.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ <h1>Source Package: cygwin</h1>
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
<tr><td><p><span class="detail">packaging repository</span>:</p></td><td><p><a href="/cgit/cygwin-packages/cygwin/">cygwin.git</a></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1 (source)</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin-src/cygwin-2.2.0-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1 (source)</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin-src/cygwin-2.2.1-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3 (source)</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin-src/cygwin-2.3.0-0.3-src">list of files</a>]</td><td>test</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1</td><td>src</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin-src/cygwin-2.2.0-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1</td><td>src</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin-src/cygwin-2.2.1-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3</td><td>src</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin-src/cygwin-2.3.0-0.3-src">list of files</a>]</td><td>test</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
13 changes: 5 additions & 8 deletions test/testdata/htdocs.expected/summary/cygwin.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ <h1>Package: cygwin</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Corinna Vinschen, Yaakov Selkowitz
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin/cygwin-2.2.0-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin/cygwin-2.2.1-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin/cygwin-2.3.0-0.3">list of files</a>]</td><td>test</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.2.0-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2016-11-01 00:00</td><td>[<a href="../x86_64/cygwin/cygwin-2.2.0-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.2.1-1</td><td>x86_64</td><td class="right">1 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/cygwin/cygwin-2.2.1-1">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.3.0-0.3</td><td>x86_64</td><td class="right">1 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/cygwin/cygwin-2.3.0-0.3">list of files</a>]</td><td>test</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
11 changes: 4 additions & 7 deletions test/testdata/htdocs.expected/summary/keychain-src.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ <h1>Source Package: keychain</h1>
<tr><td><p><span class="detail">maintainer(s)</span>:</p></td><td><p>Jari Aalto
<span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
<a href="/problems.html#personal-email">Do not contact the maintainer(s) directly</a>.)</span></p></td></tr>
</table>
<ul>
<li><span class="detail">x86_64</span></li>
</table><br>
<table class="pkgtable">
<tr><th>Version</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.6.8-1 (source)</td><td class="right">36 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/keychain-src/keychain-2.6.8-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.7.1-1 (source)</td><td class="right">132 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/keychain-src/keychain-2.7.1-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><th>Version</th><th>Arch</th><th>Package Size</th><th>Date</th><th>Files</th><th>Status</th></tr>
<tr><td>2.6.8-1</td><td>src</td><td class="right">36 KiB</td><td>2016-11-02 00:00</td><td>[<a href="../x86_64/keychain-src/keychain-2.6.8-1-src">list of files</a>]</td><td>stable</td></tr>
<tr><td>2.7.1-1</td><td>src</td><td class="right">132 KiB</td><td>2018-03-02 00:00</td><td>[<a href="../x86_64/keychain-src/keychain-2.7.1-1-src">list of files</a>]</td><td>stable</td></tr>
</table><br>
</ul>
</div>
</body>
</html>
Loading

0 comments on commit 8729295

Please sign in to comment.