From cb3c3b6fda20ecfe5e6b2644da7391eb03845e91 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 4 Sep 2013 17:04:09 +0200 Subject: EDSP doc: fix typo in Request stanza description --- doc/external-dependency-solver-protocol.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/external-dependency-solver-protocol.txt b/doc/external-dependency-solver-protocol.txt index 7a124d8f9..3f2da2195 100644 --- a/doc/external-dependency-solver-protocol.txt +++ b/doc/external-dependency-solver-protocol.txt @@ -114,12 +114,9 @@ and followed by a mixture of action and preference fields. The value of the **Request:** field is a string describing the EDSP protocol which will be used to communicate. At present, the string must -be `EDSP 0.4`. - -a unique request identifier, such as an -UUID. Request fields are mainly used to identify the beginning of a -request stanza; their actual values are otherwise not used by the EDSP -protocol. +be `EDSP 0.4`. Request fields are mainly used to identify the beginning +of a request stanza; their actual values are otherwise not used by the +EDSP protocol. The following **action fields** are supported in request stanzas: -- cgit v1.2.3 From 25252738d5ad6042b356f2d6bec2ca52ef08a1e2 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 4 Sep 2013 17:06:11 +0200 Subject: EDSP: bump protocol version to 0.5 --- apt-pkg/edsp.cc | 2 +- doc/external-dependency-solver-protocol.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index ee42267bc..a44d4a4a9 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -231,7 +231,7 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade, continue; req->append(" ").append(Pkg.FullName()); } - fprintf(output, "Request: EDSP 0.4\n"); + fprintf(output, "Request: EDSP 0.5\n"); if (del.empty() == false) fprintf(output, "Remove: %s\n", del.c_str()+1); if (inst.empty() == false) diff --git a/doc/external-dependency-solver-protocol.txt b/doc/external-dependency-solver-protocol.txt index 3f2da2195..7d41571de 100644 --- a/doc/external-dependency-solver-protocol.txt +++ b/doc/external-dependency-solver-protocol.txt @@ -1,4 +1,4 @@ -# APT External Dependency Solver Protocol (EDSP) - version 0.4 +# APT External Dependency Solver Protocol (EDSP) - version 0.5 This document describes the communication protocol between APT and external dependency solvers. The protocol is called APT EDSP, for "APT @@ -114,7 +114,7 @@ and followed by a mixture of action and preference fields. The value of the **Request:** field is a string describing the EDSP protocol which will be used to communicate. At present, the string must -be `EDSP 0.4`. Request fields are mainly used to identify the beginning +be `EDSP 0.5`. Request fields are mainly used to identify the beginning of a request stanza; their actual values are otherwise not used by the EDSP protocol. -- cgit v1.2.3 From caa3279367401965cbdd5e3a41c47945f3e263bd Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 4 Sep 2013 17:13:49 +0200 Subject: EDSP: add Architecture(s) multi-arch fields to the Request stanza --- apt-pkg/edsp.cc | 9 +++++++++ doc/external-dependency-solver-protocol.txt | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index a44d4a4a9..33478dfa6 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -232,6 +232,15 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade, req->append(" ").append(Pkg.FullName()); } fprintf(output, "Request: EDSP 0.5\n"); + + const char *arch = _config->Find("APT::Architecture").c_str(); + std::vector archs = APT::Configuration::getArchitectures(); + fprintf(output, "Architecture: %s\n", arch); + fprintf(output, "Architectures:"); + for (std::vector::const_iterator a = archs.begin(); a != archs.end(); ++a) + fprintf(output, " %s", a->c_str()); + fprintf(output, "\n"); + if (del.empty() == false) fprintf(output, "Remove: %s\n", del.c_str()+1); if (inst.empty() == false) diff --git a/doc/external-dependency-solver-protocol.txt b/doc/external-dependency-solver-protocol.txt index 7d41571de..477bc23ed 100644 --- a/doc/external-dependency-solver-protocol.txt +++ b/doc/external-dependency-solver-protocol.txt @@ -110,7 +110,8 @@ Within a dependency solving scenario, a request represents the action on installed packages requested by the user. A request is a single Deb 822 stanza opened by a mandatory Request field -and followed by a mixture of action and preference fields. +and followed by a mixture of action, preference, and global +configuration fields. The value of the **Request:** field is a string describing the EDSP protocol which will be used to communicate. At present, the string must @@ -118,6 +119,16 @@ be `EDSP 0.5`. Request fields are mainly used to identify the beginning of a request stanza; their actual values are otherwise not used by the EDSP protocol. +The following **configuration fields** are supported in request stanzas: + +- **Architecture:** (mandatory) The name of the *native* architecture on + the user machine (see also: `dpkg --print-architecture`) + +- **Architectures:** (optional, defaults to the native architecture) A + space separated list of *all* architectures known to APT (this is + roughly equivalent to the union of `dpkg --print-architecture` and + `dpkg --print-foreign-architectures`) + The following **action fields** are supported in request stanzas: - **Install:** (optional, defaults to the empty string) A space -- cgit v1.2.3 From f63c067e686b59ce9fa7c52bb39b7440e0770671 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Thu, 5 Sep 2013 16:36:44 +0200 Subject: EDSP: add Source field to Package stanzas --- apt-pkg/edsp.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 33478dfa6..178791dae 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -87,7 +88,12 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FILE* output, void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver) { + pkgRecords Recs(Cache); + pkgRecords::Parser &rec = Recs.Lookup(Ver.FileList()); + string srcpkg = rec.SourcePkg().empty() ? Pkg.Name() : rec.SourcePkg(); + fprintf(output, "Package: %s\n", Pkg.Name()); + fprintf(output, "Source: %s\n", srcpkg.c_str()); fprintf(output, "Architecture: %s\n", Ver.Arch()); fprintf(output, "Version: %s\n", Ver.VerStr()); if (Pkg.CurrentVer() == Ver) -- cgit v1.2.3 From b5ea5d4a5b8f82afb7bbe4c3eee07ae36f2fba9c Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Thu, 5 Sep 2013 10:54:12 +0200 Subject: EDSP: add APT-Release field to Package stanzas --- apt-pkg/edsp.cc | 16 ++++++++++++++-- doc/external-dependency-solver-protocol.txt | 9 +++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 178791dae..88ad27681 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -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::min(); - for (pkgCache::VerFileIterator File = Ver.FileList(); File.end() == false; ++File) { - signed short const p = Cache.GetPolicy().GetPriority(File.File()); + std::set 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 ((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::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) diff --git a/doc/external-dependency-solver-protocol.txt b/doc/external-dependency-solver-protocol.txt index 477bc23ed..790f2f1ee 100644 --- a/doc/external-dependency-solver-protocol.txt +++ b/doc/external-dependency-solver-protocol.txt @@ -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). +- **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 -- cgit v1.2.3