Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 315449 Details for
Bug 460777
RFE: make yum _bestPackageFRomList use compare_providers()
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Prefer arch over package name length in _bestPackageFromList()
0001-Prefer-arch-over-package-name-length-in-_bestPackage.patch (text/plain), 4.01 KB, created by
Ville Skyttä
on 2008-08-31 18:37:24 UTC
(
hide
)
Description:
Prefer arch over package name length in _bestPackageFromList()
Filename:
MIME Type:
Creator:
Ville Skyttä
Created:
2008-08-31 18:37:24 UTC
Size:
4.01 KB
patch
obsolete
>From 01f6c49e54075cfaceffed75ff88fb7d4fd84da3 Mon Sep 17 00:00:00 2001 >From: =?utf-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> >Date: Sun, 31 Aug 2008 21:33:52 +0300 >Subject: [PATCH] Prefer arch over package name length in _bestPackageFromList(). > >--- > test/depsolvetests.py | 41 +++++++++++++++++++++++++++++++++++++++++ > yum/__init__.py | 14 ++++++-------- > 2 files changed, 47 insertions(+), 8 deletions(-) > >diff --git a/test/depsolvetests.py b/test/depsolvetests.py >index 4a3dad5..2a36c0b 100644 >--- a/test/depsolvetests.py >+++ b/test/depsolvetests.py >@@ -1114,3 +1114,44 @@ class DepsolveTests(DepsolveTests): > > self.assertEquals('ok', *self.resolveCode()) > self.assertResult((ipo1, po1)) >+ >+ def test_bestPackageFromList(self): >+ >+ myarch = arch.getBaseArch(arch.getCanonArch()) >+ if myarch not in ('i386', 'x86_64'): >+ return >+ >+ solver = YumBase() >+ solver.conf = FakeConf() >+ >+ po1 = FakePackage('foo', arch='i386') >+ po2 = FakePackage('foobar', arch='x86_64') >+ >+ if myarch == 'i386': # only one applicable arch >+ self.assertEquals(po1, solver._bestPackageFromList(([po1, po2]))) >+ self.assertEquals(po1, solver._bestPackageFromList(([po2, po1]))) >+ else: # arch=x86_64 wins >+ self.assertEquals(po2, solver._bestPackageFromList(([po1, po2]))) >+ self.assertEquals(po2, solver._bestPackageFromList(([po2, po1]))) >+ >+ po1.name = 'foobarquux' >+ if myarch == 'i386': # only one applicable arch >+ self.assertEquals(po1, solver._bestPackageFromList(([po1, po2]))) >+ self.assertEquals(po1, solver._bestPackageFromList(([po2, po1]))) >+ else: # shortest name wins >+ self.assertEquals(po2, solver._bestPackageFromList(([po1, po2]))) >+ self.assertEquals(po2, solver._bestPackageFromList(([po2, po1]))) >+ >+ # shortest name wins >+ po2.arch = 'i386' >+ self.assertEquals(po1, solver._bestPackageFromList(([po1, po2]))) >+ self.assertEquals(po1, solver._bestPackageFromList(([po2, po1]))) >+ >+ po1.arch = po2.arch = 'x86_64' >+ if myarch == 'i386': # no applicable archs >+ self.assertEquals(None, solver._bestPackageFromList(([po1, po2]))) >+ self.assertEquals(None, solver._bestPackageFromList(([po2, po1]))) >+ else: # shortest name wins >+ self.assertEquals(po2, solver._bestPackageFromList(([po1, po2]))) >+ self.assertEquals(po2, solver._bestPackageFromList(([po2, po1]))) >+ >diff --git a/yum/__init__.py b/yum/__init__.py >index 4fa47eb..338e21c 100644 >--- a/yum/__init__.py >+++ b/yum/__init__.py >@@ -2100,9 +2100,8 @@ class YumBase(depsolve.Depsolve): > """take list of package objects and return the best package object. > If the list is empty, return None. > >- Note: this is not aware of multilib so make sure you're only >- passing it packages of a single arch group.""" >- >+ Note: arch applicability is not checked in all cases, so be sure to >+ pass only packages compatible with the current arch here.""" > > if len(pkglist) == 0: > return None >@@ -2127,11 +2126,6 @@ class YumBase(depsolve.Depsolve): > continue > > # This is basically _compare_providers() ... but without a reqpo >- if len(pkg.name) < len(best.name): # shortest name silliness >- best = pkg >- continue >- elif len(pkg.name) > len(best.name): >- continue > > # compare arch > arch = rpmUtils.arch.getBestArchFromList([pkg.arch, best.arch]) >@@ -2139,6 +2133,10 @@ class YumBase(depsolve.Depsolve): > best = pkg > continue > >+ # shortest name silliness (for best arch packages only) >+ if pkg.arch == best.arch and len(pkg.name) < len(best.name): >+ best = pkg >+ > return best > > def bestPackagesFromList(self, pkglist, arch=None): >-- >1.5.5.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 460777
: 315449 |
315450
|
317285