summaryrefslogtreecommitdiff
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc29
1 files changed, 24 insertions, 5 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index b24b96351..e1beb21c6 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -35,6 +35,7 @@
#include <apt-private/private-cacheset.h>
#include <apt-private/private-download.h>
#include <apt-private/private-install.h>
+#include <apt-private/private-json-hooks.h>
#include <apt-private/private-output.h>
#include <apti18n.h>
@@ -569,10 +570,11 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, int
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<std::string> &VolatileCmdL, CacheFile &Cache, int UpgradeMode)
{
std::map<unsigned short, APT::VersionSet> verset;
- return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeMode);
+ std::set<std::string> UnknownPackages;
+ return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeMode, UnknownPackages);
}
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<std::string> &VolatileCmdL, CacheFile &Cache,
- std::map<unsigned short, APT::VersionSet> &verset, int UpgradeMode)
+ std::map<unsigned short, APT::VersionSet> &verset, int UpgradeMode, std::set<std::string> &UnknownPackages)
{
// Enter the special broken fixing mode if the user specified arguments
bool BrokenFix = false;
@@ -621,6 +623,8 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<std::stri
APT::VersionContainerInterface::FromPackage(&(verset[MOD_INSTALL]), Cache, P, APT::CacheSetHelper::CANDIDATE, helper);
}
+ UnknownPackages = helper.notFound;
+
if (_error->PendingError() == true)
{
helper.showVirtualPackageErrors(Cache);
@@ -726,8 +730,13 @@ bool DoInstall(CommandLine &CmdL)
return false;
std::map<unsigned short, APT::VersionSet> verset;
- if(!DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, 0))
+ std::set<std::string> UnknownPackages;
+
+ if (!DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, 0, UnknownPackages))
+ {
+ RunJsonHook("AptCli::Hooks::Install", "org.debian.apt.hooks.install.fail", CmdL.FileList, Cache, UnknownPackages);
return false;
+ }
/* Print out a list of packages that are going to be installed extra
to what the user asked */
@@ -828,12 +837,22 @@ bool DoInstall(CommandLine &CmdL)
always_true, string_ident, verbose_show_candidate);
}
+ RunJsonHook("AptCli::Hooks::Install", "org.debian.apt.hooks.install.pre-prompt", CmdL.FileList, Cache);
+
+ bool result;
// See if we need to prompt
// FIXME: check if really the packages in the set are going to be installed
if (Cache->InstCount() == verset[MOD_INSTALL].size() && Cache->DelCount() == 0)
- return InstallPackages(Cache,false,false);
+ result = InstallPackages(Cache, false, false);
+ else
+ result = InstallPackages(Cache, false);
+
+ if (result)
+ result = RunJsonHook("AptCli::Hooks::Install", "org.debian.apt.hooks.install.post", CmdL.FileList, Cache);
+ else
+ /* not a result */ RunJsonHook("AptCli::Hooks::Install", "org.debian.apt.hooks.install.fail", CmdL.FileList, Cache);
- return InstallPackages(Cache,false);
+ return result;
}
/*}}}*/