This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=eed3a9097deb1be5251cd31fbf9ec4d482a155d1

commit eed3a9097deb1be5251cd31fbf9ec4d482a155d1
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Fri Apr 6 01:14:42 2018 +0200

    libdpkg: Move db-fsys code from src to lib/dpkg
    
    This will prepare the ground for external programs to start using
    libdpkg to access the dpkg fsys database via a proper API, instead
    of messing with the on-disk layout in so many improper ways.
---
 debian/changelog                                |  1 +
 lib/dpkg/Makefile.am                            |  5 +++++
 src/filesdb-hash.c => lib/dpkg/db-fsys-digest.c |  7 +++----
 src/divertdb.c => lib/dpkg/db-fsys-divert.c     |  7 +++----
 src/filesdb.c => lib/dpkg/db-fsys-files.c       |  9 ++++-----
 src/statdb.c => lib/dpkg/db-fsys-override.c     |  7 +++----
 src/filesdb.h => lib/dpkg/db-fsys.h             | 10 +++++-----
 lib/dpkg/libdpkg.map                            | 17 +++++++++++++++++
 po/POTFILES.in                                  |  8 ++++----
 src/Makefile.am                                 | 14 --------------
 src/archives.c                                  |  2 +-
 src/cleanup.c                                   |  2 +-
 src/configure.c                                 |  2 +-
 src/depcon.c                                    |  2 +-
 src/divertcmd.c                                 |  3 +--
 src/enquiry.c                                   |  2 +-
 src/filters.c                                   |  2 +-
 src/help.c                                      |  2 +-
 src/main.c                                      |  2 +-
 src/main.h                                      |  2 +-
 src/packages.c                                  |  2 +-
 src/querycmd.c                                  |  2 +-
 src/remove.c                                    |  2 +-
 src/script.c                                    |  2 +-
 src/select.c                                    |  2 +-
 src/statcmd.c                                   |  2 +-
 src/trigproc.c                                  |  2 +-
 src/unpack.c                                    |  2 +-
 src/verify.c                                    |  2 +-
 29 files changed, 64 insertions(+), 60 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d9985ff11..389afc626 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -182,6 +182,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
       before using it.
     - libdpkg: Move files list information from dpkg clientdata to pkginfo.
     - dpkg: Move ensure_package_clientdata() into its own file.
+    - libdpkg: Move db-fsys code from src to lib/dpkg.
   * Build system:
     - Set distribution tarball format to ustar, instead of default v7 format.
     - Mark PO4A and POD2MAN as precious variables.
diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index 22cef8266..e3d68576c 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -56,6 +56,10 @@ libdpkg_la_SOURCES = \
        db-ctrl-access.c \
        db-ctrl-format.c \
        db-ctrl-upgrade.c \
+       db-fsys-digest.c \
+       db-fsys-divert.c \
+       db-fsys-files.c \
+       db-fsys-override.c \
        deb-version.c \
        debug.c \
        depcon.c \
@@ -118,6 +122,7 @@ pkginclude_HEADERS = \
        command.h \
        compress.h \
        db-ctrl.h \
+       db-fsys.h \
        deb-version.h \
        debug.h \
        dir.h \
diff --git a/src/filesdb-hash.c b/lib/dpkg/db-fsys-digest.c
similarity index 97%
rename from src/filesdb-hash.c
rename to lib/dpkg/db-fsys-digest.c
index c04d7a8e6..05137c2f2 100644
--- a/src/filesdb-hash.c
+++ b/lib/dpkg/db-fsys-digest.c
@@ -1,6 +1,6 @@
 /*
- * dpkg - main program for package management
- * filesdb-hash.c - management of database of files installed on system
+ * libdpkg - Debian packaging suite library routines
+ * db-fsys-digest.c - management of filesystem digests database
  *
  * Copyright © 2012-2014 Guillem Jover <guil...@debian.org>
  *
@@ -36,8 +36,7 @@
 #include <dpkg/fdio.h>
 #include <dpkg/dir.h>
 #include <dpkg/db-ctrl.h>
-
-#include "filesdb.h"
+#include <dpkg/db-fsys.h>
 
 /*
  * If mask is nonzero, will not write any file whose filenamenode
diff --git a/src/divertdb.c b/lib/dpkg/db-fsys-divert.c
similarity index 96%
rename from src/divertdb.c
rename to lib/dpkg/db-fsys-divert.c
index a056e8296..775662382 100644
--- a/src/divertdb.c
+++ b/lib/dpkg/db-fsys-divert.c
@@ -1,6 +1,6 @@
 /*
- * dpkg - main program for package management
- * divertdb.c - management of database of diverted files
+ * libdpkg - Debian packaging suite library routines
+ * db-fsys-divert.c - management of filesystem diverted files database
  *
  * Copyright © 1995 Ian Jackson <ijack...@chiark.greenend.org.uk>
  * Copyright © 2000, 2001 Wichert Akkerman <wakke...@debian.org>
@@ -37,8 +37,7 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
 #include <dpkg/debug.h>
-
-#include "filesdb.h"
+#include <dpkg/db-fsys.h>
 
 static struct diversion *diversions = NULL;
 static char *diversionsname;
diff --git a/src/filesdb.c b/lib/dpkg/db-fsys-files.c
similarity index 98%
rename from src/filesdb.c
rename to lib/dpkg/db-fsys-files.c
index 8421d327e..6290ed283 100644
--- a/src/filesdb.c
+++ b/lib/dpkg/db-fsys-files.c
@@ -1,6 +1,6 @@
 /*
- * dpkg - main program for package management
- * filesdb.c - management of database of files installed on system
+ * libdpkg - Debian packaging suite library routines
+ * db-fsys-files.c - management of filesystem files database
  *
  * Copyright © 1995 Ian Jackson <ijack...@chiark.greenend.org.uk>
  * Copyright © 2000,2001 Wichert Akkerman <wakke...@debian.org>
@@ -48,11 +48,10 @@
 #include <dpkg/dir.h>
 #include <dpkg/fdio.h>
 #include <dpkg/pkg-array.h>
+#include <dpkg/pkg-list.h>
 #include <dpkg/progress.h>
 #include <dpkg/db-ctrl.h>
-
-#include "filesdb.h"
-#include "main.h"
+#include <dpkg/db-fsys.h>
 
 /*** Generic data structures and routines. ***/
 
diff --git a/src/statdb.c b/lib/dpkg/db-fsys-override.c
similarity index 97%
rename from src/statdb.c
rename to lib/dpkg/db-fsys-override.c
index 042f1bb1e..10a8a273d 100644
--- a/src/statdb.c
+++ b/lib/dpkg/db-fsys-override.c
@@ -1,6 +1,6 @@
 /*
- * dpkg - main program for package management
- * statdb.c - management of database of ownership and mode of files
+ * libdpkg - Debian packaging suite library routines
+ * db-fsys-override.c - management of filesystem stat overrides database
  *
  * Copyright © 1995 Ian Jackson <ijack...@chiark.greenend.org.uk>
  * Copyright © 2000, 2001 Wichert Akkerman <wakke...@debian.org>
@@ -39,8 +39,7 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/fdio.h>
 #include <dpkg/debug.h>
-
-#include "filesdb.h"
+#include <dpkg/db-fsys.h>
 
 static char *statoverridename;
 
diff --git a/src/filesdb.h b/lib/dpkg/db-fsys.h
similarity index 92%
rename from src/filesdb.h
rename to lib/dpkg/db-fsys.h
index f38fdd245..35c971552 100644
--- a/src/filesdb.h
+++ b/lib/dpkg/db-fsys.h
@@ -1,6 +1,6 @@
 /*
- * dpkg - main program for package management
- * filesdb.h - management of database of files installed on system
+ * libdpkg - Debian packaging suite library routines
+ * db-fsys.h - management of database of files installed on system
  *
  * Copyright © 1995 Ian Jackson <ijack...@chiark.greenend.org.uk>
  * Copyright © 2008-2014 Guillem Jover <guil...@debian.org>
@@ -19,8 +19,8 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef FILESDB_H
-#define FILESDB_H
+#ifndef LIBDPKG_DB_FSYS_H
+#define LIBDPKG_DB_FSYS_H
 
 #include <dpkg/file.h>
 #include <dpkg/fsys.h>
@@ -72,4 +72,4 @@ void write_filelist_except(struct pkginfo *pkg, struct pkgbin 
*pkgbin,
 void write_filehash_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
                            struct fileinlist *list, enum filenamenode_flags 
mask);
 
-#endif /* FILESDB_H */
+#endif /* LIBDPKG_DB_FSYS_H */
diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map
index 6260f7456..cf176d6c9 100644
--- a/lib/dpkg/libdpkg.map
+++ b/lib/dpkg/libdpkg.map
@@ -390,6 +390,9 @@ LIBDPKG_PRIVATE {
        pkg_infodb_has_file;
        pkg_infodb_upgrade;
 
+       # Package on-disk diversion database support
+       ensure_diversions;
+
        # Filesystem node hash support
        filesdbinit;
        files_db_reset;
@@ -408,6 +411,20 @@ LIBDPKG_PRIVATE {
        filepackages_iter_next;
        filepackages_iter_free;
 
+       # Package on-disk filesystem database support
+       parse_filehash;
+       write_filelist_except;
+       write_filehash_except;
+       ensure_packagefiles_available;
+       ensure_allinstfiles_available;
+       ensure_allinstfiles_available_quiet;
+
+       # Package on-disk stat override database support
+       statdb_parse_uid;
+       statdb_parse_gid;
+       statdb_parse_mode;
+       ensure_statoverrides;
+
        # Triggers support
        trig_name_is_illegal;
        trigdef_set_methods;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index bc549a21c..8aeef181e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,6 +14,10 @@ lib/dpkg/dbmodify.c
 lib/dpkg/db-ctrl-access.c
 lib/dpkg/db-ctrl-format.c
 lib/dpkg/db-ctrl-upgrade.c
+lib/dpkg/db-fsys-digest.c
+lib/dpkg/db-fsys-divert.c
+lib/dpkg/db-fsys-files.c
+lib/dpkg/db-fsys-override.c
 lib/dpkg/deb-version.c
 lib/dpkg/debug.c
 lib/dpkg/depcon.c
@@ -70,12 +74,9 @@ src/cleanup.c
 src/configure.c
 src/depcon.c
 src/divertcmd.c
-src/divertdb.c
 src/enquiry.c
 src/errors.c
 src/file-match.c
-src/filesdb-hash.c
-src/filesdb.c
 src/filters.c
 src/help.c
 src/main.c
@@ -87,7 +88,6 @@ src/script.c
 src/select.c
 src/selinux.c
 src/statcmd.c
-src/statdb.c
 src/trigcmd.c
 src/trigproc.c
 src/unpack.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 38b725169..e6c957062 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,10 +25,6 @@ bin_PROGRAMS = \
        dpkg-statoverride \
        dpkg-trigger
 
-noinst_HEADERS = \
-       filesdb.h \
-       $(nil)
-
 dpkg_SOURCES = \
        archives.c archives.h \
        cleanup.c \
@@ -36,12 +32,8 @@ dpkg_SOURCES = \
        depcon.c \
        enquiry.c \
        errors.c \
-       filesdb.c \
-       filesdb-hash.c \
        file-match.c file-match.h \
        filters.c filters.h \
-       divertdb.c \
-       statdb.c \
        help.c \
        main.c main.h \
        packages.c \
@@ -61,19 +53,13 @@ dpkg_LDADD = \
        $(SELINUX_LIBS)
 
 dpkg_divert_SOURCES = \
-       filesdb.c \
-       divertdb.c \
        divertcmd.c
 
 dpkg_query_SOURCES = \
-       filesdb.c \
-       divertdb.c \
        querycmd.c
 
 dpkg_statoverride_SOURCES = \
-       filesdb.c \
        selinux.c \
-       statdb.c \
        statcmd.c
 
 dpkg_statoverride_LDADD = \
diff --git a/src/archives.c b/src/archives.c
index c80db7fcd..4c5fb8897 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -56,8 +56,8 @@
 #include <dpkg/options.h>
 #include <dpkg/triglib.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 #include "archives.h"
 #include "filters.h"
diff --git a/src/cleanup.c b/src/cleanup.c
index ded8219c0..cbc690de9 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -40,8 +40,8 @@
 #include <dpkg/pkg.h>
 #include <dpkg/path.h>
 #include <dpkg/options.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 #include "archives.h"
 
diff --git a/src/configure.c b/src/configure.c
index 720812b38..2d9173eba 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -53,8 +53,8 @@
 #include <dpkg/subproc.h>
 #include <dpkg/command.h>
 #include <dpkg/triglib.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 enum conffopt {
diff --git a/src/depcon.c b/src/depcon.c
index 55f08ef08..a34384da7 100644
--- a/src/depcon.c
+++ b/src/depcon.c
@@ -35,8 +35,8 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 struct deppossi_pkg_iterator {
diff --git a/src/divertcmd.c b/src/divertcmd.c
index 170c9e93e..d50409d02 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -45,8 +45,7 @@
 #include <dpkg/glob.h>
 #include <dpkg/buffer.h>
 #include <dpkg/options.h>
-
-#include "filesdb.h"
+#include <dpkg/db-fsys.h>
 
 
 static const char printforhelp[] = N_(
diff --git a/src/enquiry.c b/src/enquiry.c
index 9da4160d5..baf26daab 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -43,8 +43,8 @@
 #include <dpkg/string.h>
 #include <dpkg/options.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 struct audit_problem {
diff --git a/src/filters.c b/src/filters.c
index 2b8b43263..f770fb74c 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -29,9 +29,9 @@
 #include <dpkg/i18n.h>
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
+#include <dpkg/db-fsys.h>
 
 #include "main.h"
-#include "filesdb.h"
 #include "filters.h"
 
 struct filter_node {
diff --git a/src/help.c b/src/help.c
index c5b06b4b6..cfcdd8ebf 100644
--- a/src/help.c
+++ b/src/help.c
@@ -34,8 +34,8 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
 #include <dpkg/path.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 const char *const statusstrings[]= {
diff --git a/src/main.c b/src/main.c
index 9710f08dd..0a45f812e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,9 +50,9 @@
 #include <dpkg/subproc.h>
 #include <dpkg/command.h>
 #include <dpkg/options.h>
+#include <dpkg/db-fsys.h>
 
 #include "main.h"
-#include "filesdb.h"
 #include "filters.h"
 
 static void DPKG_ATTR_NORET
diff --git a/src/main.h b/src/main.h
index bc3f07a65..319d8afd0 100644
--- a/src/main.h
+++ b/src/main.h
@@ -25,7 +25,7 @@
 #include <dpkg/debug.h>
 #include <dpkg/pkg-list.h>
 
-/* These two are defined in filesdb.h. */
+/* These two are defined in <dpkg/fsys.h>. */
 struct fileinlist;
 struct filenamenode;
 
diff --git a/src/packages.c b/src/packages.c
index b78d6ffe9..f735ec3e1 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -42,8 +42,8 @@
 #include <dpkg/string.h>
 #include <dpkg/options.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 static struct pkginfo *progress_bytrigproc;
diff --git a/src/querycmd.c b/src/querycmd.c
index 555bccd3e..76ab99e66 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -55,8 +55,8 @@
 #include <dpkg/file.h>
 #include <dpkg/options.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 static const char *showformat = "${binary:Package}\t${Version}\n";
diff --git a/src/remove.c b/src/remove.c
index 735c9e0f3..18d470aea 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -43,8 +43,8 @@
 #include <dpkg/options.h>
 #include <dpkg/triglib.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 /*
diff --git a/src/script.c b/src/script.c
index bb5f9825c..fc6f6117e 100644
--- a/src/script.c
+++ b/src/script.c
@@ -43,8 +43,8 @@
 #include <dpkg/command.h>
 #include <dpkg/triglib.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 void
diff --git a/src/select.c b/src/select.c
index ebdb13b7f..3eae4cbcf 100644
--- a/src/select.c
+++ b/src/select.c
@@ -38,8 +38,8 @@
 #include <dpkg/pkg-spec.h>
 #include <dpkg/options.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 static void getsel1package(struct pkginfo *pkg) {
diff --git a/src/statcmd.c b/src/statcmd.c
index af8a2f756..b7ca09eeb 100644
--- a/src/statcmd.c
+++ b/src/statcmd.c
@@ -43,10 +43,10 @@
 #include <dpkg/path.h>
 #include <dpkg/dir.h>
 #include <dpkg/glob.h>
+#include <dpkg/db-fsys.h>
 #include <dpkg/options.h>
 
 #include "main.h"
-#include "filesdb.h"
 
 static const char printforhelp[] = N_(
 "Use --help for help about overriding file stat information.");
diff --git a/src/trigproc.c b/src/trigproc.c
index ef59455e3..4aee33a80 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -34,10 +34,10 @@
 #include <dpkg/pkg.h>
 #include <dpkg/pkg-queue.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 #include <dpkg/triglib.h>
 
 #include "main.h"
-#include "filesdb.h"
 
 /*
  * Trigger processing algorithms:
diff --git a/src/unpack.c b/src/unpack.c
index 2fb138691..827211d63 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -52,9 +52,9 @@
 #include <dpkg/tarfn.h>
 #include <dpkg/options.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 #include <dpkg/triglib.h>
 
-#include "filesdb.h"
 #include "file-match.h"
 #include "main.h"
 #include "archives.h"
diff --git a/src/verify.c b/src/verify.c
index a4eb86ae7..6067fb1ac 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -30,8 +30,8 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/options.h>
 #include <dpkg/db-ctrl.h>
+#include <dpkg/db-fsys.h>
 
-#include "filesdb.h"
 #include "main.h"
 
 

-- 
Dpkg.Org's dpkg

Reply via email to