FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian dpkg

 
 
LinkBack Thread Tools
 
Old 12-24-2010, 12:34 AM
Steve Langasek
 
Default pkg:arch handling for dpkg -l

Output pkg:arch in dpkg -l output for non-native packages, and parse pkg:arch
syntax in input arguments to dpkg -l
---
src/query.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/query.c b/src/query.c
index 552f56e..50b5e9e 100644
--- a/src/query.c
+++ b/src/query.c
@@ -79,6 +79,7 @@ list1package(struct pkginfo *pkg, int *head, struct pkg_array *array)
int i,l,w;
static int nw,vw,dw;
const char *pdesc;
+ char *pname;
static char format[80] = "";

if (format[0] == '') {
@@ -93,6 +94,9 @@ list1package(struct pkginfo *pkg, int *head, struct pkg_array *array)
if (!pdesc) pdesc= _("(no description available)");

plen = strlen(array->pkgs[i]->name);
+ if (strcmp(ARCHITECTURE, array->pkgs[i]->installed.architecture) != 0 &&
+ strcmp("all", array->pkgs[i]->installed.architecture) != 0)
+ plen += strlen(array->pkgs[i]->installed.architecture) + 1;
vlen = strlen(versiondescribe(&array->pkgs[i]->installed.version,
vdew_nonambig));
dlen= strcspn(pdesc, "
");
@@ -124,13 +128,22 @@ Desired=Unknown/Install/Remove/Purge/Hold

printf("
");
*head= 1;
}
+ if (pkg->installed.architecture &&
+ strcmp(ARCHITECTURE, pkg->installed.architecture) != 0 &&
+ strcmp("all", pkg->installed.architecture) != 0)
+ {
+ pname = m_malloc(strlen(pkg->installed.architecture) + strlen(pkg->name) + 2);
+ sprintf(pname, "%s:%s", pkg->name, pkg->installed.architecture);
+ } else {
+ pname = (char *)pkg->name;
+ }
if (!pkg->installed.valid) blankpackageperfile(&pkg->installed);
limiteddescription(pkg,dw,&pdesc,&l);
printf(format,
"uihrp"[pkg->want],
"ncHUFWti"[pkg->status],
" R"[pkg->eflag],
- pkg->name,
+ pname,
versiondescribe(&pkg->installed.version, vdew_nonambig),
l, pdesc);
}
@@ -161,9 +174,21 @@ void listpackages(const char *const *argv) {
memset(found, 0, sizeof(int) * argc);

for (i = 0; i < array.n_pkgs; i++) {
+ char *arch, *pkgname;
pkg = array.pkgs[i];
for (ip = 0; ip < argc; ip++) {
- if (!fnmatch(argv[ip], pkg->name, 0)) {
+ pkgname = m_strdup(argv[ip]);
+ arch = strchr(pkgname, ':');
+ if (arch) {
+ *arch = '';
+ arch++;
+ }
+ if (!fnmatch(pkgname, pkg->name, 0) &&
+ (!pkg->installed.architecture ||
+ (arch && fnmatch(arch, pkg->installed.architecture, 0) == 0) ||
+ (!arch && (strcmp(ARCHITECTURE, pkg->installed.architecture) == 0 ||
+ strcmp("all", pkg->installed.architecture) == 0))))
+ {
list1package(pkg, &head, &array);
found[ip]++;
break;
--
1.7.1


--
To UNSUBSCRIBE, email to debian-dpkg-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20101224013428.GH4604@virgil.dodds.net">http://lists.debian.org/20101224013428.GH4604@virgil.dodds.net
 
Old 12-24-2010, 02:16 AM
Steve Langasek
 
Default pkg:arch handling for dpkg -l

On Thu, Dec 23, 2010 at 05:34:28PM -0800, Steve Langasek wrote:
> Output pkg:arch in dpkg -l output for non-native packages, and parse pkg:arch
> syntax in input arguments to dpkg -l
> ---
> src/query.c | 29 +++++++++++++++++++++++++++--
> 1 files changed, 27 insertions(+), 2 deletions(-)

Likewise, an updated version of this patch rebased against current dpkg.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek@ubuntu.com vorlon@debian.org
 

Thread Tools




All times are GMT. The time now is 09:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org