From de86a4b076a37db2f70ee5fbfbb295cc71c344df Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 22 Apr 2021 12:53:54 +0200 Subject: upgrade: Add JSON hook support (AptCli::Hooks::Upgrade) --- apt-private/private-upgrade.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc index aeaf5066b..a87ffbc46 100644 --- a/apt-private/private-upgrade.cc +++ b/apt-private/private-upgrade.cc @@ -1,12 +1,14 @@ // Includes /*{{{*/ #include +#include #include #include #include #include #include +#include #include #include @@ -24,10 +26,18 @@ static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags) if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false) return false; - if(!DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, UpgradeFlags)) + std::map verset; + std::set UnknownPackages; + if (!DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeFlags, UnknownPackages)) + { + RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.fail", CmdL.FileList, Cache, UnknownPackages); return false; - - return InstallPackages(Cache,true); + } + RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.pre-prompt", CmdL.FileList, Cache); + if (InstallPackages(Cache, true)) + return RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.post", CmdL.FileList, Cache); + else + return RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.fail", CmdL.FileList, Cache); } // DoDistUpgrade - Automatic smart upgrader /*{{{*/ -- cgit v1.2.3-70-g09d2