Преглед изворни кода

support multiple "Suite:" entries

Michael Vogt пре 12 година
родитељ
комит
d73743ddae
2 измењених фајлова са 26 додато и 9 уклоњено
  1. 18 9
      apt-pkg/sourcelist.cc
  2. 8 0
      test/integration/test-apt-sources-deb822

+ 18 - 9
apt-pkg/sourcelist.cc

@@ -85,9 +85,6 @@ bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List,
       return false;
       return false;
    }
    }
    
    
-   string Dist = Tags.FindS("Suite");
-   Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
-   
    // Define external/internal options
    // Define external/internal options
    const char* option_deb822[] = { 
    const char* option_deb822[] = { 
       "Architectures", "Architectures-Add", "Architectures-Delete", "Trusted",
       "Architectures", "Architectures-Add", "Architectures-Delete", "Trusted",
@@ -99,13 +96,25 @@ bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List,
       if (Tags.Exists(option_deb822[j]))
       if (Tags.Exists(option_deb822[j]))
          Options[option_internal[j]] = Tags.FindS(option_deb822[j]);
          Options[option_internal[j]] = Tags.FindS(option_deb822[j]);
    
    
-   // now create one item per section
+   // now create one item per suite/section
+   string Suite = Tags.FindS("Suite");
+   Suite = SubstVar(Suite,"$(ARCH)",_config->Find("APT::Architecture"));
    string const Section = Tags.FindS("Section");
    string const Section = Tags.FindS("Section");
-   std::vector<std::string> list = StringSplit(Section, " ");
-   for (std::vector<std::string>::const_iterator I = list.begin();
-        I != list.end(); I++)
-      return CreateItem(List, URI, Dist, (*I), Options);
-   
+
+   std::vector<std::string> list_dist = StringSplit(Suite, " ");
+   std::vector<std::string> list_section = StringSplit(Section, " ");
+   for (std::vector<std::string>::const_iterator I = list_dist.begin();
+        I != list_dist.end(); I++)
+   {
+      for (std::vector<std::string>::const_iterator J = list_section.begin();
+           J != list_section.end(); J++)
+         {
+            if (CreateItem(List, URI, (*I), (*J), Options) == false)
+            {
+               return false;
+            }
+         }
+   }
    return true;
    return true;
 }
 }
 
 

+ 8 - 0
test/integration/test-apt-sources-deb822

@@ -45,6 +45,14 @@ testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.deb
 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 "  aptget update --print-uris 
 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 "  aptget update --print-uris 
 
 
+# two suite entries
+echo "$BASE"  | sed -e "s/stable/stable unstable/" > $SOURCES
+testequalwithmsg "Two Suite entries deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 "  aptget update --print-uris 
 
 
 # ARCH option
 # ARCH option
 echo "$BASE" > $SOURCES
 echo "$BASE" > $SOURCES