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