Stop replacing module streams in synopsis/desc

This commit is contained in:
Mustafa Gezen 2023-02-02 15:11:28 +01:00
parent 3f336ee169
commit 0c2e29785a
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
2 changed files with 8 additions and 3 deletions

View File

@ -26,8 +26,9 @@ def parse_red_hat_date(rhdate: str) -> datetime.datetime:
async def get_last_indexed_date() -> Optional[str]: async def get_last_indexed_date() -> Optional[str]:
state = await RedHatIndexState.get_or_none() state = await RedHatIndexState.get_or_none()
return re.sub( return re.sub(
r"\+\d\d:\d\d", "", r"\+\d\d:\d\d",
state.last_indexed_at.isoformat("T") + "Z" "",
state.last_indexed_at.isoformat("T") + "Z",
) if state else None ) if state else None

View File

@ -1,4 +1,5 @@
import datetime import datetime
import re
from dataclasses import dataclass from dataclasses import dataclass
from xml.etree import ElementTree as ET from xml.etree import ElementTree as ET
@ -11,6 +12,8 @@ from apollo.rpmworker import repomd
from common.logger import Logger from common.logger import Logger
RHEL_CONTAINER_RE = re.compile(r"rhel(?:\d|)\/")
@dataclass @dataclass
class NewPackage: class NewPackage:
@ -157,6 +160,7 @@ async def clone_advisory(
"Red Hat Enterprise Linux", product.name "Red Hat Enterprise Linux", product.name
) )
synopsis = synopsis.replace("RHEL", product.name) synopsis = synopsis.replace("RHEL", product.name)
synopsis = RHEL_CONTAINER_RE.sub("", synopsis)
synopsis = synopsis.replace("rhel", product.name) synopsis = synopsis.replace("rhel", product.name)
synopsis = synopsis.replace("Red Hat", product.vendor) synopsis = synopsis.replace("Red Hat", product.vendor)
synopsis = synopsis.replace(advisory.name, name) synopsis = synopsis.replace(advisory.name, name)
@ -164,7 +168,7 @@ async def clone_advisory(
"Red Hat Enterprise Linux", product.name "Red Hat Enterprise Linux", product.name
) )
description = description.replace("RHEL", product.name) description = description.replace("RHEL", product.name)
description = description.replace("rhel", product.name) description = RHEL_CONTAINER_RE.sub("", description)
description = description.replace("Red Hat", product.vendor) description = description.replace("Red Hat", product.vendor)
description = description.replace(advisory.name, name) description = description.replace(advisory.name, name)