/[gentoo]/src/packages/weeks.py
Gentoo

Contents of /src/packages/weeks.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download) (as text)
Mon May 9 01:10:11 2005 UTC (9 years, 2 months ago) by marduk
Branch: MAIN
CVS Tags: release_1-5, v1_3_1, HEAD
Branch point for: pre_2-0, v1_3
Changes since 1.2: +4 -3 lines
File MIME type: text/x-python
Only display first 100 day's ebuilds.

1 #!/usr/bin/python -OO
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 SUBSTRING(when_found FROM 1 FOR 8) = "%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>'

  ViewVC Help
Powered by ViewVC 1.1.20