dpkg 1.22.7-3-g89f48
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
dpkg-db.h File Reference

(17456a341)

#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <dpkg/macros.h>
#include <dpkg/varbuf.h>
#include <dpkg/version.h>
#include <dpkg/arch.h>
#include <dpkg/atomic-file.h>
#include <dpkg/namevalue.h>
#include <dpkg/error.h>
Include dependency graph for dpkg-db.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dependency
 
struct  deppossi
 
struct  arbitraryfield
 
struct  conffile
 
struct  archivedetails
 
struct  pkgbin
 Node describing a binary package file. More...
 
struct  trigpend
 Node indicates that parent's Triggers-Pending mentions name. More...
 
struct  trigaw
 Node indicates that aw's Triggers-Awaited mentions pend. More...
 
struct  pkginfo
 Node describing an architecture package instance. More...
 
struct  pkgset
 Node describing a package set sharing the same package name. More...
 

Enumerations

enum  deptype {
  dep_suggests , dep_recommends , dep_depends , dep_predepends ,
  dep_breaks , dep_conflicts , dep_provides , dep_replaces ,
  dep_enhances
}
 
enum  pkgmultiarch { PKG_MULTIARCH_NO , PKG_MULTIARCH_SAME , PKG_MULTIARCH_ALLOWED , PKG_MULTIARCH_FOREIGN }
 
enum  pkgwant {
  PKG_WANT_UNKNOWN , PKG_WANT_INSTALL , PKG_WANT_HOLD , PKG_WANT_DEINSTALL ,
  PKG_WANT_PURGE , PKG_WANT_SENTINEL
}
 
enum  pkgeflag { PKG_EFLAG_OK = 0 , PKG_EFLAG_REINSTREQ = 1 }
 
enum  pkgstatus {
  PKG_STAT_NOTINSTALLED , PKG_STAT_CONFIGFILES , PKG_STAT_HALFINSTALLED , PKG_STAT_UNPACKED ,
  PKG_STAT_HALFCONFIGURED , PKG_STAT_TRIGGERSAWAITED , PKG_STAT_TRIGGERSPENDING , PKG_STAT_INSTALLED
}
 
enum  pkgpriority {
  PKG_PRIO_REQUIRED , PKG_PRIO_IMPORTANT , PKG_PRIO_STANDARD , PKG_PRIO_OPTIONAL ,
  PKG_PRIO_EXTRA , PKG_PRIO_OTHER , PKG_PRIO_UNKNOWN , PKG_PRIO_UNSET = -1
}
 
enum  versiondisplayepochwhen { vdew_never , vdew_nonambig , vdew_always }
 
enum  pkg_name_arch_when {
  pnaw_never , pnaw_nonambig , pnaw_same , pnaw_foreign ,
  pnaw_always
}
 

Functions

const char * dpkg_db_set_dir (const char *dir)
 Set current on-disk database directory.
 
const char * dpkg_db_get_dir (void)
 Get current on-disk database directory.
 
char * dpkg_db_get_path (const char *pathpart)
 Get a pathname to the current on-disk database directory.
 
void modstatdb_init (void)
 
void modstatdb_done (void)
 
bool modstatdb_is_locked (void)
 
bool modstatdb_can_lock (void)
 
void modstatdb_lock (void)
 
void modstatdb_unlock (void)
 
enum modstatdb_rw modstatdb_open (enum modstatdb_rw reqrwflags)
 
enum modstatdb_rw modstatdb_get_status (void)
 
void modstatdb_note (struct pkginfo *pkg)
 
void modstatdb_note_ifwrite (struct pkginfo *pkg)
 
void modstatdb_checkpoint (void)
 
void modstatdb_shutdown (void)
 
void pkgset_blank (struct pkgset *set)
 
int pkgset_installed_instances (struct pkgset *set)
 Get the number of installed package instances in a package set.
 
void pkg_blank (struct pkginfo *pp)
 
void pkgbin_blank (struct pkgbin *pkgbin)
 
bool pkg_is_informative (struct pkginfo *pkg, struct pkgbin *info)
 Check if a pkg is informative.
 
struct pkgsetpkg_hash_find_set (const char *name)
 Return the package set with the given name.
 
struct pkginfopkg_hash_get_singleton (struct pkgset *set)
 Return the singleton package instance from a package set.
 
struct pkginfopkg_hash_find_singleton (const char *name)
 Return the singleton package instance with the given name.
 
struct pkginfopkg_hash_get_pkg (struct pkgset *set, const struct dpkg_arch *arch)
 Return the package instance in a set with the given architecture.
 
struct pkginfopkg_hash_find_pkg (const char *name, const struct dpkg_arch *arch)
 Return the package instance with the given name and architecture.
 
int pkg_hash_count_set (void)
 Return the number of package sets available in the database.
 
int pkg_hash_count_pkg (void)
 Return the number of package instances available in the database.
 
void pkg_hash_reset (void)
 
struct pkg_hash_iterpkg_hash_iter_new (void)
 Create a new package iterator.
 
struct pkgsetpkg_hash_iter_next_set (struct pkg_hash_iter *iter)
 
struct pkginfopkg_hash_iter_next_pkg (struct pkg_hash_iter *iter)
 
void pkg_hash_iter_free (struct pkg_hash_iter *iter)
 
void pkg_hash_report (FILE *)
 
const char * pkg_name_is_illegal (const char *p)
 
const struct fieldinfofind_field_info (const struct fieldinfo *fields, const char *fieldname)
 
const struct arbitraryfieldfind_arbfield_info (const struct arbitraryfield *arbs, const char *fieldname)
 
int parsedb (const char *filename, enum parsedbflags, struct pkginfo **donep)
 Parse a deb822 style file.
 
void copy_dependency_links (struct pkginfo *pkg, struct dependency **updateme, struct dependency *newdepends, bool available)
 Copy dependency links structures.
 
void varbufversion (struct varbuf *, const struct dpkg_version *, enum versiondisplayepochwhen)
 
int parseversion (struct dpkg_version *version, const char *, struct dpkg_error *err)
 Parse a version string and check for invalid syntax.
 
const char * versiondescribe (const struct dpkg_version *, enum versiondisplayepochwhen)
 
const char * versiondescribe_c (const struct dpkg_version *version, enum versiondisplayepochwhen vdew)
 
void varbuf_add_pkgbin_name (struct varbuf *vb, const struct pkginfo *pkg, const struct pkgbin *pkgbin, enum pkg_name_arch_when pnaw)
 Add a string representation of the package name to a varbuf.
 
const char * pkgbin_name_archqual (const struct pkginfo *pkg, const struct pkgbin *pkgbin)
 
const char * pkgbin_name (struct pkginfo *pkg, struct pkgbin *pkgbin, enum pkg_name_arch_when pnaw)
 Return a string representation of the package name.
 
const char * pkg_name (struct pkginfo *pkg, enum pkg_name_arch_when pnaw)
 Return a string representation of the installed package name.
 
const char * pkgbin_name_const (const struct pkginfo *pkg, const struct pkgbin *pkgbin, enum pkg_name_arch_when pnaw)
 Return a string representation of the package name.
 
const char * pkg_name_const (const struct pkginfo *pkg, enum pkg_name_arch_when pnaw)
 Return a string representation of the installed package name.
 
void pkg_source_version (struct dpkg_version *version, const struct pkginfo *pkg, const struct pkgbin *pkgbin)
 
void varbuf_add_source_version (struct varbuf *vb, const struct pkginfo *pkg, const struct pkgbin *pkgbin)
 Add a string representation of the source package version to a varbuf.
 
const char * pkg_want_name (const struct pkginfo *pkg)
 Return a string representation of the package want status name.
 
const char * pkg_status_name (const struct pkginfo *pkg)
 Return a string representation of the package current status name.
 
const char * pkg_eflag_name (const struct pkginfo *pkg)
 Return a string representation of the package eflag status name.
 
const char * pkg_priority_name (const struct pkginfo *pkg)
 Return a string representation of the package priority name.
 
void write_stanza (FILE *, const char *, const struct pkginfo *, const struct pkgbin *)
 
void writedb_stanzas (FILE *fp, const char *filename, enum writedb_flags flags)
 
void writedb (const char *filename, enum writedb_flags flags)
 
void varbuf_stanza (struct varbuf *, const struct pkginfo *, const struct pkgbin *)
 
void varbufdependency (struct varbuf *vb, struct dependency *dep)
 
bool versionsatisfied (struct pkgbin *it, struct deppossi *against)
 
bool deparchsatisfied (struct pkgbin *it, const struct dpkg_arch *arch, struct deppossi *against)
 Check if the architecture qualifier in the dependency is satisfied.
 
bool archsatisfied (struct pkgbin *it, struct deppossi *against)
 
bool pkg_virtual_deppossi_satisfied (struct deppossi *dependee, struct deppossi *provider)
 Check if the dependency is satisfied by a virtual package.
 
void * nfmalloc (size_t)
 
char * nfstrsave (const char *)
 
char * nfstrnsave (const char *, size_t)
 
void nffreeall (void)
 

Variables

enum DPKG_ATTR_ENUM_FLAGS conffile_flags
 
 CONFFILE_NONE = 0
 No flags.
 
 CONFFILE_OBSOLETE = DPKG_BIT(0)
 The conffile is not shipped anymore in the new package.
 
 CONFFILE_REMOVE_ON_UPGRADE = DPKG_BIT(1)
 The conffile is marked to be removed during package upgrade.
 
enum DPKG_ATTR_ENUM_FLAGS modstatdb_rw
 
 msdbrw_unset = -1
 
 msdbrw_readonly
 
 msdbrw_needsuperuserlockonly
 
 msdbrw_writeifposs
 
 msdbrw_write
 
 msdbrw_needsuperuser
 
 msdbrw_available_readonly = DPKG_BIT(8)
 
 msdbrw_available_write = DPKG_BIT(9)
 
 msdbrw_available_mask = 0x0300
 
enum DPKG_ATTR_ENUM_FLAGS parsedbflags
 
 pdb_single_stanza = DPKG_BIT(0)
 Parse a single control stanza.
 
 pdb_recordavailable = DPKG_BIT(1)
 Store in ‘available’ in-core structures, not ‘status’.
 
 pdb_rejectstatus = DPKG_BIT(2)
 Throw up an error if ‘Status’ encountered.
 
 pdb_weakclassification = DPKG_BIT(3)
 Ignore priority/section info if we already have any.
 
 pdb_ignore_archives = DPKG_BIT(4)
 Ignore archives info if we already have them.
 
 pdb_ignoreolder = DPKG_BIT(5)
 Ignore packages with older versions already read.
 
 pdb_lax_version_parser = DPKG_BIT(6)
 Perform laxer version parsing.
 
 pdb_lax_stanza_parser = DPKG_BIT(7)
 Perform laxer control stanza parsing.
 
 pdb_lax_parser = pdb_lax_stanza_parser | pdb_lax_version_parser
 Perform laxer parsing, used to transition to stricter parsing.
 
 pdb_close_fd = DPKG_BIT(8)
 Close file descriptor on context destruction.
 
 pdb_dash_is_stdin = DPKG_BIT(9)
 Interpret filename ‘-’ as stdin.
 
 pdb_allow_empty = DPKG_BIT(10)
 Allow empty/missing files.
 
 pdb_parse_status
 
 pdb_parse_update = pdb_parse_status | pdb_single_stanza
 
 pdb_parse_available
 
 pdb_parse_binary
 
const struct namevalue booleaninfos []
 
const struct namevalue multiarchinfos []
 
const struct namevalue priorityinfos []
 
const struct namevalue statusinfos []
 
const struct namevalue eflaginfos []
 
const struct namevalue wantinfos []
 
enum DPKG_ATTR_ENUM_FLAGS writedb_flags
 
 wdb_none = 0
 No flags.
 
 wdb_dump_available = DPKG_BIT(0)
 Dump ‘available’ in-core structures, not ‘status’.
 
 wdb_must_sync = DPKG_BIT(1)
 Must sync the written file.
 

Variable Documentation

◆ CONFFILE_NONE

CONFFILE_NONE = 0

No flags.

Referenced by f_conffiles().

◆ CONFFILE_OBSOLETE

CONFFILE_OBSOLETE = DPKG_BIT(0)

The conffile is not shipped anymore in the new package.

Referenced by conffile_is_disappearing(), conffile_mark_obsolete(), f_conffiles(), tarobject(), and w_conffiles().

◆ CONFFILE_REMOVE_ON_UPGRADE

CONFFILE_REMOVE_ON_UPGRADE = DPKG_BIT(1)

The conffile is marked to be removed during package upgrade.

Referenced by conffile_is_disappearing(), f_conffiles(), and w_conffiles().

◆ msdbrw_available_mask

msdbrw_available_mask = 0x0300

Referenced by modstatdb_open().

◆ msdbrw_available_readonly

msdbrw_available_readonly = DPKG_BIT(8)

◆ msdbrw_available_write

msdbrw_available_write = DPKG_BIT(9)

Referenced by archivefiles(), and modstatdb_shutdown().

◆ msdbrw_needsuperuser

msdbrw_needsuperuser

◆ msdbrw_needsuperuserlockonly

msdbrw_needsuperuserlockonly

◆ msdbrw_readonly

msdbrw_readonly

◆ msdbrw_unset

msdbrw_unset = -1

◆ msdbrw_write

msdbrw_write

◆ msdbrw_writeifposs

msdbrw_writeifposs

Referenced by modstatdb_open().

◆ pdb_allow_empty

pdb_allow_empty = DPKG_BIT(10)

Allow empty/missing files.

Referenced by parsedb_load(), parsedb_open(), and parsedb_parse().

◆ pdb_close_fd

pdb_close_fd = DPKG_BIT(8)

Close file descriptor on context destruction.

Referenced by parsedb_close(), and parsedb_open().

◆ pdb_dash_is_stdin

pdb_dash_is_stdin = DPKG_BIT(9)

Interpret filename ‘-’ as stdin.

Referenced by parsedb_open(), and updateavailable().

◆ pdb_ignore_archives

pdb_ignore_archives = DPKG_BIT(4)

Ignore archives info if we already have them.

Referenced by do_showinfo(), and process_archive().

◆ pdb_ignoreolder

pdb_ignoreolder = DPKG_BIT(5)

Ignore packages with older versions already read.

Referenced by parsedb_parse(), and updateavailable().

◆ pdb_lax_parser

Perform laxer parsing, used to transition to stricter parsing.

◆ pdb_lax_stanza_parser

pdb_lax_stanza_parser = DPKG_BIT(7)

Perform laxer control stanza parsing.

Referenced by f_dependency(), and parse_stanza().

◆ pdb_lax_version_parser

pdb_lax_version_parser = DPKG_BIT(6)

Perform laxer version parsing.

Referenced by parse_db_version(), and process_archive().

◆ pdb_parse_available

pdb_parse_available
Initial value:
pdb_rejectstatus
Throw up an error if ‘Status’ encountered.
Definition dpkg-db.h:349
pdb_allow_empty
Allow empty/missing files.
Definition dpkg-db.h:367
pdb_lax_parser
Perform laxer parsing, used to transition to stricter parsing.
Definition dpkg-db.h:361
pdb_recordavailable
Store in ‘available’ in-core structures, not ‘status’.
Definition dpkg-db.h:347

Referenced by modstatdb_open(), process_archive(), and updateavailable().

◆ pdb_parse_binary

pdb_parse_binary
Initial value:
pdb_single_stanza
Parse a single control stanza.
Definition dpkg-db.h:345

Referenced by do_showinfo(), and process_archive().

◆ pdb_parse_status

pdb_parse_status
Initial value:
pdb_weakclassification
Ignore priority/section info if we already have any.
Definition dpkg-db.h:351

◆ pdb_parse_update

pdb_parse_update = pdb_parse_status | pdb_single_stanza

◆ pdb_recordavailable

pdb_recordavailable = DPKG_BIT(1)

Store in ‘available’ in-core structures, not ‘status’.

Referenced by f_archives(), f_configversion(), f_status(), and parsedb_parse().

◆ pdb_rejectstatus

pdb_rejectstatus = DPKG_BIT(2)

Throw up an error if ‘Status’ encountered.

Referenced by f_configversion(), f_status(), f_trigaw(), and f_trigpend().

◆ pdb_single_stanza

pdb_single_stanza = DPKG_BIT(0)

Parse a single control stanza.

◆ pdb_weakclassification

pdb_weakclassification = DPKG_BIT(3)

Ignore priority/section info if we already have any.

◆ wdb_dump_available

wdb_dump_available = DPKG_BIT(0)

Dump ‘available’ in-core structures, not ‘status’.

Referenced by modstatdb_shutdown(), updateavailable(), writedb(), and writedb_stanzas().

◆ wdb_must_sync

wdb_must_sync = DPKG_BIT(1)

Must sync the written file.

Referenced by modstatdb_checkpoint(), and writedb().

◆ wdb_none

wdb_none = 0

No flags.