Bug#48104: dpkg: [PATCH] translated field names in dpkg-deb
Package: dpkg
Version: 1.4.1.17
Severity: wishlist
dexter@scarlet~/deb-dev/orig/dpkg-1.4.1.16-dpkg-deb-i18n/dpkg-deb$ LANG=pl ./dpkg-deb -I /backup/debian/dists/potato/main/binary-i386/base/libc6_2.1.2-5.deb
new debian package, version 2.0.
size 1354308 bytes: control archive= 3874 bytes.
42 bytes, 2 lines conffiles
887 bytes, 18 lines control
5194 bytes, 202 lines * postinst #!/bin/sh
257 bytes, 14 lines * postrm #!/bin/sh
2697 bytes, 97 lines * preinst #!/bin/sh
741 bytes, 27 lines shlibs
Pakiet: libc6
Wersja: 2.1.2-5
Sekcja: base
Priorytet: wymagany
Architektura: i386
Zale¿y-Przed: ldso (>= 1.9.11-2.1)
Poleca: gconv-modules
Sugeruje: nscd, glibc-doc, locales
Konfliktuje: libc5 (<< 5.4.33-7), libpthread0 (<< 0.7-10), libstdc++2.8 (= 2.90.29-1), libstdc++2.9 (<< 2.91.59-2), timezone, timezones, libwcsmbs, libc6-doc, libtricks, apt (<< 0.3.0), libglib1.2 (<< 1.2.1-2)
Zastêpuje: libc6-dev (<< 2.0.110-1), timezone, timezones, libdb2, locales (<< 2.1.1-1)
Rozmiar-Instalacji: 3900
Opiekun: Debian GNU C Library Maintainers <debian-glibc@lists.debian.org>
¬ród³o: glibc
Opis: GNU C Library: Shared libraries and timezone data
Contains the standard libraries that are used by nearly all programs on
the system. This package includes shared versions of the standard C library
and the standard math library, as well as many others. Timezone data is
also included.
Patch:
diff -Nru8 dpkg-1.4.1.16/dpkg-deb/info.c dpkg-1.4.1.16-dpkg-deb-i18n/dpkg-deb/info.c
--- dpkg-1.4.1.16/dpkg-deb/info.c Fri Jan 29 09:53:59 1999
+++ dpkg-1.4.1.16-dpkg-deb-i18n/dpkg-deb/info.c Sat Oct 23 15:58:18 1999
@@ -32,16 +32,21 @@
#include <limits.h>
#include <ctype.h>
#include <config.h>
#include <dpkg.h>
#include <myopt.h>
#include "dpkg-deb.h"
+const char *translatedfields[]= {
+ "Essential",
+ "Priority"
+};
+
static void cu_info_prepare(int argc, void **argv) {
pid_t c1;
int status;
char *directory;
struct stat stab;
directory= (char*)(argv[0]);
if (chdir("/")) { perror(_("failed to chdir to `/' for cleanup")); return; }
@@ -101,16 +106,66 @@
} else {
ohshite(_("open component `%.255s' (in %.255s) failed in an unexpected way"),
component, directory);
}
}
if (re) ohshit(_("at least one requested control component missing"));
}
+static void info_control(const char *debar, const char *directory, const int ident) {
+ char fieldname[MAXFIELDNAME+1], fieldvalue[MAXFIELDNAME+1];
+ int lines;
+ char *pf;
+ FILE *cc;
+ const char *const *fp;
+ int c;
+ int translating, fnl;
+
+ if (!(cc= fopen("control","r"))) {
+ if (errno != ENOENT) ohshite(_("failed to read `control' (in `%.255s')"),directory);
+ if (fputs(_("(no `control' file in control archive!)\n"),stdout) < 0) werr("stdout");
+ } else {
+ lines= 1;
+ while ((c= getc(cc))!= EOF) {
+ if (ident)
+ if (lines) if (putc(' ',stdout) == EOF) werr("stdout");
+
+ if (!isspace(c)) {
+ for (pf=fieldname, fnl=0;
+ fnl <= MAXFIELDNAME && c!=EOF && !isspace(c) && c!=':';
+ c= getc(cc)) { *pf++= c; fnl++; }
+ *pf++= 0;
+ fputs(_(fieldname),stdout);
+
+ while(c!=EOF && c!='\n' && isspace(c)) {
+ putc(c,stdout);
+ c = getc(cc);
+ }
+ if(c!=EOF && c!='\n' && !isspace(c)) {
+ translating=0;
+ for (fp=translatedfields; !translating && *fp; fp++)
+ if (!strcasecmp(*fp,fieldname)) translating=1;
+ if (translating) {
+ for (pf=fieldvalue, fnl=0;
+ fnl <= MAXFIELDNAME && c!=EOF && !isspace(c) && c!='\n';
+ c= getc(cc)) { *pf++= c; fnl++; }
+ *pf++= 0;
+ fputs(_(fieldvalue),stdout);
+ }
+ }
+ }
+
+ if (putc(c,stdout) == EOF) werr("stdout");
+ lines= c=='\n';
+ }
+ if (!lines) if (putc('\n',stdout) == EOF) werr("stdout");
+ }
+}
+
static void info_list(const char *debar, const char *directory) {
char interpreter[INTERPRETER_MAX+1], *p;
int il, lines;
struct dirent **cdlist, *cdep;
int cdn;
FILE *cc;
struct stat stab;
int c;
@@ -146,55 +201,69 @@
S_IXUSR & stab.st_mode ? '*' : ' ',
cdep->d_name, interpreter) == EOF)
werr("stdout");
} else {
if (printf(_(" not a plain file %.255s\n"),cdep->d_name) == EOF)
werr("stdout");
}
}
- if (!(cc= fopen("control","r"))) {
- if (errno != ENOENT) ohshite(_("failed to read `control' (in `%.255s')"),directory);
- if (fputs(_("(no `control' file in control archive!)\n"),stdout) < 0) werr("stdout");
- } else {
- lines= 1;
- while ((c= getc(cc))!= EOF) {
- if (lines) if (putc(' ',stdout) == EOF) werr("stdout");
- if (putc(c,stdout) == EOF) werr("stdout");
- lines= c=='\n';
- }
- if (!lines) if (putc('\n',stdout) == EOF) werr("stdout");
- }
+ info_control(debar, directory, 1);
}
static void info_field(const char *debar, const char *directory,
const char *const *fields, int showfieldname) {
FILE *cc;
- char fieldname[MAXFIELDNAME+1];
+ char fieldname[MAXFIELDNAME+1], fieldvalue[MAXFIELDNAME+1];
char *pf;
const char *const *fp;
- int doing, c, lno, fnl;
+ int doing, translating, c, lno, fnl;
if (!(cc= fopen("control","r"))) ohshite(_("could not open the `control' component"));
doing= 1; lno= 1;
for (;;) {
c= getc(cc); if (c==EOF) { doing=0; break; }
if (c == '\n') { lno++; doing=1; continue; }
if (!isspace(c)) {
doing= 0;
for (pf=fieldname, fnl=0;
fnl <= MAXFIELDNAME && c!=EOF && !isspace(c) && c!=':';
c= getc(cc)) { *pf++= c; fnl++; }
*pf++= 0;
doing= fnl >= MAXFIELDNAME || c=='\n' || c==EOF;
for (fp=fields; !doing && *fp; fp++)
if (!strcasecmp(*fp,fieldname)) doing=1;
if (showfieldname) {
- if (doing)
- fputs(fieldname,stdout);
+ if (doing) {
+ fputs(_(fieldname),stdout);
+
+ if (c==':') {
+ putc(c,stdout);
+ c = getc(cc);
+
+ while(c!=EOF && c!='\n' && isspace(c)) {
+ putc(c,stdout);
+ c = getc(cc);
+ }
+ if(c!=EOF && c!='\n' && !isspace(c)) {
+ translating=0;
+ for (fp=translatedfields; !translating && *fp; fp++)
+ if (!strcasecmp(*fp,fieldname)) translating=1;
+ if (translating) {
+ for (pf=fieldvalue, fnl=0;
+ fnl <= MAXFIELDNAME && c!=EOF && !isspace(c) && c!='\n';
+ c= getc(cc)) { *pf++= c; fnl++; }
+ *pf++= 0;
+ fputs(_(fieldvalue),stdout);
+ }
+ }
+
+ } }
+
+
} else {
if (c==':') c= getc(cc);
while (c != '\n' && isspace(c)) c= getc(cc);
}
}
for(;;) {
if (c == EOF) break;
if (doing) putc(c,stdout);
@@ -222,18 +291,17 @@
void do_field(const char *const *argv) {
const char *debar, *directory;
info_prepare(&argv,&debar,&directory,1);
if (*argv) {
info_field(debar, directory, argv, argv[1]!=0);
} else {
- static const char *const controlonly[]= { "control", 0 };
- info_spew(debar,directory, controlonly);
+ info_control(debar, directory, 0);
}
}
void do_contents(const char *const *argv) {
const char *debar;
if (!(debar= *argv++) || *argv) badusage(_("--contents takes exactly one argument"));
extracthalf(debar, 0, "tv", 0);
diff -Nru8 dpkg-1.4.1.16/lib/parse.c dpkg-1.4.1.16-dpkg-deb-i18n/lib/parse.c
--- dpkg-1.4.1.16/lib/parse.c Fri Jan 29 09:54:00 1999
+++ dpkg-1.4.1.16-dpkg-deb-i18n/lib/parse.c Fri Oct 22 22:27:20 1999
@@ -26,41 +26,41 @@
#include <config.h>
#include <dpkg.h>
#include <dpkg-db.h>
#include "parsedump.h"
const struct fieldinfo fieldinfos[]= {
/* NB: capitalisation of these strings is important. */
- { "Package", f_name, w_name },
- { "Essential", f_boolean, w_booleandefno, PKGIFPOFF(essential) },
- { "Status", f_status, w_status },
- { "Priority", f_priority, w_priority },
- { "Section", f_section, w_section },
- { "Installed-Size", f_charfield, w_charfield, PKGIFPOFF(installedsize) },
- { "Maintainer", f_charfield, w_charfield, PKGIFPOFF(maintainer) },
- { "Architecture", f_charfield, w_charfield, PKGIFPOFF(architecture) },
- { "Source", f_charfield, w_charfield, PKGIFPOFF(source) },
- { "Version", f_version, w_version },
- { "Revision", f_revision, w_null },
- { "Config-Version", f_configversion, w_configversion },
- { "Replaces", f_dependency, w_dependency, dep_replaces },
- { "Provides", f_dependency, w_dependency, dep_provides },
- { "Depends", f_dependency, w_dependency, dep_depends },
- { "Pre-Depends", f_dependency, w_dependency, dep_predepends },
- { "Recommends", f_dependency, w_dependency, dep_recommends },
- { "Suggests", f_dependency, w_dependency, dep_suggests },
- { "Conflicts", f_dependency, w_dependency, dep_conflicts },
- { "Conffiles", f_conffiles, w_conffiles },
- { "Filename", f_filecharf, w_filecharf, FILEFOFF(name) },
- { "Size", f_filecharf, w_filecharf, FILEFOFF(size) },
- { "MD5sum", f_filecharf, w_filecharf, FILEFOFF(md5sum) },
- { "MSDOS-Filename", f_filecharf, w_filecharf, FILEFOFF(msdosname) },
- { "Description", f_charfield, w_charfield, PKGIFPOFF(description) },
+ { N_("Package"), f_name, w_name },
+ { N_("Essential"), f_boolean, w_booleandefno, PKGIFPOFF(essential) },
+ { N_("Status"), f_status, w_status },
+ { N_("Priority"), f_priority, w_priority },
+ { N_("Section"), f_section, w_section },
+ { N_("Installed-Size"), f_charfield, w_charfield, PKGIFPOFF(installedsize) },
+ { N_("Maintainer"), f_charfield, w_charfield, PKGIFPOFF(maintainer) },
+ { N_("Architecture"), f_charfield, w_charfield, PKGIFPOFF(architecture) },
+ { N_("Source"), f_charfield, w_charfield, PKGIFPOFF(source) },
+ { N_("Version"), f_version, w_version },
+ { N_("Revision"), f_revision, w_null },
+ { N_("Config-Version"), f_configversion, w_configversion },
+ { N_("Replaces"), f_dependency, w_dependency, dep_replaces },
+ { N_("Provides"), f_dependency, w_dependency, dep_provides },
+ { N_("Depends"), f_dependency, w_dependency, dep_depends },
+ { N_("Pre-Depends"), f_dependency, w_dependency, dep_predepends },
+ { N_("Recommends"), f_dependency, w_dependency, dep_recommends },
+ { N_("Suggests"), f_dependency, w_dependency, dep_suggests },
+ { N_("Conflicts"), f_dependency, w_dependency, dep_conflicts },
+ { N_("Conffiles"), f_conffiles, w_conffiles },
+ { N_("Filename"), f_filecharf, w_filecharf, FILEFOFF(name) },
+ { N_("Size"), f_filecharf, w_filecharf, FILEFOFF(size) },
+ { N_("MD5sum"), f_filecharf, w_filecharf, FILEFOFF(md5sum) },
+ { N_("MSDOS-Filename"), f_filecharf, w_filecharf, FILEFOFF(msdosname) },
+ { N_("Description"), f_charfield, w_charfield, PKGIFPOFF(description) },
/* Note that aliases are added to the nicknames table in parsehelp.c. */
{ 0 /* sentinel - tells code that list is ended */ }
};
#define NFIELDS (sizeof(fieldinfos)/sizeof(struct fieldinfo))
const int nfields= NFIELDS;
static void cu_parsedb(int argc, void **argv) { fclose((FILE*)*argv); }
diff -Nru8 dpkg-1.4.1.16/lib/parsehelp.c dpkg-1.4.1.16-dpkg-deb-i18n/lib/parsehelp.c
--- dpkg-1.4.1.16/lib/parsehelp.c Fri Jan 29 09:54:00 1999
+++ dpkg-1.4.1.16-dpkg-deb-i18n/lib/parsehelp.c Sat Oct 23 16:02:30 1999
@@ -51,33 +51,33 @@
strcat(q,"\n");
if (vfprintf(warnto,buf2,al) == EOF)
ohshite(_("failed to write parsing warning"));
}
va_end(al);
}
const struct namevalue booleaninfos[]= { /* Note ! These must be in order ! */
- { "no", 0 },
- { "yes", 1 },
+ { N_("no"), 0 },
+ { N_("yes"), 1 },
{ 0 }
};
const struct namevalue priorityinfos[]= { /* Note ! These must be in order ! */
- { "required", pri_required },
- { "important", pri_important },
- { "standard", pri_standard },
- { "recommended", pri_recommended }, /* fixme: obsolete */
- { "optional", pri_optional },
- { "extra", pri_extra },
- { "contrib", pri_contrib }, /* fixme: keep? */
- { "this is a bug - please report", pri_other },
- { "unknown", pri_unknown },
+ { N_("required"), pri_required },
+ { N_("important"), pri_important },
+ { N_("standard"), pri_standard },
+ { N_("recommended"), pri_recommended }, /* fixme: obsolete */
+ { N_("optional"), pri_optional },
+ { N_("extra"), pri_extra },
+ { N_("contrib"), pri_contrib }, /* fixme: keep? */
+ { N_("this is a bug - please report"), pri_other },
+ { N_("unknown"), pri_unknown },
- { "base", pri_required }, /* fixme: alias, remove */
+ { N_("base"), pri_required }, /* fixme: alias, remove */
{ 0 }
};
const struct namevalue statusinfos[]= { /* Note ! These must be in order ! */
{ "not-installed", stat_notinstalled },
{ "unpacked", stat_unpacked },
{ "half-configured", stat_halfconfigured },
{ "installed", stat_installed },
@@ -124,21 +124,21 @@
snprintf(buf, sizeof(buf),
_("character `%c' not allowed - only letters, digits and %s allowed"),
c, alsoallowed);
return buf;
}
const struct nickname nicknames[]= {
/* NB: capitalisation of these strings is important. */
- { "Recommended", "Recommends" },
- { "Optional", "Suggests" },
- { "Class", "Priority" },
- { "Package-Revision", "Revision" },
- { "Package_Revision", "Revision" },
+ { N_("Recommended"), "Recommends" },
+ { N_("Optional"), "Suggests" },
+ { N_("Class"), "Priority" },
+ { N_("Package-Revision"), "Revision" },
+ { N_("Package_Revision"), "Revision" },
{ 0 }
};
int informativeversion(const struct versionrevision *version) {
return (version->epoch ||
(version->version && *version->version) ||
(version->revision && *version->revision));
}
-- System Information
Debian Release: potato
Kernel Version: Linux purple 2.2.12 #1 Wed Sep 29 15:56:52 CEST 1999 i686 unknown
Versions of the packages dpkg depends on:
ii libc6 2.1.2-5 GNU C Library: Shared libraries and timezone
ii libncurses4 4.2-3.4 Shared libraries for terminal handling
ii libstdc++2.10 2.95.2-0pre3 The GNU stdc++ library
Reply to: