Bug 247246

Summary: yum-priorities does not exclude obsoletes
Product: [Fedora] Fedora Reporter: Jason Farrell <farrellj>
Component: yum-utilsAssignee: Seth Vidal <skvidal>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 7CC: danieldk, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.1.7-1.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-18 03:21:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to use the replacement package architecture for obsolete checking.
none
Fixes obsolete handling by checking them archless. none

Description Jason Farrell 2007-07-06 10:47:16 UTC
Description of problem:
the yum-priorities plugin no longer excludes obsoletes due to a change in yum's
obsoletes dictionary format.

Version-Release number of selected component (if applicable):
yum-priorities-1.1.5-1.fc7

How reproducible:
Always

Steps to Reproduce:
1. yum install yum-priorities
2. add "check_obsoletes=1" to /etc/yum/pluginconf.d/priorities.conf
3. add "priority=1" to /etc/yum.repos.d/fedora*.repo:
perl -i -pe "s/(^\s*\[.*\])/\1\npriority=1/" /tmp/yum.repos.d/{fedora*,livna*}
4. add the nasty ATRPMS 3rd party repository.  # default priority is 99
5. yum --enablerepo=atrpms update     

Actual results:
ATRPMS is still allowed to obsolete packages in the protected priority=1 repo.
At the time of this bugreport, on my system, the two packages being overridden
are "PIL" obsoleting "python-imaging", and "mpg123" replacing "mpg321".

Expected results:
obsoletes excluded.

Additional info:
The plugin author - Daniel de Kok - writes: """this bug seems to be introduced
by a change by the yum-utils maintainers. They changed the code to use the
second element in an obsolete tuple to get the architecture, while this element
clearly does not list the arch, and I don't think it ever did."""

An example obsoletes dict entry:
(u'PIL', u'i386', u'0', u'1.1.6', u'8.fc7'): [   (   u'python-imaging',
                                                          u'LT',
                                                          (   u'0',
                                                              u'1.1.6',
                                                              u'8.fc7'))],

I've tested the original version of this plugin --
http://devel.linux.duke.edu/cgi-bin/viewcvs.cgi/yum-utils/plugins/priorities/priorities.py?revision=1.1
-- and it correctly filters out the obsoletes.

Diffing yum-priorities-1.1.5-1.fc7 against the working version shows:

81,82c81
<                 key = "%s.%s" % (po.name,po.arch)
<                 if pkg_priorities.has_key(key) and pkg_priorities[key] <
repo.priority:
---
>                 if pkg_priorities.has_key(po.name) and pkg_priorities[po.name]
< repo.priority:
91,92c90
<                             key = "%s.%s" % (obsolete_pkg[0],obsolete_pkg[1])
<                             if pkg_priorities.has_key(key) and
pkg_priorities[key] < repo.priority:
---
>                             if pkg_priorities.has_key(obsolete_pkg[0]) and
pkg_priorities[obsolete_pkg[0]] < repo.priority:
102,103c100
<         key = "%s.%s" % (p.name,p.arch)
<         out[key] = priority
---
>         out[p.name] = priority

Comment 1 Daniel de Kok 2007-07-12 12:59:09 UTC
I think the sanest manner to handle this is to assume that a package obsoletes
packages with the same architecture. Since the architecture is not in the
obsoletes table (and not returned by returnObsoletes), this seems to be the only
other option (other than reverting the arch handling patch).

I have attached a patch that does this.

Comment 2 Daniel de Kok 2007-07-12 13:00:06 UTC
Created attachment 159047 [details]
Patch to use the replacement package architecture for obsolete checking.

Comment 3 Seth Vidal 2007-07-12 19:28:04 UTC
and what about noarch pkgs? Do they obsolete only other noarches, or do they
obsolete arch-pkgs too?



Comment 4 Daniel de Kok 2007-07-29 08:16:06 UTC
After some more thought: I think an package from a lower priority repo should
never be able to replace a package from a higher priority repo (as was the case
before multi-arch handling was added to yum-priorities). Patch attached.

Comment 5 Daniel de Kok 2007-07-29 08:17:16 UTC
Created attachment 160183 [details]
Fixes obsolete handling by checking them archless.

Comment 6 Jason Farrell 2007-07-31 23:30:33 UTC
Daniel - thanks - the patch did the trick. atrpms obsoletes are now being
properly excluded.

Comment 7 Fedora Update System 2007-09-10 16:51:50 UTC
yum-utils-1.1.7-1.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2007-09-18 03:21:14 UTC
yum-utils-1.1.7-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.