diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2022-09-23 16:40:05 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2022-09-28 16:32:34 +0200 |
commit | 28e44a3cd8b879744bebfec1133d0a9c51b25d88 (patch) | |
tree | 10acdbcc2531843158b9882bfdfad1813b7dcd78 | |
parent | 2d87af57ea52cb37c60103abb6468e0ad44864ff (diff) |
edsp: Add support for phased updates (test in LP#1990586)
Add Machine-ID to the first stanza, and copy Phased-Update-Percentage
to package stanzas.
This will be tested at a later state by the EDSP test case for
bug 1990586.
-rw-r--r-- | apt-pkg/edsp.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 6493a4595..9d196eed3 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -83,6 +83,8 @@ static bool WriteScenarioVersion(FileFd &output, pkgCache::PkgIterator const &Pk "\nArchitecture: ", Ver.Arch(), "\nVersion: ", Ver.VerStr()); WriteOkay(Okay, output, "\nAPT-ID: ", Ver->ID); + if (Ver.PhasedUpdatePercentage() != 100) + WriteOkay(Okay, output, "\nPhased-Update-Percentage: ", Ver.PhasedUpdatePercentage()); if ((Pkg->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) WriteOkay(Okay, output, "\nEssential: yes"); if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed) @@ -361,6 +363,9 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FileFd &output, } bool Okay = WriteGenericRequestHeaders(output, "Request: EDSP 0.5\n"); + string machineID = APT::Configuration::getMachineID(); + if (not machineID.empty()) + WriteOkay(Okay, output, "Machine-ID: ", machineID, "\n"); if (del.empty() == false) WriteOkay(Okay, output, "Remove:", del, "\n"); if (inst.empty() == false) @@ -589,6 +594,8 @@ bool EDSP::ReadRequest(int const input, std::list<std::string> &install, _config->Set("APT::Architecture", line); else if (LineStartsWithAndStrip(line, "Architectures:")) _config->Set("APT::Architectures", SubstVar(line, " ", ",")); + else if (LineStartsWithAndStrip(line, "Machine-ID")) + _config->Set("APT::Machine-ID", line); else if (LineStartsWithAndStrip(line, "Solver:")) ; // purely informational line else |