public:
- inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected;};
+ inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected; Cache.MarkProtected(Pkg);};
inline void Remove(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= ToRemove;};
inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);};
if (unlikely(Pkg.end() == true || Pkg->VersionList == 0))
return false;
+ // the user is always right
+ if (FromUser == true)
+ return true;
+
+ StateCache &P = PkgState[Pkg->ID];
+
+ // if previous state was set by user only user can reset it
+ if ((P.iFlags & Protected) == Protected)
+ {
+ if (unlikely(DebugMarker == true) && P.Mode != mode)
+ std::clog << OutputInDepth(Depth) << "Ignore Mark" << PrintMode(mode)
+ << " of " << Pkg << " as its mode (" << PrintMode(P.Mode)
+ << ") is protected" << std::endl;
+ return false;
+ }
// enforce dpkg holds
- if (FromUser == false && mode != ModeKeep && Pkg->SelectedState == pkgCache::State::Hold &&
+ else if (mode != ModeKeep && Pkg->SelectedState == pkgCache::State::Hold &&
_config->FindB("APT::Ignore-Hold",false) == false)
{
- if (unlikely(DebugMarker == true) && PkgState[Pkg->ID].Mode != mode)
+ if (unlikely(DebugMarker == true) && P.Mode != mode)
std::clog << OutputInDepth(Depth) << "Hold prevents Mark" << PrintMode(mode)
<< " of " << Pkg << std::endl;
return false;
DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)};
// These flags are used in StateCache::iFlags
- enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2)};
+ enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2), Protected = (1 << 3)};
enum VersionTypes {NowVersion, InstallVersion, CandidateVersion};
enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2};
void 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; };
void SetReInstall(PkgIterator const &Pkg,bool To);
// FIXME: Remove the unused boolean parameter on abi break
as suggested by Charles Plessy (Closes: #619083)
* apt-pkg/depcache.cc:
- remove pseudo handling leftover from SetReInstall
+ - do not change protected packages in autoinstall (Closes: #618848)
* apt-pkg/pkgcachegen.cc:
- make "all"->"native" an implementation detail of NewPackage
rather than rewrite it in higher methods
- use dpkg --print-foreign-architectures to get multiarch configuration
if non is specified with APT::Architectures (Closes: #612958)
- -- David Kalnischkies <kalnischkies@gmail.com> Sat, 26 Mar 2011 01:28:38 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com> Sat, 26 Mar 2011 12:26:32 +0100
apt (0.8.13) unstable; urgency=low
testequal 'Reading package lists...
Building dependency tree...
MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1
- Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other )
+ Ignore MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) as its mode (Keep) is protected
Package extracoolstuff is not installed, so not removed
The following NEW packages will be installed:
coolstuff
--- /dev/null
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertinstalledpackage 'libdb4.8' 'all' '1.0'
+insertinstalledpackage 'exim4' 'all' '1.0' 'Depends: exim4-daemon-light | exim4-daemon-heavy'
+insertinstalledpackage 'exim4-daemon-light' 'all' '1.0' 'Depends: libdb4.8'
+insertpackage 'unstable' 'exim4-daemon-heavy' 'all' '1.0' 'Depends: libdb4.8'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+ MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1
+ MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=1
+ MarkInstall exim4-daemon-heavy [ i386 ] < none -> 1.0 > ( other ) FU=0
+ Ignore MarkInstall of libdb4.8 [ i386 ] < 1.0 > ( other ) as its mode (Delete) is protected
+ MarkDelete exim4-daemon-heavy [ i386 ] < none -> 1.0 > ( other ) FU=0
+ MarkDelete exim4 [ i386 ] < 1.0 > ( other ) FU=1
+The following packages will be REMOVED:
+ exim4 exim4-daemon-light libdb4.8
+ MarkDelete exim4 [ i386 ] < 1.0 > ( other ) FU=1
+0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
+Remv exim4 [1.0]
+ MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=1
+Remv exim4-daemon-light [1.0]
+ MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1
+Remv libdb4.8 [1.0]' aptget remove libdb4.8 -s -o Debug::pkgDepCache::Marker=1