[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 0/2] *** SUBJECT HERE ***



*** BLURB HERE ***

Steve Langasek (2):
  Output pkg:arch in dpkg -S output for non-native packages
  pkg:arch handling for dpkg -l

 src/query.c |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

>From 0404e9789b26c9e4caff1f409920925f46ea9cf6 Mon Sep 17 00:00:00 2001
Message-Id: <0404e9789b26c9e4caff1f409920925f46ea9cf6.1293153936.git.steve.langasek@canonical.com>
In-Reply-To: <cover.1293153936.git.steve.langasek@canonical.com>
References: <cover.1293153936.git.steve.langasek@canonical.com>
From: Steve Langasek <steve.langasek@canonical.com>
Date: Mon, 31 Aug 2009 18:10:46 -0700
Subject: [PATCH 1/2] Output pkg:arch in dpkg -S output for non-native packages
To: debian-dpkg@lists.debian.org

---
 src/query.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/query.c b/src/query.c
index 68244ac..552f56e 100644
--- a/src/query.c
+++ b/src/query.c
@@ -215,6 +215,13 @@ static int searchoutput(struct filenamenode *namenode) {
     for (i=0; i < PERFILEPACKAGESLUMP && packageslump->pkgs[i]; i++) {
       if (found) fputs(", ",stdout);
       fputs(packageslump->pkgs[i]->name,stdout);
+      if (strcmp(packageslump->pkgs[i]->installed.architecture,
+                 ARCHITECTURE) != 0 &&
+          strcmp(packageslump->pkgs[i]->installed.architecture, "all") != 0)
+      {
+        fputc(':', stdout);
+        fputs(packageslump->pkgs[i]->installed.architecture, stdout);
+      }
       found++;
     }
   }
-- 
1.7.1


>From b295d1eea5ad1be7b78d72fe789239ed75befbcb Mon Sep 17 00:00:00 2001
Message-Id: <b295d1eea5ad1be7b78d72fe789239ed75befbcb.1293153936.git.steve.langasek@canonical.com>
In-Reply-To: <cover.1293153936.git.steve.langasek@canonical.com>
References: <cover.1293153936.git.steve.langasek@canonical.com>
From: Steve Langasek <steve.langasek@canonical.com>
Date: Sat, 5 Sep 2009 00:36:25 -0700
Subject: [PATCH 2/2] pkg:arch handling for dpkg -l
To: debian-dpkg@lists.debian.org

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] == '\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, "\n");
@@ -124,13 +128,22 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\
     printf("\n");
     *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 = '\0';
+		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


Reply to: