summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-17 18:22:46 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-17 18:22:46 +0200
commit3d619a202a6fbcaaaf6a6540b06c5deb3a50a3be (patch)
tree3621fbed9e6e6fa42b0d30efd9cf70ddc903da1e
parent6935cd05677544028e0d6baefc2e29933bf5fe8b (diff)
let the Mark methods return if their marking was successful
-rw-r--r--apt-pkg/depcache.cc39
-rw-r--r--apt-pkg/depcache.h6
-rw-r--r--debian/changelog3
3 files changed, 26 insertions, 22 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index b7b2f302f..f84ec25ca 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -755,17 +755,17 @@ void pkgDepCache::Update(PkgIterator const &Pkg)
// DepCache::MarkKeep - Put the package in the keep state /*{{{*/
// ---------------------------------------------------------------------
/* */
-void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
+bool pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
unsigned long Depth)
{
if (IsModeChangeOk(ModeKeep, Pkg, Depth, FromUser) == false)
- return;
+ return false;
/* Reject an attempt to keep a non-source broken installed package, those
must be upgraded */
if (Pkg.State() == PkgIterator::NeedsUnpack &&
Pkg.CurrentVer().Downloadable() == false)
- return;
+ return false;
/* We changed the soft state all the time so the UI is a bit nicer
to use */
@@ -773,7 +773,7 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
// Check that it is not already kept
if (P.Mode == ModeKeep)
- return;
+ return true;
if (Soft == true)
P.iFlags |= AutoKept;
@@ -806,31 +806,31 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
P.InstallVer = Pkg.CurrentVer();
AddStates(Pkg);
-
Update(Pkg);
-
AddSizes(Pkg);
+
+ return true;
}
/*}}}*/
// DepCache::MarkDelete - Put the package in the delete state /*{{{*/
// ---------------------------------------------------------------------
/* */
-void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
+bool pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
unsigned long Depth, bool FromUser)
{
if (IsModeChangeOk(ModeDelete, Pkg, Depth, FromUser) == false)
- return;
+ return false;
StateCache &P = PkgState[Pkg->ID];
// Check that it is not already marked for delete
if ((P.Mode == ModeDelete || P.InstallVer == 0) &&
(Pkg.Purge() == true || rPurge == false))
- return;
+ return true;
// check if we are allowed to remove the package
if (IsDeleteOk(Pkg,rPurge,Depth,FromUser) == false)
- return;
+ return false;
P.iFlags &= ~(AutoKept | Purge);
if (rPurge == true)
@@ -854,6 +854,7 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
Update(Pkg);
AddSizes(Pkg);
+ return true;
}
/*}}}*/
// DepCache::IsDeleteOk - check if it is ok to remove this package /*{{{*/
@@ -934,18 +935,18 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
// DepCache::MarkInstall - Put the package in the install state /*{{{*/
// ---------------------------------------------------------------------
/* */
-void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
+bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
unsigned long Depth, bool FromUser,
bool ForceImportantDeps)
{
if (IsModeChangeOk(ModeInstall, Pkg, Depth, FromUser) == false)
- return;
+ return false;
StateCache &P = PkgState[Pkg->ID];
// See if there is even any possible instalation candidate
if (P.CandidateVer == 0)
- return;
+ return false;
/* Check that it is not already marked for install and that it can be
installed */
@@ -954,13 +955,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
P.CandidateVer == (Version *)Pkg.CurrentVer()))
{
if (P.CandidateVer == (Version *)Pkg.CurrentVer() && P.InstallVer == 0)
- MarkKeep(Pkg, false, FromUser, Depth+1);
- return;
+ return MarkKeep(Pkg, false, FromUser, Depth+1);
+ return true;
}
// check if we are allowed to install the package
if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false)
- return;
+ return false;
ActionGroup group(*this);
P.iFlags &= ~AutoKept;
@@ -996,7 +997,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
AddSizes(Pkg);
if (AutoInst == false || _config->Find("APT::Solver", "internal") != "internal")
- return;
+ return true;
if (DebugMarker == true)
std::clog << OutputInDepth(Depth) << "MarkInstall " << Pkg << " FU=" << FromUser << std::endl;
@@ -1040,7 +1041,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
continue;
// if the dependency was critical, we can't install it, so remove it again
MarkDelete(Pkg,false,Depth + 1, false);
- return;
+ return false;
}
/* Check if any ImportantDep() (but not Critical) were added
@@ -1179,6 +1180,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
continue;
}
}
+
+ return true;
}
/*}}}*/
// DepCache::IsInstallOk - check if it is ok to install this package /*{{{*/
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 1a982ea18..2942558b0 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -388,11 +388,11 @@ class pkgDepCache : protected pkgCache::Namespace
/** \name State Manipulators
*/
// @{
- void MarkKeep(PkgIterator const &Pkg, bool Soft = false,
+ bool MarkKeep(PkgIterator const &Pkg, bool Soft = false,
bool FromUser = true, unsigned long Depth = 0);
- void MarkDelete(PkgIterator const &Pkg, bool Purge = false,
+ bool MarkDelete(PkgIterator const &Pkg, bool Purge = false,
unsigned long Depth = 0, bool FromUser = true);
- void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
+ bool MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
unsigned long Depth = 0, bool FromUser = true,
bool ForceImportantDeps = false);
void MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; };
diff --git a/debian/changelog b/debian/changelog
index 499f7f8d8..837571173 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,12 +13,13 @@ apt (0.8.15) UNRELEASED; urgency=low
* apt-pkg/depcache.cc:
- use a boolean instead of an int for Add/Remove in AddStates
similar to how it works with AddSizes
+ - let the Mark methods return if their marking was successful
[ Stefano Zacchiroli ]
* doc/external-dependency-solver-protocol.txt:
- describe EDSP and the configuration interface around it
- -- David Kalnischkies <kalnischkies@gmail.com> Tue, 17 May 2011 17:51:10 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Tue, 17 May 2011 17:53:44 +0200
apt (0.8.14.2) UNRELEASED; urgency=low