summaryrefslogtreecommitdiff
blob: 2e70ca72a6e9a7bd1ca7a8f9410f1267db30a695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python -OO

import time
import MySQLdb
from cgi import escape
import ebuilddb
import config
import gentoo

SECS_PER_DAY = 86400
NUM_EXPANDED_DAYS = 2
DAYS = ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')

def get_dayname(day):
    return DAYS[day[6]]

def get_days_ebuilds(day):
    c = db.cursor()
    query = ('SELECT ebuild.category, '
        'ebuild.name, '
        'version, '
        'when_found, '
        'description, '
        'changelog, '
        'arch, '
        'homepage, '
        'license, '
        'is_masked '
        'FROM ebuild,package '
        'WHERE SUBSTRING(when_found FROM 1 FOR 8) = "%s%02d%02d" '
        'AND ebuild.name = package.name '
        'AND ebuild.category = package.category '
        'ORDER BY when_found DESC' %
        (day[0],day[1],day[2]))
    #print query
    c.execute(query)
    results = c.fetchall()
    return results

today = int(time.time())
db = ebuilddb.db_connect()
for day in range(today,today - (7*SECS_PER_DAY),-SECS_PER_DAY):
    #print day
    gmtime = time.gmtime(day)
    dayname = get_dayname(gmtime)
    print ('<a href="%sdaily/%s/%02d/%02d/">%s</a>:<br>' 
        % (config.FEHOME,gmtime[0],gmtime[1],gmtime[2],dayname))
    results = get_days_ebuilds(gmtime)
    #print results
    ebuilds = [ gentoo.query_to_dict(i) for i in results ]
    #ebuilds.sort(ebuild_sort)
    if day < (today - NUM_EXPANDED_DAYS*SECS_PER_DAY):
        continue
    for ebuild in ebuilds[:100]:
        print ('. <a class="altlink" title="%s" href="%sebuilds/?%s-%s">%s %s</a><br>' % 
        (escape(ebuild['description']),
        config.FEHOME,
        ebuild['name'], 
        ebuild['version'],
        ebuild['name'],
        ebuild['version']))
    print '<br>'