Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python3-module-altrepo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Unitsaev
python3-module-altrepo
Commits
8574c6eb
Verified
Commit
8574c6eb
authored
Apr 03, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api: add StrEnum types for method parameters
parent
e28c926f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
117 additions
and
30 deletions
+117
-30
README.md
README.md
+15
-12
methods.py
altrepo/api/methods.py
+0
-0
types.py
altrepo/api/types.py
+76
-0
acl_and_groups.py
examples/acl_and_groups.py
+2
-1
api_packages.py
examples/api_packages.py
+3
-4
api_tasks.py
examples/api_tasks.py
+2
-3
appstream.py
examples/appstream.py
+2
-1
backport_helper.py
examples/backport_helper.py
+2
-1
branch_compare.py
examples/branch_compare.py
+2
-1
errata_updates.py
examples/errata_updates.py
+2
-1
images.py
examples/images.py
+2
-1
maintainer_dashboard.py
examples/maintainer_dashboard.py
+3
-2
package_dependencies.py
examples/package_dependencies.py
+2
-1
package_files.py
examples/package_files.py
+2
-1
security_audit.py
examples/security_audit.py
+2
-1
No files found.
README.md
View file @
8574c6eb
...
...
@@ -24,12 +24,13 @@ pip3 install altrepo
```
python
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
client
=
ALTRepo
()
await
client
.
init
()
result
=
await
client
.
api
.
package
.
package_info
(
"
vim"
,
branch
=
"sisyphus"
)
result
=
await
client
.
api
.
package
.
package_info
(
"
firefox"
,
branch
=
Branch
.
sisyphus
)
pkg
=
result
.
packages
[
0
]
print
(
f
"{pkg.name} {pkg.version}-{pkg.release}"
)
...
...
@@ -45,15 +46,17 @@ asyncio.run(main())
Получение подробной информации о пакете и поиск по имени:
```
python
from
altrepo.api.types
import
Branch
# Информация о конкретном пакете
result
=
await
client
.
api
.
package
.
package_info
(
"firefox"
,
branch
=
"sisyphus"
)
result
=
await
client
.
api
.
package
.
package_info
(
"firefox"
,
branch
=
Branch
.
sisyphus
)
pkg
=
result
.
packages
[
0
]
print
(
f
"{pkg.name} {pkg.version}-{pkg.release} ({pkg.summary})"
)
# Поиск пакетов по подстроке в имени
result
=
await
client
.
api
.
package
.
package_search
(
"python3-module"
,
branch
=
"sisyphus"
)
for
pkg
in
result
.
packages
[:
10
]:
print
(
f
" {pkg.name}
: {pkg.summary}
"
)
found
=
await
client
.
api
.
site
.
find_packages
(
"python3-module-alt"
,
branch
=
Branch
.
sisyphus
)
for
pkg
in
found
.
packages
[:
10
]:
print
(
f
" {pkg.name}"
)
```
### Задачи и мейнтейнеры
...
...
@@ -61,18 +64,20 @@ for pkg in result.packages[:10]:
Поиск задач по мейнтейнеру или по имени пакета:
```
python
from
altrepo.api.types
import
Branch
# Задачи мейнтейнера
result
=
await
client
.
api
.
task
.
find_tasks
(
input
=
[
"fiersik"
],
branch
=
"sisyphus"
,
by_package
=
False
result
=
await
client
.
api
.
task
.
progress
.
find_tasks
(
input
=
[
"fiersik"
],
branch
=
Branch
.
sisyphus
,
by_package
=
False
)
for
task
in
result
.
tasks
[:
5
]:
print
(
f
" #{task.task_id} [{task.
state}] {task.
owner}"
)
print
(
f
" #{task.task_id} [{task.
task_state}] {task.task_
owner}"
)
# Баги мейнтейнера из Bugzilla
bugs
=
await
client
.
api
.
bug
.
bugzilla_by_maintainer
(
"fiersik"
)
if
bugs
:
for
bug
in
bugs
.
bugs
[:
5
]:
print
(
f
" #{bug.
bug_
id} {bug.status}: {bug.summary}"
)
print
(
f
" #{bug.id} {bug.status}: {bug.summary}"
)
```
### Отслеживание устаревших пакетов
...
...
@@ -85,8 +90,7 @@ watch = await client.parser.packages.watch_by_maintainer("fiersik", "by-acl")
for
pkg
in
watch
[:
5
]:
print
(
f
" {pkg.pkg_name}: {pkg.old_version} -> {pkg.new_version}"
)
# Полный список устаревших пакетов по всему репозиторию
# Каждая запись содержит имя мейнтейнера (или группы с префиксом @)
# Полный список устаревших пакетов
total
=
await
client
.
parser
.
packages
.
watch_total
()
print
(
f
"Всего устаревших пакетов: {len(total)}"
)
```
...
...
@@ -160,7 +164,6 @@ for pkg in ftbfs[:5]:
from
altrepo
import
ALTRepo
,
ALTRepoConfig
config
=
ALTRepoConfig
(
api_base_url
=
"https://rdb.altlinux.org/api"
,
appstream_dir
=
"/tmp/appstream"
,
appstream_branches
=
[
"sisyphus"
,
"p11"
,
"p10"
],
)
...
...
altrepo/api/methods.py
View file @
8574c6eb
This diff is collapsed.
Click to expand it.
altrepo/api/types.py
0 → 100644
View file @
8574c6eb
from
enum
import
StrEnum
class
Acl
(
StrEnum
):
none
=
"none"
by_nick
=
"by_nick"
by_nick_leader
=
"by_nick_leader"
by_nick_or_group
=
"by_nick_or_group"
by_nick_leader_and_group
=
"by_nick_leader_and_group"
class
PackageType
(
StrEnum
):
source
=
"source"
binary
=
"binary"
class
PackageTypeAll
(
StrEnum
):
all
=
"all"
source
=
"source"
binary
=
"binary"
class
DependencyType
(
StrEnum
):
both
=
"both"
source
=
"source"
binary
=
"binary"
class
DependencyKind
(
StrEnum
):
all
=
"all"
provide
=
"provide"
require
=
"require"
conflict
=
"conflict"
obsolete
=
"obsolete"
class
ErrataState
(
StrEnum
):
all
=
"all"
active
=
"active"
discarded
=
"discarded"
class
ErrataType
(
StrEnum
):
packages
=
"packages"
repository
=
"repository"
bug
=
"bug"
vuln
=
"vuln"
exclusion
=
"exclusion"
class
ApprovalGroup
(
StrEnum
):
maint
=
"maint"
tester
=
"tester"
class
AuthProvider
(
StrEnum
):
ldap
=
"ldap"
keycloak
=
"keycloak"
class
ImageShow
(
StrEnum
):
active
=
"active"
all
=
"all"
class
Branch
(
StrEnum
):
sisyphus
=
"sisyphus"
sisyphus_e2k
=
"sisyphus_e2k"
sisyphus_riscv64
=
"sisyphus_riscv64"
sisyphus_loongarch64
=
"sisyphus_loongarch64"
p11
=
"p11"
p10
=
"p10"
p10_e2k
=
"p10_e2k"
p9
=
"p9"
c10f2
=
"c10f2"
c9f2
=
"c9f2"
examples/acl_and_groups.py
View file @
8574c6eb
...
...
@@ -2,13 +2,14 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
client
=
ALTRepo
()
await
client
.
init
()
acl
=
await
client
.
api
.
acl
.
by_packages
(
"sisyphus"
,
[
"firefox"
,
"openssh"
])
acl
=
await
client
.
api
.
acl
.
by_packages
(
Branch
.
sisyphus
,
[
"firefox"
,
"openssh"
])
print
(
"ACL пакетов:"
)
for
pkg
in
acl
.
packages
:
print
(
f
" {pkg.name}: {', '.join(pkg.members) or '(группа)'}"
)
...
...
examples/api_packages.py
View file @
8574c6eb
...
...
@@ -2,21 +2,20 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
client
=
ALTRepo
()
await
client
.
init
()
# Информация о пакете
result
=
await
client
.
api
.
package
.
package_info
(
"firefox"
,
branch
=
"sisyphus"
)
result
=
await
client
.
api
.
package
.
package_info
(
"firefox"
,
branch
=
Branch
.
sisyphus
)
pkg
=
result
.
packages
[
0
]
print
(
f
"{pkg.name} {pkg.version}-{pkg.release} (arch={pkg.arch})"
)
print
(
f
" Мейнтейнер: {pkg.packager}"
)
print
(
f
" SHA1: {pkg.sha1}"
)
# Поиск пакетов в ветке
found
=
await
client
.
api
.
site
.
find_packages
(
"python3-module-alt"
,
branch
=
"sisyphus"
)
found
=
await
client
.
api
.
site
.
find_packages
(
"python3-module-alt"
,
branch
=
Branch
.
sisyphus
)
for
p
in
found
.
packages
[:
5
]:
print
(
f
" {p.name}"
)
...
...
examples/api_tasks.py
View file @
8574c6eb
...
...
@@ -2,20 +2,19 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
client
=
ALTRepo
()
await
client
.
init
()
# Поиск задач мейнтейнера
result
=
await
client
.
api
.
task
.
progress
.
find_tasks
(
input
=
[
"fiersik"
],
branch
=
"sisyphus"
,
by_package
=
False
input
=
[
"fiersik"
],
branch
=
Branch
.
sisyphus
,
by_package
=
False
)
for
task
in
result
.
tasks
[:
5
]:
print
(
f
"#{task.task_id} [{task.task_state}] {task.task_owner}"
)
# Информация о конкретной задаче
if
result
.
tasks
:
info
=
await
client
.
api
.
task
.
task_info
(
result
.
tasks
[
0
]
.
task_id
)
print
(
f
"
\n
Задача #{info.id}: {info.state} ({info.branch})"
)
...
...
examples/appstream.py
View file @
8574c6eb
...
...
@@ -2,13 +2,14 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
client
=
ALTRepo
()
await
client
.
init
()
branch
=
"sisyphus"
branch
=
Branch
.
sisyphus
await
client
.
appstream
.
data
.
load_by_branch
(
branch
,
"latest"
)
for
name
in
[
"firefox"
,
"telegram-desktop"
,
"gimp"
,
"vlc"
]:
...
...
examples/backport_helper.py
View file @
8574c6eb
...
...
@@ -2,6 +2,7 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
...
...
@@ -9,7 +10,7 @@ async def main():
await
client
.
init
()
result
=
await
client
.
api
.
dependencies
.
backport_helper
(
"sisyphus"
,
"p11"
,
[
"ocaml"
]
Branch
.
sisyphus
,
Branch
.
p11
,
[
"ocaml"
]
)
print
(
f
"Бэкпорт ocaml из sisyphus в p11 ({result.count} пакетов):"
)
for
level
in
result
.
dependencies
:
...
...
examples/branch_compare.py
View file @
8574c6eb
...
...
@@ -2,6 +2,7 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
...
...
@@ -11,7 +12,7 @@ async def main():
pkgsets
=
await
client
.
api
.
packageset
.
active_packagesets
()
print
(
f
"Активные ветки: {', '.join(pkgsets.packagesets)}"
)
diff
=
await
client
.
api
.
packageset
.
compare_packagesets
(
"sisyphus"
,
"p11"
)
diff
=
await
client
.
api
.
packageset
.
compare_packagesets
(
Branch
.
sisyphus
,
Branch
.
p11
)
print
(
f
"
\n
sisyphus vs p11 ({len(diff.packages)} записей):"
)
for
p
in
diff
.
packages
[:
10
]:
p1
,
p2
=
p
.
package1
,
p
.
package2
...
...
examples/errata_updates.py
View file @
8574c6eb
...
...
@@ -2,6 +2,7 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
...
...
@@ -11,7 +12,7 @@ async def main():
branches
=
await
client
.
api
.
errata
.
errata_branches
()
print
(
f
"Ветки с эрратами: {', '.join(branches.branches)}"
)
adv
=
await
client
.
api
.
errata
.
advisory
(
branch
=
"p11"
,
limit
=
10
)
adv
=
await
client
.
api
.
errata
.
advisory
(
branch
=
Branch
.
p11
,
limit
=
10
)
if
adv
.
erratas
:
print
(
f
"
\n
Последние advisory для p11:"
)
for
e
in
adv
.
erratas
:
...
...
examples/images.py
View file @
8574c6eb
...
...
@@ -2,6 +2,7 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
...
...
@@ -13,7 +14,7 @@ async def main():
for
img
in
images
.
images
[:
5
]:
print
(
f
" {img.name} ({img.branch}, {img.date})"
)
active
=
await
client
.
api
.
image
.
active_images
(
branch
=
"p11"
)
active
=
await
client
.
api
.
image
.
active_images
(
branch
=
Branch
.
p11
)
if
active
.
images
:
print
(
f
"
\n
Активные образы p11:"
)
for
img
in
active
.
images
:
...
...
examples/maintainer_dashboard.py
View file @
8574c6eb
...
...
@@ -2,6 +2,7 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
,
Acl
async
def
main
():
...
...
@@ -9,7 +10,7 @@ async def main():
await
client
.
init
()
nickname
=
"fiersik"
branch
=
"sisyphus"
branch
=
Branch
.
sisyphus
info
=
await
client
.
api
.
site
.
maintainer_info
(
branch
,
nickname
)
mi
=
info
.
information
...
...
@@ -20,7 +21,7 @@ async def main():
for
pkg
in
pkgs
.
packages
[:
5
]:
print
(
f
" {pkg.name} {pkg.version}-{pkg.release}"
)
bugs
=
await
client
.
api
.
bug
.
bugzilla_by_maintainer
(
nickname
)
bugs
=
await
client
.
api
.
bug
.
bugzilla_by_maintainer
(
nickname
,
by_acl
=
Acl
.
by_nick
)
if
bugs
and
bugs
.
bugs
:
print
(
f
"
\n
Баги ({len(bugs.bugs)}):"
)
for
bug
in
bugs
.
bugs
[:
5
]:
...
...
examples/package_dependencies.py
View file @
8574c6eb
...
...
@@ -2,13 +2,14 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
client
=
ALTRepo
()
await
client
.
init
()
branch
=
"sisyphus"
branch
=
Branch
.
sisyphus
name
=
"firefox"
found
=
await
client
.
api
.
site
.
find_packages
(
name
,
branch
=
branch
)
...
...
examples/package_files.py
View file @
8574c6eb
...
...
@@ -2,13 +2,14 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
client
=
ALTRepo
()
await
client
.
init
()
branch
=
"sisyphus"
branch
=
Branch
.
sisyphus
files
=
await
client
.
api
.
file
.
search
(
branch
,
"nginx.conf"
)
print
(
f
"Файлы nginx.conf ({len(files.files)}):"
)
...
...
examples/security_audit.py
View file @
8574c6eb
...
...
@@ -2,6 +2,7 @@
import
asyncio
from
altrepo
import
ALTRepo
from
altrepo.api.types
import
Branch
async
def
main
():
...
...
@@ -13,7 +14,7 @@ async def main():
for
pkg
in
fixes
.
packages
[:
5
]:
print
(
f
" {pkg.name} {pkg.version}-{pkg.release} ({pkg.branch})"
)
erratas
=
await
client
.
api
.
errata
.
search
(
branch
=
"p11"
,
name
=
"openssh"
)
erratas
=
await
client
.
api
.
errata
.
search
(
branch
=
Branch
.
p11
,
name
=
"openssh"
)
if
erratas
.
erratas
:
print
(
f
"
\n
Эрраты openssh в p11:"
)
for
e
in
erratas
.
erratas
[:
5
]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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