diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2019-01-21 20:28:33 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2019-01-21 21:58:00 +0100 |
commit | 44af2b430f4d676b8498b726e50c969fa37955db (patch) | |
tree | f4d0d7e48c9b8fd5a92ac71cf26983bf5c6aaaa9 | |
parent | 042f3f2622e1adbc7546cfa25a5d138486b99341 (diff) | |
download | aur-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>
-rwxr-xr-x | aurweb/scripts/aurblup.py | 6 |
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() |