]> git.saurik.com Git - apt.git/commitdiff
EDSP: add APT-Release field to Package stanzas
authorStefano Zacchiroli <zack@debian.org>
Thu, 5 Sep 2013 08:54:12 +0000 (10:54 +0200)
committerStefano Zacchiroli <zack@debian.org>
Sun, 4 May 2014 16:27:10 +0000 (18:27 +0200)
apt-pkg/edsp.cc
doc/external-dependency-solver-protocol.txt

index 178791daeb44a553e079bccb5c7c676f44d10864..88ad27681180a2c9e07cd9a75fe6a021731596af 100644 (file)
@@ -113,10 +113,22 @@ void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgI
    else if ((Ver->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
       fprintf(output, "Multi-Arch: same\n");
    signed short Pin = std::numeric_limits<signed short>::min();
    else if ((Ver->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
       fprintf(output, "Multi-Arch: same\n");
    signed short Pin = std::numeric_limits<signed short>::min();
-   for (pkgCache::VerFileIterator File = Ver.FileList(); File.end() == false; ++File) {
-      signed short const p = Cache.GetPolicy().GetPriority(File.File());
+   std::set<string> Releases;
+   for (pkgCache::VerFileIterator I = Ver.FileList(); I.end() == false; ++I) {
+      pkgCache::PkgFileIterator File = I.File();
+      signed short const p = Cache.GetPolicy().GetPriority(File);
       if (Pin < p)
         Pin = p;
       if (Pin < p)
         Pin = p;
+      if ((File->Flags & pkgCache::Flag::NotSource) != pkgCache::Flag::NotSource) {
+        string Release = File.RelStr();
+        if (!Release.empty())
+           Releases.insert(Release);
+      }
+   }
+   if (!Releases.empty()) {
+       fprintf(output, "APT-Release:\n");
+       for (std::set<string>::iterator R = Releases.begin(); R != Releases.end(); ++R)
+          fprintf(output, " %s\n", R->c_str());
    }
    fprintf(output, "APT-Pin: %d\n", Pin);
    if (Cache.GetCandidateVer(Pkg) == Ver)
    }
    fprintf(output, "APT-Pin: %d\n", Pin);
    if (Cache.GetCandidateVer(Pkg) == Ver)
index 477bc23eddf94bf3b402c54e7d3d9eb0c681340a..790f2f1ee80a511f708a86f01589f5de687a92b4 100644 (file)
@@ -209,6 +209,15 @@ field. The following fields are supported in package stanzas:
   should be removed by the solver only when the Autoremove action is
   requested (see Request section).
 
   should be removed by the solver only when the Autoremove action is
   requested (see Request section).
 
+- **APT-Release:** (optional) The releases the package belongs to, according to
+  APT. The format of this field is multiline with one value per line and the
+  first line (the one containing the field name) empty. Each subsequent line
+  corresponds to one of the releases the package belongs to and looks like
+  this: `o=Debian,a=unstable,n=sid,l=Debian,c=main`. That is, each release line
+  is a comma-separated list of "key=value" pairs, each of which denotes a
+  Release file entry (Origin, Label, Codename, etc.) in the format of
+  APT_PREFERENCES(5).
+
 ### Answer
 
 An answer from the external solver to APT is either a *solution* or an
 ### Answer
 
 An answer from the external solver to APT is either a *solution* or an