Просмотр исходного кода

libdpkg: Always print parse warnings on stderr

Remove now unused warnto from parsedb_stat struct.
Guillem Jover лет назад: 15
Родитель
Сommit
ba908783e3
9 измененных файлов с 15 добавлено и 22 удалено
  1. 1 1
      dpkg-deb/build.c
  2. 1 1
      dpkg-deb/info.c
  3. 3 4
      lib/dpkg/dbmodify.c
  4. 1 1
      lib/dpkg/dpkg-db.h
  5. 3 6
      lib/dpkg/parse.c
  6. 0 1
      lib/dpkg/parsedump.h
  7. 3 5
      lib/dpkg/parsehelp.c
  8. 1 1
      src/processarc.c
  9. 2 2
      src/update.c

+ 1 - 1
dpkg-deb/build.c

@@ -265,7 +265,7 @@ void do_build(const char *const *argv) {
     strcat(controlfile, "/" BUILDCONTROLDIR "/" CONTROLFILE);
     warns = 0;
     parsedb(controlfile, pdb_recordavailable|pdb_rejectstatus,
-            &checkedinfo, stderr, &warns);
+            &checkedinfo, &warns);
     if (strspn(checkedinfo->name,
                "abcdefghijklmnopqrstuvwxyz0123456789+-.")
         != strlen(checkedinfo->name))

+ 1 - 1
dpkg-deb/info.c

@@ -258,7 +258,7 @@ void do_showinfo(const char* const* argv) {
   info_prepare(&argv,&debar,&directory,1);
 
   parsedb(CONTROLFILE, pdb_recordavailable | pdb_rejectstatus | pdb_ignorefiles,
-          &pkg, NULL, NULL);
+          &pkg, NULL);
   pkg_format_show(fmt, pkg, &pkg->available);
 }
 

+ 3 - 4
lib/dpkg/dbmodify.c

@@ -75,8 +75,7 @@ static void cleanupdates(void) {
   struct dirent **cdlist;
   int cdn, i;
 
-  parsedb(statusfile, pdb_lax_parser | pdb_weakclassification,
-          NULL, NULL, NULL);
+  parsedb(statusfile, pdb_lax_parser | pdb_weakclassification, NULL, NULL);
 
   *updatefnrest = '\0';
   updateslength= -1;
@@ -88,7 +87,7 @@ static void cleanupdates(void) {
     for (i=0; i<cdn; i++) {
       strcpy(updatefnrest, cdlist[i]->d_name);
       parsedb(updatefnbuf, pdb_lax_parser | pdb_weakclassification,
-              NULL, NULL, NULL);
+              NULL, NULL);
       if (cstatus < msdbrw_write) free(cdlist[i]);
     }
 
@@ -255,7 +254,7 @@ modstatdb_init(const char *admindir, enum modstatdb_rw readwritereq)
     if(!(cflags & msdbrw_noavail))
     parsedb(availablefile,
             pdb_recordavailable | pdb_rejectstatus | pdb_lax_parser,
-            NULL,NULL,NULL);
+            NULL, NULL);
   }
 
   if (cstatus >= msdbrw_write) {

+ 1 - 1
lib/dpkg/dpkg-db.h

@@ -243,7 +243,7 @@ enum parsedbflags {
 
 const char *pkg_name_is_illegal(const char *p, const char **ep);
 int parsedb(const char *filename, enum parsedbflags, struct pkginfo **donep,
-            FILE *warnto, int *warncount);
+            int *warncount);
 void copy_dependency_links(struct pkginfo *pkg,
                            struct dependency **updateme,
                            struct dependency *newdepends,

+ 3 - 6
lib/dpkg/parse.c

@@ -81,8 +81,9 @@ const struct fieldinfo fieldinfos[]= {
 };
 
 int parsedb(const char *filename, enum parsedbflags flags,
-            struct pkginfo **donep, FILE *warnto, int *warncount) {
-  /* warnto, warncount and donep may be null.
+            struct pkginfo **donep, int *warncount)
+{
+  /* warncount and donep may be null.
    * If donep is not null only one package's information is expected.
    */
   
@@ -106,10 +107,6 @@ int parsedb(const char *filename, enum parsedbflags flags,
   ps.filename = filename;
   ps.flags = flags;
   ps.lno = 0;
-  if (warnto == NULL)
-    ps.warnto = stderr;
-  else
-    ps.warnto = warnto;
   ps.warncount = 0;
 
   newpifp= (flags & pdb_recordavailable) ? &newpig.available : &newpig.installed;

+ 0 - 1
lib/dpkg/parsedump.h

@@ -28,7 +28,6 @@ struct parsedb_state {
 	enum parsedbflags flags;
 	const char *filename;
 	int lno;
-	FILE *warnto;
 	int warncount;
 };
 

+ 3 - 5
lib/dpkg/parsehelp.c

@@ -72,11 +72,9 @@ parse_warn(struct parsedb_state *ps,
 
   va_start(args, fmt);
   ps->warncount++;
-  if (ps->warnto) {
-    strcat(q,"\n");
-    if (vfprintf(ps->warnto, buf2, args) == EOF)
-      ohshite(_("failed to write parsing warning"));
-  }
+  strcat(q, "\n");
+  if (vfprintf(stderr, buf2, args) == EOF)
+    ohshite(_("failed to write parsing warning"));
   va_end(args);
 }
 

+ 1 - 1
src/processarc.c

@@ -241,7 +241,7 @@ void process_archive(const char *filename) {
   strcpy(cidirrest,CONTROLFILE);
 
   parsedb(cidir, pdb_recordavailable | pdb_rejectstatus | pdb_ignorefiles,
-          &pkg,NULL,NULL);
+          &pkg, NULL);
   if (!pkg->files) {
     pkg->files= nfmalloc(sizeof(struct filedetails));
     pkg->files->next = NULL;

+ 2 - 2
src/update.c

@@ -80,12 +80,12 @@ void updateavailable(const char *const *argv) {
 
   if (cipaction->arg == act_avmerge)
     parsedb(vb.buf, pdb_recordavailable | pdb_rejectstatus | pdb_lax_parser,
-            NULL, NULL, NULL);
+            NULL, NULL);
 
   if (cipaction->arg != act_avclear)
     count += parsedb(sourcefile,
 		     pdb_recordavailable | pdb_rejectstatus | pdb_ignoreolder,
-                     NULL, NULL, NULL);
+                     NULL, NULL);
 
   if (!f_noact) {
     writedb(vb.buf,1,0);