summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-08-05 14:01:06 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-08-05 19:38:42 +0200
commit3a41f8d56495e469396455b7d95e94e21e26f9b0 (patch)
treefb0e06c5eddf7cdf6b9d26d367de32495cceaade
parent6e38309c194d860cccd26f901ee5687502331779 (diff)
downloadaur-3a41f8d56495e469396455b7d95e94e21e26f9b0.tar.gz
aur-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-xgit-interface/git-update.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index 28207203..e6f6410a 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)