Просмотр исходного кода

dpkg: Remove old control files on upgrade when needed for Multi-Arch change

When we upgrade from “Multi-Arch: same” to something else (or vice versa)
the layout used for the control files changes (pkg.foo vs pkg:arch.foo)
and it means we must get rid of the old control files.

Sponsored-by: Linaro Limited

[guillem@debian.org:
 - Reword comment and debug message. ]

Signed-off-by: Guillem Jover <guillem@debian.org>
Raphaël Hertzog лет назад: 15
Родитель
Сommit
65c28bd697
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      src/processarc.c

+ 10 - 0
src/processarc.c

@@ -327,6 +327,16 @@ pkg_infodb_update(struct pkginfo *pkg, char *cidir, char *cidirrest)
   }
   pop_cleanup(ehflag_normaltidy); /* closedir */
 
+  /* If the old and new versions use a different infodb layout, get rid
+   * of the files using the old layout. */
+  if (pkg->installed.multiarch != pkg->available.multiarch &&
+      (pkg->installed.multiarch == multiarch_same ||
+       pkg->available.multiarch == multiarch_same)) {
+    debug(dbg_scripts,
+          "process_archive remove old info files after db layout switch");
+    pkg_infodb_foreach(pkg, &pkg->installed, pkg_infodb_remove_file);
+  }
+
   dir_sync_path(pkgadmindir());
 }