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

Diff of /src/packages/daily.py

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

Revision 1.1.1.1 Revision 1.6
1#!/usr/bin/python -OO 1#!/usr/bin/python -O
2 2
3import sys 3import sys
4import config 4import config
5import ebuilddb 5import ebuilddb
6import gentoo 6import gentoo
16 print ('<div class="centerpage">\n' 16 print ('<div class="centerpage">\n'
17 '<table class="ebuild">\n' 17 '<table class="ebuild">\n'
18 '<tr><td class="fields">Error in request</td></tr><br>\n' 18 '<tr><td class="fields">Error in request</td></tr><br>\n'
19 '<tr><td class="item"><img src="%s/?category=generic" align="right" alt="">' 19 '<tr><td class="item"><img src="%s/?category=generic" align="right" alt="">'
20 '<p>An error was encountered processing your request. Request a ' 20 '<p>An error was encountered processing your request. Request a '
21 'different page or check the <a href="%s">fresh ebuilds main page</a>.' 21 'different page or check the <a href="%s">packages.gentoo.org main page</a>.'
22 '</p></td></tr>' 22 '</p></td></tr>'
23 '</table>' 23 '</table>'
24 '</div>') % (config.ICONS,config.FEHOME) 24 '</div>') % (config.ICONS,config.FEHOME)
25 25
26try: 26try:
71db = ebuilddb.db_connect() 71db = ebuilddb.db_connect()
72c = db.cursor() 72c = db.cursor()
73 73
74extra = '' 74extra = ''
75if arch: 75if arch:
76 stable_extra = ('FIND_IN_SET("%s", ebuild.arch) > 0 AND '
77 'FIND_IN_SET("%s", ebuild.prevarch) = 0 ' % (arch, arch))
78 testing_extra = ('FIND_IN_SET("~%s", ebuild.arch) > 0 AND '
79 'FIND_IN_SET("%s", ebuild.prevarch) = 0 ' % (arch, arch))
76 if branch == 'stable': 80 if branch == 'stable':
77 extra = ' AND ebuild.arch REGEXP "^%s| %s" ' % (arch,arch) 81 extra = ' AND (%s) ' % stable_extra
78 elif branch == 'testing': 82 elif branch == 'testing':
79 extra = ' AND ebuild.arch REGEXP "^~%s| ~%s" ' % (arch,arch) 83 extra = ' AND (%s) ' % testing_extra
80 else: 84 else:
81 extra = ' AND ebuild.arch LIKE "%%%s%%" ' % arch 85 extra = ' AND ((%s) OR (%s)) ' % (stable_extra, testing_extra)
82 86
83query = ('SELECT ebuild.category,' 87query = ('SELECT ebuild.category,'
84 'ebuild.name,' 88 'ebuild.name,'
85 'version,' 89 'version,'
86 'when_found,' 90 'when_found,'
87 'description,' 91 'description,'
88 'changelog,' 92 'changelog,'
89 'arch,' 93 'arch,'
90 'homepage,' 94 'homepage,'
91 'license ' 95 'license, is_masked '
92 'FROM ebuild,package ' 96 'FROM ebuild,package '
93 'WHERE TO_DAYS(when_found) = TO_DAYS("%s-%02d-%02d") ' 97 'WHERE SUBSTRING(when_found FROM 1 FOR 8) = "%s%02d%02d" '
94 'AND ebuild.name = package.name ' 98 'AND ebuild.name = package.name '
95 'AND ebuild.category = package.category %s' 99 'AND ebuild.category = package.category %s'
96 'ORDER BY when_found desc' % 100 'ORDER BY when_found desc' %
97 (year, month, day,extra)) 101 (year, month, day,extra))
98 102
107 111
108# cache to file, if not todays date 112# cache to file, if not todays date
109if today[:3] != (year,month,day): 113if today[:3] != (year,month,day):
110 filename = os.path.join(config.LOCALHOME,'daily','cache', 114 filename = os.path.join(config.LOCALHOME,'daily','cache',
111 '%d%02d%02d-%s-%s.html' % (year,month,day,arch,branch)) 115 '%d%02d%02d-%s-%s.html' % (year,month,day,arch,branch))
112 open(filename,'w').write(s) 116 open(filename,'w').write(s)

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

  ViewVC Help
Powered by ViewVC 1.1.20