Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/loader.py
| Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | ): | ||||
| super().__init__(storage=storage, url=url, max_content_size=max_content_size) | super().__init__(storage=storage, url=url, max_content_size=max_content_size) | ||||
| self.provider_url = url | self.provider_url = url | ||||
| self.unsupported_file_extensions = unsupported_file_extensions | self.unsupported_file_extensions = unsupported_file_extensions | ||||
| # Note: this could be renamed get_artifacts in the PackageLoader | # Note: this could be renamed get_artifacts in the PackageLoader | ||||
| # base class. | # base class. | ||||
| @cached_method | @cached_method | ||||
| def raw_sources(self): | def raw_sources(self): | ||||
| return retrieve_sources(self.url) | return retrieve_sources(self.origin.url) | ||||
| @cached_method | @cached_method | ||||
| def supported_sources(self): | def supported_sources(self): | ||||
| raw_sources = self.raw_sources() | raw_sources = self.raw_sources() | ||||
| return clean_sources( | return clean_sources( | ||||
| parse_sources(raw_sources), self.unsupported_file_extensions | parse_sources(raw_sources), self.unsupported_file_extensions | ||||
| ) | ) | ||||
| @cached_method | @cached_method | ||||
| def integrity_by_url(self) -> Dict[str, str]: | def integrity_by_url(self) -> Dict[str, str]: | ||||
| sources = self.supported_sources() | sources = self.supported_sources() | ||||
| return {s["urls"][0]: s["integrity"] for s in sources["sources"]} | return {s["urls"][0]: s["integrity"] for s in sources["sources"]} | ||||
| def get_versions(self) -> List[str]: | def get_versions(self) -> List[str]: | ||||
| """The first mirror of the mirror list is used as branch name in the | """The first mirror of the mirror list is used as branch name in the | ||||
| snapshot. | snapshot. | ||||
| """ | """ | ||||
| return list(self.integrity_by_url().keys()) | return list(self.integrity_by_url().keys()) | ||||
| def get_metadata_authority(self): | def get_metadata_authority(self): | ||||
| return MetadataAuthority( | return MetadataAuthority( | ||||
| type=MetadataAuthorityType.FORGE, | type=MetadataAuthorityType.FORGE, | ||||
| url=self.url, | url=self.origin.url, | ||||
| metadata={}, | metadata={}, | ||||
| ) | ) | ||||
| def get_extrinsic_snapshot_metadata(self): | def get_extrinsic_snapshot_metadata(self): | ||||
| return [ | return [ | ||||
| RawExtrinsicMetadataCore( | RawExtrinsicMetadataCore( | ||||
| format="nixguix-sources-json", | format="nixguix-sources-json", | ||||
| metadata=self.raw_sources(), | metadata=self.raw_sources(), | ||||
| ▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines | |||||