| 1 |
#!/usr/bin/python |
| 2 |
|
| 3 |
import time |
| 4 |
import MySQLdb |
| 5 |
from cgi import escape |
| 6 |
import ebuilddb |
| 7 |
import config |
| 8 |
import gentoo |
| 9 |
|
| 10 |
SECS_PER_DAY = 86400 |
| 11 |
NUM_EXPANDED_DAYS = 2 |
| 12 |
DAYS = ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday') |
| 13 |
|
| 14 |
def get_dayname(day): |
| 15 |
return DAYS[day[6]] |
| 16 |
|
| 17 |
def get_days_ebuilds(day): |
| 18 |
c = db.cursor() |
| 19 |
query = ('SELECT ebuild.category, ' |
| 20 |
'ebuild.name, ' |
| 21 |
'version, ' |
| 22 |
'when_found, ' |
| 23 |
'description, ' |
| 24 |
'changelog, ' |
| 25 |
'arch, ' |
| 26 |
'homepage, ' |
| 27 |
'license, ' |
| 28 |
'is_masked ' |
| 29 |
'FROM ebuild,package ' |
| 30 |
'WHERE DATE(when_found) = "%s-%02d-%02d" ' |
| 31 |
'AND ebuild.name = package.name ' |
| 32 |
'AND ebuild.category = package.category ' |
| 33 |
'ORDER BY when_found DESC' % |
| 34 |
(day[0],day[1],day[2])) |
| 35 |
#print query |
| 36 |
c.execute(query) |
| 37 |
results = c.fetchall() |
| 38 |
return results |
| 39 |
|
| 40 |
today = int(time.time()) |
| 41 |
db = ebuilddb.db_connect() |
| 42 |
for day in range(today,today - (7*SECS_PER_DAY),-SECS_PER_DAY): |
| 43 |
#print day |
| 44 |
gmtime = time.gmtime(day) |
| 45 |
dayname = get_dayname(gmtime) |
| 46 |
print ('<a href="%sdaily/%s/%02d/%02d/">%s</a>:<br>' |
| 47 |
% (config.FEHOME,gmtime[0],gmtime[1],gmtime[2],dayname)) |
| 48 |
results = get_days_ebuilds(gmtime) |
| 49 |
#print results |
| 50 |
ebuilds = [ gentoo.query_to_dict(i) for i in results ] |
| 51 |
#ebuilds.sort(ebuild_sort) |
| 52 |
if day < (today - NUM_EXPANDED_DAYS*SECS_PER_DAY): |
| 53 |
continue |
| 54 |
for ebuild in ebuilds[:100]: |
| 55 |
print ('. <a class="altlink" title="%s" href="%sebuilds/?%s-%s">%s %s</a><br>' % |
| 56 |
(escape(ebuild['description']), |
| 57 |
config.FEHOME, |
| 58 |
ebuild['name'], |
| 59 |
ebuild['version'], |
| 60 |
ebuild['name'], |
| 61 |
ebuild['version'])) |
| 62 |
print '<br>' |