Skip to content

Commit

Permalink
Versions: Prefix external packages name
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jun 14, 2024
1 parent fece94a commit 6e030d5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
6 changes: 3 additions & 3 deletions github_app_geo_project/module/versions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,15 @@ def _update_upstream_versions(
transversal_status = context.transversal_status
for external_config in context.module_config.get("external-packages", []):
package = external_config["package"]
name = f"endoflife.date/{package}"
datasource = external_config["datasource"]

module_utils.manage_updated_separated(
transversal_status.updated, transversal_status.repositories, package
transversal_status.updated, transversal_status.repositories, name
)

package_status: _TransversalStatusRepo = context.transversal_status.repositories.setdefault(
package, _TransversalStatusRepo()
name, _TransversalStatusRepo()
)
package_status.url = f"https://endoflife.date/{package}"

Expand All @@ -638,7 +639,6 @@ def _update_upstream_versions(
return
package_status.upstream_updated = datetime.datetime.now()

package_status.url = f"https://endoflife.date/{package}"
response = requests.get(f"https://endoflife.date/api/{package}.json", timeout=10)
if not response.ok:
_LOGGER.error("Failed to get the data for %s", package)
Expand Down
24 changes: 18 additions & 6 deletions tests/test_module_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,17 +733,29 @@ def test_update_upstream_versions() -> None:

_update_upstream_versions(context)

assert list(context.transversal_status.updated.keys()) == ["package1", "package2"]
assert list(context.transversal_status.repositories.keys()) == ["package1", "package2"]
assert context.transversal_status.repositories["package1"].url == "https://endoflife.date/package1"
assert context.transversal_status.repositories["package2"].url == "https://endoflife.date/package2"
assert context.transversal_status.repositories["package1"].versions == {
assert list(context.transversal_status.updated.keys()) == [
"endoflife.date/package1",
"endoflife.date/package2",
]
assert list(context.transversal_status.repositories.keys()) == [
"endoflife.date/package1",
"endoflife.date/package2",
]
assert (
context.transversal_status.repositories["endoflife.date/package1"].url
== "https://endoflife.date/package1"
)
assert (
context.transversal_status.repositories["endoflife.date/package2"].url
== "https://endoflife.date/package2"
)
assert context.transversal_status.repositories["endoflife.date/package1"].versions == {
"1.0": _TransversalStatusVersion(
support="2038-12-31",
names_by_datasource={"datasource1": _TransversalStatusNameByDatasource(names=["package1"])},
)
}
assert context.transversal_status.repositories["package2"].versions == {
assert context.transversal_status.repositories["endoflife.date/package2"].versions == {
"v1.0": _TransversalStatusVersion(
support="2038-12-31",
names_by_datasource={"datasource2": _TransversalStatusNameByDatasource(names=["package2"])},
Expand Down

0 comments on commit 6e030d5

Please sign in to comment.