summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-04-28 23:59:00 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-05-11 17:22:32 +0200
commitab640001ee772fa27ee789f6717805f9d46d5bce (patch)
tree0b5b25fae6faf4f6da0f76e0e6e05c4c78f01151
parent3f732aa6ad0a81b6a6942a61fd5ed26a26590e8e (diff)
remove unused and strange default-value for pins
If the pin for a generic pin is 0, it get a value by strange looking rules, if the pin is specific the rules are at least not strange, but the value 989 is a magic number without any direct meaning… but both never happens in practice as the parsing skips such entries with a warning, so there always is a priority != 0 and the code therefore never used.
-rw-r--r--apt-pkg/policy.cc34
-rwxr-xr-xtest/integration/test-bug-543966-downgrade-below-1000-pin4
2 files changed, 14 insertions, 24 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 9a1d2977e..00693ce54 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -97,37 +97,29 @@ bool pkgPolicy::InitDefaults()
// Apply the defaults..
SPtrArray<bool> Fixed = new bool[Cache->HeaderP->PackageFileCount];
memset(Fixed,0,sizeof(*Fixed)*Cache->HeaderP->PackageFileCount);
- signed Cur = 989;
StatusOverride = false;
- for (vector<Pin>::const_iterator I = Defaults.begin(); I != Defaults.end();
- ++I, --Cur)
+ for (vector<Pin>::const_iterator I = Defaults.begin(); I != Defaults.end(); ++I)
{
pkgVersionMatch Match(I->Data,I->Type);
for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F)
{
- if (Match.FileMatch(F) == true && Fixed[F->ID] == false)
+ if (Fixed[F->ID] == false && Match.FileMatch(F) == true)
{
- if (I->Priority != 0 && I->Priority > 0)
- Cur = I->Priority;
-
- if (I->Priority < 0)
- PFPriority[F->ID] = I->Priority;
- else
- PFPriority[F->ID] = Cur;
-
+ PFPriority[F->ID] = I->Priority;
+
if (PFPriority[F->ID] >= 1000)
StatusOverride = true;
-
+
Fixed[F->ID] = true;
- }
- }
+ }
+ }
}
if (_config->FindB("Debug::pkgPolicy",false) == true)
for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F)
- std::clog << "Prio of " << F.FileName() << ' ' << PFPriority[F->ID] << std::endl;
-
- return true;
+ std::clog << "Prio of " << F.FileName() << ' ' << PFPriority[F->ID] << std::endl;
+
+ return true;
}
/*}}}*/
// Policy::GetCandidateVer - Get the candidate install version /*{{{*/
@@ -324,13 +316,7 @@ pkgCache::VerIterator pkgPolicy::GetMatch(pkgCache::PkgIterator const &Pkg)
APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg)
{
if (Pins[Pkg->ID].Type != pkgVersionMatch::None)
- {
- // In this case 0 means default priority
- if (Pins[Pkg->ID].Priority == 0)
- return 989;
return Pins[Pkg->ID].Priority;
- }
-
return 0;
}
APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File)
diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin
index 485df999c..e59231608 100755
--- a/test/integration/test-bug-543966-downgrade-below-1000-pin
+++ b/test/integration/test-bug-543966-downgrade-below-1000-pin
@@ -87,3 +87,7 @@ msgmsg 'Tests with generic-form pin'
testpinning '*'
msgmsg 'Tests with specific-form pin'
testpinning 'base-files'
+msgmsg 'Tests with specific-form pin with glob'
+testpinning 'base-fil*'
+msgmsg 'Tests with specific-form pin with regex'
+testpinning '/^base-f[iI]les$/'