summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-09-14 18:57:46 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-09-14 18:57:46 +0200
commit5ed56f934dd204cc3a1d757ccf5eac23f8374736 (patch)
treeef9bc81beb82db782ade3d44837673a9c1f3e11d /apt-pkg
parent6874a1a88255fe0ab1b501961ce1fec26ee718a7 (diff)
* apt-pkg/policy.cc:
- support 100-pinning in Release file with ButAutomaticUpgrades as requested by the backports crew (Closes: #596097) * apt-pkg/deb/deblistparser.cc: - overrule NotAutomatic in case of ButAutomaticUpgrades
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/deblistparser.cc6
-rw-r--r--apt-pkg/depcache.cc3
-rw-r--r--apt-pkg/pkgcache.cc1
-rw-r--r--apt-pkg/pkgcache.h2
-rw-r--r--apt-pkg/policy.cc9
5 files changed, 15 insertions, 6 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 5fb737970..da8b0271b 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -815,6 +815,12 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
if (Section.FindFlag("NotAutomatic",FileI->Flags,
pkgCache::Flag::NotAutomatic) == false)
_error->Warning("Bad NotAutomatic flag");
+ if (Section.FindFlag("ButAutomaticUpgrades",FileI->Flags,
+ pkgCache::Flag::ButAutomaticUpgrades) == false)
+ _error->Warning("Bad ButAutomaticUpgrades flag");
+ // overrule the NotAutomatic setting if needed as they are both present for compatibility
+ else if ((FileI->Flags & pkgCache::Flag::ButAutomaticUpgrades) == pkgCache::Flag::ButAutomaticUpgrades)
+ FileI->Flags &= ~pkgCache::Flag::NotAutomatic;
return !_error->PendingError();
}
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 018b05e65..d893c42d7 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1615,7 +1615,8 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator const &Pk
/* Stash the highest version of a not-automatic source, we use it
if there is nothing better */
- if ((J.File()->Flags & Flag::NotAutomatic) != 0)
+ if ((J.File()->Flags & Flag::NotAutomatic) != 0 ||
+ (J.File()->Flags & Flag::ButAutomaticUpgrades) != 0)
{
if (Last.end() == true)
Last = I;
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index a66a5198d..324445fa7 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -731,6 +731,7 @@ bool pkgCache::VerIterator::Automatic() const
{
VerFileIterator Files = FileList();
for (; Files.end() == false; Files++)
+ // Do not check ButAutomaticUpgrades here as it is kind of automatic…
if ((Files.File()->Flags & pkgCache::Flag::NotAutomatic) != pkgCache::Flag::NotAutomatic)
return true;
return false;
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 799521784..82a69b2ca 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -146,7 +146,7 @@ class pkgCache /*{{{*/
struct Flag
{
enum PkgFlags {Auto=(1<<0),Essential=(1<<3),Important=(1<<4)};
- enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1)};
+ enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1),ButAutomaticUpgrades=(1<<2)};
};
protected:
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index a3286391b..4f9d56775 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -16,7 +16,7 @@
990 = Config file override package files
989 = Start for preference auto-priorities
500 = Default package files
- 100 = The status file
+ 100 = The status file and ButAutomaticUpgrades sources
0 -> 100 = NotAutomatic sources like experimental
-inf -> 0 = Never selected
@@ -70,9 +70,10 @@ bool pkgPolicy::InitDefaults()
PFPriority[I->ID] = 500;
if ((I->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
PFPriority[I->ID] = 100;
- else
- if ((I->Flags & pkgCache::Flag::NotAutomatic) == pkgCache::Flag::NotAutomatic)
- PFPriority[I->ID] = 1;
+ else if ((I->Flags & pkgCache::Flag::ButAutomaticUpgrades) == pkgCache::Flag::ButAutomaticUpgrades)
+ PFPriority[I->ID] = 100;
+ else if ((I->Flags & pkgCache::Flag::NotAutomatic) == pkgCache::Flag::NotAutomatic)
+ PFPriority[I->ID] = 1;
}
// Apply the defaults..