Whole document tree
    

Whole document tree

dpkg Internals Manual - Code Internals
[ previous ] [ Contents ] [ 1 ] [ 2 ] [ next ]

dpkg Internals Manual
Chapter 2 - Code Internals


2.1 Structure Definitons


2.1.1 versionrevision

     struct versionrevision {
       unsigned long epoch;
       char *version;
       char *revision;
     };

The versionrevision structure is used to store a Debian version specification


2.2 Functions


2.2.1 Parsing translation tables

Each of these tables is used to associate a set of strings with a corresponding set of integers. Current tables are:

     const struct namevalue booleaninfos[];

Maps boolean strings ("yes","no") to their binary values.


2.2.1.1 priorityinfos[]

     const struct namevalue priorityinfos[];

Maps priority strings to and from values of type enum pkgpriority. Current priority values are:

  • required - required
  • important - important
  • standard - standard
  • recommended - recommended
  • optional - optional
  • extra - extra
  • contrib - contrib
  • other - other
  • unknown - unknown
  • base - This is obsolete, but is accepted as an alias for required.

2.2.1.2 statusinfos[]

     const struct namevalue statusinfos[];

Maps package status strings to values of type enum ???. Package status strings are: "not-installed" "unpacked" "half-configured" "installed" "half-installed" "config-files" "postinst-failed" "removal-failed"


2.2.1.3 eflaginfos[]

     const struct namevalue eflaginfos[];

2.2.1.4 wantinfos[]

     const struct namevalue wantinfos[];

2.2.1.5 nicknames[]

     const struct nickname nicknames[];

Maps obsolete control fields to their current versions.


2.2.2 Parsing functions


2.2.2.1 parseerr()

     void parseerr
     (FILE *file, const char *filename, int lno,
      FILE *warnto, int *warncount, const struct pkginfo *pigp,
      int warnonly, const char *fmt, ...);

Report an error parsing a control data stream. Checks file for error status on file, printing an error message to stderr and exiting with error status if an error is present on the stream. Formats the variable arguments according to the printf-style string in fmt, preceding the result with filename, lno, and pigp (if not NULL). If warnonly is 0, writes the result to stderr and exits with error status. Otherwise, increments warncount and returns normally.


2.2.2.2 illegal_packagename()

const char *illegal_packagename (const char *p, const char **ep) Checks the package name at p for proper syntax. Returns NULL in case of success, setting *ep to point after the last character in the package name, including any trailing whitespace (as defined by isspace()). In case of error, returns the error message as a pointer to a static buffer.


2.2.2.3 informativeversion()

int informativeversion(const struct versionrevision *version)

Returns true if and only if the versionrevision is non-empty; otherwise returns false.


2.2.2.4 varbufversion()

     void varbufversion
     (struct varbuf *vb,
      const struct versionrevision *version,
      enum versiondisplayepochwhen vdew);

Writes a human-readable representation of version to vb. Possible values of vdew:

  • vdew_never - never include epoch
  • vdew_nonambig - include epoch string if non-zero
  • vdew_always - always include epoch string

2.2.2.5 versiondescribe()

     const char *versiondescribe
     (const struct versionrevision *version,
      enum versiondisplayepochwhen vdew);

Return a human-readable representation of version as a pointer to a static buffer. If the version structure is empty, return "<none>". Static buffers are allocated from a set of 10 in round-robin fashion (they will be re-used after 10 successive calls to versiondescribe).


2.2.2.6 parseversion()

     const char *parseversion
     (struct versionrevision *rversion, const char *string);

Parse the contents of string into rversion. If successful, returns NULL, otherwise returns a pointer to a static error string.


2.2.2.7 parsemustfield()

     void parsemustfield
     (FILE *file, const char *filename, int lno,
      FILE *warnto, int *warncount,
      const struct pkginfo *pigp, int warnonly,
      char **value, const char *what);

2.2.2.8 skip_slash_dotslash()

     const char *skip_slash_dotslash (const char *p);

2.2.2.9 convert_string()

     static int convert_string
     (const char *filename, int lno, const char *what, int otherwise,
      FILE *warnto, int *warncount, const struct pkginfo *pigp,
      const char *startp, const struct namevalue *nvip,
      const char **endpp)

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ next ]

dpkg Internals Manual

Version (dpkg 1.9.21)
Klee Dienes klee@mit.edu