Re: crazy ideas for yum/pup/that_damned_applet

seth vidal <[email protected]> Thu, 03 Mar 2005 09:23:26 -0500
Newsgroups gmane.linux.redhat.fedora.configuration
Message-ID <1109859806.21434.20.camel@cutter>
> I think that's the first step.  I'll try and play today.
> 

here's the simplest form of the class to do the checking.

it doesn't do anything other than setup, build the updates/obsoletes and
iterates them.

I don't have any dbus knowledge, yet, so I don't have the event sending
in there, of course.

-sv

-- 
Fedora-config-list mailing list
[email protected]
http://www.redhat.com/mailman/listinfo/fedora-config-list
yum-test-check.py (application/x-python, 1.6 KB)
# 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.

# seth vidal 2005 (c) etc etc

import yum
import yum.Errors
import sys
import os
import libxml2


class YumQuiet(yum.YumBase):
    def __init__(self):
        yum.YumBase.__init__(self)
    
    def log(self, value, msg):
        pass

def main():
    my = YumQuiet()
    my.doConfigSetup()
    try:
        my.doRepoSetup()
    except yum.Errors.RepoError, e:
        print >> sys.stderr, '%s' % e
        print >> sys.stderr, 'Cannot continue'
        sys.exit(1)
    my.doSackSetup()
    my.doTsSetup()
    my.doRpmDBSetup()
    my.doUpdateSetup()
    updates = my.up.getUpdatesTuples()
    obsoletes = []
    if my.conf.obsoletes:
        obsoletes = my.up.getObsoletesTuples(newest=1)
    
    for (obs, ins) in obsoletes:
        print "do obs dbus event: %s obsoletes %s" % (obs, ins)
    
    for (new, old) in updates:
        print "do update dbus event: %s over %s" % (new, old)
    

if __name__ == "__main__":
    main()