Michael Vogt лет назад: 12
Родитель
Сommit
300b15e345
2 измененных файлов с 20 добавлено и 1 удалено
  1. 10 1
      apt-pkg/sourcelist.cc
  2. 10 0
      test/integration/test-apt-sources-deb822

+ 10 - 1
apt-pkg/sourcelist.cc

@@ -273,7 +273,16 @@ bool pkgSourceList::ReadAppend(string File)
          for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
          for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
             if (Tags.Exists(option_str[j]))
             if (Tags.Exists(option_str[j]))
                Options[option_str[j]] = Tags.FindS(option_str[j]);
                Options[option_str[j]] = Tags.FindS(option_str[j]);
-         Parse->CreateItem(SrcList, URI, Dist, Section, Options);
+
+         // now create one item per section
+         std::vector<std::string> list;
+         if (Section.find(","))
+             list = StringSplit(Section, ",");
+         else
+             list = StringSplit(Section, " ");
+         for (int i=0; i < list.size(); i++)
+            Parse->CreateItem(SrcList, URI, Dist, list[i], Options);
+
          i++;
          i++;
       }
       }
       // we are done
       // we are done

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

@@ -22,6 +22,16 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.
 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris 
 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris 
 
 
 
 
+# two sections (we support both "," and " " as seperator)
+echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list
+
+testequal "'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/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 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 "  aptget update --print-uris 
+
+
 # Two entries
 # Two entries
 echo "$BASE" > rootdir/etc/apt/sources.list
 echo "$BASE" > rootdir/etc/apt/sources.list
 echo "" >> rootdir/etc/apt/sources.list
 echo "" >> rootdir/etc/apt/sources.list