diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2016-08-05 14:01:06 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2016-08-05 19:38:42 +0200 |
commit | 3a41f8d56495e469396455b7d95e94e21e26f9b0 (patch) | |
tree | fb0e06c5eddf7cdf6b9d26d367de32495cceaade | |
parent | 6e38309c194d860cccd26f901ee5687502331779 (diff) | |
download | aurweb-3a41f8d56495e469396455b7d95e94e21e26f9b0.tar.xz |
git-update: Remove package details before updating
Explicitly remove all package sources, dependencies, relations, licenses
and groups before inserting new ones.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-x | git-interface/git-update.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py index 2820720..e6f6410 100755 --- a/git-interface/git-update.py +++ b/git-interface/git-update.py @@ -78,8 +78,13 @@ def save_metadata(metadata, conn, user): conn.execute("UPDATE PackageBases SET MaintainerUID = ? " + "WHERE ID = ? AND MaintainerUID IS NULL", [user_id, pkgbase_id]) - conn.execute("DELETE FROM Packages WHERE PackageBaseID = ?", - [pkgbase_id]) + for table in ('Sources', 'Depends', 'Relations', 'Licenses', 'Groups'): + conn.execute("DELETE FROM Package" + table + " WHERE EXISTS (" + + "SELECT * FROM Packages " + + "WHERE Packages.PackageBaseID = ? AND " + + "Package" + table + ".PackageID = Packages.ID)", + [pkgbase_id]) + conn.execute("DELETE FROM Packages WHERE PackageBaseID = ?", [pkgbase_id]) for pkgname in srcinfo.utils.get_package_names(metadata): pkginfo = srcinfo.utils.get_merged_package(pkgname, metadata) |