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

Diff of /src/packages/weeks.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.2
6import ebuilddb 6import ebuilddb
7import config 7import config
8import gentoo 8import gentoo
9 9
10SECS_PER_DAY = 86400 10SECS_PER_DAY = 86400
11NUM_EXPANDED_DAYS = 2
11DAYS = ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday') 12DAYS = ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')
12 13
13def get_dayname(day): 14def get_dayname(day):
14 return DAYS[day[6]] 15 return DAYS[day[6]]
15 16
16def get_days_ebuilds(day): 17def 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
38today = time.time() 39today = time.time()
39db = ebuilddb.db_connect() 40db = ebuilddb.db_connect()
40for day in range(today,today - (7*SECS_PER_DAY),-SECS_PER_DAY): 41for 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>'

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.20