| 1 |
#!/usr/bin/python -OO
|
| 2 |
|
| 3 |
__revision__ = "$Revision: $"
|
| 4 |
# $Source: $
|
| 5 |
|
| 6 |
import sys
|
| 7 |
import gentoo
|
| 8 |
import ebuilddb
|
| 9 |
|
| 10 |
def new_to_html(db):
|
| 11 |
"""Gather new ebuilds and convert to HTML"""
|
| 12 |
|
| 13 |
new_ebuilds = gentoo.get_most_recent(db, new = True)
|
| 14 |
|
| 15 |
html_list = [gentoo.ebuild_to_html(gentoo.query_to_dict(i), new = True,
|
| 16 |
show_bugs = False) for i in new_ebuilds]
|
| 17 |
|
| 18 |
return '\n'.join(html_list)
|
| 19 |
|
| 20 |
|
| 21 |
def bumps_to_html(db):
|
| 22 |
"""Gather revision bumps and convert to HTML"""
|
| 23 |
|
| 24 |
bumps = gentoo.get_most_recent_bumps(db)
|
| 25 |
html_list = [gentoo.ebuild_to_html(gentoo.query_to_dict(i)) for i in bumps]
|
| 26 |
|
| 27 |
return '\n'.join(html_list)
|
| 28 |
|
| 29 |
def new_to_rss(db):
|
| 30 |
"""Gather new ebuilds and convert to RSS"""
|
| 31 |
|
| 32 |
new_ebuilds = gentoo.get_most_recent(db, new = True)
|
| 33 |
eb_dict = [gentoo.query_to_dict(i) for i in new_ebuilds]
|
| 34 |
gentoo.ebuilds_to_rss(sys.stdout, eb_dict, simple = True,
|
| 35 |
subtitle = 'New Packages')
|
| 36 |
|
| 37 |
if __name__ == '__main__':
|
| 38 |
db = ebuilddb.db_connect()
|
| 39 |
|
| 40 |
if len(sys.argv) > 1:
|
| 41 |
if sys.argv[1] == 'rss':
|
| 42 |
new_to_rss(db)
|
| 43 |
if sys.argv[1] == 'bumps':
|
| 44 |
print bumps_to_html(db)
|
| 45 |
|
| 46 |
else:
|
| 47 |
print new_to_html(db)
|