Package: libsbuild-perl Version: 0.59.0-1 Severity: wishlist File: /usr/share/perl5/Sbuild/BuildDepSatisfierBase.pm Tags: patch
Hello, (this bug is actually against not-yet-released version 0.59.1-1). The patch and commit log are below. It applies on the top of the current buildd/master branch. Author: Modestas Vainius <mo...@debian.org> Date: Fri Feb 19 02:07:11 2010 +0200 Sort apt policy versions by priority, then by version. In my opinion, it makes sense to sort package versions by priority first (versions with greater priority will be prefered over versions with lower priority if they both satify the dependency). If priority is the same, then higher versions will be prefered over lower ones (i.e. like previous behaviour for all versions). This change allows buildd administrators to configure preferences for multiple repositories via standard apt_preferences(5) file in the chroot. What is more, this is similar to how aptitude 0.6 orders solutions in the same tier. Signed-off-by: Modestas Vainius <mo...@debian.org> diff --git a/lib/Sbuild/BuildDepSatisfierBase.pm b/lib/Sbuild/BuildDepSatisfierBase.pm index cc170cd..7d6c08d 100644 --- a/lib/Sbuild/BuildDepSatisfierBase.pm +++ b/lib/Sbuild/BuildDepSatisfierBase.pm @@ -359,6 +359,7 @@ sub get_apt_policy { my $builder = $self->get('Builder'); my @interest = @_; my $package; + my $ver; my %packages; my $pipe = @@ -373,9 +374,30 @@ sub get_apt_policy { $package=$1 if /^([0-9a-z+.-]+):$/; $packages{$package}->{curversion}=$1 if /^ {2}Installed: ([0-9a-zA-Z-.:~+]*)$/; $packages{$package}->{defversion}=$1 if /^ {2}Candidate: ([0-9a-zA-Z-.:~+]*)$/; - push @{$packages{$package}->{versions}}, "$2" if /^ (\*{3}| {3}) ([0-9a-zA-Z-.:~+]*) 0$/; + if (/^ (\*{3}| {3}) ([0-9a-zA-Z-.:~+]*) 0$/) { + $ver = "$2"; + push @{$packages{$package}->{versions}}, $ver; + } + if (/^ {5} *(-?\d+) /) { + my $prio = $1; + if (!defined $packages{$package}->{priority}{$ver} || + $packages{$package}->{priority}{$ver} < $prio) { + $packages{$package}->{priority}{$ver} = $prio; + } + } } close($pipe); + # Resort by priority keeping current version order if priority is the same + use sort "stable"; + foreach my $package (keys %packages) { + my $p = $packages{$package}; + if (exists $p->{priority}) { + $p->{versions} = [ sort( + { -($p->{priority}{$a} <=> $p->{priority}{$b}) } @{$p->{versions}} + ) ]; + } + } + no sort "stable"; die $self->get_conf('APT_CACHE') . " exit status $?\n" if $?; return \%packages; -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-2-amd64 (SMP w/1 CPU core) 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 libsbuild-perl depends on: ii adduser 3.112 add and remove users and groups ii apt 0.7.25.3 Advanced front-end for dpkg ii dctrl-tools 2.14 Command-line tools to process Debi ii devscripts 2.10.61 scripts to make the life of a Debi ii dpkg-dev 1.15.5.6 Debian package development tools ii exim4 4.71-3 metapackage to ease Exim MTA (v4) ii exim4-daemon-light [mail-tran 4.71-3 lightweight Exim MTA (v4) daemon ii libfilesys-df-perl 0.92-3+b1 Module to obtain filesystem disk s ii perl 5.10.1-11 Larry Wall's Practical Extraction ii perl-modules 5.10.1-11 Core Perl modules ii schroot 1.4.0-1 Execute commands in a chroot envir libsbuild-perl recommends no packages. libsbuild-perl suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org