mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Merge branch 'aurblup-update-repo' into 'master'
fix: update repo information with aurblup script / git packaging repo changes See merge request archlinux/aurweb!710
This commit is contained in:
commit
acdb2864de
3 changed files with 32 additions and 1 deletions
|
@ -49,6 +49,7 @@ def _main(force: bool = False):
|
|||
.all()
|
||||
)
|
||||
|
||||
# delete providers not existing in any of our alpm repos
|
||||
for name, provides in old_providers.difference(providers):
|
||||
db.delete_all(
|
||||
db.query(OfficialProvider).filter(
|
||||
|
@ -59,10 +60,20 @@ def _main(force: bool = False):
|
|||
)
|
||||
)
|
||||
|
||||
# add new providers that do not yet exist in our DB
|
||||
for name, provides in providers.difference(old_providers):
|
||||
repo = repomap.get((name, provides))
|
||||
db.create(OfficialProvider, Name=name, Repo=repo, Provides=provides)
|
||||
|
||||
# update providers where a pkg was moved from one repo to another
|
||||
all_providers = db.query(OfficialProvider)
|
||||
|
||||
for op in all_providers:
|
||||
new_repo = repomap.get((op.Name, op.Provides))
|
||||
|
||||
if op.Repo != new_repo:
|
||||
op.Repo = new_repo
|
||||
|
||||
|
||||
def main(force: bool = False):
|
||||
db.get_engine()
|
||||
|
|
|
@ -119,7 +119,7 @@ max-blob-size = 256000
|
|||
|
||||
[aurblup]
|
||||
db-path = /srv/http/aurweb/aurblup/
|
||||
sync-dbs = core extra community multilib testing community-testing
|
||||
sync-dbs = core-testing extra-testing multilib-testing core extra multilib
|
||||
server = https://mirrors.kernel.org/archlinux/%s/os/x86_64
|
||||
|
||||
[mkpkglists]
|
||||
|
|
|
@ -87,3 +87,23 @@ def test_aurblup_cleanup(alpm_db: AlpmDatabase):
|
|||
db.query(OfficialProvider).filter(OfficialProvider.Name == "fake package").all()
|
||||
)
|
||||
assert len(providers) == 0
|
||||
|
||||
|
||||
def test_aurblup_repo_change(alpm_db: AlpmDatabase):
|
||||
# Add a package and sync up the database.
|
||||
alpm_db.add("pkg", "1.0", "x86_64", provides=["pkg2", "pkg3"])
|
||||
aurblup.main()
|
||||
|
||||
# We should find an entry with repo "test"
|
||||
op = db.query(OfficialProvider).filter(OfficialProvider.Name == "pkg").first()
|
||||
assert op.Repo == "test"
|
||||
|
||||
# Modify the repo to something that does not exist.
|
||||
op.Repo = "nonsense"
|
||||
|
||||
# Run our script.
|
||||
aurblup.main()
|
||||
|
||||
# Repo should be set back to "test"
|
||||
db.refresh(op)
|
||||
assert op.Repo == "test"
|
||||
|
|
Loading…
Add table
Reference in a new issue