summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2016-11-27 10:54:33 +0000
committerJulian Andres Klode <jak@debian.org>2017-01-02 14:27:52 +0100
commit926c09cc9cf4797e9a44c4253b1ce9ec1212c0da (patch)
tree0990721b30b3753971f0ccf4928c9ca744621275 /apt-pkg/deb/deblistparser.cc
parentae73a2944a89e0d2406a2aab4a4c082e1e9da3f9 (diff)
ParseDepends: Support passing the desired architecture
This is useful for e.g. Britney, where the Build-Depends would have to be parsed for multiple architectures. With this change, the call can choose the architecture without having to mess with the config. Signed-off-by: Niels Thykier <niels@thykier.net> Closes: #845969 (jak@d.o: made the code compile)
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 0fc08d8fb..cf0a9a402 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -547,11 +547,23 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
bool const &StripMultiArch,
bool const &ParseRestrictionsList)
{
+ return debListParser::ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags,
+ StripMultiArch, ParseRestrictionsList,
+ _config->Find("APT::Architecture"));
+}
+
+const char *debListParser::ParseDepends(const char *Start,const char *Stop,
+ string &Package,string &Ver,
+ unsigned int &Op, bool const &ParseArchFlags,
+ bool const &StripMultiArch,
+ bool const &ParseRestrictionsList,
+ string const &Arch)
+{
StringView PackageView;
StringView VerView;
auto res = ParseDepends(Start, Stop, PackageView, VerView, Op, (bool)ParseArchFlags,
- (bool) StripMultiArch, (bool) ParseRestrictionsList);
+ (bool) StripMultiArch, (bool) ParseRestrictionsList, Arch);
Package = PackageView.to_string();
Ver = VerView.to_string();
@@ -563,6 +575,17 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
bool StripMultiArch,
bool ParseRestrictionsList)
{
+ return debListParser::ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags,
+ StripMultiArch, ParseRestrictionsList,
+ _config->Find("APT::Architecture"));
+}
+
+const char *debListParser::ParseDepends(const char *Start,const char *Stop,
+ StringView &Package,StringView &Ver,
+ unsigned int &Op, bool ParseArchFlags,
+ bool StripMultiArch,
+ bool ParseRestrictionsList, string const &Arch)
+{
// Strip off leading space
for (;Start != Stop && isspace_ascii(*Start) != 0; ++Start);
@@ -630,8 +653,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
if (unlikely(ParseArchFlags == true))
{
- string const arch = _config->Find("APT::Architecture");
- APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(arch, false);
+ APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(Arch, false);
// Parse an architecture
if (I != Stop && *I == '[')