Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/debian/loader.py
Show First 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | ) -> Optional[Revision]: | ||||
committer=author, | committer=author, | ||||
committer_date=date, | committer_date=date, | ||||
parents=(), | parents=(), | ||||
directory=directory, | directory=directory, | ||||
synthetic=True, | synthetic=True, | ||||
) | ) | ||||
def _artifact_to_dsc_sha256(known_artifacts: Dict, url: str) -> Optional[str]: | |||||
extrinsic = known_artifacts.get("extrinsic") | |||||
if not extrinsic: | |||||
return None | |||||
known_p_info = DebianPackageInfo.from_metadata(extrinsic["raw"], url=url) | |||||
dsc = [file for (name, file) in known_p_info.files.items() if name.endswith(".dsc")] | |||||
if len(dsc) != 1: | |||||
raise DscCountError( | |||||
f"Expected exactly one known .dsc file for package {known_p_info.name}, " | |||||
f"got {len(dsc)}" | |||||
) | |||||
return dsc[0].sha256 | |||||
def uid_to_person(uid: str) -> Dict[str, str]: | def uid_to_person(uid: str) -> Dict[str, str]: | ||||
"""Convert an uid to a person suitable for insertion. | """Convert an uid to a person suitable for insertion. | ||||
Args: | Args: | ||||
uid: an uid of the form "Name <email@ddress>" | uid: an uid of the form "Name <email@ddress>" | ||||
Returns: | Returns: | ||||
a dictionary with the following keys: | a dictionary with the following keys: | ||||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |