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

Bug#560058: marked as done (quinn-diff: should support architecture wildcards)



Your message dated Mon, 28 Mar 2011 10:48:11 +0000
with message-id <E1Q49zX-00076L-Gw@franck.debian.org>
and subject line Bug#618820: Removed package(s) from unstable
has caused the Debian Bug report #560058,
regarding quinn-diff: should support architecture wildcards
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
560058: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560058
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: quinn-diff
Version: 0.67
Severity: normal
Tags: patch

quinn-diff should support architecture wildcards just as support for them have
been implemented in dpkg and sbuild.

Here's a patch that will allow quinn-diff to support a Packages-arch-specific
that has entries that include architecture wildcards.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages quinn-diff depends on:
ii  libc6                         2.10.2-2   GNU C Library: Shared libraries
ii  libglib2.0-0                  2.22.3-1   The GLib library of C routines

Versions of packages quinn-diff recommends:
ii  debianutils                   3.2.2      Miscellaneous utilities specific t
ii  lftp                          4.0.2-1    Sophisticated command-line FTP/HTT

quinn-diff suggests no packages.

-- no debconf information
diff --git a/src/utils.c b/src/utils.c
index 3cbd674..08e7ffa 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -287,20 +287,322 @@ xstrdup (const char *s)
 boolean
 in_arch_list(const char *arch_list, const char *arch)
 {
-  char **archs;
-  int i;
-
-  if ((archs = g_strsplit(arch_list," ",0)) != NULL)
+  /* Overview of strings to match:
+   * any
+   * <cpu>
+   * any-any
+   * any-<cpu>
+   * <kernel>-any
+   * <kernel>-<cpu>
+   * any-any-any
+   * any-any-<cpu>
+   * any-<kernel>-any
+   * any-<kernel>-<cpu>
+   * <system>-any-any
+   * <system>-any-<cpu>
+   * <system>-<kernel>-any
+   * <system>-<kernel>-<cpu>
+   */
+
+  char *archs = strdup(arch_list);
+  char *archtok = strtok(archs, " ");
+
+  while (archtok != NULL)
+  {
+    /* Traditional comparison. Search for exact strings or "any"
+     * any
+     * <cpu>
+     * any-any
+     * <kernel>-<cpu>
+     * any-any-any
+     * <system>-<kernel>-<cpu>
+     */
+    if (!strcmp(archtok,arch) || !strcmp(archtok,"any") ||
+	!strcmp(archtok,"any-any") || !strcmp(archtok,"any-any-any"))
     {
-      for ( i = 0 ; archs[i] ; i++ )
-	{
-	  if (!strcmp(archs[i],arch))
-	    {
-	      g_strfreev(archs);
-	      return TRUE;
-	    }
-	}
-      g_strfreev(archs);
+      free(archs);
+      return TRUE;
+    }
+
+    /* Match from variable 'arch' with the use of triplets
+     * '<system>-<kernel>-<cpu>' */
+    int first = 0, second = 0;
+    char *temp = strchr(arch, '-');
+    if (temp != NULL) {
+      first = temp - arch;
+      temp = strchr(temp + 1, '-');
+      if (temp != NULL) {
+	second = temp - arch;
+      }
     }
+
+    /* Search for matches when Packages arch given <cpu>:
+     * linux-any
+     * linux-<cpu>
+     * any-<cpu>
+     * any-linux-any
+     * any-linux-<cpu>
+     */
+    if ((first == 0) && (first == second)) {
+      int size = strlen("any-linux-") + strlen(arch) + 1;
+      char *wildcard = malloc(size);
+      if (wildcard == NULL) {
+        fubar (SYSERR, "in_arch_list: failed to allocate memory for wildcard.");
+      }
+
+      /* linux-any, linux-<cpu>, any-linux-any */
+      sprintf(wildcard, "linux-%s", arch);
+      if (!strcmp(archtok,"linux-any") || !strcmp(archtok,wildcard) ||
+	  !strcmp(archtok,"any-linux-any")) {
+	free(archs);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* any-<cpu> */
+      sprintf(wildcard, "any-%s", arch);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* any-linux-<cpu> */
+      sprintf(wildcard, "any-linux-%s", arch);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(wildcard);
+	return TRUE;
+      }
+
+      free(wildcard);
+    }
+
+    /* Search for matches when Packages arch given is <kernel>-<cpu>:
+     * any-<cpu>
+     * <kernel>-any
+     * any-any-<cpu>
+     * any-<kernel>-any
+     * any-<kernel>-<cpu>
+     */
+    if ((first > 0) && (second == 0)) {
+      char *cpu = strdup(arch+first+1);
+      char *kernel = strdup(arch);
+      kernel[first] = '\0';
+
+      /* any-<cpu>, any-any-<cpu> */
+      unsigned int size = strlen("any-any-") + strlen(cpu) + 1;
+      char *wildcard = malloc(size);
+      if (wildcard == NULL) {
+        fubar (SYSERR, "in_arch_list: failed to allocate memory for wildcard.");
+      }
+      sprintf(wildcard, "any-%s", cpu);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(wildcard);
+	return TRUE;
+      }
+      sprintf(wildcard, "any-any-%s", cpu);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* <kernel>-any, any-<kernel>-any */
+      size = strlen("any-") + strlen(kernel) + strlen("-any") + 1;
+      wildcard = (char*)realloc(wildcard, size);
+      if (wildcard == NULL) {
+        fubar (SYSERR,
+	  "in_arch_list: failed to reallocate memory for wildcard.");
+      }
+      sprintf(wildcard, "%s-any", kernel);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(wildcard);
+	return TRUE;
+      }
+      sprintf(wildcard, "any-%s-any", kernel);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* any-<kernel>-<cpu> */
+      size = strlen("any-") + strlen(kernel) + strlen(cpu) + 1;
+      wildcard = (char*)realloc(wildcard, size);
+      if (wildcard == NULL) {
+        fubar (SYSERR,
+	  "in_arch_list: failed to reallocate memory for wildcard.");
+      }
+      sprintf(wildcard, "any-%s-%s", kernel, cpu);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(wildcard);
+	return TRUE;
+      }
+
+      free(cpu);
+      free(kernel);
+      free(wildcard);
+    }
+
+    /* Search for matches when Pakages arch given is <system>-<kernel>-<cpu>:
+     * any-<cpu>
+     * <kernel>-any
+     * any-any-<cpu>
+     * any-<kernel>-any
+     * any-<kernel>-<cpu>
+     * <system>-any-any
+     * <system>-any-<cpu>
+     * <system>-<kernel>-any
+     */
+    if ((first > 0) && (second > first)) {
+      char *cpu = strdup(arch+second+1);
+      char *kernel = strdup(arch+first+1);
+      kernel[strlen(arch)-second] = '\0';
+      char *system = strdup(arch);
+      system[first] = '\0';
+
+      /* any-<cpu>, any-any-<cpu> */
+      unsigned int size = strlen("any-any-") + strlen(cpu) + 1;
+      char *wildcard = malloc(size);
+      if (wildcard == NULL) {
+        fubar (SYSERR, "in_arch_list: failed to allocate memory for wildcard.");
+      }
+      sprintf(wildcard, "any-%s", cpu);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+      sprintf(wildcard, "any-any-%s", cpu);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* <kernel>-any, any-<kernel>-any */
+      size = strlen("any-") + strlen(kernel) + strlen("-any") + 1;
+      wildcard = (char*)realloc(wildcard, size);
+      if (wildcard == NULL) {
+        fubar (SYSERR,
+	  "in_arch_list: failed to reallocate memory for wildcard.");
+      }
+      sprintf(wildcard, "%s-any", kernel);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+      sprintf(wildcard, "any-%s-any", kernel);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* any-<kernel>-<cpu> */
+      size = strlen("any-") + strlen(kernel) + strlen("-") + strlen(cpu) + 1;
+      wildcard = (char*)realloc(wildcard, size);
+      if (wildcard == NULL) {
+        fubar (SYSERR,
+	  "in_arch_list: failed to reallocate memory for wildcard.");
+      }
+      sprintf(wildcard, "any-%s-%s", kernel, cpu);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* <system>-any-any */
+      size = strlen(system) + strlen("-any-any") + 1;
+      wildcard = (char*)realloc(wildcard, size);
+      if (wildcard == NULL) {
+        fubar (SYSERR,
+	  "in_arch_list: failed to reallocate memory for wildcard.");
+      }
+      sprintf(wildcard, "%s-any-any", system);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* <system>-any-<cpu> */
+      size = strlen(system) + strlen("-any-") + strlen(cpu) + 1;
+      wildcard = (char*)realloc(wildcard, size);
+      if (wildcard == NULL) {
+        fubar (SYSERR,
+	  "in_arch_list: failed to reallocate memory for wildcard.");
+      }
+      sprintf(wildcard, "%s-any-%s", system, cpu);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+
+      /* <system>-<kernel>-any */
+      size = strlen(system) + strlen("-") + strlen(kernel) + strlen("-any") + 1;
+      wildcard = (char*)realloc(wildcard, size);
+      if (wildcard == NULL) {
+        fubar (SYSERR,
+	  "in_arch_list: failed to reallocate memory for wildcard.");
+      }
+      sprintf(wildcard, "%s-%s-any", system, kernel);
+      if (!strcmp(archtok,wildcard)) {
+	free(archs);
+	free(cpu);
+	free(kernel);
+	free(system);
+	free(wildcard);
+	return TRUE;
+      }
+
+      free(cpu);
+      free(kernel);
+      free(system);
+      free(wildcard);
+    }
+
+    /* Go on to the next architecture in the list */
+    archtok = strtok(NULL, " ");
+  }
+  free(archs);
   return FALSE;
 }

--- End Message ---
--- Begin Message ---
Version: 0.72-2+rm

Dear submitter,

as the package quinn-diff has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see http://bugs.debian.org/618820

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@debian.org.

Debian distribution maintenance software
pp.
Alexander Reichle-Schmehl (the ftpmaster behind the curtain)


--- End Message ---

Reply to: