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...

> 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)

 This is fine, although if you wanted to convert things to use
to_utf8() .. I wouldn't complain :).

>          
> @@ -222,6 +222,8 @@
>              sys.exit(1)
>      
>      recent = my.getRecent(days=days)
> +    recent.sort(key=lambda pkg: pkg.returnSimple('buildtime'))
> +    recent.reverse()


 This is wrong for a number of reasons:

1. buildtime has no correlation to when packages appear in a repo.

2. getRecent() uses int(pkg.returnSimple('filetime')) (Ie. the mtime on
the .rpm files).

...you could just change the above to use filetime, if you just want
some sorting ... or you could add an option to use buildtime instead of
filetime if you want that (but again note #1), and use that for sorting
too.

_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to