mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: Indicate dependency source
Dependencies might reside in the AUR or official repositories. Add "AUR" as superscript letters to indicate if a package/provider is present in the AUR. Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
1433553c05
commit
0a7b02956f
5 changed files with 72 additions and 7 deletions
|
@ -10,8 +10,10 @@ from aurweb.models.package import Package
|
|||
from aurweb.models.package_base import PackageBase
|
||||
from aurweb.models.package_dependency import PackageDependency
|
||||
from aurweb.models.package_notification import PackageNotification
|
||||
from aurweb.models.package_relation import PackageRelation
|
||||
from aurweb.models.package_source import PackageSource
|
||||
from aurweb.models.package_vote import PackageVote
|
||||
from aurweb.models.relation_type import PROVIDES_ID
|
||||
from aurweb.models.user import User
|
||||
from aurweb.packages import util
|
||||
|
||||
|
@ -155,3 +157,41 @@ def test_pkg_required(package: Package):
|
|||
|
||||
# We should have 1 record
|
||||
assert qry.count() == 1
|
||||
|
||||
|
||||
def test_provides_markup(package: Package):
|
||||
# Create dependency and provider for AUR pkg
|
||||
with db.begin():
|
||||
dep = db.create(
|
||||
PackageDependency,
|
||||
Package=package,
|
||||
DepName="test",
|
||||
DepTypeID=DEPENDS_ID,
|
||||
)
|
||||
rel_pkg = db.create(Package, PackageBase=package.PackageBase, Name=dep.DepName)
|
||||
db.create(
|
||||
PackageRelation,
|
||||
Package=rel_pkg,
|
||||
RelName=dep.DepName,
|
||||
RelTypeID=PROVIDES_ID,
|
||||
)
|
||||
|
||||
# AUR provider links should end with ᴬᵁᴿ
|
||||
link = util.provides_markup(dep.provides())
|
||||
assert link.endswith("</a>ᴬᵁᴿ")
|
||||
assert OFFICIAL_BASE not in link
|
||||
|
||||
# Remove AUR provider and add official one
|
||||
with db.begin():
|
||||
db.delete(rel_pkg)
|
||||
db.create(
|
||||
OfficialProvider,
|
||||
Name="official-pkg",
|
||||
Repo="extra",
|
||||
Provides=dep.DepName,
|
||||
)
|
||||
|
||||
# Repo provider links should not have any suffix
|
||||
link = util.provides_markup(dep.provides())
|
||||
assert link.endswith("</a>")
|
||||
assert OFFICIAL_BASE in link
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue