%manuals-version-def; ]> internals.info dpkg Internals Manual Klee Dienes Version &manuals-version; (dpkg &dpkg-version;) This manual describes the internal structure of the Copyright

Copyright ©1997 Klee Dienes This manual is free software; you may redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with your Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with the COPYING. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Build Notes

Automake

This chapter by Tom Lees <tom&at;lpsg.demon.co.uk> on Tue, 4 Mar 1997 21:34:57 +0000, with subsequent modifications by Klee Dienes <klee&at;debian.org>

This chapter contains general notes about the conversion to The current version of automake used is version it supports emacs lisp properly It supports libtool properly it includes the aclocal utility

The ftp://ftp.cygnus.com/pub/tromey

This doesn't affect anything other than rebuilding the Probably the main difference which is noticable is that instead of using proprietary directory names, it now supports ./configure --localstatedir=/etc --sharedstatedir=/var/lib.

I have also customized the canonicalizing macros found in It uses automake autoconf aclocal autoheader gettextize libtoolize

If you want to modify any of the sources, I recommend that you do the following first (after having installed the appropriate utilities, of course):- make maintainer-clean aclocal autoheader autoconf gettextize libtoolize (do not let automake run this, as it will cause it not to include the libtool files in the dist targets) for i in COPYING INSTALL; do ln -s /usr/share/automake/$i .; done automake

I have also incorporated the patches originally made by Galen Hazelwood to internationalize dpkg using GNU gettext - see the file "NOTES.intl" for more information about this.

Other minor changes are: The version number is now determined from debian/changelog, not from the directory name. Creation of version.h now handled from configure script, not Makefile. include/dpkg.h is now generated from include/dpkg.h.in by a sed script, inserting the appropriate directory definitions - so now it supports changing the dpkg directories (can install in /usr/local) Updated the COPYING (1 very minor change) and INSTALL files to those distributed with automake-1.1l Since the shared libdpkg is now installed, I also made include/Makefile install dpkg.h and dpkg-db.h into /usr/include by default Questions: Should I use

Internationalization

This section by Galen Hazelwood.

Dpkg is, to say the least, generous in its error reporting. The vast majority of the output strings are error messages of one kind or another. And if you feel that you've stumbled into the Department of Redundancy Department, you would be absolutely correct. Many of the error messages in dpkg.pot are duplicates, used at different points in the program.

To avoid swamping the translators completely, I made some executive decisions on what kinds of strings to translate. All the strings sent to debug() are left alone, on the grounds that these are for dpkg developers, and not for the general public. Most interal error messages were very cryptic, and would probably confuse the translators when seen just sitting there in the dpkg.pot file, and are also left alone. (I did mark some of the more verbose ones for translation.)

If others disagree with me about the necessity of translating these strings, it's easy enough to just go through and mark them later.

I added the startup gettext code to the main routine in dselect, which was necessary as many of the strings in lib are translated. Dselect is otherwise unchanged.

Changes: The files in intl and po were taken from gettext 0.10.26, by way of the gettextize program. I altered the makefiles to remove the VERSION symbol, which is only used in targets which dpkg does not support. aclocal.m4 was stolen from the textutils package, configure.in was altered to use these new tests, symbols were added to acconfig.h, and the two new directories were added to Makefile.in. The dpkg, dpkg-deb, md5sum, split, and dselect Makefiles now look for headers in ../intl, and try to link with whatever i18n libraries configure finds. They also now define LOCALEDIR in CFLAGS. include/dpkg.h has the necessary NLS boilerplate, and the only file which dosen't include this (md5sum/md5sum.c) had it added directly. The most intrusive change is due to a disagreement between xgettext and the dpkg coding style. Although xgettext understands string constant concatenation, it can't handle the case where preprocessor symbols are used as well. The dpkg code uses this a lot, especially in cases like this: ohshite("error reading from " BACKEND " pipe"); where BACKEND is defined as "dpkg-deb". Because xgettext can't handle this, I have changed this usage in all cases to something like: ohshite(_("error reading from dpkg-deb pipe"); This isn't very kind to Ian, I know. But what can I do?

Code Internals
Structure Definitons versionrevision

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

The

Functions 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 ( const struct namevalue priorityinfos[];

Maps priority strings to and from values of type required important standard recommended optional extra contrib other unknown This is obsolete, but is accepted as an alias for const struct namevalue statusinfos[]; Maps package status strings to values of type const struct namevalue eflaginfos[]; const struct namevalue wantinfos[]; const struct nickname nicknames[]; Maps obsolete control fields to their current versions. Parsing functions 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 const char *illegal_packagename (const char *p, const char **ep) Checks the package name at int informativeversion(const struct versionrevision *version)

Returns true if and only if the void varbufversion (struct varbuf *vb, const struct versionrevision *version, enum versiondisplayepochwhen vdew); Writes a human-readable representation of never include epoch include epoch string if non-zero always include epoch string const char *versiondescribe (const struct versionrevision *version, enum versiondisplayepochwhen vdew);

Return a human-readable representation of const char *parseversion (struct versionrevision *rversion, const char *string);

Parse the contents of void parsemustfield (FILE *file, const char *filename, int lno, FILE *warnto, int *warncount, const struct pkginfo *pigp, int warnonly, char **value, const char *what); const char *skip_slash_dotslash (const char *p); 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)