~ubuntu-branches/ubuntu/lucid/dpkg/lucid

« back to all changes in this revision

Viewing changes to lib/dpkg-db.h

  • Committer: Bazaar Package Importer
  • Author(s): Guillem Jover, Guillem Jover, Raphael Hertzog, Modestas Vainius, Updated dpkg translations, Updated dselect translations, Updated man page translations, Updated scripts translations
  • Date: 2009-09-06 09:37:45 UTC
  • mto: (1.4.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 68.
  • Revision ID: james.westby@ubuntu.com-20090906093745-orb3im04ozfxypis
Tags: 1.15.4
[ Guillem Jover ]
* Call _g instead of g_ in dpkg-name.
* Fix inverted logic when deciding to assume the architecture in dpkg-name
  when the package didn't have such field.
* Do not take into account Revision and Package_Revision fields in dpkg-name
  and dpkg-scanpackages as they have been handled already by “dpkg-deb -I”.
* Switch dpkg-scansources to use Dpkg::Cdata instead of duplicating the
  .dsc parsing code. As a side effect it now handles properly bogus files.
* Do not remap obsolete fields in dpkg-scanpackages as they have been
  handled already by “dpkg-deb -I”.
* Properly mark packages being purged for disappearance from the database.
  This will make the status database not be left behind with traces of old
  not-installed packages. Closes: #472208
* On parse mark not-installed leftover packages for automatic removal from
  the database on next dump. This obsoletes the --forget-old-unavail option,
  thus making it now a no-op. Closes: #33394, #429262
* Document “hold” under package selection states instead of flags in dpkg(1).
* Remove trailing ‘/’ and ‘/.’ from the directory name to be used as the
  package name on “dpkg-deb -b”. Closes: #218018, #373602
* Remove obsolete ‘hold’ and ‘hold-reinstreq’ internal status flags.
* Add fakeroot to dpkg-dev Recommends. Closes: #536821
* Fix an always false test when trying to decide which package to deselect
  to resolve a dependency problem in dselect.
* Add uClibc Linux support to ostable and triplettable. Closes: #455501
* Add uClinux support to ostable and triplettable.
  Thanks to Simon Richter <sjr@debian.org>.
* When aborting due to file conflicts print the version of the conflicted
  package. Closes: #540019
* Remove double slash in database path visible to the user in some error
  conditions.
* Stop macthing sparc64-*-* GNU triplets with sparc Debian architecture.
* Add support for config.d style directories in dpkg and dselect,
  (/etc/dpkg/dpkg.cfg.d and /etc/dpkg/dselect.cfg.d respectively).
* Define DPKG_MAINTSCRIPT_ARCH on the maintainer script environment to the
  architecture the package got built for.
* Document DPKG_MAINTSCRIPT_PACKAGE maintainer script environment variable
  in dpkg man page.
* Document DPKG_RUNNING_VERSION maintainer script environment variable
  in dpkg man page.
* Change po4a usage to not create unwated changes depending if doing out or
  in-tree builds.
* Use po4a “--previous” support when updating the man pages.
  Suggested by Christian Perrier <bubulle@debian.org>.
* On configuration error print file name and line number.
* Allow quoting values in configuration file options.
* Add new --pre-invoke and --post-invoke hooks in dpkg.
* Add new --control-path command to dpkg-query.
* Use ohshit on bad version syntax in --compare-versions.
* Add Multi-Arch to the list of known binary package fields for dpkg-dev.
  Thanks to Steve Langasek <vorlon@debian.org>.

[ Raphael Hertzog ]
* Replace install-info by a wrapper around GNU's install-info. The wrapper
  will be dropped in squeeze+1. dpkg now Breaks: old versions of
  info-browsers that do not depend on the new install-info package
  that provides the real functionality. Closes: #9771, #523980
  See http://wiki.debian.org/Transitions/DpkgToGnuInstallInfo for details.
* Fix dpkg's preinst in case /var/lib/dpkg/alternatives contains unexpected
  sub-directories. Closes: #535138
  And also when one of the file doesn't contain correct alternatives
  information (improper number of lines). Closes: #537558
* Upgrade Standards-Version to 3.8.2 (no changes).
* Update deb-substvars(5) to list fields that do not support substvars.
  Closes: #535353
* Fix dpkg-parsechangelog to include all entries with -v0 parameter.
  Closes: #537800
* Fix update-alternatives to mention the correct slave link that can't
  be installed due to a conflicting file instead of quoting the master link.
* Add support for extra override file in dpkg-scanpackages. Thanks to Robert
  Millan for the patch. Closes: #537559
* Add support for extra override file in dpkg-scansources.
* Document format of extra override file in a new manual page
  deb-extra-override(5).
* Update sample in dpkg-gensymbols(1) to give an accurate listing of
  64 bit arches. Thanks to Julien Cristau for the patch. Closes: #540382
* Create /etc/cron.daily/dpkg to handle the backup of
  /var/lib/dpkg/status in /var/backups. This is taken out of the cron
  package and need no conflicts/breaks as the code does nothing if
  the current status file is already backupped. Thanks to Leo 'costela'
  Antunes <costela@debian.org> for the patch. Closes: #541412
* Change behaviour of dpkg --merge-avail to not update a package's
  information if the version provided is older than the one already listed
  in the available file. Thanks to Ian Jackson
  <ian@davenant.greenend.org.uk> for the patch. Closes: #496114
* dpkg-architecture can now export DEB_{HOST,BUILD}_ARCH_{BITS,ENDIAN}
  (pointer size and endianness):
  - cputable (in dpkg) modified to contain those information
  - dpkg-dev depends on dpkg (>= 1.15.4) to ensure that we have an updated
    cputable (and so that a versioned build-dependency on dpkg-dev is enough
    to use this new feature)
  Closes: #531307
* Split overly long Binary: field values over multiple lines. This is
  allowed since policy 3.8.3. Closes: #494714
* Improve performance of dpkg-shlibdeps by caching minimal version
  associated to each library in Dpkg::Shlib::SymbolFile. Thanks to
  Jiří Paleček <jpalecek@web.de> for the patch.
* Slightly improve dpkg-source(1) by giving the section name that we're
  referring to. Closes: #544037
* Fix translation error in german manpage of dpkg-buildpackage. Thanks
  to Joachim Breitner <nomeata@debian.org>. Closes: #541829

[ Modestas Vainius ]
* Provide a meaningful label for dpkg-gensymbols diff.

[ Updated dpkg translations ]
* Asturian (Marcos Alvarez Costales). Closes: #535327
* French (Christian Perrier).
* German (Sven Joachim).
* Italian (Milo Casagrande). Closes: #536538
* Russian (Yuri Kozlov). Closes: #542254
* Slovak (Ivan Masár). Closes: #537742
* Swedish (Peter Krefting).

[ Updated dselect translations ]
* Russian (Yuri Kozlov). Closes: #542254
* Slovak (Ivan Masár). Closes: #537741

[ Updated man page translations ]
* French (Christian Perrier).
* German (Helge Kreutzmann), proofread by Jens Seidel.
* Swedish (Peter Krefting).

[ Updated scripts translations ]
* French completed (Christian Perrier).
* German (Helge Kreutzmann).
* Russian (Yuri Kozlov). Closes: #542254
* Swedish (Peter Krefting).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * libdpkg - Debian packaging suite library routines
3
 
 * dpkg-db.h - declarations for in-core package database management
4
 
 *
5
 
 * Copyright © 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk>
6
 
 * Copyright © 2000,2001 Wichert Akkerman
7
 
 *
8
 
 * This is free software; you can redistribute it and/or modify
9
 
 * it under the terms of the GNU General Public License as
10
 
 * published by the Free Software Foundation; either version 2,
11
 
 * or (at your option) any later version.
12
 
 *
13
 
 * This is distributed in the hope that it will be useful, but
14
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public
19
 
 * License along with dpkg; if not, write to the Free Software
20
 
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
 
 */
22
 
 
23
 
#ifndef DPKG_DB_H
24
 
#define DPKG_DB_H
25
 
 
26
 
#include <dpkg-def.h>
27
 
 
28
 
DPKG_BEGIN_DECLS
29
 
 
30
 
#include <sys/types.h>
31
 
#include <stdio.h>
32
 
 
33
 
struct versionrevision {
34
 
  unsigned long epoch;
35
 
  const char *version;
36
 
  const char *revision;
37
 
};  
38
 
 
39
 
enum deptype {
40
 
  dep_suggests,
41
 
  dep_recommends,
42
 
  dep_depends,
43
 
  dep_predepends,
44
 
  dep_breaks,
45
 
  dep_conflicts,
46
 
  dep_provides,
47
 
  dep_replaces,
48
 
  dep_enhances
49
 
};
50
 
 
51
 
enum depverrel {
52
 
  dvrf_earlier=      0001,
53
 
  dvrf_later=        0002,
54
 
  dvrf_strict=       0010,
55
 
  dvrf_orequal=      0020,
56
 
  dvrf_builtup=      0100,
57
 
  dvr_none=          0200,
58
 
  dvr_earlierequal=  dvrf_builtup | dvrf_earlier | dvrf_orequal,
59
 
  dvr_earlierstrict= dvrf_builtup | dvrf_earlier | dvrf_strict,
60
 
  dvr_laterequal=    dvrf_builtup | dvrf_later   | dvrf_orequal,
61
 
  dvr_laterstrict=   dvrf_builtup | dvrf_later   | dvrf_strict,
62
 
  dvr_exact=         0400
63
 
};
64
 
 
65
 
struct dependency {
66
 
  struct pkginfo *up;
67
 
  struct dependency *next;
68
 
  struct deppossi *list;
69
 
  enum deptype type;
70
 
};
71
 
 
72
 
struct deppossi {
73
 
  struct dependency *up;
74
 
  struct pkginfo *ed;
75
 
  struct deppossi *next, *nextrev, *backrev;
76
 
  struct versionrevision version;
77
 
  enum depverrel verrel;
78
 
  int cyclebreak;
79
 
};
80
 
 
81
 
struct arbitraryfield {
82
 
  struct arbitraryfield *next;
83
 
  const char *name;
84
 
  const char *value;
85
 
};
86
 
 
87
 
struct conffile {
88
 
  struct conffile *next;
89
 
  const char *name;
90
 
  const char *hash;
91
 
  int obsolete;
92
 
};
93
 
 
94
 
struct filedetails {
95
 
  struct filedetails *next;
96
 
  const char *name;
97
 
  const char *msdosname;
98
 
  const char *size;
99
 
  const char *md5sum;
100
 
};
101
 
 
102
 
struct pkginfoperfile { /* pif */
103
 
  int valid;
104
 
  struct dependency *depends;
105
 
  struct deppossi *depended;
106
 
  int essential; /* The `essential' flag, 1=yes, 0=no (absent) */
107
 
  const char *description;
108
 
  const char *maintainer;
109
 
  const char *source;
110
 
  const char *architecture;
111
 
  const char *installedsize;
112
 
  const char *origin;
113
 
  const char *bugs;
114
 
  struct versionrevision version;
115
 
  struct conffile *conffiles;
116
 
  struct arbitraryfield *arbs;
117
 
};
118
 
 
119
 
struct trigpend {
120
 
  /* Node indicates that parent's Triggers-Pending mentions name. */
121
 
  /* NB that these nodes do double duty: after they're removed from
122
 
   * a package's trigpend list, references may be preserved by the
123
 
   * trigger cycle checker (see trigproc.c).
124
 
   */
125
 
  struct trigpend *next;
126
 
  const char *name;
127
 
};
128
 
 
129
 
struct trigaw {
130
 
  /* Node indicates that aw's Triggers-Awaited mentions pend. */
131
 
  struct pkginfo *aw, *pend;
132
 
  struct trigaw *nextsamepend;
133
 
  struct {
134
 
    struct trigaw *next, *back;
135
 
  } sameaw;
136
 
};
137
 
 
138
 
struct perpackagestate; /* dselect and dpkg have different versions of this */
139
 
 
140
 
struct pkginfo { /* pig */
141
 
  struct pkginfo *next;
142
 
  const char *name;
143
 
  enum pkgwant {
144
 
    want_unknown, want_install, want_hold, want_deinstall, want_purge,
145
 
    want_sentinel /* Not allowed except as special sentinel value
146
 
                     in some places */
147
 
  } want;
148
 
  enum pkgeflag {
149
 
    eflagf_reinstreq    = 01,
150
 
    eflagf_obsoletehold = 02,
151
 
    eflagv_ok           = 0,
152
 
    eflagv_reinstreq    =    eflagf_reinstreq,
153
 
    eflagv_obsoletehold =                       eflagf_obsoletehold,
154
 
    eflagv_obsoleteboth =    eflagf_reinstreq | eflagf_obsoletehold
155
 
  } eflag; /* bitmask, but obsoletehold no longer used except when reading */
156
 
  enum pkgstatus {
157
 
    stat_notinstalled,
158
 
    stat_configfiles,
159
 
    stat_halfinstalled,
160
 
    stat_unpacked,
161
 
    stat_halfconfigured,
162
 
    stat_triggersawaited,
163
 
    stat_triggerspending,
164
 
    stat_installed
165
 
  } status;
166
 
  enum pkgpriority {
167
 
    pri_required,
168
 
    pri_important,
169
 
    pri_standard,
170
 
    pri_optional,
171
 
    pri_extra,
172
 
    pri_other, pri_unknown, pri_unset=-1
173
 
  } priority;
174
 
  const char *otherpriority;
175
 
  const char *section;
176
 
  struct versionrevision configversion;
177
 
  struct filedetails *files;
178
 
  struct pkginfoperfile installed;
179
 
  struct pkginfoperfile available;
180
 
  struct perpackagestate *clientdata;
181
 
  enum { white, gray, black } color;  /* used during cycle detection */
182
 
 
183
 
  struct {
184
 
    /* ->aw == this */
185
 
    struct trigaw *head, *tail;
186
 
  } trigaw;
187
 
 
188
 
  /* ->pend == this, non-NULL for us when Triggers-Pending. */
189
 
  struct trigaw *othertrigaw_head;
190
 
  struct trigpend *trigpend_head;
191
 
};
192
 
 
193
 
/*** from lock.c ***/
194
 
 
195
 
void lockdatabase(const char *admindir);
196
 
void unlockdatabase(void);
197
 
 
198
 
/*** from dbmodify.c ***/
199
 
 
200
 
enum modstatdb_rw {
201
 
  /* Those marked with \*s*\ are possible returns from modstatdb_init. */
202
 
  msdbrw_readonly/*s*/, msdbrw_needsuperuserlockonly/*s*/,
203
 
  msdbrw_writeifposs,
204
 
  msdbrw_write/*s*/, msdbrw_needsuperuser,
205
 
  /* Now some optional flags: */
206
 
  msdbrw_flagsmask= ~077,
207
 
  /* flags start at 0100 */
208
 
  msdbrw_noavail= 0100,
209
 
};
210
 
 
211
 
enum modstatdb_rw modstatdb_init(const char *admindir, enum modstatdb_rw reqrwflags);
212
 
void modstatdb_note(struct pkginfo *pkg);
213
 
void modstatdb_note_ifwrite(struct pkginfo *pkg);
214
 
void modstatdb_checkpoint(void);
215
 
void modstatdb_shutdown(void);
216
 
 
217
 
/* Initialised by modstatdb_init. */
218
 
extern char *statusfile, *availablefile;
219
 
extern char *triggersdir, *triggersfilefile, *triggersnewfilefile;
220
 
 
221
 
const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile);
222
 
 
223
 
/*** from trigdeferred.l ***/
224
 
 
225
 
enum trigdef_updateflags {
226
 
  tduf_nolockok =           001,
227
 
  tduf_write =              002,
228
 
  tduf_nolock =             003,
229
 
  /* Should not be set unless _write is. */
230
 
  tduf_writeifempty =       010,
231
 
  tduf_writeifenoent =      020,
232
 
};
233
 
 
234
 
struct trigdefmeths {
235
 
  void (*trig_begin)(const char *trig);
236
 
  void (*package)(const char *awname);
237
 
  void (*trig_end)(void);
238
 
};
239
 
 
240
 
extern const struct trigdefmeths *trigdef;
241
 
extern FILE *trig_new_deferred;
242
 
 
243
 
/* Return values:
244
 
 *  -1  Lock ENOENT with O_CREAT (directory does not exist)
245
 
 *  -2  Unincorp empty, tduf_writeifempty unset
246
 
 *  -3  Unincorp ENOENT, tduf_writeifenoent unset
247
 
 *   1  Unincorp ENOENT, tduf_writeifenoent set   } caller must call
248
 
 *   2  ok                                        }  trigdef_update_done!
249
 
 */
250
 
int trigdef_update_start(enum trigdef_updateflags uf, const char *admindir);
251
 
 
252
 
int trigdef_yylex(void);
253
 
void trigdef_process_done(void);
254
 
 
255
 
/*** hooks for more sophisticated processing in dpkg proper ***/
256
 
 
257
 
/* We do things like this so we can get most of the trigger tracking
258
 
 * in dpkg-query, dselect, and so on, but avoid the transitional
259
 
 * processing and deferred trigproc queue management other than when
260
 
 * we're actually doing real package management work. */
261
 
 
262
 
struct trigfileint {
263
 
  struct pkginfo *pkg;
264
 
  struct filenamenode *fnn;
265
 
  struct trigfileint *samefile_next;
266
 
  struct {
267
 
    struct trigfileint *next, *back;
268
 
  } inoverall;
269
 
};
270
 
 
271
 
struct trig_hooks {
272
 
 /* The first two are normally NULL.
273
 
  * If non-NULL, we're dpkg proper and we might need to invent trigger
274
 
  * activations as the first run of a triggers-supporting dpkg.
275
 
  */
276
 
  void (*enqueue_deferred)(struct pkginfo *pend);
277
 
  void (*transitional_activate)(enum modstatdb_rw cstatus);
278
 
 
279
 
  struct filenamenode *(*namenode_find)(const char *filename, int nonew);
280
 
  struct trigfileint **(*namenode_interested)(struct filenamenode *fnn);
281
 
 
282
 
  /* Returns a pointer from nfmalloc. */
283
 
  const char *(*namenode_name)(struct filenamenode *fnn);
284
 
};
285
 
 
286
 
extern struct trig_hooks trigh;
287
 
 
288
 
#define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS                              \
289
 
  static struct trigfileint **th_nn_interested(struct filenamenode *fnn) \
290
 
    { return &fnn->trig_interested; }                                    \
291
 
  static const char *th_nn_name(struct filenamenode *fnn)                \
292
 
    { return fnn->name; }
293
 
 
294
 
/*** from triglib.c ***/
295
 
 
296
 
void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
297
 
void trig_file_activate(struct filenamenode *trig, struct pkginfo *aw);
298
 
 
299
 
int trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/);
300
 
int trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);
301
 
int trig_note_aw(struct pkginfo *pend, struct pkginfo *aw);
302
 
void trig_clear_awaiters(struct pkginfo *notpend);
303
 
 
304
 
void trig_enqueue_awaited_pend(struct pkginfo *pend);
305
 
void trig_fixup_awaiters(enum modstatdb_rw cstatus);
306
 
 
307
 
void trig_file_interests_ensure(void);
308
 
void trig_file_interests_save(void);
309
 
 
310
 
void trig_cicb_interest_delete(const char *trig, void *user);
311
 
void trig_cicb_interest_add(const char *trig, void *user);
312
 
typedef void trig_parse_cicb(const char *trig, void *user);
313
 
void trig_parse_ci(const char *file, trig_parse_cicb *interest,
314
 
                   trig_parse_cicb *activate, void *user);
315
 
 
316
 
/* Called by process_archive. */
317
 
void trig_cicb_statuschange_activate(const char *trig, void *user);
318
 
 
319
 
void trig_incorporate(enum modstatdb_rw cstatus, const char *admindir);
320
 
 
321
 
const char *illegal_triggername(const char *p);
322
 
 
323
 
/*** from database.c ***/
324
 
 
325
 
struct pkginfo *findpackage(const char *name);
326
 
void blankpackage(struct pkginfo *pp);
327
 
void blankpackageperfile(struct pkginfoperfile *pifp);
328
 
void blankversion(struct versionrevision*);
329
 
int informative(struct pkginfo *pkg, struct pkginfoperfile *info);
330
 
int countpackages(void);
331
 
void resetpackages(void);
332
 
 
333
 
struct pkgiterator *iterpkgstart(void);
334
 
struct pkginfo *iterpkgnext(struct pkgiterator*);
335
 
void iterpkgend(struct pkgiterator*);
336
 
 
337
 
void hashreport(FILE*);
338
 
 
339
 
/*** from parse.c ***/
340
 
 
341
 
enum parsedbflags {
342
 
  pdb_recordavailable   =001, /* Store in `available' in-core structures, not `status' */
343
 
  pdb_rejectstatus      =002, /* Throw up an error if `Status' encountered             */
344
 
  pdb_weakclassification=004, /* Ignore priority/section info if we already have any   */
345
 
  pdb_ignorefiles       =010  /* Ignore files info if we already have them             */
346
 
};
347
 
 
348
 
const char *illegal_packagename(const char *p, const char **ep);
349
 
int parsedb(const char *filename, enum parsedbflags, struct pkginfo **donep,
350
 
            FILE *warnto, int *warncount);
351
 
void copy_dependency_links(struct pkginfo *pkg,
352
 
                           struct dependency **updateme,
353
 
                           struct dependency *newdepends,
354
 
                           int available);
355
 
 
356
 
/*** from parsehelp.c ***/
357
 
 
358
 
struct namevalue {
359
 
  const char *name;
360
 
  int value, length;
361
 
};
362
 
 
363
 
extern const struct namevalue booleaninfos[];
364
 
extern const struct namevalue priorityinfos[];
365
 
extern const struct namevalue statusinfos[];
366
 
extern const struct namevalue eflaginfos[];
367
 
extern const struct namevalue wantinfos[];
368
 
 
369
 
int informativeversion(const struct versionrevision *version);
370
 
 
371
 
enum versiondisplayepochwhen { vdew_never, vdew_nonambig, vdew_always };
372
 
void varbufversion(struct varbuf*, const struct versionrevision*,
373
 
                   enum versiondisplayepochwhen);
374
 
const char *parseversion(struct versionrevision *rversion, const char*);
375
 
const char *versiondescribe(const struct versionrevision*,
376
 
                            enum versiondisplayepochwhen);
377
 
 
378
 
/*** from varbuf.c ***/
379
 
 
380
 
struct varbuf;
381
 
 
382
 
#define VARBUF_INIT { 0, 0, NULL }
383
 
 
384
 
extern void varbufaddc(struct varbuf *v, int c);
385
 
extern void varbufdupc(struct varbuf *v, int c, size_t s);
386
 
extern void varbufsubstc(struct varbuf *v, int c_src, int c_dst);
387
 
int varbufprintf(struct varbuf *v, const char *fmt, ...) PRINTFFORMAT(2,3);
388
 
int varbufvprintf(struct varbuf *v, const char *fmt, va_list va);
389
 
void varbufinit(struct varbuf *v, size_t size);
390
 
void varbufreset(struct varbuf *v);
391
 
void varbufextend(struct varbuf *v);
392
 
void varbuffree(struct varbuf *v);
393
 
#define varbufaddstr(v, s)      varbufaddbuf(v, s, strlen(s))
394
 
extern void varbufaddbuf(struct varbuf *v, const void *s, size_t size);
395
 
 
396
 
/* varbufinit must be called exactly once before the use of each varbuf
397
 
 * (including before any call to varbuffree), or the variable must be
398
 
 * initialized with VARBUF_INIT.
399
 
 *
400
 
 * However, varbufs allocated `static' are properly initialised anyway and
401
 
 * do not need varbufinit; multiple consecutive calls to varbufinit before
402
 
 * any use are allowed.
403
 
 *
404
 
 * varbuffree must be called after a varbuf is finished with, if anything
405
 
 * other than varbufinit has been done.  After this you are allowed but
406
 
 * not required to call varbufinit again if you want to start using the
407
 
 * varbuf again.
408
 
 *
409
 
 * Callers using C++ need not worry about any of this.
410
 
 */
411
 
struct varbuf {
412
 
  size_t used, size;
413
 
  char *buf;
414
 
 
415
 
#ifdef __cplusplus
416
 
  void init(size_t _size = 0) { varbufinit(this, _size); }
417
 
  void free() { varbuffree(this); }
418
 
  varbuf(size_t _size = 0) { varbufinit(this, _size); }
419
 
  ~varbuf() { varbuffree(this); }
420
 
  void operator()(int c) { varbufaddc(this,c); }
421
 
  void operator()(const char *s) { varbufaddstr(this,s); }
422
 
  void terminate(void/*to shut 2.6.3 up*/) { varbufaddc(this,0); used--; }
423
 
  void reset() { used=0; }
424
 
  const char *string() { terminate(); return buf; }
425
 
#endif
426
 
};
427
 
 
428
 
/*** from dump.c ***/
429
 
 
430
 
void writerecord(FILE*, const char*,
431
 
                 const struct pkginfo*, const struct pkginfoperfile*);
432
 
 
433
 
void writedb(const char *filename, int available, int mustsync);
434
 
 
435
 
void varbufrecord(struct varbuf*, const struct pkginfo*, const struct pkginfoperfile*);
436
 
void varbufdependency(struct varbuf *vb, struct dependency *dep);
437
 
  /* NB THE VARBUF MUST HAVE BEEN INITIALISED AND WILL NOT BE NULL-TERMINATED */
438
 
 
439
 
/*** from vercmp.c ***/
440
 
 
441
 
int versionsatisfied(struct pkginfoperfile *it, struct deppossi *against);
442
 
int versionsatisfied3(const struct versionrevision *it,
443
 
                      const struct versionrevision *ref,
444
 
                      enum depverrel verrel);
445
 
int versioncompare(const struct versionrevision *version,
446
 
                   const struct versionrevision *refversion);
447
 
int epochsdiffer(const struct versionrevision *a,
448
 
                 const struct versionrevision *b);
449
 
 
450
 
/*** from nfmalloc.c ***/
451
 
extern void *nfmalloc(size_t);
452
 
char *nfstrsave(const char*);
453
 
char *nfstrnsave(const char*, size_t);
454
 
void nffreeall(void);
455
 
 
456
 
/*** from showpkg.c ***/
457
 
 
458
 
struct lstitem;
459
 
 
460
 
struct lstitem* parseformat(const char* fmt);
461
 
void freeformat(struct lstitem* head);
462
 
void show1package(const struct lstitem* head, struct pkginfo *pkg);
463
 
 
464
 
DPKG_END_DECLS
465
 
 
466
 
#endif /* DPKG_DB_H */