Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
aurweb
Commits
500d6b40
Verified
Commit
500d6b40
authored
Nov 04, 2022
by
Leonidas Spyropoulos
Browse files
feat: add co-maintainers to RPC
Signed-off-by:
Leonidas Spyropoulos
<
artafinde@archlinux.org
>
parent
bcd808dd
Pipeline
#39776
passed with stages
in 2 minutes and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
aurweb/rpc.py
View file @
500d6b40
...
...
@@ -284,6 +284,22 @@ class RPC:
)
.
distinct
()
.
order_by
(
"Name"
),
# Co-Maintainer
db
.
query
(
models
.
PackageComaintainer
)
.
join
(
models
.
User
,
models
.
User
.
ID
==
models
.
PackageComaintainer
.
UsersID
)
.
join
(
models
.
Package
,
models
.
Package
.
PackageBaseID
==
models
.
PackageComaintainer
.
PackageBaseID
,
)
.
with_entities
(
models
.
Package
.
ID
,
literal
(
"CoMaintainers"
).
label
(
"Type"
),
models
.
User
.
Username
.
label
(
"Name"
),
literal
(
str
()).
label
(
"Cond"
),
)
.
distinct
()
# A package could have the same co-maintainer multiple times
.
order_by
(
"Name"
),
]
# Union all subqueries together.
...
...
test/test_rpc.py
View file @
500d6b40
...
...
@@ -272,6 +272,33 @@ def relations(user: User, packages: list[Package]) -> list[PackageRelation]:
yield
output
@
pytest
.
fixture
def
comaintainer
(
user2
:
User
,
user3
:
User
,
packages
:
list
[
Package
]
)
->
list
[
PackageComaintainer
]:
output
=
[]
with
db
.
begin
():
comaintainer
=
db
.
create
(
PackageComaintainer
,
User
=
user2
,
PackageBase
=
packages
[
0
].
PackageBase
,
Priority
=
1
,
)
output
.
append
(
comaintainer
)
comaintainer
=
db
.
create
(
PackageComaintainer
,
User
=
user3
,
PackageBase
=
packages
[
0
].
PackageBase
,
Priority
=
1
,
)
output
.
append
(
comaintainer
)
# Finally, yield the packages.
yield
output
@
pytest
.
fixture
(
autouse
=
True
)
def
setup
(
db_test
):
# Create some extra package relationships.
...
...
@@ -321,6 +348,7 @@ def test_rpc_singular_info(
packages
:
list
[
Package
],
depends
:
list
[
PackageDependency
],
relations
:
list
[
PackageRelation
],
comaintainer
:
list
[
PackageComaintainer
],
):
# Define expected response.
pkg
=
packages
[
0
]
...
...
@@ -343,6 +371,7 @@ def test_rpc_singular_info(
"MakeDepends"
:
[
"chungus-makedepends"
],
"CheckDepends"
:
[
"chungus-checkdepends"
],
"Conflicts"
:
[
"chungus-conflicts"
],
"CoMaintainers"
:
[
"user2"
,
"user3"
],
"Provides"
:
[
"chungus-provides<=200"
],
"Replaces"
:
[
"chungus-replaces<=200"
],
"License"
:
[
pkg
.
package_licenses
.
first
().
License
.
Name
],
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment