summaryrefslogtreecommitdiff
path: root/readyaml.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2014-02-25 07:17:39 +0100
committerHelmut Grohne <helmut@subdivi.de>2014-02-25 07:17:39 +0100
commitc04c6a6c6a3412593e77cf31eb5ceefc46f87783 (patch)
tree2ed77c18114d969d4beec843021d529cf321ea75 /readyaml.py
parentf29676904602fa9b0e0cf51ab0e7345ba28939db (diff)
downloaddebian-dedup-c04c6a6c6a3412593e77cf31eb5ceefc46f87783.tar.gz
record package metadata that describes co-installability
Specifically all entries in the Conflicts header are saved in the conflict table, all entries in the Provides header are saved in the provide table (to cover conflicts with virtual packages) and packages using dpkg-divert in preinst get a magic "_dpkg-divert" entry in their conflict table. With this metadata it should be possible to compute undeclared file conflicts.
Diffstat (limited to 'readyaml.py')
-rwxr-xr-xreadyaml.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/readyaml.py b/readyaml.py
index 2ef9a3b..50603b1 100755
--- a/readyaml.py
+++ b/readyaml.py
@@ -31,6 +31,8 @@ def readyaml(db, stream):
if pid is not None:
cur.execute("DELETE FROM content WHERE pid = ?;", (pid,))
cur.execute("DELETE FROM dependency WHERE pid = ?;", (pid,))
+ cur.execute("DELETE FROM conflict WHERE pid = ?;", (pid,))
+ cur.execute("DELETE FROM provide WHERE pid = ?;", (pid,))
cur.execute("UPDATE package SET version = ?, architecture = ?, source = ? WHERE id = ?;",
(metadata["version"], metadata["architecture"], metadata["source"], pid))
else:
@@ -40,6 +42,10 @@ def readyaml(db, stream):
pid = cur.lastrowid
cur.executemany("INSERT INTO dependency (pid, required) VALUES (?, ?);",
((pid, dep) for dep in metadata["depends"]))
+ cur.executemany("INSERT INTO conflict (pid, conflicting) VALUES (?, ?);",
+ ((pid, conflict) for conflict in metadata["conflicts"]))
+ cur.executemany("INSERT INTO provide (pid, provided) VALUES (?, ?);",
+ ((pid, provided) for provided in metadata["provides"]))
for entry in gen:
if entry == "commit":
db.commit()