[buildd-tools-devel] Bug#608789: custom SolutionCost for AptitudeResolver in order to improve results

Modestas Vainius modax at debian.org
Mon Jan 3 13:28:18 UTC 2011


Package: sbuild
Version: 0.60.8-1
Severity: normal
Tags: patch

Hello,

I partially take my words that I said in [1] back. aptitude sometimes needs a
bit more hints to give us what we really want, i.e. we need to feed it a custom
SolutionCost as default settings might not be sufficient for experimental,
backports and especially more complex buildd configurations.

Issues concern installation from non-default sources. You will find full
explanation in the patch header. Please keep commit message intact (if
possible) as it contains useful information on the "how aptitude resolver
works" topic.

1. http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=54;mbox=yes;bug=607945

-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (100, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.36-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=lt_LT.UTF-8, LC_CTYPE=lt_LT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sbuild depends on:
ii  adduser                       3.112+nmu2 add and remove users and groups
ii  libsbuild-perl                0.60.8-1   Tool for building Debian binary pa
ii  perl                          5.10.1-16  Larry Wall's Practical Extraction 
ii  perl-modules                  5.10.1-16  Core Perl modules

Versions of packages sbuild recommends:
ii  debootstrap                   1.0.26     Bootstrap a basic Debian system
ii  fakeroot                      1.14.5-1   Gives a fake root environment

Versions of packages sbuild suggests:
pn  deborphan                     <none>     (no description available)
ii  wget                          1.12-2.1   retrieves files from the web

-- no debconf information
-------------- next part --------------
>From c29e39ce2f7078e0c83342694cb86e3423a9a1b0 Mon Sep 17 00:00:00 2001
From: Modestas Vainius <modax at debian.org>
Date: Mon, 3 Jan 2011 02:29:50 +0200
Subject: [PATCH 2/2] AptitudeResolver: define a custom SolutionCost.

aptitude 0.6.2 release replaced resolver tiers with resolver costs. sbuild
AptitudeResolver used to rely on resolver tiers to deliver the following
behaviour:

1) Install non-default versions only if there is no solution among default (aka
candidate) package versions.
2) Solution should contain versions from sources with the highest possible
priority (when pulling from non-default versions).

While default SolutionCost (i.e. "safety, priority") configuration is supposed
to deliver this, it's apparently not enough. In particular:

1) "priority" cost component is broken in aptitude releases up to 0.6.3-3.2
(see #608786). It does not prioritize non-default versions by their
pin-priorities.  However, thanks to Non-Default-Level safety level, the issue
does not affect configurations which have apt sources at two (one default and
one non-default) or fewer pin priorities. As a result, standard buildd
configurations (unstable, experimental, backports) are not affected by this
bug.

2) Once Non-Default safety level is breached, it is hard to guess what set of
non-default versions the solution will produce (it will be based on the "score"
criteria that is not easily predictable). Yet requirements are pretty clear: we
want as few non-default versions as possible. Fortunately, we can tell aptitude
that.

So sbuild custom SolutionCost achieves the following:

1) it gets the safest solution (tries only default versions first, then a mix of
default and non-default versions),
2) installs versions from the highest possible pin-priority source,
3) installs as few non-default versions as possible,
4) and finally picks a solution with the best score.

See /usr/share/doc/aptitude/html/en/ch02s03s04.html (aptitude-doc-en package)
for more information on aptitude resolver cost calculation.

Signed-off-by: Modestas Vainius <modax at debian.org>
---
 lib/Sbuild/AptitudeResolver.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/Sbuild/AptitudeResolver.pm b/lib/Sbuild/AptitudeResolver.pm
index f86ef02..79dbf77 100644
--- a/lib/Sbuild/AptitudeResolver.pm
+++ b/lib/Sbuild/AptitudeResolver.pm
@@ -86,6 +86,7 @@ sub install_deps {
 	'--without-recommends',
 	'-o', "Aptitude::CmdLine::Ignore-Trust-Violations=$ignore_trust_violations",
 	'-o', 'Aptitude::ProblemResolver::StepScore=100',
+	'-o', "Aptitude::ProblemResolver::SolutionCost=safety, priority, non-default-versions",
 	'-o', "Aptitude::ProblemResolver::Hints::KeepDummy=reject $dummy_pkg_name :UNINST",
 	'-o', 'Aptitude::ProblemResolver::Keep-All-Level=55000',
 	'-o', 'Aptitude::ProblemResolver::Remove-Essential-Level=maximum',
-- 
1.7.2.3



More information about the Buildd-tools-devel mailing list