From 80a00c8b0a68ab87a43b7f9bf7bd70d723625143 Mon Sep 17 00:00:00 2001 From: espie Date: Sat, 12 Oct 2013 14:11:23 +0000 Subject: [PATCH] the speedfactor case needs access to the weights. --- infrastructure/lib/DPB/Heuristics.pm | 5 +++-- infrastructure/lib/DPB/Heuristics/SpeedFactor.pm | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/infrastructure/lib/DPB/Heuristics.pm b/infrastructure/lib/DPB/Heuristics.pm index fb03db3c739..99222f21606 100644 --- a/infrastructure/lib/DPB/Heuristics.pm +++ b/infrastructure/lib/DPB/Heuristics.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Heuristics.pm,v 1.28 2013/10/12 13:53:35 espie Exp $ +# $OpenBSD: Heuristics.pm,v 1.29 2013/10/12 14:11:23 espie Exp $ # # Copyright (c) 2010-2013 Marc Espie # @@ -25,7 +25,8 @@ package DPB::Heuristics; # for now, we don't create a separate object, we assume everything here is # "global" -my (%weight, %bad_weight, %wrkdir, %needed_by, %pkgname); +my (%bad_weight, %wrkdir, %needed_by, %pkgname); +our %weight; sub new { diff --git a/infrastructure/lib/DPB/Heuristics/SpeedFactor.pm b/infrastructure/lib/DPB/Heuristics/SpeedFactor.pm index 4aef481f238..46abb02bec1 100644 --- a/infrastructure/lib/DPB/Heuristics/SpeedFactor.pm +++ b/infrastructure/lib/DPB/Heuristics/SpeedFactor.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SpeedFactor.pm,v 1.1 2013/10/12 13:53:35 espie Exp $ +# $OpenBSD: SpeedFactor.pm,v 1.2 2013/10/12 14:11:23 espie Exp $ # # Copyright (c) 2010-2013 Marc Espie # @@ -29,13 +29,13 @@ sub add { my ($self, $v) = @_; $self->SUPER::add($v); - $self->{weight} += $weight{$v}; + $self->{weight} += $DPB::Heuristics::weight{$v}; } sub remove { my ($self, $v) = @_; - $self->{weight} -= $weight{$v}; + $self->{weight} -= $DPB::Heuristics::weight{$v}; $self->SUPER::remove($v); } @@ -63,7 +63,7 @@ sub add { my ($self, $v) = @_; $self->SUPER::add($v); - $v->{weight} = $weight{$v}; + $v->{weight} = $DPB::Heuristics::weight{$v}; $self->{bins}[find_bin($v->{weight})]->add($v); }