Hello community, here is the log from the commit of package yum checked in at Fri Oct 6 18:46:31 CEST 2006. -------- --- yum/yum.changes 2006-10-01 11:37:21.000000000 +0200 +++ /mounts/work_src_done/STABLE/yum/yum.changes 2006-10-05 11:38:22.000000000 +0200 @@ -1,0 +2,31 @@ +Thu Oct 5 11:36:09 CEST 2006 - cthiel@suse.de + +- update to version 3.0 + * yum/depsolve.py: messing around with a few tests to figure out where it + is slow. + * shell.py, yum/depsolve.py: make the fix for pekka's bug more correct + * shell.py: fix for the traceback Pekka reported - makes sure that our ts + is reopened/intialized when the user decides to not run the transaction + from the shell. + * yum/plugins.py: replaced IncludingConfigParser with + ConfigPreProcessor/ConfigParser in plugins, so i works like the rest of + yum. + * yum/packages.py: * add a remote_url property for packages to get the + remote location as a string that can be printed * get rid of some + explicit uses of relativepath + * yum/config.py: Copy the default value in case it is mutable and + different config instances end up manipulating the same default value. + * yum/plugins.py: fix for this error : AttributeError: 'module' object has + no attribute 'IncludingConfigParser' When running latest yum-cvs with + plugins. + * yum/: __init__.py, config.py, parser.py: make the include= and yum -c + http://path/to/file behave like I thought they should. + * yum/config.py: put accidentally removed line back + + * yum/: packages.py, repos.py: cleaned up Repository.setkeys as discussed + on yum-devel + * yum/config.py: Removed on the fly write-back support from the config + classes. Added BaseConfig.write() instead. This is simpler and should + use less memory. No-one was using the write support anyway. + +------------------------------------------------------------------- Old: ---- yum-2.9.8.tar.bz2 New: ---- yum-3.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yum.spec ++++++ --- /var/tmp/diff_new_pack.Xm4Jlz/_old 2006-10-06 18:45:58.000000000 +0200 +++ /var/tmp/diff_new_pack.Xm4Jlz/_new 2006-10-06 18:45:58.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package yum (Version 2.9.8) +# spec file for package yum (Version 3.0) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -12,7 +12,7 @@ Name: yum BuildRequires: python-devel -Version: 2.9.8 +Version: 3.0 Release: 1 Summary: RPM installer/updater Group: System/Packages @@ -20,7 +20,7 @@ URL: http://linux.duke.edu/yum/ Source: %{name}-%{version}.tar.bz2 Source1: %{name}.conf -Patch2: %{name}-no_updatesd.patch +Patch: %{name}-no_updatesd.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires: rpm >= 4.4.0 Requires: rpm-python @@ -45,7 +45,7 @@ %prep %setup -q -%patch2 +%patch %ifnarch %{ix86} for i in rpmUtils yum do @@ -79,6 +79,33 @@ %{py_sitedir}/* %changelog -n yum +* Thu Oct 05 2006 - cthiel@suse.de +- update to version 3.0 + * yum/depsolve.py: messing around with a few tests to figure out where it + is slow. + * shell.py, yum/depsolve.py: make the fix for pekka's bug more correct + * shell.py: fix for the traceback Pekka reported - makes sure that our ts + is reopened/intialized when the user decides to not run the transaction + from the shell. + * yum/plugins.py: replaced IncludingConfigParser with + ConfigPreProcessor/ConfigParser in plugins, so i works like the rest of + yum. + * yum/packages.py: * add a remote_url property for packages to get the + remote location as a string that can be printed * get rid of some + explicit uses of relativepath + * yum/config.py: Copy the default value in case it is mutable and + different config instances end up manipulating the same default value. + * yum/plugins.py: fix for this error : AttributeError: 'module' object has + no attribute 'IncludingConfigParser' When running latest yum-cvs with + plugins. + * yum/: __init__.py, config.py, parser.py: make the include= and yum -c + http://path/to/file behave like I thought they should. + * yum/config.py: put accidentally removed line back + * yum/: packages.py, repos.py: cleaned up Repository.setkeys as discussed + on yum-devel + * yum/config.py: Removed on the fly write-back support from the config + classes. Added BaseConfig.write() instead. This is simpler and should + use less memory. No-one was using the write support anyway. * Sun Oct 01 2006 - cthiel@suse.de - update to version 2.9.8 * yum/rpmsack.py: minor fix to deprecated returnTupleByKeyword method in ++++++ yum-2.9.8.tar.bz2 -> yum-3.0.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/ChangeLog new/yum-3.0/ChangeLog --- old/yum-2.9.8/ChangeLog 2006-09-29 16:48:46.000000000 +0200 +++ new/yum-3.0/ChangeLog 2006-10-05 04:22:30.000000000 +0200 @@ -1,3 +1,80 @@ +2006-10-04 21:58 skvidal + + * yum.spec, yum/__init__.py: + - 3.0 mark - make python 2.4 a req in yum.spec + +2006-10-03 17:43 skvidal + + * yum/depsolve.py: + messing around with a few tests to figure out where it is slow. + +2006-10-03 01:48 skvidal + + * shell.py, yum/depsolve.py: + make the fix for pekka's bug more correct + +2006-10-03 01:41 skvidal + + * shell.py: + fix for the traceback Pekka reported - makes sure that our ts is + reopened/intialized when the user decides to not run the + transaction from the shell. + +2006-10-02 12:34 timlau + + * yum/plugins.py: replaced IncludingConfigParser with + ConfigPreProcessor/ConfigParser in plugins, so i works like the + rest of yum. + +2006-10-02 10:42 katzj + + * yum/packages.py: * add a remote_url property for packages to get + the remote location as a string that can be printed * get rid of + some explicit uses of relativepath + +2006-10-02 09:02 mjs + + * yum/config.py: Copy the default value in case it is mutable and + different config instances end up manipulating the same default + value. + +2006-10-02 04:42 timlau + + * yum/plugins.py: fix for this error : AttributeError: 'module' + object has no attribute 'IncludingConfigParser' When running latest + yum-cvs with plugins. + +2006-10-01 23:46 skvidal + + * yum/: __init__.py, config.py, parser.py: + make the include= and yum -c http://path/to/file behave like I + thought they should. + + This, ultimately, removes the need for parser.IncludingConfigParser + and parser.IncludedConfigParser but I haven't removed them yet b/c + I wanted to verify that they are not used elsewhere, first. + +2006-09-29 11:44 mjs + + * yum/config.py: put accidentally removed line back + +2006-09-29 11:42 mjs + + * yum/: packages.py, repos.py: cleaned up Repository.setkeys as + discussed on yum-devel + +2006-09-29 11:30 mjs + + * yum/config.py: Removed on the fly write-back support from the + config classes. Added BaseConfig.write() instead. This is simpler + and should use less memory. No-one was using the write support + anyway. + +2006-09-29 11:12 skvidal + + * ChangeLog: + check in changelog + 2006-09-29 10:45 skvidal * yum.spec, yum/__init__.py: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/shell.py new/yum-3.0/shell.py --- old/yum-2.9.8/shell.py 2006-09-26 16:00:21.000000000 +0200 +++ new/yum-3.0/shell.py 2006-10-03 07:49:17.000000000 +0200 @@ -330,3 +330,4 @@ self.base.doTsSetup() self.base.doRpmDBSetup() + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/__init__.py new/yum-3.0/yum/__init__.py --- old/yum-2.9.8/yum/__init__.py 2006-09-29 16:47:33.000000000 +0200 +++ new/yum-3.0/yum/__init__.py 2006-10-05 04:00:56.000000000 +0200 @@ -26,7 +26,7 @@ import glob import logging import logging.config -from ConfigParser import ParsingError +from ConfigParser import ParsingError, ConfigParser import Errors import rpmsack import rpmUtils.updates @@ -36,6 +36,7 @@ import config import repos import misc +from parser import ConfigPreProcessor import transactioninfo import urlgrabber from urlgrabber.grabber import URLGrabError @@ -48,7 +49,7 @@ from packages import parsePackages, YumAvailablePackage, YumLocalPackage, YumInstalledPackage from constants import * -__version__ = '2.9.8' +__version__ = '3.0' class YumBase(depsolve.Depsolve): """This is a primary structure and base class. It houses the objects and @@ -166,19 +167,19 @@ # Read .repo files from directories specified by the reposdir option # (typically /etc/yum.repos.d and /etc/yum/repos.d) - parser = config.IncludedDirConfigParser(vars=self.yumvar) + parser = ConfigParser() for reposdir in self.conf.reposdir: if os.path.exists(self.conf.installroot+'/'+reposdir): reposdir = self.conf.installroot + '/' + reposdir if os.path.isdir(reposdir): - #XXX: why can't we just pass the list of files? - files = ' '.join(glob.glob('%s/*.repo' % reposdir)) - try: - parser.read(files) - except ParsingError, e: - msg = str(e) - raise Errors.ConfigError, msg + for repofn in glob.glob('%s/*.repo' % reposdir): + confpp_obj = ConfigPreProcessor(repofn, vars=self.yumvar) + try: + parser.readfp(confpp_obj) + except ParsingError, e: + msg = str(e) + raise Errors.ConfigError, msg # Check sections in the .repo files that were just slurped up for section in parser.sections(): diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/config.py new/yum-3.0/yum/config.py --- old/yum-2.9.8/yum/config.py 2006-09-29 16:40:22.000000000 +0200 +++ new/yum-3.0/yum/config.py 2006-10-02 23:06:42.000000000 +0200 @@ -20,22 +20,12 @@ import rpm import copy import urlparse -from parser import IncludingConfigParser, IncludedDirConfigParser -from ConfigParser import NoSectionError, NoOptionError +from parser import ConfigPreProcessor +from ConfigParser import NoSectionError, NoOptionError, ConfigParser, ParsingError import rpmUtils.transaction import rpmUtils.arch import Errors -class OptionData(object): - ''' - Simple class to track state for a single option instance. - ''' - def __init__(self, name, initial_value): - self.name = name - self.value = initial_value - self.parser = None - self.section = None - class Option(object): ''' This class handles a single Yum configuration file option. Create @@ -66,11 +56,8 @@ ''' if obj is None: return self - optdata = getattr(obj, self._attrname, None) - if optdata == None: - return None - else: - return optdata.value + + return getattr(obj, self._attrname, None) def __set__(self, obj, value): '''Called when the option is set (via the descriptor protocol). @@ -79,23 +66,15 @@ @param value: The value to set the option to. @return: Nothing. ''' - optdata = getattr(obj, self._attrname) - # Only try to parse if its a string if isinstance(value, basestring): try: value = self.parse(value) except ValueError, e: # Add the field name onto the error - raise ValueError('Error parsing %r: %s' % (optdata.name, - str(e))) - - optdata.value = value + raise ValueError('Error parsing %r: %s' % (value, str(e))) - # Write string value back to parser instance if possible - if optdata.parser != None: - strvalue = self.tostring(value) - optdata.parser.set(optdata.section, optdata.name, strvalue) + setattr(obj, self._attrname, value) def setup(self, obj, name): '''Initialise the option for a config instance. @@ -104,19 +83,7 @@ @param obj: BaseConfig (or subclass) instance. @param name: Name of the option. ''' - setattr(obj, self._attrname, OptionData(name, self.default)) - - def setparser(self, obj, parser, section): - '''Set the configuration parser for this option. This is required so - that options can be written back to a configuration file. - - @param obj: BaseConfig (or subclass) instance. - @param parser: ConfigParser (or subclass) where the option is read from. - @param section: config file section where the option is from. - ''' - optdata = getattr(obj, self._attrname) - optdata.parser = parser - optdata.section = section + setattr(obj, self._attrname, copy.copy(self.default)) def clone(self): '''Return a safe copy of this Option instance @@ -387,8 +354,8 @@ @param parent: Optional parent BaseConfig (or subclass) instance to use when doing option value inheritance. ''' + self.cfg = parser self._section = section - self.cfg = parser # Keep a reference to the parser for name in self.iterkeys(): option = self.optionobj(name) @@ -400,7 +367,6 @@ if parent and option.inherit: value = getattr(parent, name) - option.setparser(self, parser, section) if value is not None: setattr(self, name, value) @@ -440,6 +406,31 @@ if self.isoption(name): yield (name, getattr(self, name)) + def write(self, fileobj, section=None, always=()): + '''Write out the configuration to a file-like object + + @param fileobj: File-like object to write to + @param section: Section name to use. If not-specified the section name + used during parsing will be used. + @param always: A sequence of option names to always write out. + Options not listed here will only be written out if they are at + non-default values. Set to None to dump out all options. + ''' + # Write section heading + if section is None: + if self._section is None: + raise ValueError("not populated, don't know section") + section = self._section + + fileobj.write('[%s]\n' % section) + + # Write options + for name, value in self.iteritems(): + option = self.optionobj(name) + + if always is None or name in always or option.default != value: + fileobj.write("%s = %s\n" % (name, option.tostring(value))) + def getConfigOption(self, option, default=None): warnings.warn('getConfigOption() will go away in a future version of Yum.\n' 'Please access option values as attributes or using getattr().', @@ -569,14 +560,16 @@ May raise Errors.ConfigError if a problem is detected with while parsing. ''' - if not os.path.exists(configfile): - raise Errors.ConfigError, 'No such config file %s' % configfile StartupConf.installroot.default = root startupconf = StartupConf() - parser = IncludingConfigParser() - parser.read(configfile) + parser = ConfigParser() + confpp_obj = ConfigPreProcessor(configfile) + try: + parser.readfp(confpp_obj) + except ParsingError, e: + raise Errors.ConfigError("Parsing file failed: %s" % e) startupconf.populate(parser, 'main') # Check that plugin paths are all absolute diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/depsolve.py new/yum-3.0/yum/depsolve.py --- old/yum-2.9.8/yum/depsolve.py 2006-09-06 06:46:23.000000000 +0200 +++ new/yum-3.0/yum/depsolve.py 2006-10-03 23:45:45.000000000 +0200 @@ -19,6 +19,7 @@ import re import types import logging +import time import rpmUtils.transaction import rpmUtils.miscutils @@ -127,6 +128,10 @@ if self.dsCallback: self.dsCallback.transactionPopulation() ts_elem = {} + + if self.ts.ts is None: + self.initActionTs() + if keepold: for te in self.ts: epoch = te.E() diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/packages.py new/yum-3.0/yum/packages.py --- old/yum-2.9.8/yum/packages.py 2006-09-24 22:06:30.000000000 +0200 +++ new/yum-3.0/yum/packages.py 2006-10-02 23:06:42.000000000 +0200 @@ -24,6 +24,7 @@ import fnmatch import stat import warnings +from urlparse import urljoin from rpmUtils import RpmUtilsError import rpmUtils.arch import rpmUtils.miscutils @@ -110,10 +111,9 @@ return exactmatch, matched, unmatched class FakeRepository: - """Fake repositorty class for use in rpmsack package objects""" + """Fake repository class for use in rpmsack package objects""" def __init__(self, repoid): self.id = repoid - self.setkeys = [] def __cmp__(self, other): if self.id > other.id: @@ -122,6 +122,7 @@ return -1 else: return 0 + def __hash__(self): return hash(self.id) @@ -394,9 +395,19 @@ def _remote_path(self): return self.returnSimple('relativepath') + + def _remote_url(self): + """returns a URL that can be used for downloading the package. + Note that if you're going to download the package in your tool, + you should use self.repo.getPackage.""" + base = self.returnSimple('basepath') + if base: + return urljoin(base, self.remote_path) + return urljoin(self.repo.urls[0], self.remote_path) size = property(_size) remote_path = property(_remote_path) + remote_url = property(_remote_url) @@ -419,8 +430,7 @@ def localPkg(self): """return path to local package (whether it is present there, or not)""" if not hasattr(self, 'localpath'): - remote = self.returnSimple('relativepath') - rpmfn = os.path.basename(remote) + rpmfn = os.path.basename(self.remote_path) self.localpath = self.repo.pkgdir + '/' + rpmfn return self.localpath @@ -429,8 +439,7 @@ byte ranges""" if not hasattr(self, 'hdrpath'): - pkgpath = self.returnSimple('relativepath') - pkgname = os.path.basename(pkgpath) + pkgname = os.path.basename(self.remote_path) hdrname = pkgname[:-4] + '.hdr' self.hdrpath = self.repo.hdrdir + '/' + hdrname diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/parser.py new/yum-3.0/yum/parser.py --- old/yum-2.9.8/yum/parser.py 2006-07-10 20:00:54.000000000 +0200 +++ new/yum-3.0/yum/parser.py 2006-10-02 05:36:13.000000000 +0200 @@ -7,6 +7,8 @@ import os.path from ConfigParser import ConfigParser, NoSectionError, NoOptionError +import Errors + #TODO: better handling of recursion #TODO: ability to handle bare includes (ie. before first [section]) #TODO: avoid include line reordering on write @@ -276,6 +278,188 @@ return ''.join(done) +class ConfigPreProcessor: + """ + ConfigParser Include Pre-Processor + + File-like Object capable of pre-processing include= lines for + a ConfigParser. + + The readline function expands lines matching include=(url) + into lines from the url specified. Includes may occur in + included files as well. + + Suggested Usage: + cfg = ConfigParser.ConfigParser() + fileobj = confpp( fileorurl ) + cfg.readfp(fileobj) + """ + + + def __init__(self, configfile, vars=None): + # put the vars away in a helpful place + self._vars = vars + + # set some file-like object attributes for ConfigParser + # these just make confpp look more like a real file object. + self.mode = 'r' + + # establish whether to use urlgrabber or urllib + # we want to use urlgrabber if it supports urlopen + if hasattr(urlgrabber.grabber, 'urlopen'): + self._urlresolver = urlgrabber.grabber + else: + self._urlresolver = urllib + + + # first make configfile a url even if it points to + # a local file + scheme = urlparse.urlparse(configfile)[0] + if scheme == '': + # check it to make sure it's not a relative file url + if configfile[0] != '/': + configfile = os.getcwd() + '/' + configfile + url = 'file://' + configfile + else: + url = configfile + + # these are used to maintain the include stack and check + # for recursive/duplicate includes + self._incstack = [] + self._alreadyincluded = [] + + # _pushfile will return None if he couldn't open the file + fo = self._pushfile( url ) + if fo is None: + raise Errors.ConfigError, 'Error accessing file: %s' % url + + def readline( self, size=0 ): + """ + Implementation of File-Like Object readline function. This should be + the only function called by ConfigParser according to the python docs. + We maintain a stack of real FLOs and delegate readline calls to the + FLO on top of the stack. When EOF occurs on the topmost FLO, it is + popped off the stack and the next FLO takes over. include= lines + found anywhere cause a new FLO to be opened and pushed onto the top + of the stack. Finally, we return EOF when the bottom-most (configfile + arg to __init__) FLO returns EOF. + + Very Technical Pseudo Code: + + def confpp.readline() [this is called by ConfigParser] + open configfile, push on stack + while stack has some stuff on it + line = readline from file on top of stack + pop and continue if line is EOF + if line starts with 'include=' then + error if file is recursive or duplicate + otherwise open file, push on stack + continue + else + return line + + return EOF + """ + + # set line to EOF initially. + line='' + while len(self._incstack) > 0: + # peek at the file like object on top of the stack + fo = self._incstack[-1] + line = fo.readline() + if len(line) > 0: + m = re.match( r'\s*include\s*=\s*(?P<url>.*)', line ) + if m: + url = m.group('url') + if len(url) == 0: + raise Errors.ConfigError, \ + 'Error parsing config %s: include must specify file to include.' % (self.name) + else: + # whooohoo a valid include line.. push it on the stack + fo = self._pushfile( url ) + else: + # line didn't match include=, just return it as is + # for the ConfigParser + break + else: + # the current file returned EOF, pop it off the stack. + self._popfile() + + # at this point we have a line from the topmost file on the stack + # or EOF if the stack is empty + if vars: + return varReplace(line, self._vars) + return line + + + def _absurl( self, url ): + """ + Returns an absolute url for the (possibly) relative + url specified. The base url used to resolve the + missing bits of url is the url of the file currently + being included (i.e. the top of the stack). + """ + + if len(self._incstack) == 0: + # it's the initial config file. No base url to resolve against. + return url + else: + return urlparse.urljoin( self.geturl(), url ) + + + def _pushfile( self, url ): + """ + Opens the url specified, pushes it on the stack, and + returns a file like object. Returns None if the url + has previously been included. + If the file can not be opened this function exits. + """ + + # absolutize this url using the including files url + # as a base url. + absurl = self._absurl(url) + # check if this has previously been included. + if self._urlalreadyincluded(absurl): + return None + try: + fo = self._urlresolver.urlopen(absurl) + except urlgrabber.grabber.URLGrabError, e: + fo = None + if fo is not None: + self.name = absurl + self._incstack.append( fo ) + self._alreadyincluded.append(absurl) + else: + raise Errors.ConfigError, \ + 'Error accessing file for config %s' % (absurl) + + return fo + + + def _popfile( self ): + """ + Pop a file off the stack signaling completion of including that file. + """ + fo = self._incstack.pop() + fo.close() + if len(self._incstack) > 0: + self.name = self._incstack[-1].geturl() + else: + self.name = None + + + def _urlalreadyincluded( self, url ): + """ + Checks if the url has already been included at all.. this + does not necessarily have to be recursive + """ + for eurl in self._alreadyincluded: + if eurl == url: return 1 + return 0 + + + def geturl(self): return self.name + def _test(): import sys diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/plugins.py new/yum-3.0/yum/plugins.py --- old/yum-2.9.8/yum/plugins.py 2006-09-26 16:00:21.000000000 +0200 +++ new/yum-3.0/yum/plugins.py 2006-10-02 23:06:42.000000000 +0200 @@ -24,6 +24,8 @@ import ConfigParser import config import Errors +from parser import ConfigPreProcessor + # TODO: expose rpm package sack objects to plugins (once finished) # TODO: allow plugins to use the existing config stuff to define options for @@ -245,18 +247,13 @@ self.verbose_logger.log(logginglevels.INFO_2, "Unable to find configuration file for plugin %s" % modname) return None - - + parser = ConfigParser.ConfigParser() + confpp_obj = ConfigPreProcessor(conffilename) try: - parser = config.IncludingConfigParser() - parser.read(conffilename) - except ConfigParser.Error, e: + parser.readfp(confpp_obj) + except ParsingError, e: raise Errors.ConfigError("Couldn't parse %s: %s" % (conffilename, str(e))) - except IOError, e: - self.verbose_logger.log(logginglevels.INFO_2, str(e)) - return None - return parser def setCmdLine(self, opts, commands): diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/repos.py new/yum-3.0/yum/repos.py --- old/yum-2.9.8/yum/repos.py 2006-09-29 06:55:42.000000000 +0200 +++ new/yum-3.0/yum/repos.py 2006-09-29 17:46:32.000000000 +0200 @@ -210,8 +210,6 @@ def __init__(self, repoid): self.id = repoid - self.setkeys = [] - self.disable() def __cmp__(self, other): @@ -230,22 +228,11 @@ def setAttribute(self, key, value): """sets a generic attribute of this repository""" - self.setkeys.append(key) setattr(self, key, value) def getAttribute(self, key): - if key in self.setkeys or hasattr(self, key): - return getattr(self, key) - return None - - def unsetAttribute(self, key): - """delete an attribute of this repository""" - self.setkeys.remove(key) - delattr(self, key) - - def getAttributeKeys(self): - return self.setkeys - + return getattr(self, key, None) + def isEnabled(self): enabled = self.getAttribute('enabled') return enabled is not None and enabled diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum/repos.py.orig new/yum-3.0/yum/repos.py.orig --- old/yum-2.9.8/yum/repos.py.orig 2006-07-01 18:34:28.000000000 +0200 +++ new/yum-3.0/yum/repos.py.orig 1970-01-01 01:00:00.000000000 +0100 @@ -1,286 +0,0 @@ -#!/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 2004 Duke University - -import os -import os.path -import re -import fnmatch -import types -import time - -import Errors -from packageSack import MetaSack -from packages import YumAvailablePackage - -_is_fnmatch_pattern = re.compile(r"[*?[]").search - -class RepoStorage: - """This class contains multiple repositories and core configuration data - about them.""" - - def __init__(self): - self.repos = {} # list of repos by repoid pointing a repo object - # of repo options/misc data - self.callback = None # progress callback used for populateSack() for importing the xml files - self.cache = 0 - self.pkgSack = MetaSack() - - - def __str__(self): - return str(self.repos.keys()) - - - def add(self, repoobj): - if self.repos.has_key(repoobj.id): - raise Errors.RepoError, 'Repository %s is listed more than once in the configuration' % (repoobj.id) - self.repos[repoobj.id] = repoobj - - - def delete(self, repoid): - if self.repos.has_key(repoid): - del self.repos[repoid] - - def sort(self): - repolist = self.repos.values() - repolist.sort() - return repolist - - def getRepo(self, repoid): - try: - return self.repos[repoid] - except KeyError, e: - raise Errors.RepoError, \ - 'Error getting repository data for %s, repository not found' % (repoid) - - def findRepos(self,pattern): - """find all repositories matching fnmatch `pattern`""" - - result = [] - - for item in pattern.split(','): - item = item.strip() - match = re.compile(fnmatch.translate(item)).match - for name,repo in self.repos.items(): - if match(name): - result.append(repo) - return result - - def disableRepo(self, repoid): - """disable a repository from use - - fnmatch wildcards may be used to disable a group of repositories. - returns repoid of disabled repos as list - """ - repos = [] - if _is_fnmatch_pattern(repoid) or repoid.find(',') != -1: - for repo in self.findRepos(repoid): - repos.append(repo.id) - repo.disable() - else: - thisrepo = self.getRepo(repoid) - repos.append(thisrepo.id) - thisrepo.disable() - - return repos - - def enableRepo(self, repoid): - """enable a repository for use - - fnmatch wildcards may be used to enable a group of repositories. - returns repoid of enables repos as list - """ - repos = [] - if _is_fnmatch_pattern(repoid) or repoid.find(',') != -1: - for repo in self.findRepos(repoid): - repos.append(repo.id) - repo.enable() - else: - thisrepo = self.getRepo(repoid) - repos.append(thisrepo.id) - thisrepo.enable() - - return repos - - def listEnabled(self): - """return list of enabled repo objects""" - returnlist = [] - for repo in self.repos.values(): - if repo.isEnabled(): - returnlist.append(repo) - - return returnlist - - def listGroupsEnabled(self): - """return a list of repo objects that have groups enabled""" - returnlist = [] - for repo in self.listEnabled(): - if repo.enablegroups: - returnlist.append(repo) - - return returnlist - - def setCache(self, cacheval): - """sets cache value in all repos""" - self.cache = cacheval - for repo in self.repos.values(): - repo.cache = cacheval - - def setCacheDir(self, cachedir): - """sets the cachedir value in all repos""" - - for repo in self.repos.values(): - repo.basecachedir = cachedir - - def setProgressBar(self, obj): - """sets the progress bar for downloading files from repos""" - - for repo in self.repos.values(): - repo.setCallback(obj) - - def setFailureCallback(self, obj): - """sets the failure callback for all repos""" - - for repo in self.repos.values(): - repo.setFailureObj(obj) - - def setMirrorFailureCallback(self, obj): - """sets the failure callback for all mirrors""" - - for repo in self.repos.values(): - repo.setMirrorFailureObj(obj) - - def getPackageSack(self): - return self.pkgSack - - - def populateSack(self, which='enabled', with='metadata', callback=None, cacheonly=0): - """This populates the package sack from the repositories, two optional - arguments: which='repoid, enabled, all' - with='metadata, filelists, otherdata, all'""" - - if not callback: - callback = self.callback - myrepos = [] - if which == 'enabled': - myrepos = self.listEnabled() - elif which == 'all': - myrepos = self.repos.values() - else: - if type(which) == types.ListType: - for repo in which: - if isinstance(repo, Repository): - myrepos.append(repo) - else: - repobj = self.getRepo(repo) - myrepos.append(repobj) - elif type(which) == types.StringType: - repobj = self.getRepo(which) - myrepos.append(repobj) - - if with == 'all': - data = ['metadata', 'filelists', 'otherdata'] - else: - data = [ with ] - - for repo in myrepos: - sack = repo.getPackageSack() - sack.populate(repo, with, callback, cacheonly) - self.pkgSack.addSack(repo.id, sack) - - -class Repository: - """this is an actual repository object""" - - def __init__(self, repoid): - self.id = repoid - self.setkeys = [] - - self.disable() - - def __cmp__(self, other): - if self.id > other.id: - return 1 - elif self.id < other.id: - return -1 - else: - return 0 - - def __str__(self): - return self.id - - def setAttribute(self, key, value): - """sets a generic attribute of this repository""" - self.setkeys.append(key) - setattr(self, key, value) - - def getAttribute(self, key): - if key in self.setkeys and hasattr(self, key): - return getattr(self, key) - return None - - def unsetAttribute(self, key): - """delete an attribute of this repository""" - self.setkeys.remove(key) - delattr(self, key) - - def getAttributeKeys(self): - return self.setkeys - - def isEnabled(self): - enabled = self.getAttribute('enabled') - return enabled is not None and enabled - - def enable(self): - self.setAttribute('enabled', 1) - - def disable(self): - self.setAttribute('enabled', 0) - - def getExcludePkgList(self): - excludeList = self.getAttribute('exclude') - return excludeList or [] - - def getIncludePkgList(self): - includeList = self.getAttribute('includepkgs') - return includeList or [] - - # Abstract interface - def ready(self): - raise NotImplementedError() - - def getGroupLocation(self): - raise NotImplementedError() - - def getPackageSack(self): - raise NotImplementedError() - - def setup(self, cache): - raise NotImplementedError() - - def setCallback(self, callback): - raise NotImplementedError() - - def setFailureObj(self, obj): - raise NotImplementedError() - - def setMirrorFailureObj(self, obj): - raise NotImplementedError() - - def getPackage(self, package, checkfunc = None, text = None, cache = True): - raise NotImplementedError() - - def getHeader(self, package, checkfunc = None, reget = 'simple', cache = True): - raise NotImplementedError() diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yum-2.9.8/yum.spec new/yum-3.0/yum.spec --- old/yum-2.9.8/yum.spec 2006-09-29 16:47:51.000000000 +0200 +++ new/yum-3.0/yum.spec 2006-10-05 04:00:37.000000000 +0200 @@ -1,6 +1,6 @@ Summary: RPM installer/updater Name: yum -Version: 2.9.8 +Version: 3.0 Release: 1 License: GPL Group: System Environment/Base @@ -10,7 +10,8 @@ BuildArchitectures: noarch BuildRequires: python BuildRequires: gettext -Requires: python, rpm-python, rpm >= 0:4.4.2 +Requires: python >= 2.4 +Requires: rpm-python, rpm >= 0:4.4.2 Requires: python-sqlite Requires: urlgrabber Requires: python-elementtree @@ -88,6 +89,9 @@ %{_mandir}/man*/yum-updatesd* %changelog +* Wed Oct 4 2006 Seth Vidal <skvidal at linux.duke.edu> +- 3.0 + * Fri Sep 29 2006 Seth Vidal <skvidal at linux.duke.edu> - 2.9.8 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@suse.de