summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am9
-rw-r--r--src/archives.c2
-rw-r--r--src/depcon.c2
-rw-r--r--src/enquiry.c2
-rw-r--r--src/filesdb-hash.c2
-rw-r--r--src/filesdb.c2
-rw-r--r--src/infodb-access.c121
-rw-r--r--src/infodb-format.c151
-rw-r--r--src/infodb-upgrade.c253
-rw-r--r--src/infodb.h51
-rw-r--r--src/packages.c2
-rw-r--r--src/querycmd.c2
-rw-r--r--src/remove.c2
-rw-r--r--src/script.c2
-rw-r--r--src/select.c2
-rw-r--r--src/trigproc.c2
-rw-r--r--src/unpack.c2
-rw-r--r--src/verify.c2
18 files changed, 14 insertions, 597 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2d776dd9a..1e9735acd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,7 +27,7 @@ bin_PROGRAMS = \
noinst_HEADERS = \
filesdb.h \
- infodb.h
+ $(nil)
dpkg_SOURCES = \
archives.c archives.h \
@@ -40,9 +40,6 @@ dpkg_SOURCES = \
filesdb-hash.c \
file-match.c file-match.h \
filters.c filters.h \
- infodb-access.c \
- infodb-format.c \
- infodb-upgrade.c \
divertdb.c \
statdb.c \
help.c \
@@ -64,20 +61,16 @@ dpkg_LDADD = \
dpkg_divert_SOURCES = \
filesdb.c \
- infodb-format.c \
divertdb.c \
divertcmd.c
dpkg_query_SOURCES = \
filesdb.c \
- infodb-access.c \
- infodb-format.c \
divertdb.c \
querycmd.c
dpkg_statoverride_SOURCES = \
filesdb.c \
- infodb-format.c \
selinux.c \
statdb.c \
statcmd.c
diff --git a/src/archives.c b/src/archives.c
index 113b76c3d..6d73375ab 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -55,12 +55,12 @@
#include <dpkg/tarfn.h>
#include <dpkg/options.h>
#include <dpkg/triglib.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
#include "main.h"
#include "archives.h"
#include "filters.h"
-#include "infodb.h"
static inline void
fd_writeback_init(int fd)
diff --git a/src/depcon.c b/src/depcon.c
index 398d06a36..560190c1f 100644
--- a/src/depcon.c
+++ b/src/depcon.c
@@ -34,9 +34,9 @@
#include <dpkg/i18n.h>
#include <dpkg/dpkg.h>
#include <dpkg/dpkg-db.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"
struct deppossi_pkg_iterator {
diff --git a/src/enquiry.c b/src/enquiry.c
index 99349ba7c..6182fce7f 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -42,9 +42,9 @@
#include <dpkg/triglib.h>
#include <dpkg/string.h>
#include <dpkg/options.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"
struct audit_problem {
diff --git a/src/filesdb-hash.c b/src/filesdb-hash.c
index 275716009..c04d7a8e6 100644
--- a/src/filesdb-hash.c
+++ b/src/filesdb-hash.c
@@ -35,9 +35,9 @@
#include <dpkg/debug.h>
#include <dpkg/fdio.h>
#include <dpkg/dir.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
/*
* If mask is nonzero, will not write any file whose filenamenode
diff --git a/src/filesdb.c b/src/filesdb.c
index 87bca58e3..8ca613e24 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -49,9 +49,9 @@
#include <dpkg/fdio.h>
#include <dpkg/pkg-array.h>
#include <dpkg/progress.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"
/*** Generic data structures and routines. ***/
diff --git a/src/infodb-access.c b/src/infodb-access.c
deleted file mode 100644
index c28f46da2..000000000
--- a/src/infodb-access.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * dpkg - main program for package management
- * infodb.c - package control information database
- *
- * Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
- * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-#include <compat.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <dirent.h>
-#include <unistd.h>
-
-#include <dpkg/i18n.h>
-#include <dpkg/dpkg.h>
-#include <dpkg/dpkg-db.h>
-#include <dpkg/debug.h>
-
-#include "filesdb.h"
-#include "infodb.h"
-
-bool
-pkg_infodb_has_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
- const char *name)
-{
- const char *filename;
- struct stat stab;
-
- filename = pkg_infodb_get_file(pkg, pkgbin, name);
- if (lstat(filename, &stab) == 0)
- return true;
- else if (errno == ENOENT)
- return false;
- else
- ohshite(_("unable to check existence of '%.250s'"), filename);
-}
-
-void
-pkg_infodb_foreach(struct pkginfo *pkg, struct pkgbin *pkgbin,
- pkg_infodb_file_func *func)
-{
- DIR *db_dir;
- struct dirent *db_de;
- struct varbuf_state db_path_state;
- struct varbuf db_path = VARBUF_INIT;
- const char *pkgname;
- enum pkg_infodb_format db_format;
-
- /* Make sure to always read and verify the format version. */
- db_format = pkg_infodb_get_format();
-
- if (pkgbin->multiarch == PKG_MULTIARCH_SAME &&
- db_format == PKG_INFODB_FORMAT_MULTIARCH)
- pkgname = pkgbin_name(pkg, pkgbin, pnaw_always);
- else
- pkgname = pkgbin_name(pkg, pkgbin, pnaw_never);
-
- varbuf_add_str(&db_path, pkg_infodb_get_dir());
- varbuf_add_char(&db_path, '/');
- varbuf_end_str(&db_path);
- varbuf_snapshot(&db_path, &db_path_state);
-
- db_dir = opendir(db_path.buf);
- if (!db_dir)
- ohshite(_("cannot read info directory"));
-
- push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)db_dir);
- while ((db_de = readdir(db_dir)) != NULL) {
- const char *filename, *filetype, *dot;
-
- debug(dbg_veryverbose, "infodb foreach info file '%s'",
- db_de->d_name);
-
- /* Ignore dotfiles, including ‘.’ and ‘..’. */
- if (db_de->d_name[0] == '.')
- continue;
-
- /* Ignore anything odd. */
- dot = strrchr(db_de->d_name, '.');
- if (dot == NULL)
- continue;
-
- /* Ignore files from other packages. */
- if (strlen(pkgname) != (size_t)(dot - db_de->d_name) ||
- strncmp(db_de->d_name, pkgname, dot - db_de->d_name))
- continue;
-
- debug(dbg_stupidlyverbose, "infodb foreach file this pkg");
-
- /* Skip past the full stop. */
- filetype = dot + 1;
-
- varbuf_rollback(&db_path, &db_path_state);
- varbuf_add_str(&db_path, db_de->d_name);
- varbuf_end_str(&db_path);
- filename = db_path.buf;
-
- func(filename, filetype);
- }
- pop_cleanup(ehflag_normaltidy); /* closedir */
-
- varbuf_destroy(&db_path);
-}
diff --git a/src/infodb-format.c b/src/infodb-format.c
deleted file mode 100644
index 432930890..000000000
--- a/src/infodb-format.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * dpkg - main program for package management
- * infodb-format.c - package control information database format
- *
- * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-#include <compat.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <dpkg/i18n.h>
-#include <dpkg/dpkg.h>
-#include <dpkg/dpkg-db.h>
-#include <dpkg/varbuf.h>
-
-#include "infodb.h"
-
-static enum pkg_infodb_format db_format = PKG_INFODB_FORMAT_UNKNOWN;
-static bool db_upgrading;
-
-static enum pkg_infodb_format
-pkg_infodb_parse_format(const char *file)
-{
- FILE *fp;
- int format;
-
- fp = fopen(file, "r");
- if (fp == NULL) {
- /* A missing format file means legacy format (0). */
- if (errno == ENOENT)
- return PKG_INFODB_FORMAT_LEGACY;
- ohshite(_("error trying to open %.250s"), file);
- }
-
- if (fscanf(fp, "%u", &format) != 1)
- ohshit(_("corrupt info database format file '%s'"), file);
-
- fclose(fp);
-
- return format;
-}
-
-static enum pkg_infodb_format
-pkg_infodb_read_format(void)
-{
- struct atomic_file *file;
- struct stat st;
- char *filename;
-
- filename = dpkg_db_get_path(INFODIR "/format");
- file = atomic_file_new(filename, 0);
-
- db_format = pkg_infodb_parse_format(file->name);
-
- /* Check if a previous upgrade got interrupted. Because we are only
- * supposed to upgrade the db layout one format at a time, if the
- * new file exists that means the new format is just one ahead,
- * we don't try to read it because it contains unreliable data. */
- if (stat(file->name_new, &st) == 0) {
- db_format++;
- db_upgrading = true;
- }
-
- atomic_file_free(file);
- free(filename);
-
- if (db_format < 0 || db_format >= PKG_INFODB_FORMAT_LAST)
- ohshit(_("info database format (%d) is bogus or too new; "
- "try getting a newer dpkg"), db_format);
-
- return db_format;
-}
-
-enum pkg_infodb_format
-pkg_infodb_get_format(void)
-{
- if (db_format > PKG_INFODB_FORMAT_UNKNOWN)
- return db_format;
- else
- return pkg_infodb_read_format();
-}
-
-void
-pkg_infodb_set_format(enum pkg_infodb_format version)
-{
- db_format = version;
-}
-
-bool
-pkg_infodb_is_upgrading(void)
-{
- if (db_format < 0)
- pkg_infodb_read_format();
-
- return db_upgrading;
-}
-
-const char *
-pkg_infodb_get_dir(void)
-{
- static char *infodir;
-
- if (infodir == NULL)
- infodir = dpkg_db_get_path(INFODIR);
-
- return infodir;
-}
-
-const char *
-pkg_infodb_get_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
- const char *filetype)
-{
- static struct varbuf vb;
- enum pkg_infodb_format format;
-
- /* Make sure to always read and verify the format version. */
- format = pkg_infodb_get_format();
-
- varbuf_reset(&vb);
- varbuf_add_str(&vb, pkg_infodb_get_dir());
- varbuf_add_char(&vb, '/');
- varbuf_add_str(&vb, pkg->set->name);
- if (pkgbin->multiarch == PKG_MULTIARCH_SAME &&
- format == PKG_INFODB_FORMAT_MULTIARCH)
- varbuf_add_archqual(&vb, pkgbin->arch);
- varbuf_add_char(&vb, '.');
- varbuf_add_str(&vb, filetype);
- varbuf_end_str(&vb);
-
- return vb.buf;
-}
diff --git a/src/infodb-upgrade.c b/src/infodb-upgrade.c
deleted file mode 100644
index 1a8e144e8..000000000
--- a/src/infodb-upgrade.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * dpkg - main program for package management
- * infodb-upgrade.c - package control information database format upgrade
- *
- * Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
- * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
- * Copyright © 2011 Linaro Limited
- * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-#include <compat.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <dpkg/i18n.h>
-#include <dpkg/dpkg.h>
-#include <dpkg/dpkg-db.h>
-#include <dpkg/path.h>
-#include <dpkg/dir.h>
-
-#include "filesdb.h"
-#include "infodb.h"
-
-struct rename_node {
- struct rename_node *next;
- char *old;
- char *new;
-};
-
-/* Global variables. */
-static struct rename_node *rename_head = NULL;
-
-static struct rename_node *
-rename_node_new(const char *old, const char *new, struct rename_node *next)
-{
- struct rename_node *node;
-
- node = m_malloc(sizeof(*node));
- node->next = next;
- node->old = m_strdup(old);
- node->new = m_strdup(new);
-
- return node;
-}
-
-static void
-rename_node_free(struct rename_node *node)
-{
- free(node->old);
- free(node->new);
- free(node);
-}
-
-static void
-pkg_infodb_link_multiarch_files(void)
-{
- DIR *db_dir;
- struct dirent *db_de;
- struct varbuf pkgname = VARBUF_INIT;
- struct varbuf oldname = VARBUF_INIT;
- struct varbuf newname = VARBUF_INIT;
- struct varbuf_state db_path_state;
-
- varbuf_add_str(&oldname, pkg_infodb_get_dir());
- varbuf_add_char(&oldname, '/');
- varbuf_end_str(&oldname);
- varbuf_snapshot(&oldname, &db_path_state);
-
- varbuf_add_buf(&newname, oldname.buf, oldname.used);
- varbuf_end_str(&newname);
-
- db_dir = opendir(oldname.buf);
- if (!db_dir)
- ohshite(_("cannot read info directory"));
-
- push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)db_dir);
- while ((db_de = readdir(db_dir)) != NULL) {
- const char *filetype, *dot;
- struct pkginfo *pkg;
- struct pkgset *set;
-
- /* Ignore dotfiles, including ‘.’ and ‘..’. */
- if (db_de->d_name[0] == '.')
- continue;
-
- /* Ignore anything odd. */
- dot = strrchr(db_de->d_name, '.');
- if (dot == NULL)
- continue;
-
- varbuf_reset(&pkgname);
- varbuf_add_buf(&pkgname, db_de->d_name, dot - db_de->d_name);
- varbuf_end_str(&pkgname);
-
- /* Skip files already converted. */
- if (strchr(pkgname.buf, ':'))
- continue;
-
- set = pkg_db_find_set(pkgname.buf);
- for (pkg = &set->pkg; pkg; pkg = pkg->arch_next)
- if (pkg->status != PKG_STAT_NOTINSTALLED)
- break;
- if (!pkg) {
- warning(_("info file %s/%s not associated to any package"),
- pkg_infodb_get_dir(), db_de->d_name);
- continue;
- }
-
- /* Does it need to be upgraded? */
- if (pkg->installed.multiarch != PKG_MULTIARCH_SAME)
- continue;
-
- /* Skip past the full stop. */
- filetype = dot + 1;
-
- varbuf_rollback(&oldname, &db_path_state);
- varbuf_add_str(&oldname, db_de->d_name);
- varbuf_end_str(&oldname);
-
- varbuf_rollback(&newname, &db_path_state);
- varbuf_add_pkgbin_name(&newname, pkg, &pkg->installed, pnaw_always);
- varbuf_add_char(&newname, '.');
- varbuf_add_str(&newname, filetype);
- varbuf_end_str(&newname);
-
- if (link(oldname.buf, newname.buf) && errno != EEXIST)
- ohshite(_("error creating hard link '%.255s'"),
- newname.buf);
- rename_head = rename_node_new(oldname.buf, newname.buf, rename_head);
- }
- pop_cleanup(ehflag_normaltidy); /* closedir */
-
- varbuf_destroy(&pkgname);
- varbuf_destroy(&newname);
- varbuf_destroy(&oldname);
-}
-
-static void
-cu_abort_db_upgrade(int argc, void **argv)
-{
- struct atomic_file *file = argv[0];
- struct rename_node *next;
-
- /* Restore the old files if needed and drop the newly created files. */
- while (rename_head) {
- next = rename_head->next;
- if (link(rename_head->new, rename_head->old) && errno != EEXIST)
- ohshite(_("error creating hard link '%.255s'"),
- rename_head->old);
- if (unlink(rename_head->new))
- ohshite(_("cannot remove '%.250s'"), rename_head->new);
- rename_node_free(rename_head);
- rename_head = next;
- }
- if (unlink(file->name_new) && errno != ENOENT)
- ohshite(_("cannot remove '%.250s'"), file->name_new);
-
- atomic_file_free(file);
-}
-
-static void
-pkg_infodb_write_format(struct atomic_file *file, int version)
-{
- if (fprintf(file->fp, "%d\n", version) < 0)
- ohshite(_("error while writing '%s'"), file->name_new);
-
- atomic_file_sync(file);
- atomic_file_close(file);
- dir_sync_path_parent(file->name);
-
- pkg_infodb_set_format(version);
-}
-
-static void
-pkg_infodb_unlink_monoarch_files(void)
-{
- struct rename_node *next;
-
- while (rename_head) {
- next = rename_head->next;
- if (unlink(rename_head->old))
- ohshite(_("cannot remove '%.250s'"), rename_head->old);
- rename_node_free(rename_head);
- rename_head = next;
- }
-}
-
-static void
-pkg_infodb_upgrade_to_multiarch(void)
-{
- struct atomic_file *db_file;
- char *db_format_file;
-
- db_format_file = dpkg_db_get_path(INFODIR "/format");
- db_file = atomic_file_new(db_format_file, 0);
- atomic_file_open(db_file);
-
- push_cleanup(cu_abort_db_upgrade, ehflag_bombout, NULL, 0, 1, db_file);
-
- pkg_infodb_link_multiarch_files();
- pkg_infodb_write_format(db_file, 1);
-
- pkg_infodb_unlink_monoarch_files();
- atomic_file_commit(db_file);
- dir_sync_path(pkg_infodb_get_dir());
-
- pop_cleanup(ehflag_normaltidy);
-
- atomic_file_free(db_file);
- free(db_format_file);
-}
-
-/**
- * Upgrade the infodb if there's the need and possibility.
- *
- * Currently this implies, that the modstatdb was opened for writing and:
- * - previous upgrade has not been completed; or
- * - current format is not the latest one.
- */
-void
-pkg_infodb_upgrade(void)
-{
- enum pkg_infodb_format db_format;
-
- /* Make sure to always read and verify the format version. */
- db_format = pkg_infodb_get_format();
-
- if (modstatdb_get_status() < msdbrw_write)
- return;
-
- if (db_format < PKG_INFODB_FORMAT_MULTIARCH ||
- pkg_infodb_is_upgrading())
- pkg_infodb_upgrade_to_multiarch();
-}
diff --git a/src/infodb.h b/src/infodb.h
deleted file mode 100644
index 472011cc3..000000000
--- a/src/infodb.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * dpkg - main program for package management
- * infodb.h - package control information database
- *
- * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-#ifndef DPKG_INFODB_H
-#define DPKG_INFODB_H
-
-#include <stdbool.h>
-
-#include <dpkg/dpkg-db.h>
-
-enum pkg_infodb_format {
- PKG_INFODB_FORMAT_UNKNOWN = -1,
- PKG_INFODB_FORMAT_LEGACY = 0,
- PKG_INFODB_FORMAT_MULTIARCH = 1,
- PKG_INFODB_FORMAT_LAST,
-};
-
-enum pkg_infodb_format pkg_infodb_get_format(void);
-void pkg_infodb_set_format(enum pkg_infodb_format format);
-bool pkg_infodb_is_upgrading(void);
-void pkg_infodb_upgrade(void);
-
-const char *pkg_infodb_get_dir(void);
-const char *pkg_infodb_get_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
- const char *filetype);
-bool pkg_infodb_has_file(struct pkginfo *pkg, struct pkgbin *pkgbin,
- const char *name);
-
-typedef void pkg_infodb_file_func(const char *filename, const char *filetype);
-
-void pkg_infodb_foreach(struct pkginfo *pkg, struct pkgbin *pkgbin,
- pkg_infodb_file_func *func);
-
-#endif /* DPKG_INFODB_H */
diff --git a/src/packages.c b/src/packages.c
index ae001757f..da221c093 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -41,9 +41,9 @@
#include <dpkg/pkg-queue.h>
#include <dpkg/string.h>
#include <dpkg/options.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"
static struct pkginfo *progress_bytrigproc;
diff --git a/src/querycmd.c b/src/querycmd.c
index 127f0c883..67b84b20a 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -54,9 +54,9 @@
#include <dpkg/path.h>
#include <dpkg/file.h>
#include <dpkg/options.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"
static const char *showformat = "${binary:Package}\t${Version}\n";
diff --git a/src/remove.c b/src/remove.c
index 9cfd7d044..45c9a9e3e 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -42,8 +42,8 @@
#include <dpkg/dir.h>
#include <dpkg/options.h>
#include <dpkg/triglib.h>
+#include <dpkg/db-ctrl.h>
-#include "infodb.h"
#include "filesdb.h"
#include "main.h"
diff --git a/src/script.c b/src/script.c
index ecf4a94a1..bb5f9825c 100644
--- a/src/script.c
+++ b/src/script.c
@@ -42,9 +42,9 @@
#include <dpkg/subproc.h>
#include <dpkg/command.h>
#include <dpkg/triglib.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"
void
diff --git a/src/select.c b/src/select.c
index 6faf67df3..ebdb13b7f 100644
--- a/src/select.c
+++ b/src/select.c
@@ -37,9 +37,9 @@
#include <dpkg/pkg-show.h>
#include <dpkg/pkg-spec.h>
#include <dpkg/options.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"
static void getsel1package(struct pkginfo *pkg) {
diff --git a/src/trigproc.c b/src/trigproc.c
index 7b6537bb4..70a42eaa2 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -33,11 +33,11 @@
#include <dpkg/dpkg-db.h>
#include <dpkg/pkg.h>
#include <dpkg/pkg-queue.h>
+#include <dpkg/db-ctrl.h>
#include <dpkg/triglib.h>
#include "main.h"
#include "filesdb.h"
-#include "infodb.h"
/*
* Trigger processing algorithms:
diff --git a/src/unpack.c b/src/unpack.c
index f43c01e45..ae0e12132 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -51,11 +51,11 @@
#include <dpkg/dir.h>
#include <dpkg/tarfn.h>
#include <dpkg/options.h>
+#include <dpkg/db-ctrl.h>
#include <dpkg/triglib.h>
#include "filesdb.h"
#include "file-match.h"
-#include "infodb.h"
#include "main.h"
#include "archives.h"
diff --git a/src/verify.c b/src/verify.c
index e68ec7b44..2698fc216 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -29,9 +29,9 @@
#include <dpkg/dpkg.h>
#include <dpkg/dpkg-db.h>
#include <dpkg/options.h>
+#include <dpkg/db-ctrl.h>
#include "filesdb.h"
-#include "infodb.h"
#include "main.h"