summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-06-26 23:01:49 +0200
committerJulian Andres Klode <jak@debian.org>2010-06-26 23:01:49 +0200
commit3b20aef1a2b5fd2fcd6f62a819edbdb19631fb98 (patch)
treeeb91ad582d9fe20f6b6c6d9ae1a0ff1050ebd112 /apt-pkg/deb
parent7ecb5be707d7365df3af157a122b52667b96ace9 (diff)
apt-pkg/deb/deblistparser.cc: Fix bug in architecture wildcard support.
Previously, linux-any was always matched, because the code simply appended linux- to the APT::Architecture value. Now, it does this only if the APT::Architecture value does not contain "-".
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/deblistparser.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index ddbd0d31a..00016679a 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -473,6 +473,14 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
return I;
}
+/*
+ * CompleteArch:
+ *
+ * The complete architecture, consisting of <kernel>-<cpu>.
+ */
+static string CompleteArch(std::string& arch) {
+ return (arch.find("-") != string::npos) ? arch : "linux-" + arch;
+}
/*}}}*/
// ListParser::ParseDepends - Parse a dependency element /*{{{*/
// ---------------------------------------------------------------------
@@ -546,6 +554,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
if (ParseArchFlags == true)
{
string arch = _config->Find("APT::Architecture");
+ string completeArch = CompleteArch(arch);
// Parse an architecture
if (I != Stop && *I == '[')
@@ -577,9 +586,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
Found = true;
} else {
std::string wildcard = SubstVar(string(I, End), "any", "*");
- if (fnmatch(wildcard.c_str(), arch.c_str(), 0) == 0)
- Found = true;
- else if (fnmatch(wildcard.c_str(), ("linux-" + arch).c_str(), 0) == 0)
+ if (fnmatch(wildcard.c_str(), completeArch.c_str(), 0) == 0)
Found = true;
}