Skip to content

Commit

Permalink
Remove pgp support
Browse files Browse the repository at this point in the history
With the signatures being removed from the package DBs this is not needed
anymore
  • Loading branch information
lazka committed Nov 4, 2023
1 parent 875b5d8 commit c746ac1
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 106 deletions.
3 changes: 0 additions & 3 deletions app/appstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import annotations

import re
import base64
import uuid
import time
from datetime import datetime, timezone
Expand All @@ -18,7 +17,6 @@
from .appconfig import REPOSITORIES
from .utils import vercmp, version_is_newer_than, extract_upstream_version, split_depends, \
split_optdepends, strip_vcs
from .pgp import parse_signature
from .pkgextra import PkgExtra, PkgExtraEntry


Expand Down Expand Up @@ -246,7 +244,6 @@ def __init__(self, builddate: str, csize: str, depends: list[str], filename: str
self.builddate = int(builddate)
self.csize = csize
self.url = url
self.signature = parse_signature(base64.b64decode(pgpsig)) if pgpsig is not None else None
self.depends = split_depends(depends)
self.checkdepends = split_depends(checkdepends)
self.filename = filename
Expand Down
58 changes: 0 additions & 58 deletions app/pgp.py

This file was deleted.

8 changes: 0 additions & 8 deletions app/templates/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@ <h4 class="card-title">Package: <a href="{{ package_url(p) }}">{{ p.name }}</a><
<dt class="col-sm-3 text-sm-end">Build Date:</dt>
<dd class="col-sm-9">{{ p.builddate|timestamp }}</dd>

{% if p.signature %}
<dt class="col-sm-3 text-sm-end">Signed By:</dt>
<dd class="col-sm-9"><a href="{{ p.signature.url }}">{{ p.signature.name }}</a></dd>

<dt class="col-sm-3 text-sm-end">Signature Date:</dt>
<dd class="col-sm-9">{{ p.signature.date }}</dd>
{% endif %}

<dt class="col-sm-3 text-sm-end">Package Size:</dt>
<dd class="col-sm-9">{{ p.csize|filesize }}</dd>

Expand Down
12 changes: 1 addition & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ uvicorn = {extras = ["standard"], version = "^0.23.0"}
aiofiles = "^23.1.0"
jinja2 = "^3.1.2"
fastapi-etag = "^0.4.0"
pgpdump = "^1.5"
gunicorn = "^21.0.1"
aiolimiter = "^1.0.0-beta.1"
pydantic = "^2.0.3"
Expand Down
25 changes: 0 additions & 25 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# type: ignore

import os
import base64
import datetime

os.environ["NO_MIDDLEWARE"] = "1"

import pytest
from app import app
from app.appstate import SrcInfoPackage, parse_packager
from app.fetch import parse_cygwin_versions
from app.pgp import parse_signature, SigError, Signature
from app.utils import split_optdepends, strip_vcs, vercmp
from app.pkgextra import extra_to_pkgextra_entry
from fastapi.testclient import TestClient
Expand Down Expand Up @@ -120,28 +117,6 @@ def test_parse_cygwin_mingw64():
assert versions["headers"].version == "11.0.1"


EXAMPLE_SIG = (
"iHUEABEIAB0WIQStNRxQrghXdetZMztfku/BpH1FoQUCXlOY5wAKCRBfku"
"/BpH1FodQoAP4nQnPNLnx5MVIJgZgCwW/hplW7Ai9MqkmFBqD8/+EXfAD/"
"Rgxtz2XH7RZ1JKh7PN5NsVz9UlBM7977PjFg9WptNGU=")


def test_pgp():
with pytest.raises(SigError):
parse_signature(b"")

with pytest.raises(SigError):
parse_signature(b"foobar")

data = base64.b64decode(EXAMPLE_SIG)
sig = parse_signature(data)
assert isinstance(sig, Signature)
assert sig.keyid == "5f92efc1a47d45a1"
assert sig.date == datetime.datetime(2020, 2, 24, 9, 35, 35)
assert sig.name == "Alexey Pavlov"
assert sig.url == "https://keyserver.ubuntu.com/pks/lookup?op=vindex&fingerprint=on&search=0x5f92efc1a47d45a1"


def test_parse_packager():
info = parse_packager("foobar")
assert info.name == "foobar"
Expand Down

0 comments on commit c746ac1

Please sign in to comment.