aur: Create also a git origin for each listed package repository

It will enable to archive the history of the PKGBUILD file associated
to the AUR package.
This commit is contained in:
Antoine Lambert 2022-09-02 15:45:07 +02:00
parent d76fbb3447
commit b6c69e5075
2 changed files with 16 additions and 2 deletions

View file

@ -145,3 +145,10 @@ class AurLister(StatelessLister[AurListerPage]):
"aur_metadata": aur_metadata,
},
)
yield ListedOrigin(
lister_id=self.lister_obj.id,
visit_type="git",
url=origin["git_url"],
last_update=last_update,
)

View file

@ -116,16 +116,19 @@ def test_aur_lister(datadir, swh_scheduler, requests_mock):
res = lister.run()
assert res.pages == 4
assert res.origins == 4
assert res.origins == 8
scheduler_origins = swh_scheduler.get_listed_origins(lister.lister_obj.id).results
aur_origins = [origin for origin in scheduler_origins if origin.visit_type == "aur"]
git_origins = [origin for origin in scheduler_origins if origin.visit_type == "git"]
assert [
(
scheduled.visit_type,
scheduled.url,
scheduled.extra_loader_arguments["artifacts"],
)
for scheduled in sorted(scheduler_origins, key=lambda scheduled: scheduled.url)
for scheduled in sorted(aur_origins, key=lambda scheduled: scheduled.url)
] == [
(
"aur",
@ -134,3 +137,7 @@ def test_aur_lister(datadir, swh_scheduler, requests_mock):
)
for expected in sorted(expected_origins, key=lambda expected: expected["url"])
]
assert {origin.url for origin in git_origins} == {
origin["git_url"] for origin in expected_origins
}