mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Merge branch 'master' into live
This commit is contained in:
commit
9336d92cf3
4 changed files with 7 additions and 25 deletions
|
@ -6,7 +6,7 @@ from typing import Any
|
||||||
# Publicly visible version of aurweb. This is used to display
|
# Publicly visible version of aurweb. This is used to display
|
||||||
# aurweb versioning in the footer and must be maintained.
|
# aurweb versioning in the footer and must be maintained.
|
||||||
# Todo: Make this dynamic/automated.
|
# Todo: Make this dynamic/automated.
|
||||||
AURWEB_VERSION = "v6.0.5"
|
AURWEB_VERSION = "v6.0.6"
|
||||||
|
|
||||||
_parser = None
|
_parser = None
|
||||||
|
|
||||||
|
|
|
@ -61,12 +61,16 @@ def dep_extra_desc(dep: models.PackageDependency) -> str:
|
||||||
|
|
||||||
@register_filter("pkgname_link")
|
@register_filter("pkgname_link")
|
||||||
def pkgname_link(pkgname: str) -> str:
|
def pkgname_link(pkgname: str) -> str:
|
||||||
|
record = db.query(Package).filter(
|
||||||
|
Package.Name == pkgname).exists()
|
||||||
|
if db.query(record).scalar():
|
||||||
|
return f"/packages/{pkgname}"
|
||||||
|
|
||||||
official = db.query(OfficialProvider).filter(
|
official = db.query(OfficialProvider).filter(
|
||||||
OfficialProvider.Name == pkgname).exists()
|
OfficialProvider.Name == pkgname).exists()
|
||||||
if db.query(official).scalar():
|
if db.query(official).scalar():
|
||||||
base = "/".join([OFFICIAL_BASE, "packages"])
|
base = "/".join([OFFICIAL_BASE, "packages"])
|
||||||
return f"{base}/?q={pkgname}"
|
return f"{base}/?q={pkgname}"
|
||||||
return f"/packages/{pkgname}"
|
|
||||||
|
|
||||||
|
|
||||||
@register_filter("package_link")
|
@register_filter("package_link")
|
||||||
|
@ -98,17 +102,10 @@ def get_pkg_or_base(
|
||||||
:raises HTTPException: With status code 404 if record doesn't exist
|
:raises HTTPException: With status code 404 if record doesn't exist
|
||||||
:return: {Package,PackageBase} instance
|
:return: {Package,PackageBase} instance
|
||||||
"""
|
"""
|
||||||
provider = db.query(models.OfficialProvider).filter(
|
|
||||||
models.OfficialProvider.Name == name).first()
|
|
||||||
if provider:
|
|
||||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
|
||||||
|
|
||||||
with db.begin():
|
with db.begin():
|
||||||
instance = db.query(cls).filter(cls.Name == name).first()
|
instance = db.query(cls).filter(cls.Name == name).first()
|
||||||
|
|
||||||
if not instance:
|
if not instance:
|
||||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#
|
#
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "aurweb"
|
name = "aurweb"
|
||||||
version = "v6.0.5"
|
version = "v6.0.6"
|
||||||
license = "GPL-2.0-only"
|
license = "GPL-2.0-only"
|
||||||
description = "Source code for the Arch User Repository's website"
|
description = "Source code for the Arch User Repository's website"
|
||||||
homepage = "https://aur.archlinux.org"
|
homepage = "https://aur.archlinux.org"
|
||||||
|
|
|
@ -203,21 +203,6 @@ def test_package_not_found(client: TestClient):
|
||||||
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
|
|
||||||
def test_package_official_not_found(client: TestClient, package: Package):
|
|
||||||
""" When a Package has a matching OfficialProvider record, it is not
|
|
||||||
hosted on AUR, but in the official repositories. Getting a package
|
|
||||||
with this kind of record should return a status code 404. """
|
|
||||||
with db.begin():
|
|
||||||
db.create(OfficialProvider,
|
|
||||||
Name=package.Name,
|
|
||||||
Repo="core",
|
|
||||||
Provides=package.Name)
|
|
||||||
|
|
||||||
with client as request:
|
|
||||||
resp = request.get(package_endpoint(package))
|
|
||||||
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
|
||||||
|
|
||||||
|
|
||||||
def test_package(client: TestClient, package: Package):
|
def test_package(client: TestClient, package: Package):
|
||||||
""" Test a single / packages / {name} route. """
|
""" Test a single / packages / {name} route. """
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue