Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/debian/loader.py
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | class DebianPackageChangelog: | ||||
date = attr.ib(type=str) | date = attr.ib(type=str) | ||||
"""Date of the changelog entry.""" | """Date of the changelog entry.""" | ||||
history = attr.ib(type=List[Tuple[str, str]]) | history = attr.ib(type=List[Tuple[str, str]]) | ||||
"""List of tuples (package_name, version)""" | """List of tuples (package_name, version)""" | ||||
@attr.s | @attr.s | ||||
class DebianPackageInfo(BasePackageInfo): | class DebianPackageInfo(BasePackageInfo): | ||||
raw = attr.ib(type=Dict[str, Any]) | raw_info = attr.ib(type=Dict[str, Any]) | ||||
files = attr.ib(type=Dict[str, DebianFileMetadata]) | files = attr.ib(type=Dict[str, DebianFileMetadata]) | ||||
"""Metadata of the files (.deb, .dsc, ...) of the package.""" | """Metadata of the files (.deb, .dsc, ...) of the package.""" | ||||
name = attr.ib(type=str) | name = attr.ib(type=str) | ||||
version = attr.ib(type=str) | version = attr.ib(type=str) | ||||
@classmethod | @classmethod | ||||
def from_metadata(cls, a_metadata: Dict[str, Any], url: str) -> "DebianPackageInfo": | def from_metadata(cls, a_metadata: Dict[str, Any], url: str) -> "DebianPackageInfo": | ||||
return cls( | return cls( | ||||
url=url, | url=url, | ||||
filename=None, | filename=None, | ||||
raw=a_metadata, | raw_info=a_metadata, | ||||
files={ | files={ | ||||
file_name: DebianFileMetadata(**file_metadata) | file_name: DebianFileMetadata(**file_metadata) | ||||
for (file_name, file_metadata) in a_metadata.get("files", {}).items() | for (file_name, file_metadata) in a_metadata.get("files", {}).items() | ||||
}, | }, | ||||
name=a_metadata["name"], | name=a_metadata["name"], | ||||
version=a_metadata["version"], | version=a_metadata["version"], | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | ) -> Optional[Revision]: | ||||
parents=(), | parents=(), | ||||
directory=directory, | directory=directory, | ||||
synthetic=True, | synthetic=True, | ||||
metadata={ | metadata={ | ||||
"intrinsic": {"tool": "dsc", "raw": attr.asdict(intrinsic_metadata),}, | "intrinsic": {"tool": "dsc", "raw": attr.asdict(intrinsic_metadata),}, | ||||
"extrinsic": { | "extrinsic": { | ||||
"provider": dsc_url, | "provider": dsc_url, | ||||
"when": self.visit_date.isoformat(), | "when": self.visit_date.isoformat(), | ||||
"raw": p_info.raw, | "raw": p_info.raw_info, | ||||
}, | }, | ||||
}, | }, | ||||
) | ) | ||||
def resolve_revision_from( | def resolve_revision_from( | ||||
known_package_artifacts: Mapping, p_info: DebianPackageInfo | known_package_artifacts: Mapping, p_info: DebianPackageInfo | ||||
) -> Optional[bytes]: | ) -> Optional[bytes]: | ||||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |