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=7ab849d1a814b2d2b2e29f9965fb5d51b654265a

commit 7ab849d1a814b2d2b2e29f9965fb5d51b654265a
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Fri May 4 05:04:01 2018 +0200

    libdpkg: Rename struct pkginfo files member to archives
    
    Rename matching types and macros, so that the purpose of the symbols
    is clear, and to open the way for moving the fsys files list from the
    dpkg clientdata.
---
 debian/changelog     |  1 +
 dpkg-deb/info.c      |  4 ++--
 dselect/pkglist.cc   |  2 +-
 lib/dpkg/dpkg-db.h   | 11 ++++++-----
 lib/dpkg/dump.c      | 18 +++++++++---------
 lib/dpkg/fields.c    | 22 +++++++++++-----------
 lib/dpkg/parse.c     | 14 +++++++-------
 lib/dpkg/parsedump.h | 11 ++++++++---
 lib/dpkg/pkg.c       |  2 +-
 src/enquiry.c        |  6 +++---
 src/querycmd.c       |  2 +-
 src/unpack.c         | 14 ++++++++------
 12 files changed, 58 insertions(+), 49 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 118a3d2e8..c29836791 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -176,6 +176,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
       new pkgbin_name_archqual() function.
     - libdpkg: Add new pkg_name() and pkgbin_name() const variants.
     - libdpkg, dselect: Use new pkg_name_const() and pkgbin_name_const().
+    - libdpkg: Rename struct pkginfo files member to archives.
   * Build system:
     - Set distribution tarball format to ustar, instead of default v7 format.
     - Mark PO4A and POD2MAN as precious variables.
diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index 0229f3a91..8169507c5 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -207,7 +207,7 @@ info_field(const char *debar, const char *dir, const char 
*const *fields,
   int i;
 
   controlfile = str_fmt("%s/%s", dir, CONTROLFILE);
-  parsedb(controlfile, pdb_parse_binary | pdb_ignorefiles, &pkg);
+  parsedb(controlfile, pdb_parse_binary | pdb_ignore_archives, &pkg);
   free(controlfile);
 
   for (i = 0; fields[i]; i++) {
@@ -252,7 +252,7 @@ do_showinfo(const char *const *argv)
   info_prepare(&argv, &debar, &dir, 1);
 
   controlfile  = str_fmt("%s/%s", dir, CONTROLFILE);
-  parsedb(controlfile, pdb_parse_binary | pdb_ignorefiles, &pkg);
+  parsedb(controlfile, pdb_parse_binary | pdb_ignore_archives, &pkg);
   pkg_format_show(fmt, pkg, &pkg->available);
   pkg_format_free(fmt);
   free(controlfile);
diff --git a/dselect/pkglist.cc b/dselect/pkglist.cc
index cb144e773..ced7487d6 100644
--- a/dselect/pkglist.cc
+++ b/dselect/pkglist.cc
@@ -400,7 +400,7 @@ packagelist::packagelist(keybindings *kb) : baselist(kb) {
     struct perpackagestate *state= &datatable[nitems];
     state->pkg= pkg;
     if (pkg->status == PKG_STAT_NOTINSTALLED &&
-        !pkg->files &&
+        !pkg->archives &&
         pkg->want != PKG_WANT_INSTALL) {
       pkg->clientdata = nullptr;
       continue;
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index de8745b02..caa0cf0a2 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -84,8 +84,8 @@ struct conffile {
   bool obsolete;
 };
 
-struct filedetails {
-  struct filedetails *next;
+struct archivedetails {
+  struct archivedetails *next;
   const char *name;
   const char *msdosname;
   const char *size;
@@ -204,11 +204,12 @@ struct pkginfo {
   const char *otherpriority;
   const char *section;
   struct dpkg_version configversion;
-  struct filedetails *files;
   struct pkgbin installed;
   struct pkgbin available;
   struct perpackagestate *clientdata;
 
+  struct archivedetails *archives;
+
   struct {
     /* ->aw == this */
     struct trigaw *head, *tail;
@@ -307,8 +308,8 @@ enum parsedbflags {
   pdb_rejectstatus             = DPKG_BIT(2),
   /** Ignore priority/section info if we already have any. */
   pdb_weakclassification       = DPKG_BIT(3),
-  /** Ignore files info if we already have them. */
-  pdb_ignorefiles              = DPKG_BIT(4),
+  /** Ignore archives info if we already have them. */
+  pdb_ignore_archives          = DPKG_BIT(4),
   /** Ignore packages with older versions already read. */
   pdb_ignoreolder              = DPKG_BIT(5),
   /** Perform laxer version parsing. */
diff --git a/lib/dpkg/dump.c b/lib/dpkg/dump.c
index a5f040184..b70023c9e 100644
--- a/lib/dpkg/dump.c
+++ b/lib/dpkg/dump.c
@@ -140,16 +140,16 @@ w_charfield(struct varbuf *vb,
 }
 
 void
-w_filecharf(struct varbuf *vb,
-            const struct pkginfo *pkg, const struct pkgbin *pkgbin,
-            enum fwriteflags flags, const struct fieldinfo *fip)
+w_archives(struct varbuf *vb,
+           const struct pkginfo *pkg, const struct pkgbin *pkgbin,
+           enum fwriteflags flags, const struct fieldinfo *fip)
 {
-  struct filedetails *fdp;
+  struct archivedetails *archive;
 
   if (pkgbin != &pkg->available)
     return;
-  fdp = pkg->files;
-  if (!fdp || !STRUCTFIELD(fdp, fip->integer, const char *))
+  archive = pkg->archives;
+  if (!archive || !STRUCTFIELD(archive, fip->integer, const char *))
     return;
 
   if (flags&fw_printheader) {
@@ -157,10 +157,10 @@ w_filecharf(struct varbuf *vb,
     varbuf_add_char(vb, ':');
   }
 
-  while (fdp) {
+  while (archive) {
     varbuf_add_char(vb, ' ');
-    varbuf_add_str(vb, STRUCTFIELD(fdp, fip->integer, const char *));
-    fdp= fdp->next;
+    varbuf_add_str(vb, STRUCTFIELD(archive, fip->integer, const char *));
+    archive = archive->next;
   }
 
   if (flags&fw_printheader)
diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c
index aeb22b46c..cfa1075b2 100644
--- a/lib/dpkg/fields.c
+++ b/lib/dpkg/fields.c
@@ -109,22 +109,22 @@ f_name(struct pkginfo *pkg, struct pkgbin *pkgbin,
 }
 
 void
-f_filecharf(struct pkginfo *pkg, struct pkgbin *pkgbin,
-            struct parsedb_state *ps,
-            const char *value, const struct fieldinfo *fip)
+f_archives(struct pkginfo *pkg, struct pkgbin *pkgbin,
+           struct parsedb_state *ps,
+           const char *value, const struct fieldinfo *fip)
 {
-  struct filedetails *fdp, **fdpp;
+  struct archivedetails *fdp, **fdpp;
   char *cpos, *space;
   int allowextend;
 
   if (!*value)
-    parse_error(ps, _("empty file details field '%s'"), fip->name);
+    parse_error(ps, _("empty archive details field '%s'"), fip->name);
   if (!(ps->flags & pdb_recordavailable))
     parse_error(ps,
-                _("file details field '%s' not allowed in status file"),
+                _("archive details field '%s' not allowed in status file"),
                fip->name);
-  allowextend = !pkg->files;
-  fdpp = &pkg->files;
+  allowextend = !pkg->archives;
+  fdpp = &pkg->archives;
   cpos= nfstrsave(value);
   while (*cpos) {
     space = cpos;
@@ -136,9 +136,9 @@ f_filecharf(struct pkginfo *pkg, struct pkgbin *pkgbin,
     if (!fdp) {
       if (!allowextend)
         parse_error(ps,
-                    _("too many values in file details field '%s' "
+                    _("too many values in archive details field '%s' "
                       "(compared to others)"), fip->name);
-      fdp= nfmalloc(sizeof(struct filedetails));
+      fdp = nfmalloc(sizeof(struct archivedetails));
       fdp->next= NULL;
       fdp->name= fdp->msdosname= fdp->size= fdp->md5sum= NULL;
       *fdpp= fdp;
@@ -151,7 +151,7 @@ f_filecharf(struct pkginfo *pkg, struct pkgbin *pkgbin,
   }
   if (*fdpp)
     parse_error(ps,
-                _("too few values in file details field '%s' "
+                _("too few values in archive details field '%s' "
                   "(compared to others)"), fip->name);
 }
 
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index b0db8179d..d9daa112c 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -76,10 +76,10 @@ const struct fieldinfo fieldinfos[]= {
   { FIELD("Conflicts"),        f_dependency,      w_dependency,     
dep_conflicts            },
   { FIELD("Enhances"),         f_dependency,      w_dependency,     
dep_enhances             },
   { FIELD("Conffiles"),        f_conffiles,       w_conffiles                  
              },
-  { FIELD("Filename"),         f_filecharf,       w_filecharf,      
FILEFOFF(name)           },
-  { FIELD("Size"),             f_filecharf,       w_filecharf,      
FILEFOFF(size)           },
-  { FIELD("MD5sum"),           f_filecharf,       w_filecharf,      
FILEFOFF(md5sum)         },
-  { FIELD("MSDOS-Filename"),   f_filecharf,       w_filecharf,      
FILEFOFF(msdosname)      },
+  { FIELD("Filename"),         f_archives,        w_archives,       
ARCHIVEFOFF(name)        },
+  { FIELD("Size"),             f_archives,        w_archives,       
ARCHIVEFOFF(size)        },
+  { FIELD("MD5sum"),           f_archives,        w_archives,       
ARCHIVEFOFF(md5sum)      },
+  { FIELD("MSDOS-Filename"),   f_archives,        w_archives,       
ARCHIVEFOFF(msdosname)   },
   { FIELD("Description"),      f_charfield,       w_charfield,      
PKGIFPOFF(description)   },
   { FIELD("Triggers-Pending"), f_trigpend,        w_trigpend                   
              },
   { FIELD("Triggers-Awaited"), f_trigaw,          w_trigaw                     
              },
@@ -480,7 +480,7 @@ pkg_parse_copy(struct parsedb_state *ps,
     pkg_copy_eflags(dst_pkg, src_pkg);
     pkg_set_status(dst_pkg, src_pkg->status);
     dst_pkg->configversion = src_pkg->configversion;
-    dst_pkg->files = NULL;
+    dst_pkg->archives = NULL;
 
     dst_pkg->trigpend_head = src_pkg->trigpend_head;
     dst_pkg->trigaw = src_pkg->trigaw;
@@ -493,8 +493,8 @@ pkg_parse_copy(struct parsedb_state *ps,
       /* ->othertrigaw_head is updated by trig_note_aw in *(pkg_db_find())
        * rather than in dst_pkg. */
     }
-  } else if (!(ps->flags & pdb_ignorefiles)) {
-    dst_pkg->files = src_pkg->files;
+  } else if (!(ps->flags & pdb_ignore_archives)) {
+    dst_pkg->archives = src_pkg->archives;
   }
 }
 
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index 336f35f7f..2a857c47d 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -89,17 +89,22 @@ bool parse_stanza(struct parsedb_state *ps, struct 
field_state *fs,
 #define STRUCTFIELD(klass, off, type) (*(type *)((uintptr_t)(klass) + (off)))
 
 #define PKGIFPOFF(f) (offsetof(struct pkgbin, f))
-#define FILEFOFF(f) (offsetof(struct filedetails, f))
+#define ARCHIVEFOFF(f) (offsetof(struct archivedetails, f))
 
 typedef void freadfunction(struct pkginfo *pkg, struct pkgbin *pkgbin,
                            struct parsedb_state *ps,
                            const char *value, const struct fieldinfo *fip);
-freadfunction f_name, f_charfield, f_priority, f_section, f_status, 
f_filecharf;
+freadfunction f_name;
+freadfunction f_charfield;
+freadfunction f_priority;
+freadfunction f_section;
+freadfunction f_status;
 freadfunction f_boolean, f_dependency, f_conffiles, f_version, f_revision;
 freadfunction f_configversion;
 freadfunction f_multiarch;
 freadfunction f_architecture;
 freadfunction f_trigpend, f_trigaw;
+freadfunction f_archives;
 
 enum fwriteflags {
        /** Print field header and trailing newline. */
@@ -113,8 +118,8 @@ fwritefunction w_name, w_charfield, w_priority, w_section, 
w_status, w_configver
 fwritefunction w_version, w_null, w_booleandefno, w_dependency, w_conffiles;
 fwritefunction w_multiarch;
 fwritefunction w_architecture;
-fwritefunction w_filecharf;
 fwritefunction w_trigpend, w_trigaw;
+fwritefunction w_archives;
 
 void
 varbuf_add_arbfield(struct varbuf *vb, const struct arbitraryfield *arbfield,
diff --git a/lib/dpkg/pkg.c b/lib/dpkg/pkg.c
index 4f1828bbc..711df8fd8 100644
--- a/lib/dpkg/pkg.c
+++ b/lib/dpkg/pkg.c
@@ -123,7 +123,7 @@ pkg_blank(struct pkginfo *pkg)
        pkg->otherpriority = NULL;
        pkg->section = NULL;
        dpkg_version_blank(&pkg->configversion);
-       pkg->files = NULL;
+       pkg->archives = NULL;
        pkg->clientdata = NULL;
        pkg->trigaw.head = NULL;
        pkg->trigaw.tail = NULL;
diff --git a/src/enquiry.c b/src/enquiry.c
index e309f5516..9da4160d5 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -477,7 +477,7 @@ predeppackage(const char *const *argv)
     if (pkg->want != PKG_WANT_INSTALL)
       continue;
     /* Ignore packages not available. */
-    if (!pkg->files)
+    if (!pkg->archives)
       continue;
     pkg->clientdata->istobe = PKG_ISTOBE_PREINSTALL;
     for (dep= pkg->available.depends; dep; dep= dep->next) {
@@ -512,7 +512,7 @@ predeppackage(const char *const *argv)
 
       possi_iter = deppossi_pkg_iter_new(possi, wpb_available);
       while (!pkg && (trypkg = deppossi_pkg_iter_next(possi_iter))) {
-        if (trypkg->files &&
+        if (trypkg->archives &&
             trypkg->clientdata->istobe == PKG_ISTOBE_NORMAL &&
             versionsatisfied(&trypkg->available, possi)) {
           pkg = trypkg;
@@ -526,7 +526,7 @@ predeppackage(const char *const *argv)
           if (!pkg_virtual_deppossi_satisfied(possi, provider))
             continue;
           trypkg = provider->up->up;
-          if (!trypkg->files)
+          if (!trypkg->archives)
             continue;
           if (trypkg->clientdata->istobe == PKG_ISTOBE_NORMAL) {
             pkg = trypkg;
diff --git a/src/querycmd.c b/src/querycmd.c
index 2fd1b7827..0c637bed7 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -461,7 +461,7 @@ enqperpackage(const char *const *argv)
       if (pkg->status == PKG_STAT_NOTINSTALLED &&
           pkg->priority == PKG_PRIO_UNKNOWN &&
           str_is_unset(pkg->section) &&
-          !pkg->files &&
+          !pkg->archives &&
           pkg->want == PKG_WANT_UNKNOWN &&
           !pkg_is_informative(pkg, &pkg->installed)) {
         notice(_("package '%s' is not installed and no information is 
available"),
diff --git a/src/unpack.c b/src/unpack.c
index ae0e12132..0ab4175e2 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -1130,22 +1130,24 @@ void process_archive(const char *filename) {
     parsedb_flags = pdb_parse_available;
   else
     parsedb_flags = pdb_parse_binary;
-  parsedb_flags |= pdb_ignorefiles;
+  parsedb_flags |= pdb_ignore_archives;
   if (fc_badversion)
     parsedb_flags |= pdb_lax_version_parser;
 
   parsedb(cidir, parsedb_flags, &pkg);
 
-  if (!pkg->files) {
-    pkg->files= nfmalloc(sizeof(struct filedetails));
-    pkg->files->next = NULL;
-    pkg->files->name = pkg->files->msdosname = pkg->files->md5sum = NULL;
+  if (!pkg->archives) {
+    pkg->archives = nfmalloc(sizeof(struct archivedetails));
+    pkg->archives->next = NULL;
+    pkg->archives->name = NULL;
+    pkg->archives->msdosname = NULL;
+    pkg->archives->md5sum = NULL;
   }
   /* Always nfmalloc. Otherwise, we may overwrite some other field (like
    * md5sum). */
   psize = nfmalloc(30);
   sprintf(psize, "%jd", (intmax_t)stab.st_size);
-  pkg->files->size = psize;
+  pkg->archives->size = psize;
 
   if (cipaction->arg_int == act_avail) {
     printf(_("Recorded info about %s from %s.\n"),

-- 
Dpkg.Org's dpkg

Reply via email to