From 28e44a3cd8b879744bebfec1133d0a9c51b25d88 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 23 Sep 2022 16:40:05 +0200 Subject: 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. --- apt-pkg/edsp.cc | 7 +++++++ 1 file changed, 7 insertions(+) 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 &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 -- cgit v1.2.3-70-g09d2