parser: add watch_total support for full outdated packages list

parent 9617ea45
......@@ -7,6 +7,7 @@ class ALTRepoConfig:
cybertalk_url: str = "https://lists.altlinux.org/pipermail/sisyphus-cybertalk/{}/"
ftbfs_url: str = "https://git.altlinux.org/beehive/stats/Sisyphus-x86_64/ftbfs-joined"
watch_url: str = "https://watch.altlinux.org/pub/watch/{by_acl}/{nickname}.txt"
watch_total_url: str = "https://watch.altlinux.org/pub/watch/watch-total.txt"
appstream_url: str = (
"https://git.altlinux.org/gears/a/appstream-data-desktop.git?"
"a=blob_plain;f=xmls/altlinux.xml;hb=refs/heads/{branch}"
......
......@@ -5,7 +5,7 @@ from typing import List, Literal
from . import models
from .news import urls_parser, urls_for_range, packages_parser, bugs_parser
from .packages import ftbfs_parser, watch_parser
from .packages import ftbfs_parser, watch_parser, watch_total_parser
class BaseParser:
......@@ -146,10 +146,11 @@ def _aggregate_packages(
class PackagesInfo:
def __init__(self, client: BaseParser, ftbfs_url: str, watch_url: str):
def __init__(self, client: BaseParser, ftbfs_url: str, watch_url: str, watch_total_url: str):
self.client = client
self._ftbfs_url = ftbfs_url
self._watch_url = watch_url
self._watch_total_url = watch_total_url
async def ftbfs(self) -> List[models.FTBFSModel]:
text = await self.client.get(self._ftbfs_url)
......@@ -167,9 +168,13 @@ class PackagesInfo:
except:
return []
async def watch_total(self) -> List[models.WatchTotalModel]:
text = await self.client.get(self._watch_total_url)
return watch_total_parser(text)
class ALTRepoParser:
def __init__(self, session: aiohttp.ClientSession, config: "ALTRepoConfig"):
self._client = BaseParser(session)
self.news = NewsInfo(self._client, config.cybertalk_url)
self.packages = PackagesInfo(self._client, config.ftbfs_url, config.watch_url)
self.packages = PackagesInfo(self._client, config.ftbfs_url, config.watch_url, config.watch_total_url)
......@@ -59,3 +59,11 @@ class WatchByMaintainerModel(BaseModel):
old_version: str
new_version: str
url: str
class WatchTotalModel(BaseModel):
maintainer: str
pkg_name: str
old_version: str
new_version: str
url: str
from .ftbfs import ftbfs_parser
from .watch import watch_parser
from .watch import watch_parser, watch_total_parser
......@@ -12,3 +12,17 @@ def watch_parser(text: str):
for parts in (line.split("\t") for line in text.strip().splitlines())
if len(parts) == 4
]
def watch_total_parser(text: str):
return [
models.WatchTotalModel(
maintainer=parts[0],
pkg_name=parts[1],
old_version=parts[2],
new_version=parts[3],
url=parts[4],
)
for parts in (line.split("\t") for line in text.strip().splitlines())
if len(parts) == 5
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment