Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123608
D8554.id30854.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Subscribers
None
D8554.id30854.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
@@ -2,10 +2,11 @@
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
+
from distutils.version import LooseVersion
from pathlib import Path
import re
-from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple
+from typing import Any, Dict, Iterator, Optional, Sequence, Tuple
import attr
@@ -56,19 +57,15 @@
self,
storage: StorageInterface,
url: str,
- artifacts: List[Dict[str, Any]],
- arch_metadata: List[Dict[str, Any]],
+ artifacts: Dict[str, Dict[str, Any]],
+ arch_metadata: Dict[str, Dict[str, Any]],
**kwargs,
):
super().__init__(storage=storage, url=url, **kwargs)
self.url = url
- 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
- }
+ self.artifacts = artifacts
+ self.arch_metadata = arch_metadata
def get_versions(self) -> Sequence[str]:
"""Get all released versions of an Arch Linux package
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
@@ -2,6 +2,7 @@
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
+
import pytest
from swh.loader.package.arch.loader import ArchLoader
@@ -20,56 +21,56 @@
EXPECTED_PACKAGES = [
{
"url": "https://archive.archlinux.org/packages/d/dialog/",
- "artifacts": [
- {
+ "artifacts": {
+ "1:1.3_20190211-1": {
"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",
},
- {
+ "1:1.3_20220414-1": {
"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_metadata": {
+ "1:1.3_20190211-1": {
"arch": "x86_64",
"repo": "core",
"name": "dialog",
"version": "1:1.3_20190211-1",
"last_modified": "2019-02-13T08:36:00",
},
- {
+ "1:1.3_20220414-1": {
"arch": "x86_64",
"repo": "core",
"name": "dialog",
"version": "1:1.3_20220414-1",
"last_modified": "2022-04-16T03:59:00",
},
- ],
+ },
},
{
"url": "https://archlinuxarm.org/packages/aarch64/gzip",
- "artifacts": [
- {
+ "artifacts": {
+ "1.12-1": {
"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_metadata": {
+ "1.12-1": {
"arch": "aarch64",
"name": "gzip",
"repo": "core",
"version": "1.12-1",
"last_modified": "2022-04-07T21:08:14",
}
- ],
+ },
},
]
@@ -228,23 +229,23 @@
loader = ArchLoader(
swh_storage,
url,
- artifacts=[
- {
+ artifacts={
+ "0.0.1": {
"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=[
- {
+ },
+ arch_metadata={
+ "0.0.1": {
"version": "0.0.1",
"arch": "aarch64",
"name": "42",
"repo": "community",
"last_modified": "2022-04-07T21:08:14",
},
- ],
+ },
)
with pytest.raises(Exception):
assert loader.load() == {"status": "failed"}
diff --git a/swh/loader/package/aur/loader.py b/swh/loader/package/aur/loader.py
--- a/swh/loader/package/aur/loader.py
+++ b/swh/loader/package/aur/loader.py
@@ -2,10 +2,11 @@
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
+
from distutils.version import LooseVersion
from pathlib import Path
import re
-from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple
+from typing import Any, Dict, Iterator, Optional, Sequence, Tuple
import attr
@@ -66,19 +67,15 @@
self,
storage: StorageInterface,
url: str,
- artifacts: List[Dict[str, Any]],
- aur_metadata: List[Dict[str, Any]],
+ artifacts: Dict[str, Dict[str, Any]],
+ aur_metadata: Dict[str, Dict[str, Any]],
**kwargs,
):
super().__init__(storage=storage, url=url, **kwargs)
self.url = url
- self.artifacts: Dict[str, Dict] = {
- artifact["version"]: artifact for artifact in artifacts
- }
- self.aur_metadata: Dict[str, Dict] = {
- meta["version"]: meta for meta in aur_metadata
- }
+ self.artifacts = artifacts
+ self.aur_metadata = aur_metadata
def get_versions(self) -> Sequence[str]:
"""Get all released versions of an Aur package
diff --git a/swh/loader/package/aur/tests/test_aur.py b/swh/loader/package/aur/tests/test_aur.py
--- a/swh/loader/package/aur/tests/test_aur.py
+++ b/swh/loader/package/aur/tests/test_aur.py
@@ -2,6 +2,7 @@
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
+
from swh.loader.package.aur.loader import AurLoader
from swh.loader.package.utils import EMPTY_AUTHOR
from swh.loader.tests import assert_last_visit_matches, check_snapshot, get_stats
@@ -18,93 +19,93 @@
EXPECTED_PACKAGES = [
{
"url": "https://aur.archlinux.org/hg-evolve.git",
- "artifacts": [
- {
+ "artifacts": {
+ "10.5.2-1": {
"filename": "hg-evolve.tar.gz",
"url": "https://aur.archlinux.org/cgit/aur.git/snapshot/hg-evolve.tar.gz", # noqa: B950
"version": "10.5.2-1",
}
- ],
- "aur_metadata": [
- {
+ },
+ "aur_metadata": {
+ "10.5.2-1": {
"version": "10.5.2-1",
"project_url": "https://www.mercurial-scm.org/doc/evolution/",
"last_update": "2022-07-16T00:08:41+00:00",
"pkgname": "hg-evolve",
}
- ],
+ },
},
{
"url": "https://aur.archlinux.org/ibus-git.git",
- "artifacts": [
- {
+ "artifacts": {
+ "1.5.23+12+gef4c5c7e-1": {
"filename": "ibus-git.tar.gz",
"url": "https://aur.archlinux.org/cgit/aur.git/snapshot/ibus-git.tar.gz", # noqa: B950
"version": "1.5.23+12+gef4c5c7e-1",
}
- ],
- "aur_metadata": [
- {
+ },
+ "aur_metadata": {
+ "1.5.23+12+gef4c5c7e-1": {
"version": "1.5.23+12+gef4c5c7e-1",
"project_url": "https://github.com/ibus/ibus/wiki",
"last_update": "2021-02-08T06:12:11+00:00",
"pkgname": "ibus-git",
}
- ],
+ },
},
{
"url": "https://aur.archlinux.org/libervia-web-hg.git",
- "artifacts": [
- {
+ "artifacts": {
+ "0.9.0.r1492.3a34d78f2717-1": {
"filename": "libervia-web-hg.tar.gz",
"url": "https://aur.archlinux.org/cgit/aur.git/snapshot/libervia-web-hg.tar.gz", # noqa: B950
"version": "0.9.0.r1492.3a34d78f2717-1",
}
- ],
- "aur_metadata": [
- {
+ },
+ "aur_metadata": {
+ "0.9.0.r1492.3a34d78f2717-1": {
"version": "0.9.0.r1492.3a34d78f2717-1",
"project_url": "http://salut-a-toi.org/",
"last_update": "2022-02-26T15:30:58+00:00",
"pkgname": "libervia-web-hg",
}
- ],
+ },
},
{
"url": "https://aur.archlinux.org/tealdeer-git.git",
- "artifacts": [
- {
+ "artifacts": {
+ "r255.30b7c5f-1": {
"filename": "tealdeer-git.tar.gz",
"url": "https://aur.archlinux.org/cgit/aur.git/snapshot/tealdeer-git.tar.gz", # noqa: B950
"version": "r255.30b7c5f-1",
}
- ],
- "aur_metadata": [
- {
+ },
+ "aur_metadata": {
+ "r255.30b7c5f-1": {
"version": "r255.30b7c5f-1",
"project_url": "https://github.com/dbrgn/tealdeer",
"last_update": "2020-09-04T20:36:52+00:00",
"pkgname": "tealdeer-git",
}
- ],
+ },
},
{
"url": "https://aur.archlinux.org/a-fake-one.git",
- "artifacts": [
- {
+ "artifacts": {
+ "0.0.1": {
"filename": "a-fake-one.tar.gz",
"url": "https://aur.archlinux.org/cgit/aur.git/snapshot/a-fake-one.tar.gz", # noqa: B950
"version": "0.0.1",
},
- ],
- "aur_metadata": [
- {
+ },
+ "aur_metadata": {
+ "0.0.1": {
"version": "0.0.1",
"project_url": "https://nowhere/a-fake-one",
"last_update": "2022-02-02T22:22:22+00:00",
"pkgname": "a-fake-one",
}
- ],
+ },
},
]
@@ -228,21 +229,21 @@
loader = AurLoader(
swh_storage,
url,
- artifacts=[
- {
+ artifacts={
+ "0.0.1": {
"version": "0.0.1",
"url": "https://myforge.nowhere/42/42.tar.gz",
"filename": "42.tar.gz",
},
- ],
- aur_metadata=[
- {
+ },
+ aur_metadata={
+ "0.0.1": {
"pkgname": "42",
"version": "0.0.1",
"project_url": "https://myforge.nowhere/42",
"last_update": "2022-04-07T21:08:14",
},
- ],
+ },
)
load_status = loader.load()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 1:06 PM (19 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220575
Attached To
D8554: arch/aur: Align loader parameters with lister output
Event Timeline
Log In to Comment