Sfoglia il codice sorgente

debListParser: ParseDepends: Only query native arch if needed

This makes the code parsing architecture lists slower, but on
the other hand, improves the more generic case of reading
dependencies from Packages files.
Julian Andres Klode 10 anni fa
parent
commit
0e0bff781d
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      apt-pkg/deb/deblistparser.cc

+ 2 - 1
apt-pkg/deb/deblistparser.cc

@@ -562,8 +562,8 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
    Package.assign(Start,I - Start);
    Package.assign(Start,I - Start);
 
 
    // We don't want to confuse library users which can't handle MultiArch
    // We don't want to confuse library users which can't handle MultiArch
-   string const arch = _config->Find("APT::Architecture");
    if (StripMultiArch == true) {
    if (StripMultiArch == true) {
+      string const arch = _config->Find("APT::Architecture");
       size_t const found = Package.rfind(':');
       size_t const found = Package.rfind(':');
       if (found != string::npos &&
       if (found != string::npos &&
 	  (strcmp(Package.c_str() + found, ":any") == 0 ||
 	  (strcmp(Package.c_str() + found, ":any") == 0 ||
@@ -609,6 +609,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
 
 
    if (ParseArchFlags == true)
    if (ParseArchFlags == true)
    {
    {
+      string const arch = _config->Find("APT::Architecture");
       APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(arch, false);
       APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(arch, false);
 
 
       // Parse an architecture
       // Parse an architecture