summaryrefslogtreecommitdiff
path: root/importpkg.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 /importpkg.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 'importpkg.py')
-rwxr-xr-ximportpkg.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/importpkg.py b/importpkg.py
index aeccda5..f3868ff 100755
--- a/importpkg.py
+++ b/importpkg.py
@@ -58,14 +58,24 @@ def process_package(filelike, hash_functions):
raise ValueError("unexpected control.tar.gz")
state = "control"
tf = tarfile.open(fileobj=af, mode="r|gz")
+ meta = None
+ use_dpkg_divert = False
for elem in tf:
+ if elem.name == "./preinst":
+ if "dpkg-divert" in tf.extractfile(elem).read():
+ use_dpkg_divert = True
+ continue
if elem.name != "./control":
continue
if state != "control":
raise ValueError("duplicate control file")
state = "control_file"
- yield process_control(tf.extractfile(elem).read())
- break
+ meta = process_control(tf.extractfile(elem).read())
+ if meta is None:
+ raise ValueError("control file not found")
+ if use_dpkg_divert:
+ meta["conflicts"].add("_dpkg-divert")
+ yield meta
continue
elif name == "data.tar.gz":
tf = tarfile.open(fileobj=af, mode="r|gz")