diff -ur origs/apt-0.9.7.7ubuntu1/apt-pkg/deb/deblistparser.cc apt-0.9.7.7ubuntu2/apt-pkg/deb/deblistparser.cc --- origs/apt-0.9.7.7ubuntu1/apt-pkg/deb/deblistparser.cc 2012-12-13 15:08:13.000000000 +0000 +++ apt-0.9.7.7ubuntu2/apt-pkg/deb/deblistparser.cc 2013-01-30 11:22:30.000000000 +0000 @@ -472,6 +472,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, string &Package,string &Ver, unsigned int &Op, bool const &ParseArchFlags, + bool const &ParseProfileFlags, bool const &StripMultiArch) { // Strip off leading space @@ -480,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 == ')') @@ -597,6 +599,75 @@ for (;I != Stop && isspace(*I) != 0; I++); } + if (ParseProfileFlags == true) + { + std::vector profiles; + + // accept non-list order as override setting + string const overrideProfile = _config->Find("APT::Build-Profile", ""); + + if (overrideProfile.empty() == false) + profiles.push_back(overrideProfile); + + std::vector p = _config->FindVector("APT::Build-Profile"); + profiles.insert(profiles.end(), p.begin(), p.end()); + + // 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 && profiles.empty() == false && + std::find(profiles.begin(), profiles.end(), profile) != profiles.end()) + { + 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; @@ -630,7 +701,7 @@ string Version; unsigned int Op; - Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled); + Start = ParseDepends(Start,Stop,Package,Version,Op,false,false,!MultiArchEnabled); if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); size_t const found = Package.rfind(':'); diff -ur origs/apt-0.9.7.7ubuntu1/apt-pkg/deb/deblistparser.h apt-0.9.7.7ubuntu2/apt-pkg/deb/deblistparser.h --- origs/apt-0.9.7.7ubuntu1/apt-pkg/deb/deblistparser.h 2012-12-13 15:08:13.000000000 +0000 +++ apt-0.9.7.7ubuntu2/apt-pkg/deb/deblistparser.h 2013-01-30 11:22:30.000000000 +0000 @@ -76,6 +76,7 @@ static const char *ParseDepends(const char *Start,const char *Stop, std::string &Package,std::string &Ver,unsigned int &Op, bool const &ParseArchFlags = false, + bool const &ParseProfileFlags = false, bool const &StripMultiArch = true); static const char *ConvertRelation(const char *I,unsigned int &Op); diff -ur origs/apt-0.9.7.7ubuntu1/apt-pkg/deb/debsrcrecords.cc apt-0.9.7.7ubuntu2/apt-pkg/deb/debsrcrecords.cc --- origs/apt-0.9.7.7ubuntu1/apt-pkg/deb/debsrcrecords.cc 2012-12-13 15:08:13.000000000 +0000 +++ apt-0.9.7.7ubuntu2/apt-pkg/deb/debsrcrecords.cc 2013-01-30 11:22:30.000000000 +0000 @@ -90,7 +90,7 @@ while (1) { Start = debListParser::ParseDepends(Start, Stop, - rec.Package,rec.Version,rec.Op,true, StripMultiArch); + rec.Package,rec.Version,rec.Op,true,true, StripMultiArch); if (Start == 0) return _error->Error("Problem parsing dependency: %s", fields[I]); diff -ur origs/apt-0.9.7.7ubuntu1/debian/changelog apt-0.9.7.7ubuntu2/debian/changelog --- origs/apt-0.9.7.7ubuntu1/debian/changelog 2013-01-18 07:50:25.000000000 +0000 +++ apt-0.9.7.7ubuntu2/debian/changelog 2013-01-30 11:26:22.000000000 +0000 @@ -1,3 +1,9 @@ +apt (0.9.7.7ubuntu2~profile1) raring; urgency=low + + * Add Build-profile support (<> style). Set APT::Build-Profile=. Closes: #661537 + + -- Wookey Wed, 30 Jan 2013 11:23:40 +0000 + apt (0.9.7.7ubuntu1) raring; urgency=low * Merge from Debian unstable, pulling in new translations and fixes.