Selaa lähdekoodia

libdpkg: Pass struct pkgbin to pkg_summary()

Guillem Jover 14 vuotta sitten
vanhempi
commit
de78783d96
5 muutettua tiedostoa jossa 13 lisäystä ja 11 poistoa
  1. 2 2
      lib/dpkg/pkg-format.c
  2. 3 3
      lib/dpkg/pkg-show.c
  3. 3 2
      lib/dpkg/pkg-show.h
  4. 2 1
      src/enquiry.c
  5. 3 3
      src/querycmd.c

+ 2 - 2
lib/dpkg/pkg-format.c

@@ -3,7 +3,7 @@
  * pkg-format.c - customizable package formatting
  *
  * Copyright © 2001 Wichert Akkerman <wakkerma@debian.org>
- * Copyright © 2008-2011 Guillem Jover <guillem@debian.org>
+ * Copyright © 2008-2012 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -231,7 +231,7 @@ virt_summary(struct varbuf *vb,
 	const char *desc;
 	int len;
 
-	desc = pkg_summary(pkg, &len);
+	desc = pkg_summary(pkg, pkgbin, &len);
 
 	varbuf_add_buf(vb, desc, len);
 }

+ 3 - 3
lib/dpkg/pkg-show.c

@@ -3,7 +3,7 @@
  * pkg-show.c - primitives for pkg information display
  *
  * Copyright © 1995,1996 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2008-2011 Guillem Jover <guillem@debian.org>
+ * Copyright © 2008-2012 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -131,12 +131,12 @@ pkg_name(struct pkginfo *pkg, enum pkg_name_arch_when pnaw)
 }
 
 const char *
-pkg_summary(const struct pkginfo *pkg, int *len_ret)
+pkg_summary(const struct pkginfo *pkg, const struct pkgbin *pkgbin, int *len_ret)
 {
 	const char *pdesc;
 	size_t len;
 
-	pdesc = pkg->installed.description;
+	pdesc = pkgbin->description;
 	if (!pdesc)
 		pdesc = _("(no description available)");
 

+ 3 - 2
lib/dpkg/pkg-show.h

@@ -2,7 +2,7 @@
  * libdpkg - Debian packaging suite library routines
  * pkg-show.h - primitives for pkg information display
  *
- * Copyright © 2010-2011 Guillem Jover <guillem@debian.org>
+ * Copyright © 2010-2012 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,7 +26,8 @@
 
 DPKG_BEGIN_DECLS
 
-const char *pkg_summary(const struct pkginfo *pkg, int *len_ret);
+const char *pkg_summary(const struct pkginfo *pkg, const struct pkgbin *pkgbin,
+                        int *len_ret);
 int pkg_abbrev_want(const struct pkginfo *pkg);
 int pkg_abbrev_status(const struct pkginfo *pkg);
 int pkg_abbrev_eflag(const struct pkginfo *pkg);

+ 2 - 1
src/enquiry.c

@@ -3,6 +3,7 @@
  * enquiry.c - status enquiry and listing options
  *
  * Copyright © 1995,1996 Ian Jackson <ian@chiark.greenend.org.uk>
+ * Copyright © 2006,2008-2012 Guillem Jover <guillem@debian.org>
  * Copyright © 2011 Linaro Limited
  * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
  *
@@ -147,7 +148,7 @@ static void describebriefly(struct pkginfo *pkg) {
   l= strlen(pkg->set->name);
   if (l>20) maxl -= (l-20);
 
-  pdesc = pkg_summary(pkg, &l);
+  pdesc = pkg_summary(pkg, &pkg->installed, &l);
   l = min(l, maxl);
 
   printf(" %-20s %.*s\n", pkg->set->name, l, pdesc);

+ 3 - 3
src/querycmd.c

@@ -4,7 +4,7 @@
  *
  * Copyright © 1995,1996 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 2000,2001 Wichert Akkerman <wakkerma@debian.org>
- * Copyright © 2006-2011 Guillem Jover <guillem@debian.org>
+ * Copyright © 2006-2012 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -105,7 +105,7 @@ list_format_init(struct list_format *fmt, struct pkg_array *array)
       plen = strlen(array->pkgs[i]->set->name);
       vlen = strlen(versiondescribe(&array->pkgs[i]->installed.version,
                                     vdew_nonambig));
-      pkg_summary(array->pkgs[i], &dlen);
+      pkg_summary(array->pkgs[i], &array->pkgs[i]->installed, &dlen);
 
       if (plen > fmt->nw)
         fmt->nw = plen;
@@ -183,7 +183,7 @@ list1package(struct pkginfo *pkg, struct list_format *fmt, struct pkg_array *arr
   list_format_init(fmt, array);
   list_format_print_header(fmt);
 
-  pdesc = pkg_summary(pkg, &l);
+  pdesc = pkg_summary(pkg, &pkg->installed, &l);
   l = min(l, fmt->dw);
 
   printf(fmt->format,