Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066707
D8264.id29844.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Subscribers
None
D8264.id29844.diff
View Options
diff --git a/swh/loader/package/arch/loader.py b/swh/loader/package/arch/loader.py
--- a/swh/loader/package/arch/loader.py
+++ b/swh/loader/package/arch/loader.py
@@ -57,6 +57,7 @@
storage: StorageInterface,
url: str,
artifacts: List[Dict[str, Any]],
+ arch_metadata: List[Dict[str, Any]],
**kwargs,
):
@@ -65,6 +66,9 @@
self.artifacts: Dict[str, Dict] = {
artifact["version"]: artifact for artifact in artifacts
}
+ self.arch_metadata: Dict[str, Dict] = {
+ metadata["version"]: metadata for metadata in arch_metadata
+ }
def get_versions(self) -> Sequence[str]:
"""Get all released versions of an Arch Linux package
@@ -102,14 +106,15 @@
Iterator of tuple (release_name, p_info)
"""
artifact = self.artifacts[version]
- assert version == artifact["version"]
+ metadata = self.arch_metadata[version]
+ assert version == artifact["version"] == metadata["version"]
p_info = ArchPackageInfo(
- name=artifact["name"],
+ name=metadata["name"],
filename=artifact["filename"],
url=artifact["url"],
version=version,
- last_modified=artifact["last_modified"],
+ last_modified=metadata["last_modified"],
)
yield release_name(version, artifact["filename"]), p_info
diff --git a/swh/loader/package/arch/tests/test_arch.py b/swh/loader/package/arch/tests/test_arch.py
--- a/swh/loader/package/arch/tests/test_arch.py
+++ b/swh/loader/package/arch/tests/test_arch.py
@@ -23,22 +23,30 @@
"artifacts": [
{
"url": "https://archive.archlinux.org/packages/d/dialog/dialog-1:1.3_20190211-1-x86_64.pkg.tar.xz", # noqa: B950
+ "version": "1:1.3_20190211-1",
+ "length": 180000,
+ "filename": "dialog-1:1.3_20190211-1-x86_64.pkg.tar.xz",
+ },
+ {
+ "url": "https://archive.archlinux.org/packages/d/dialog/dialog-1:1.3_20220414-1-x86_64.pkg.tar.zst", # noqa: B950
+ "version": "1:1.3_20220414-1",
+ "length": 198000,
+ "filename": "dialog-1:1.3_20220414-1-x86_64.pkg.tar.zst",
+ },
+ ],
+ "arch_metadata": [
+ {
"arch": "x86_64",
"repo": "core",
"name": "dialog",
"version": "1:1.3_20190211-1",
- "length": 180000,
- "filename": "dialog-1:1.3_20190211-1-x86_64.pkg.tar.xz",
"last_modified": "2019-02-13T08:36:00",
},
{
- "url": "https://archive.archlinux.org/packages/d/dialog/dialog-1:1.3_20220414-1-x86_64.pkg.tar.zst", # noqa: B950
"arch": "x86_64",
"repo": "core",
"name": "dialog",
"version": "1:1.3_20220414-1",
- "length": 198000,
- "filename": "dialog-1:1.3_20220414-1-x86_64.pkg.tar.zst",
"last_modified": "2022-04-16T03:59:00",
},
],
@@ -48,12 +56,17 @@
"artifacts": [
{
"url": "https://uk.mirror.archlinuxarm.org/aarch64/core/gzip-1.12-1-aarch64.pkg.tar.xz", # noqa: B950
+ "length": 79640,
+ "version": "1.12-1",
+ "filename": "gzip-1.12-1-aarch64.pkg.tar.xz",
+ }
+ ],
+ "arch_metadata": [
+ {
"arch": "aarch64",
"name": "gzip",
"repo": "core",
- "length": 79640,
"version": "1.12-1",
- "filename": "gzip-1.12-1-aarch64.pkg.tar.xz",
"last_modified": "2022-04-07T21:08:14",
}
],
@@ -66,6 +79,7 @@
swh_storage,
url=EXPECTED_PACKAGES[0]["url"],
artifacts=EXPECTED_PACKAGES[0]["artifacts"],
+ arch_metadata=EXPECTED_PACKAGES[0]["arch_metadata"],
)
assert loader.get_versions() == [
@@ -79,6 +93,7 @@
swh_storage,
url=EXPECTED_PACKAGES[0]["url"],
artifacts=EXPECTED_PACKAGES[0]["artifacts"],
+ arch_metadata=EXPECTED_PACKAGES[0]["arch_metadata"],
)
assert loader.get_default_version() == "1:1.3_20220414-1"
@@ -88,6 +103,7 @@
swh_storage,
url=EXPECTED_PACKAGES[1]["url"],
artifacts=EXPECTED_PACKAGES[1]["artifacts"],
+ arch_metadata=EXPECTED_PACKAGES[1]["arch_metadata"],
)
actual_load_status = loader.load()
assert actual_load_status["status"] == "eventful"
@@ -154,6 +170,7 @@
swh_storage,
url=EXPECTED_PACKAGES[0]["url"],
artifacts=EXPECTED_PACKAGES[0]["artifacts"],
+ arch_metadata=EXPECTED_PACKAGES[0]["arch_metadata"],
)
actual_load_status = loader.load()
assert actual_load_status["status"] == "eventful"
@@ -215,11 +232,16 @@
{
"filename": "42-0.0.1.pkg.xz",
"url": "https://mirror2.nowhere/pkg/42-0.0.1.pkg.xz",
+ "version": "0.0.1",
+ "length": 42,
+ },
+ ],
+ arch_metadata=[
+ {
"version": "0.0.1",
"arch": "aarch64",
"name": "42",
"repo": "community",
- "length": 42,
"last_modified": "2022-04-07T21:08:14",
},
],
diff --git a/swh/loader/package/arch/tests/test_tasks.py b/swh/loader/package/arch/tests/test_tasks.py
--- a/swh/loader/package/arch/tests/test_tasks.py
+++ b/swh/loader/package/arch/tests/test_tasks.py
@@ -19,10 +19,15 @@
"version": "0.0.1",
"url": "https://somewhere/some-package-0.0.1.pkg.xz",
"filename": "some-package-0.0.1.pkg.xz",
+ "length": 42,
+ }
+ ],
+ arch_metadata=[
+ {
+ "version": "0.0.1",
"arch": "aarch64",
"name": "some-package",
"repo": "community",
- "length": 42,
"last_modified": "1970-01-01T21:08:14",
}
],
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 6:52 PM (11 w, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3233058
Attached To
D8264: Arch: Adapt the loader to manage 'arch_metadata' from 'extra_loader_arguments'
Event Timeline
Log In to Comment