[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#697577: apt: default pkgProblemResolver::Scores prioritise Priority: important over Priority: required



Package: apt
Version: 0.8.10.3
Severity: important

A note on the version information for this bug: it is present in both
wheezy and squeeze and probably earlier.

The default pkgProblemResolver::Scores::Important is greater than
pkgProblemResolver::Scores::Required. According to my reading of the
Debian policy document, Priority: required should be higher than
Priority: important:

http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority
http://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities

Code that needs to be adjusted here is PrioMap in
pkgProblemResolver::MakeScores() in apt-pkg/algorithms.cc and if you
change the order then probably you also need to adjust the order in
PrioList in ./apt-pkg/deb/deblistparser.cc.

static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important},
                       {"required",pkgCache::State::Required},
                       {"standard",pkgCache::State::Standard},
                       {"optional",pkgCache::State::Optional},
                       {"extra",pkgCache::State::Extra},
                       {}};

void pkgProblemResolver::MakeScores()
{
   unsigned long Size = Cache.Head().PackageCount;
   memset(Scores,0,sizeof(*Scores)*Size);

   // Important Required Standard Optional Extra
   int PrioMap[] = {
      0,
      _config->FindI("pkgProblemResolver::Scores::Important",3),
      _config->FindI("pkgProblemResolver::Scores::Required",2),
      _config->FindI("pkgProblemResolver::Scores::Standard",1),
      _config->FindI("pkgProblemResolver::Scores::Optional",-1),
      _config->FindI("pkgProblemResolver::Scores::Extra",-2)
   };

pabs@chianamo ~ $ sudo apt-get -o Debug::pkgProblemResolver=yes -o Debug::pkgProblemResolver::ShowScores=yes dist-upgrade 2>&1 | head -n30
Reading package lists...
Building dependency tree...
Reading state information...
Starting
Settings used to calculate pkgProblemResolver::Scores::
  Important => 3
  Required => 2
  Standard => 1
  Optional => -1
  Extra => -2
  Essentials => 100
  InstalledAndNotObsolete => 1
  Depends => 1
  Recommends => 1
  AddProtected => 10000
  AddEssential => 5000
Show Scores
24475 libc6 [ amd64 ] < 2.13-37 -> 2.13-38 | 2.16-0experimental1 > ( libs )
12428 multiarch-support [ amd64 ] < 2.13-37 -> 2.13-38 | 2.16-0experimental1 > ( libs )

-- 
bye,
pabs

http://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: