=== modified file 'apt-pkg/deb/deblistparser.cc'
--- apt-pkg/deb/deblistparser.cc	2013-01-08 15:35:57 +0000
+++ apt-pkg/deb/deblistparser.cc	2013-01-29 20:03:07 +0000
@@ -481,7 +481,8 @@
    // Parse off the package name
    const char *I = Start;
    for (;I != Stop && isspace(*I) == 0 && *I != '(' && *I != ')' &&
-	*I != ',' && *I != '|' && *I != '[' && *I != ']'; I++);
+	*I != ',' && *I != '|' && *I != '[' && *I != ']' &&
+	*I != '<' && *I != '>'; I++);
    
    // Malformed, no '('
    if (I != Stop && *I == ')')
@@ -598,6 +599,64 @@
       for (;I != Stop && isspace(*I) != 0; I++);
    }
 
+   string const buildprofile = _config->Find("APT::Get::Build-Profile");
+
+   if (buildprofile.empty() == false) {
+       // Parse a build profile
+       if (I != Stop && *I == '<')
+       {
+           ++I;
+           // malformed
+           if (unlikely(I == Stop))
+               return 0;
+
+           const char *End = I;
+           bool Found = false;
+           bool NegProfile = false;
+           while (I != Stop)
+           {
+               // look for whitespace or ending '>'
+               for (;End != Stop && !isspace(*End) && *End != '>'; ++End);
+
+               if (unlikely(End == Stop))
+                   return 0;
+
+               if (*I == '!')
+               {
+                   NegProfile = true;
+                   ++I;
+               }
+
+               std::string profile(I, End);
+               if (profile.empty() == false && profile == buildprofile)
+               {
+                   Found = true;
+                   if (I[-1] != '!')
+                       NegProfile = false;
+                   // we found a match, so fast-forward to the end of the wildcards
+                   for (; End != Stop && *End != '>'; ++End);
+               }
+
+               if (*End++ == '>') {
+                   I = End;
+                   break;
+               }
+
+               I = End;
+               for (;I != Stop && isspace(*I) != 0; I++);
+           }
+
+           if (NegProfile == true)
+               Found = !Found;
+
+           if (Found == false)
+               Package = ""; /* not for this profile */
+       }
+
+       // Skip whitespace
+       for (;I != Stop && isspace(*I) != 0; I++);
+   }
+
    if (I != Stop && *I == '|')
       Op |= pkgCache::Dep::Or;
    

