[Yum] pkgpolicy=(newest)|first|last by repo order in .conf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Folks,

Seeing as this has been discussed many times I'll get to the point: has
anyone considered poking an ordered dictionary through to ConfigParser?

Apart from touching a supposed private attribute (which I can live
with), this would seem to be a simple solution...

In yum/config.py:

========================================
...

class ConfigDictionary(dict):
    def __setitem__ (self, key, value):
        dict.__setitem__ (self, key, (len (self), value,))
    def __getitem__(self, key):
        return dict.__getitem__(self, key)[1]
    def ordered_sids(self):
        i = [(v, k) for (k, v) in self.items()]
        i.sort()
        return [k for (v, k) in i]

class yumconf:

    def __init__(self, configfile = '/etc/yum.conf'):
        self.cfg = ConfigParser.ConfigParser()
        self.cfg._sections = ConfigDictionary() #!!!!!!

etc...
========================================
In yum/yummain.py

    serverlist = [sid for sid in conf.cfg._sections.ordered_sids() if
sid in conf.servers]
    if conf.pkgpolicy == 'first':
        serverlist.reverse()
        conf.pkgpolicy = 'last'

    #serverlist = conf.servers
    #serverlist.sort()

========================================

Cheers, C.
-- 
Cymon J. Cox <cymon@xxxxxxxx>


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux