I've attached a proposed plugin for inclusion in yum-utils, it's main
use is to allow easy removal of excludes.
 It also have adds a "list excludes" command, so you can see exactly
what you are excluding.

 Comments?

-- 
James Antill <[EMAIL PROTECTED]>
#! /usr/bin/python -tt
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# Copyright Red Hat Inc. 2007
#
# Author: James Antill <[EMAIL PROTECTED]>

# Examples:
#
#  yum --disable-excludes=all list updates
#  yum --disable-excludes=global list updates
#  yum list excludes
#

import yum
from yum.plugins import TYPE_INTERACTIVE

requires_api_version = '2.5'
plugin_type = (TYPE_INTERACTIVE,)

def config_hook(conduit):
    '''
    Yum Plugin Config Hook: 
    Setup the option parser with the '--disable-excludes' command line option.
    '''
    parser = conduit.getOptParser()
    if not parser:
        return

    parser.add_option('--disable-excludes', action='store',
                      choices=['none', 'all', 'global', 'repos'],
                      dest='disable_excludes', default="none",
                      help='Turn off exclude patterns')

def dump_excludes(conduit):
    print "JDBG: ex=", conduit._base.conf.exclude
    for repo in conduit._base.repos.listEnabled():
        print "JDBG:", repo, repo.getExcludePkgList()

def prereposetup_hook(conduit):
    """ Turn "list excludes" into a command, via. magic. Disable forms of
    excludes, if option was set. """
    opts, args = conduit.getCmdLine()

    if len(args) == 2 and args[0] == 'list' and args[1] == 'excludes':
        if not len(conduit._base.conf.exclude):
            raise yum.plugins.PluginYumExit(" No global excludes")

        # This is pretty hacky
        args.pop()
        args.extend(conduit._base.conf.exclude)
        conduit._base.extcmds = conduit._base.conf.exclude
        conduit._base.conf.exclude = []

    if opts.disable_excludes != "none":
        if opts.disable_excludes != "repo":
            conduit._base.conf.exclude = []
        if opts.disable_excludes != "global":
            for repo in conduit._base.repos.listEnabled():
                if repo.getExcludePkgList():
                    repo.exclude = []

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to