/[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.1.1 Revision 1.3
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, '
28 'is_masked '
27 'FROM ebuild,package ' 29 'FROM ebuild,package '
28 'WHERE TO_DAYS(when_found) = TO_DAYS("%s-%02d-%02d") ' 30 'WHERE SUBSTRING(when_found FROM 1 FOR 8) = "%s%02d%02d" '
29 'AND ebuild.name = package.name ' 31 'AND ebuild.name = package.name '
30 'AND ebuild.category = package.category ' 32 'AND ebuild.category = package.category '
31 'ORDER BY when_found DESC' % 33 'ORDER BY when_found DESC' %
32 (day[0],day[1],day[2])) 34 (day[0],day[1],day[2]))
33 #print query 35 #print query
34 c.execute(query) 36 c.execute(query)
35 results = c.fetchall() 37 results = c.fetchall()
36 return results 38 return results
37 39
38today = time.time() 40today = int(time.time())
39db = ebuilddb.db_connect() 41db = ebuilddb.db_connect()
40for day in range(today,today - (7*SECS_PER_DAY),-SECS_PER_DAY): 42for day in range(today,today - (7*SECS_PER_DAY),-SECS_PER_DAY):
41 #print day 43 #print day
42 gmtime = time.gmtime(day) 44 gmtime = time.gmtime(day)
43 dayname = get_dayname(gmtime) 45 dayname = get_dayname(gmtime)
44 print ('<a href="%sdaily/%s/%02d/%02d/">%s</a>:<br>' 46 print ('<a href="%sdaily/%s/%02d/%02d/">%s</a>:<br>'
45 % (config.FEHOME,gmtime[0],gmtime[1],gmtime[2],dayname)) 47 % (config.FEHOME,gmtime[0],gmtime[1],gmtime[2],dayname))
46 results = get_days_ebuilds(gmtime) 48 results = get_days_ebuilds(gmtime)
47 #print results 49 #print results
48 ebuilds = [ gentoo.query_to_dict(i) for i in results ] 50 ebuilds = [ gentoo.query_to_dict(i) for i in results ]
49 #ebuilds.sort(ebuild_sort) 51 #ebuilds.sort(ebuild_sort)
52 if day < (today - NUM_EXPANDED_DAYS*SECS_PER_DAY):
53 continue
50 for ebuild in ebuilds: 54 for ebuild in ebuilds[:100]:
51 print ('. <a class="altlink" title="%s" href="%sebuilds/?%s-%s">%s %s</a><br>' % 55 print ('. <a class="altlink" title="%s" href="%sebuilds/?%s-%s">%s %s</a><br>' %
52 (escape(ebuild['description']), 56 (escape(ebuild['description']),
53 config.FEHOME, 57 config.FEHOME,
54 ebuild['name'], 58 ebuild['name'],
55 ebuild['version'], 59 ebuild['version'],
56 ebuild['name'], 60 ebuild['name'],
57 ebuild['version'])) 61 ebuild['version']))
58 print '<br>' 62 print '<br>'

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20