diff options
author | Daniel Hartwig <mandyke@gmail.com> | 2012-03-25 13:01:46 +0800 |
---|---|---|
committer | Daniel Hartwig <mandyke@gmail.com> | 2012-03-25 13:01:46 +0800 |
commit | 1ae1dc9f54b28358047fb31d4eb0ad0f92889a8c (patch) | |
tree | 64de025cb692fa66b9918b8af1bf2e145a57d43e /src | |
parent | 1102e252065408ac41479a1bb2d4633c6b63c28c (diff) | |
download | aptitude-1ae1dc9f54b28358047fb31d4eb0ad0f92889a8c.tar.gz |
Also support MultiArch flags from apt 0.8.16
* configure.ac:
- check for MultiArch support in APT (requires at least 0.8);
* src/generic/apt/apt.cc:
- support libapt-pkg 0.8.16 in multiarch_type;
* src/generic/apt/matching/match.cc:
- tweak multiarch;
Diffstat (limited to 'src')
-rw-r--r-- | src/generic/apt/apt.cc | 19 | ||||
-rw-r--r-- | src/generic/apt/matching/match.cc | 44 |
2 files changed, 31 insertions, 32 deletions
diff --git a/src/generic/apt/apt.cc b/src/generic/apt/apt.cc index efbd1441..aa010d37 100644 --- a/src/generic/apt/apt.cc +++ b/src/generic/apt/apt.cc @@ -1265,12 +1265,19 @@ std::wstring get_long_description(const pkgCache::VerIterator &ver, const char *multiarch_type(unsigned char type) { - const char *types[] = {"", "", _("foreign"), _("same"), _("allowed"), - _("foreign"), _("allowed")}; - - if(type < sizeof(types)/sizeof(*types)) - return types[type]; - return ""; + switch(type) + { + case pkgCache::Version::Foreign: + case pkgCache::Version::AllForeign: + return _("foreign"); + case pkgCache::Version::Same: + return _("same"); + case pkgCache::Version::Allowed: + case pkgCache::Version::AllAllowed: + return _("allowed"); + default: + return ""; + } } int get_arch_order(const char *a) diff --git a/src/generic/apt/matching/match.cc b/src/generic/apt/matching/match.cc index 4ca70b6c..84fb97fc 100644 --- a/src/generic/apt/matching/match.cc +++ b/src/generic/apt/matching/match.cc @@ -1212,32 +1212,24 @@ namespace aptitude else { bool matches = false; - const int multiarch = target.get_ver()->MultiArch; - - switch(p->get_multiarch_multiarch_type()) - { - case pattern::multiarch_none: - matches = (multiarch == pkgCache::Version::None || - multiarch == pkgCache::Version::All); - break; - - case pattern::multiarch_foreign: - matches = (multiarch == pkgCache::Version::Foreign || - multiarch == pkgCache::Version::AllForeign); - break; - - case pattern::multiarch_same: - matches = multiarch == pkgCache::Version::Same; - break; - - case pattern::multiarch_allowed: - matches = (multiarch == pkgCache::Version::Allowed || - multiarch == pkgCache::Version::AllAllowed); - break; - - default: - throw MatchingException("Internal error: bad multiarch-type flag."); - } + const pattern::multiarch_type type = p->get_multiarch_multiarch_type(); + + switch(target.get_ver()->MultiArch) + { + case pkgCache::Version::Foreign: + case pkgCache::Version::AllForeign: + matches = (type == pattern::multiarch_foreign); + break; + case pkgCache::Version::Same: + matches = (type == pattern::multiarch_same); + break; + case pkgCache::Version::Allowed: + case pkgCache::Version::AllAllowed: + matches = (type == pattern::multiarch_allowed); + break; + default: + matches = (type == pattern::multiarch_none); + } if(matches) return match::make_atomic(p); |