[Yum-devel] [PATCH] repo-rss: non-ASCII fix, sorting

Morty morty at frakir.org
Mon Aug 12 23:15:00 UTC 2013


On Fri, Feb 01, 2013 at 03:31:46PM -0500, James Antill wrote:
> On Wed, 2013-01-23 at 13:01 -0500, Morty wrote:
> > The below patch is against 1.1.31.  It does two things:
> > 
> > 1. fixes a bug where repo-rss crashed when dealing with packages that
> >    contain non-ASCII in their descriptions.
> > 
> > 2. reverse sorts the results by buildtime so the most recent package
> >    builds will be first in the RSS feed.
> 
>  Sorry it took a while to respond, to your patch...

Sorry I just took much longer to counter-respond.  ;)

> ...you could just change the above to use filetime, if you just want
> some sorting

Done.

Revised patch inline:

diff -Nur yum-utils-1.1.31.orig/repo-rss.py yum-utils-1.1.31/repo-rss.py
--- yum-utils-1.1.31.orig/repo-rss.py	2011-08-10 11:20:19.000000000 -0400
+++ yum-utils-1.1.31/repo-rss.py	2013-01-17 17:39:19.980320000 -0500
@@ -144,7 +144,7 @@
             changelog += '%s - %s\n%s\n\n' % (date, author, desc)
         description = '<p><strong>%s</strong> - %s</p>\n\n' % (escape(pkg.name), 
                                             escape(pkg.returnSimple('summary')))
-        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(pkg.returnSimple('description').encode('utf-8').replace("\n", "<br />\n"))
+        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(to_unicode(pkg.returnSimple('description')).encode('utf-8').replace("\n", "<br />\n"))
         description += escape('<pre>%s</pre>' % escape(to_unicode(changelog).encode('utf-8')))
         item.newChild(None, 'description', description)
         
@@ -222,6 +222,8 @@
             sys.exit(1)
     
     recent = my.getRecent(days=days)
+    recent.sort(key=lambda pkg: pkg.returnSimple('filetime'))
+    recent.reverse()
     if options.groups:
         comps = Comps()
         for repo in my.repos.listEnabled():


More information about the Yum-devel mailing list