=== modified file 'apt-pkg/deb/deblistparser.cc'
--- apt-pkg/deb/deblistparser.cc	2012-04-18 16:13:30 +0000
+++ apt-pkg/deb/deblistparser.cc	2012-05-12 10:46:32 +0000
@@ -550,8 +550,6 @@
 
    if (ParseArchFlags == true)
    {
-      string completeArch = CompleteArch(arch);
-
       // Parse an architecture
       if (I != Stop && *I == '[')
       {
@@ -581,8 +579,8 @@
 	    if (stringcmp(arch,I,End) == 0) {
 	       Found = true;
 	    } else {
-	       std::string wildcard = SubstVar(string(I, End), "any", "*");
-	       if (fnmatch(wildcard.c_str(), completeArch.c_str(), 0) == 0)
+	       ArchSpec const spec = ArchSpec(string(I, End));
+	       if (spec.Match(arch) == true)
 	          Found = true;
 	    }
 	    
@@ -892,3 +890,32 @@
    return Out;
 }
 									/*}}}*/
+// ArchSpec::ArchSpec - Constructor                                     /*{{{*/
+// ---------------------------------------------------------------------
+/* Encapsulates an architecture specification string as an object
+   capable of efficient matching against archtecture strings.
+
+   The strings are of the format <kernel>-<cpu> where either component,
+   or the whole string, can be the wildcard "any":
+
+     i386
+     mipsel
+     linux-any
+     netbsd-i386
+     any-amd64
+     any
+
+   See debian-policy section 11.1 */
+debListParser::ArchSpec::ArchSpec(string const &Spec)
+   : Str(Spec), Pattern(SubstVar(Spec, "any", "*"))
+{
+}
+									/*}}}*/
+// ArchSpec::Match - Match Spec against Arch				/*{{{*/
+bool debListParser::ArchSpec::Match(string const &Arch) const
+{
+  if (Arch == Str)
+    return true;
+  return fnmatch(Pattern.c_str(), CompleteArch(Arch).c_str(), 0) == 0;
+}
+									/*}}}*/

=== modified file 'apt-pkg/deb/deblistparser.h'
--- apt-pkg/deb/deblistparser.h	2011-12-13 00:22:38 +0000
+++ apt-pkg/deb/deblistparser.h	2012-05-12 11:03:37 +0000
@@ -29,6 +29,18 @@
       unsigned char Val;
    };
 
+   // Architecture specification string, <kernel>-<cpu>
+   // See debian-policy section 11.1
+   class ArchSpec
+   {
+      public:
+      std::string const Str;
+      std::string const Pattern;
+
+      ArchSpec(std::string const &Spec);
+      bool Match(std::string const &Arch) const;
+   };
+
    private:
    /** \brief dpointer placeholder (for later in case we need it) */
    void *d;

