From a3364fb5fb5ee56813e6d124f1a916f9dcff3c3c Mon Sep 17 00:00:00 2001
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Date: Thu, 29 Oct 2009 15:56:22 +0100
Subject: [PATCH] sort eligible providers by DEFAULT_PREFERENCE

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 lib/bb/providers.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/bb/providers.py b/lib/bb/providers.py
index 8970fb3..74a69ab 100644
--- a/lib/bb/providers.py
+++ b/lib/bb/providers.py
@@ -190,7 +190,7 @@ def _filterProviders(providers, item, cfgData, dataCache):
         if preferred_versions[pn][1]:
             eligible.append(preferred_versions[pn][1])
 
-    # Now add latest verisons
+    # Now add latest versions
     for pn in pkg_pn.keys():
         if pn in preferred_versions and preferred_versions[pn][1]:
             continue
@@ -212,6 +212,8 @@ def _filterProviders(providers, item, cfgData, dataCache):
             continue
         eligible.remove(fn)
         eligible = [fn] + eligible
+    # sort eligible according to their DEFAULT_PREFERENCE
+    eligible.sort(lambda a, b: dataCache.pkg_dp[b] - dataCache.pkg_dp[a])
 
     return eligible
 
-- 
1.6.5

