From d4af23c2d81116b8f7557ee795059bca126ae9f4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 26 Jun 2010 20:56:44 +0200 Subject: * apt-pkg/deb/deblistparser.cc: - Handle architecture wildcards (Closes: #547724). --- apt-pkg/deb/deblistparser.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb/deblistparser.cc') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 83c5b8d2e..ddbd0d31a 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -19,6 +19,7 @@ #include #include +#include #include /*}}}*/ @@ -572,8 +573,15 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, I++; } - if (stringcmp(arch,I,End) == 0) + if (stringcmp(arch,I,End) == 0) { 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) + Found = true; + } if (*End++ == ']') { I = End; -- cgit v1.2.3 From 3b20aef1a2b5fd2fcd6f62a819edbdb19631fb98 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 26 Jun 2010 23:01:49 +0200 Subject: 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 "-". --- apt-pkg/deb/deblistparser.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb/deblistparser.cc') 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 -. + */ +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; } -- cgit v1.2.3 From 5143f361005775e3674f4f5871ad574cbe8ef705 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 27 Jun 2010 21:04:53 +0200 Subject: deblistparser: Special-case *-armel, lpia and powerpcspe architectures. --- apt-pkg/deb/deblistparser.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'apt-pkg/deb/deblistparser.cc') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 00016679a..6ede14c4d 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -479,6 +479,12 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op) * The complete architecture, consisting of -. */ static string CompleteArch(std::string& arch) { + if (arch == "armel") return "linux-arm"; + if (arch == "lpia") return "linux-i386"; + if (arch == "powerpcspe") return "linux-powerpc"; + if (arch == "uclibc-linux-armel") return "linux-arm"; + if (arch == "uclinux-armel") return "uclinux-arm"; + return (arch.find("-") != string::npos) ? arch : "linux-" + arch; } /*}}}*/ -- cgit v1.2.3