diff --git a/swh/lister/fedora/lister.py b/swh/lister/fedora/lister.py --- a/swh/lister/fedora/lister.py +++ b/swh/lister/fedora/lister.py @@ -170,14 +170,23 @@ for pkg_metadata in page: # extract package metadata package_name = pkg_metadata.name - package_version = pkg_metadata.version + package_version = pkg_metadata.vr + package_version_split = package_version.split(".") + if package_version_split[-1].startswith("fc"): + # remove trailing ".fcXY" in version for the rpm loader to avoid + # creating multiple releases targeting same directory + package_version = ".".join(package_version_split[:-1]) + package_build_time = get_last_modified(pkg_metadata) package_download_path = pkg_metadata.location # build origin url origin_url = self.origin_url_for_package(package_name) # create package version key as expected by the fedora (rpm) loader - package_version_key = pkg_metadata.vr + package_version_key = ( + f"fedora{self.current_release}/{self.current_edition}/" + f"{package_version}" + ).lower() # this is the first time a package is listed if origin_url not in self.listed_origins: diff --git a/swh/lister/fedora/tests/test_lister.py b/swh/lister/fedora/tests/test_lister.py --- a/swh/lister/fedora/tests/test_lister.py +++ b/swh/lister/fedora/tests/test_lister.py @@ -40,9 +40,9 @@ def pkg_versions(): return { "https://src.fedoraproject.org/rpms/0install": { - "2.11-4.fc26": { + "fedora26/everything/2.11-4": { "name": "0install", - "version": "2.11", + "version": "2.11-4", "release": 26, "edition": "Everything", "buildTime": "2017-02-10T04:59:31+00:00", @@ -55,9 +55,9 @@ } }, "https://src.fedoraproject.org/rpms/0xFFFF": { - "0.3.9-15.fc26": { + "fedora26/everything/0.3.9-15": { "name": "0xFFFF", - "version": "0.3.9", + "version": "0.3.9-15", "release": 26, "edition": "Everything", "buildTime": "2017-02-10T05:01:53+00:00", @@ -66,9 +66,9 @@ "sha256": "96f9c163c0402d2b30e5343c8397a6d50e146c85a446804396b119ef9698231f" }, }, - "0.9-4.fc36": { + "fedora36/everything/0.9-4": { "name": "0xFFFF", - "version": "0.9", + "version": "0.9-4", "release": 36, "edition": "Everything", "buildTime": "2022-01-19T19:13:53+00:00", @@ -79,9 +79,9 @@ }, }, "https://src.fedoraproject.org/rpms/2ping": { - "4.5.1-2.fc36": { + "fedora36/everything/4.5.1-2": { "name": "2ping", - "version": "4.5.1", + "version": "4.5.1-2", "release": 36, "edition": "Everything", "buildTime": "2022-01-19T19:12:21+00:00", @@ -213,9 +213,9 @@ # Add new version to the set of expected pkg versions: pkg_versions["https://src.fedoraproject.org/rpms/0xFFFF"].update( { - "0.10-4.fc36": { + "fedora36/everything/0.10-4": { "name": "0xFFFF", - "version": "0.10", + "version": "0.10-4", "release": 36, "edition": "Everything", "buildTime": "2022-01-19T19:13:53+00:00",