Explorar o código

dpkg: Deconfigure other instances of the unpacked package

When a new version of a “Multi-Arch: same” package is installed,
the other instances that are not synchronized (i.e. which
have a different version) must be deconfigured.

Sponsored-by: Linaro Limited

[guillem@debian.org:
 - Ignore the package earlier if the package state is not correct.
 - Use enqueue_deconfigure() instead of ad-hoc code. ]

Signed-off-by: Guillem Jover <guillem@debian.org>
Raphaël Hertzog %!s(int64=15) %!d(string=hai) anos
pai
achega
e5bf4b7412
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      src/processarc.c

+ 11 - 0
src/processarc.c

@@ -501,6 +501,17 @@ void process_archive(const char *filename) {
    * that we need. */
    * that we need. */
   pkg->clientdata->istobe= itb_installnew;
   pkg->clientdata->istobe= itb_installnew;
 
 
+  /* Deconfigure other instances from a pkgset if they are not in sync. */
+  for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
+    if (otherpkg == pkg)
+      continue;
+    if (otherpkg->status <= stat_halfconfigured)
+      continue;
+
+    if (versioncompare(&pkg->available.version, &otherpkg->installed.version))
+      enqueue_deconfigure(otherpkg, NULL);
+  }
+
   for (dsearch= pkg->available.depends; dsearch; dsearch= dsearch->next) {
   for (dsearch= pkg->available.depends; dsearch; dsearch= dsearch->next) {
     switch (dsearch->type) {
     switch (dsearch->type) {
     case dep_conflicts:
     case dep_conflicts: