[yum-cvs] yum cli.py,1.167,1.168 output.py,1.51,1.52

Seth Vidal skvidal at login.linux.duke.edu
Tue Mar 15 07:43:05 UTC 2005


Update of /home/groups/yum/cvs/yum
In directory login:/tmp/cvs-serv14754

Modified Files:
	cli.py output.py 
Log Message:

purge generate-rss and all of its reqs


Index: cli.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/cli.py,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -r1.167 -r1.168
--- cli.py	11 Mar 2005 03:17:55 -0000	1.167
+++ cli.py	15 Mar 2005 07:43:03 -0000	1.168
@@ -115,7 +115,6 @@
                                                             'disablerepo=',
                                                             'exclude=',
                                                             'obsoletes',
-                                                            'rss-filename=',
                                                             'tolerant'])
         except getopt.error, e:
             self.errorlog(0, _('Options Error: %s') % e)
@@ -218,8 +217,6 @@
                     self.conf.setConfigOption('obsoletes', 1)
                 elif o == '--installroot':
                     self.conf.setConfigOption('installroot', a)
-                elif o == '--rss-filename':
-                    self.conf.setConfigOption('rss-filename', a)
                 elif o == '--enablerepo':
                     try:
                         self.repos.enableRepo(a)
@@ -319,8 +316,8 @@
                                 'grouplist', 'groupupdate', 'groupinstall',
                                 'groupremove', 'groupinfo', 'makecache',
                                 'clean', 'remove', 'provides', 'check-update',
-                                'search', 'generate-rss', 'upgrade', 
-                                'whatprovides', 'localinstall', 'localupdate',
+                                'search', 'upgrade', 'whatprovides',
+                                'localinstall', 'localupdate',
                                 'resolvedep', 'shell']:
             self.usage()
             raise CliError
@@ -384,15 +381,6 @@
                     self.usage()
                     raise CliError
                     
-        elif self.basecmd == 'generate-rss':
-            if len(self.extcmds) == 0:
-                self.extcmds.insert(0, 'recent')
-            
-            if self.extcmds[0] not in ['updates', 'recent']:
-                self.errorlog(0, _("Error: generate-rss takes no argument, 'updates' or 'recent'."))
-                self.usage()
-                raise CliError
-            
         elif self.basecmd == 'shell':
             if len(self.extcmds) == 0:
                 self.log(3, "No argument to shell")
@@ -410,8 +398,7 @@
                 raise CliError
               
         elif self.basecmd in ['list', 'check-update', 'info', 'update', 'upgrade',
-                              'generate-rss', 'grouplist', 'makecache',
-                              'resolvedep']:
+                              'grouplist', 'makecache', 'resolvedep']:
             pass
     
         else:
@@ -525,34 +512,6 @@
             else:
                 return result, []
             
-            
-        elif self.basecmd == 'generate-rss':
-            self.log(2, 'Setting up RSS Generation')
-            titles = { 'recent': 'Recent Packages',
-                       'updates': 'Updated Packages'}
-            try:
-                pkgtype = self.extcmds[0]
-                ypl = self.returnPkgLists()
-                this_pkg_list = getattr(ypl, pkgtype)
-                if len(this_pkg_list) > 0:
-                    needrepos = []
-                    for po in this_pkg_list:
-                        if po.repoid not in needrepos:
-                            needrepos.append(po.repoid)
-
-                    self.log(2, 'Importing Changelog Metadata')
-                    self.repos.populateSack(with='otherdata', which=needrepos)
-                    self.log(2, 'Generating RSS File for %s' % pkgtype)
-                        
-                    self.listPkgs(this_pkg_list, titles[pkgtype], outputType='rss')
-                else:
-                    self.errorlog(0, 'No Recent Packages')
-
-            except yum.Errors.YumBaseError, e:
-                return 1, [str(e)]
-            else:
-                return 0, ['Done']
-                
         elif self.basecmd == 'clean':
             self.conf.setConfigOption('cache', 1)
             return self.cleanCli()
@@ -1468,7 +1427,7 @@
         print _("""
     Usage:  yum [options] < update | install | info | remove | list |
             clean | provides | search | check-update | groupinstall | 
-            groupupdate | grouplist | groupinfo | groupremove | generate-rss |
+            groupupdate | grouplist | groupinfo | groupremove |
             makecache | localinstall | shell >
                 
         Options:
@@ -1480,7 +1439,6 @@
         -C run from cache only - do not update the cache
         --installroot=[path] - set the install root (default '/')
         --version - output the version of yum
-        --rss-filename=[path/filename] - set the filename to generate rss to
         --exclude=package to exclude
         --disablerepo=repository id to disable (overrides config file)
         --enablerepo=repository id to enable (overrides config file)

Index: output.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/output.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- output.py	12 Mar 2005 07:24:04 -0000	1.51
+++ output.py	15 Mar 2005 07:43:03 -0000	1.52
@@ -22,7 +22,6 @@
 import sys
 import time
 from i18n import _
-import libxml2
 
 try:
     import readline
@@ -81,8 +80,7 @@
     def listPkgs(self, lst, description, outputType):
         """outputs based on whatever outputType is. Current options:
            'list' - simple pkg list
-           'info' - similar to rpm -qi output
-           'rss' - rss feed-type output"""
+           'info' - similar to rpm -qi output"""
         
         if outputType in ['list', 'info']:
             thingslisted = 0
@@ -101,112 +99,6 @@
             if thingslisted == 0:
                 return 1, ['No Packages to list']
         
-        elif outputType == 'rss':
-            # take recent updates only and dump to an rss compat output
-            if len(lst) > 0:
-                if self.conf.getConfigOption('rss-filename') is None:
-                    raise yum.Errors.YumBaseError, \
-                       "No File specified for rss create"
-                else:
-                    fn = self.conf.getConfigOption('rss-filename')
-    
-                if fn[0] != '/':
-                    cwd = os.getcwd()
-                    fn = os.path.join(cwd, fn)
-                try:
-                    fo = open(fn, 'w')
-                except IOError, e:
-                    raise yum.Errors.YumBaseError, \
-                       "Could not open file %s for rss create" % (e)
-
-                doc = libxml2.newDoc('1.0')
-                self.xmlescape = doc.encodeEntitiesReentrant
-                rss = doc.newChild(None, 'rss', None)
-                rss.setProp('version', '2.0')
-                node = rss.newChild(None, 'channel', None)
-                rssheader = self.startRSS(description)
-                fo.write(rssheader)
-                for pkg in lst:
-                    item = self.rssnode(node, pkg)
-                    fo.write(item.serialize("utf-8", 1))
-                    item.unlinkNode()
-                    item.freeNode()
-                    del item
-                
-                end = self.endRSS()
-                fo.write(end)
-                fo.close()
-                del fo
-                doc.freeDoc()
-                del doc
-                
-    def startRSS(self, description='Yum Package List'):
-        """return string representation of rss preamble"""
-    
-        rfc822_format = "%a, %d %b %Y %X GMT"
-        now = time.strftime(rfc822_format, time.gmtime())
-        rssheader = """<?xml version="1.0" encoding="utf-8"?>
-    <rss version="2.0">
-      <channel>
-        <title>%s</title>
-        <link>http://linux.duke.edu/projects/yum/</link>
-        <description>%s</description>
-        <pubDate>%s</pubDate>
-        <generator>Yum</generator>
-        """ % (description, description, now)
-        
-        return rssheader
-    
-    def rssnode(self, node, pkg):
-        """return an rss20 compliant item node
-           takes a node, and a pkg object"""
-        
-        repo = self.repos.getRepo(pkg.repoid)
-        url = repo.urls[0]
-        rfc822_format = "%a, %d %b %Y %X GMT"
-        clog_format = "%a, %d %b %Y GMT"
-        xhtml_ns = "http://www.w3.org/1999/xhtml"
-        escape = self.xmlescape
-        
-        item = node.newChild(None, 'item', None)
-        title = escape(str(pkg))
-        item.newChild(None, 'title', title)
-        date = time.gmtime(float(pkg.returnSimple('buildtime')))
-        item.newChild(None, 'pubDate', time.strftime(rfc822_format, date))
-        item.newChild(None, 'guid', pkg.returnSimple('id'))
-        link = url + '/' + pkg.returnSimple('relativepath')
-        item.newChild(None, 'link', escape(link))
-
-        # build up changelog
-        changelog = ''
-        cnt = 0
-        for e in pkg.returnChangelog():
-            cnt += 1
-            if cnt > 3: 
-                changelog += '...'
-                break
-            (date, author, desc) = e
-            date = time.strftime(clog_format, time.gmtime(float(date)))
-            changelog += '%s - %s\n%s\n\n' % (date, author, desc)
-        body = item.newChild(None, "body", None)
-        body.newNs(xhtml_ns, None)
-        body.newChild(None, "p", escape(pkg.returnSimple('summary')))
-        body.newChild(None, "pre", escape(pkg.returnSimple('description')))
-        body.newChild(None, "p", 'Change Log:')
-        body.newChild(None, "pre", escape(changelog))
-        description = '<pre>%s - %s\n\n' % (escape(pkg.name), 
-                                            escape(pkg.returnSimple('summary')))
-        description += '%s\n\nChange Log:\n\n</pre>' % escape(pkg.returnSimple('description'))
-        description += escape('<pre>%s</pre>' % escape(changelog))
-        item.newChild(None, 'description', description)
-        
-        return item
-        
-    
-    def endRSS(self):
-        """end the rss output"""
-        end="\n  </channel>\n</rss>\n"
-        return end
     
         
     def userconfirm(self):




More information about the Yum-cvs-commits mailing list