summaryrefslogtreecommitdiffstats
path: root/aurweb
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2019-01-21 20:28:33 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2019-01-21 21:58:00 +0100
commit44af2b430f4d676b8498b726e50c969fa37955db (patch)
treef4d0d7e48c9b8fd5a92ac71cf26983bf5c6aaaa9 /aurweb
parent042f3f2622e1adbc7546cfa25a5d138486b99341 (diff)
downloadaur-44af2b430f4d676b8498b726e50c969fa37955db.tar.gz
aur-44af2b430f4d676b8498b726e50c969fa37955db.tar.xz
aurblup: make provider updates more robust
Reverse the order of deletion and addition so that deletion comes first. This prevents corner cases such as failing unique key constraints when a provided package changes from lower case to upper case and the old name is not yet gone. Helped-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'aurweb')
-rwxr-xr-xaurweb/scripts/aurblup.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/aurweb/scripts/aurblup.py b/aurweb/scripts/aurblup.py
index 1433173c..a7d43f12 100755
--- a/aurweb/scripts/aurblup.py
+++ b/aurweb/scripts/aurblup.py
@@ -39,13 +39,13 @@ def main():
cur = conn.execute("SELECT Name, Provides FROM OfficialProviders")
oldproviders = set(cur.fetchall())
+ for pkg, provides in oldproviders.difference(providers):
+ conn.execute("DELETE FROM OfficialProviders "
+ "WHERE Name = ? AND Provides = ?", [pkg, provides])
for pkg, provides in providers.difference(oldproviders):
repo = repomap[(pkg, provides)]
conn.execute("INSERT INTO OfficialProviders (Name, Repo, Provides) "
"VALUES (?, ?, ?)", [pkg, repo, provides])
- for pkg, provides in oldproviders.difference(providers):
- conn.execute("DELETE FROM OfficialProviders "
- "WHERE Name = ? AND Provides = ?", [pkg, provides])
conn.commit()
conn.close()