[Blends-commit] [SCM] website branch, master, updated. 93e635d223b6629eb17e059b3733b9ea2d75d3b0

Andreas Tille tille at debian.org
Fri Jul 19 20:56:13 UTC 2013


The following commit has been merged in the master branch:
commit 4a0b7963587bcd9745b28c89078f188a474a8343
Author: Andreas Tille <tille at debian.org>
Date:   Fri Jul 19 12:05:42 2013 +0200

    Revert to bugs query without metapackage bugs (which was wrongly implemented here anyway)

diff --git a/misc/sql/bugs.sh b/misc/sql/bugs.sh
index 9fb1e12..1da0817 100755
--- a/misc/sql/bugs.sh
+++ b/misc/sql/bugs.sh
@@ -15,10 +15,12 @@ SELECT distinct sources.source, tasks.tasks, CASE WHEN dependency = 'd' AND comp
     JOIN packages p ON p.package = b.package
     JOIN bugs bu    ON bu.source = p.source
     JOIN sources s  ON s.source  = p.source
-    WHERE blend = '$1' AND b.distribution = 'debian'
+    WHERE (blend = '$1' AND b.distribution = 'debian')
+       OR bu.source IN (SELECT metapackage_name FROM blends_tasks WHERE blend = '$1' AND metapackage)
   GROUP BY s.source, b.dependency, b.component, s.homepage, s.vcs_browser, s.maintainer, s.version
   ) sources
   LEFT OUTER JOIN (
+   SELECT * FROM (
     SELECT source, array_agg(task) AS tasks FROM (
      SELECT DISTINCT p.source, b.task
       FROM packages p
@@ -26,8 +28,11 @@ SELECT distinct sources.source, tasks.tasks, CASE WHEN dependency = 'd' AND comp
       JOIN blends_dependencies b ON b.package = p.package
       JOIN sources s ON p.source = s.source AND p.release = s.release
       WHERE b.blend = '$1'
-    ) tmp
+    ) tmp1
     GROUP BY source
+   ) tmp2
+    UNION
+    SELECT metapackage_name AS source, ARRAY[task] AS tasks FROM blends_tasks WHERE blend = '$1' AND metapackage
   ) tasks ON sources.source = tasks.source
   WHERE row_number = 1
   ORDER BY source;
@@ -39,7 +44,8 @@ SELECT source, bu.id, title, status, done_by, tags FROM (
     FROM blends_dependencies b
     JOIN packages p ON p.package = b.package
     JOIN bugs bu    ON bu.source = p.source
-    WHERE blend = '$1' AND b.distribution = 'debian'
+    WHERE (blend = '$1' AND b.distribution = 'debian')
+       OR bu.source IN (SELECT metapackage_name FROM blends_tasks WHERE blend = '$1' AND metapackage)
   ) bu
   LEFT OUTER JOIN (
     SELECT id, array_agg(tag) AS tags FROM bugs_tags GROUP BY id
diff --git a/webtools/bugs_udd.py b/webtools/bugs_udd.py
index 72e1a64..a2c24d0 100755
--- a/webtools/bugs_udd.py
+++ b/webtools/bugs_udd.py
@@ -115,7 +115,7 @@ def main():
     """
     _execute_udd_query(query)
 
-    STATES = ('depends', 'suggests', 'done')
+    STATES = ['depends', 'suggests', 'done']
     SEVERITIES = ('critical', 'grave', 'serious', 'important', 'normal', 'minor', 'wishlist')
 
     # initialise bugs_data dictionary for all tasks
@@ -211,7 +211,6 @@ def main():
         print >>f
     f.close()
 
-    exit(1)
     # Define directories used
     current_dir  = os.path.dirname(__file__)
     # locale_dir   = os.path.join(current_dir, 'locale')
@@ -220,7 +219,7 @@ def main():
     # initialize gensi
     loader = TemplateLoader([template_dir], auto_reload=True)
     
-    outputdir = CheckOrCreateOutputDir(config['outputdir'],'thermometer')
+    outputdir = CheckOrCreateOutputDir(config['outputdir'],'bugs_udd') # FIXME: as long as we are not finished use different dir
     if outputdir == None:
             exit(-1)
     
@@ -232,7 +231,7 @@ def main():
 
     data={}
     data['projectname'] = blendname
-    data['blend_data']  = blend_data
+    data['bugs_data']   = bugs_data
     if config.has_key('advertising') and config['advertising'] != None:
         # we have to remove the gettext _() call which was inserted into the config
         # file to enable easy input for config file editors - but the call has to
@@ -243,17 +242,6 @@ def main():
     else:
         data['projectadvertising'] = None
 
-    legend = [
-               ['upToDate',        'Up to date'],
-               ['debianOutOfDate', 'Debian stable behind unstable'],
-               ['ubuntuOutOfDate', 'Ubuntu behind Debian unstable'],
-               ['unpackaged',      'Not packaged'],
-               ['obsolete',        'Obsolete'],
-               ['newer-in-debian', 'Upstream behind unstable'],
-               ['uptodate',        'Unstable fits upstream'],
-               ['outdated',        'Unstable behind upstream'],
-             ]
-    data['legend']     = legend
     data['summary']           = to_unicode(_('Summary'))
     data['idxsummary']        = to_unicode(_("""A %sDebian Pure Blend%s is a Debian internal project which assembles
 a set of packages that might help users to solve certain tasks of their work.  The list on
@@ -261,29 +249,191 @@ the right shows the tasks of %s.""" ) \
                                       % ('<a href="http://blends.alioth.debian.org/blends/">', '</a>', data['projectname']))
     data['idxsummary']        = Markup(to_unicode(data['idxsummary']))
 
-    for key in ('homepage', 'projecturl', 'projectname', 'logourl', 'ubuntuhome', 'projectubuntu'):
-        data[key] = config[key]
-    data['updatetimestamp']   = to_unicode(_('Last update:')) + ' ' + formatdate(time.mktime(t.timetuple()))
-
-    data['thermometer']  = blendname + '_thermometer.html'
-    os.system("ln -sf %s %s/index.html" % (data['thermometer'], outputdir))
-    data['uthermometer'] = 'ubuntu_' + blendname + '_thermometer.html'
-    outputfile  = outputdir + '/' + data['thermometer']
-    uoutputfile = outputdir + '/' + data['uthermometer']
+    t = datetime.now()
+    data['lang']              = 'en'
+    data['othertasks']        = _("Links to other tasks")
+    data['taskslink']         = _("Tasks")
+    data['bugslink']          = _("Tasks overview")
+    data['legend']            = _("Legend")
+    data['bugsofpackage']     = _("Bugs of package")
+    data['totalbugs']         = _("Total bugs")
+    data['openbugs']          = _("Open bugs")
+    data['fixedbugs']         = _("Fixed bugs")
+    data['summary']           = _('Summary')
+    data['bugssummary']       = _("""A %sDebian Pure Blend%s is a Debian internal project which assembles
+    a set of packages that might help users to solve certain tasks of their work.  This page should be helpful
+    to track down the bugs of packages that are interesting for the %s project to enable developers a quick
+    overview about possible problems.""" ) \
+                                          % ('<a href="http://blends.alioth.debian.org/blends/">', '</a>', data['projectname'])
+    data['bugssummary']        = Markup(data['bugssummary'])
+    data['gtstrBugsPage']     = _("Bugs page")
+    data['gtstrListOfBugspages'] = _("This is a list of metapackages.  The links are leading to the respective bugs page.")
+    data['updatetimestamp']   = _('Last update:') + ' ' + formatdate(time.mktime(t.timetuple()))
+    data['weightexplanation'] = _("""To estimate the overall status of the packages in the dependencies of
+    a metapackage a weighted severity is calculated.  Done bugs are ignored and bugs in dependent and
+    recommended packages are weighted by factor three compared to suggested packages.  Release critical
+    bugs have a much larger weight than important, while the contribution of normal bugs is even smaller
+    and minor bugs have a very small weight.  Wishlist bugs are ignored in this calculation.  The resulting
+    sum is compared to some boundaries to find a verbal form.  The actual numbers need some adjustment
+    to make real sense - this evaluation method is in testing phase.""")
+    data['weightdetails']     = _("The severities of bugs are weighted as follows")
+    
+    if data['advertising'] != None:
+    	# If data['advertising'] is enclosed in _() gettext tries to ask for translations of 'advertising'
+    	# which makes no sense.  That's why this is masked by an extra string variable
+    	advertising = data['advertising']
+    	##data['projectadvertising'] = _(advertising) # Hopefully translation will work this way ...
+    	# Genshi needs explicite information that it is dealing with an UTF-8 string which should not be changed
+    	advertising = _(advertising)
+    	data['projectadvertising'] = Markup(unicode(advertising))# , 'utf-8'))
+    else:
+    	data['projectadvertising'] = None
+    
+    data['assessments']     = [ (EXCELLENT,    'excellent'),
+                                (VERYGOOD,     'verygood'),
+                                (GOOD,         'good'),
+                                (SATISFACTORY, 'satisfactory'),
+                                (PASS,         'pass'),
+                                (BAD,          'bad')
+                              ]
+    
+    nbugs           = {}
+    ndone           = {}
+    buglist         = {}
+    severitysummary = {} # Number of bugs in different severity / dependency classes
+    weightedsev     = {} # verbal interpretation of weighted bugs
+    weightedclass   = {} # CSS class according bug weight
+    weighttask      = {} # weighted severity as number per task
+    severitystat    = {} # Count bugs with different severities per task
+    for task in (): ## FIXME:  bugs_data:
+    	pkgbugs       = []
+    	nbugs[task]   = 0
+    	ndone[task]   = 0
+    	buglist[task] = {}
+    
+    	# query bugs of meta package name
+    	pkg = { 'pkgname'    : data['tasks'][task].metapkg.pkg,
+    		'source'     : None,
+    		'homepage'   : None,
+    		'vcs-browser': None,
+    		'maintainer' : None,
+    	      }
+    	if data['tasks'][task].metapkg.properties['vcs-browser'] != HOMEPAGENONE:
+    		pkg['vcs-browser'] = data['tasks'][task].metapkg.properties['vcs-browser']
+    	if data['tasks'][task].metapkg.responsible != None:
+    		pkg['maintainer']  = data['tasks'][task].metapkg.responsible
+    	pkgbug_oad = PackageBugsOpenAndDone(pkg)
+    	# the metapackage itself belongs to the list do dependent packages
+    	if pkgbug_oad.open.pkgname:
+    		buglist[task][DEPENDENT].append(pkgbug_oad.open)
+    		nbugs[task] += pkgbug_oad.open.nbugs
+    	if pkgbug_oad.done.pkgname:
+    		buglist[task][DONE].append(pkgbug_oad.done)
+    		ndone[task] += pkgbug_oad.done.nbugs
+    
+    	for pkg in packages[task]:
+    		pkgbug_oad = PackageBugsOpenAndDone(pkg)
+    		if pkgbug_oad.open.pkgname:
+    			buglist[task][pkg['bugrelevantdependency']].append(pkgbug_oad.open)
+    		if pkgbug_oad.done.pkgname:
+    			buglist[task][DONE].append(pkgbug_oad.done)
+    		nbugs[task] += pkgbug_oad.open.nbugs
+    		ndone[task] += pkgbug_oad.done.nbugs
+    
+    	severitysummary[task] = {}
+    	wsev = 0  # sumarise weighted severities
+    	severitystat[task] = {}
+    	for cat in BUGLISTCAT:
+    		curbuglist = buglist[task][cat]
+    		if len(curbuglist.pkgbugs) > 0:
+    			# sort lists of PkgBug objects inside the three categories
+    			curbuglist.pkgbugs.sort()
+    		severitysummary[task][cat] = ''
+    		severitystat[task][cat] = {}
+    		if cat != DONE:
+    			sevsum = ''
+    			komma  = ''
+    			fac = 1
+    			if cat == DEPENDENT:
+    				fac = 3
+    			for s in SEVERITIES:
+    				if curbuglist.severities[s] > 0:
+    					sevsum += komma + str(curbuglist.severities[s]) + ' ' + s
+    					komma   = ', '
+    				severitystat[task][cat][s] = curbuglist.severities[s]
+    				# calculate weighted severity for whole metapackage
+    				wsev += fac * weight[s] * curbuglist.severities[s]
+    			severitysummary[task][cat] = sevsum
+    	if   wsev < data['assessments'][0][0]:
+    		weightedsev[task]   = _('Metapackage is in excellent shape')
+    		weightedclass[task] = data['assessments'][0][1]
+    	elif wsev < data['assessments'][1][0]:
+    		weightedsev[task]   = _('Metapackage is in very good shape')
+    		weightedclass[task] = data['assessments'][1][1]
+    	elif wsev < data['assessments'][2][0]:
+    		weightedsev[task]   = _('Metapackage is in good shape')
+    		weightedclass[task] = data['assessments'][2][1]
+    	elif wsev < data['assessments'][3][0]:
+    		weightedsev[task]   = _('Consider looking into bugs of this metapackage')
+    		weightedclass[task] = data['assessments'][3][1]
+    	elif wsev < data['assessments'][4][0]:
+    		weightedsev[task]   = _('Looking into bugs of this metapackage is recommended')
+    		weightedclass[task] = data['assessments'][4][1]
+    	else:
+    		weightedsev[task]   = _('Immediately looking into bugs of the dependencies of this metapackage is advised')
+    		weightedclass[task] = data['assessments'][5][1]
+    	weightedsev[task] += ' (%i)' % wsev
+    	weighttask[task]   = wsev
+    
+    data['headings'] = {DEPENDENT : _('Open bugs in dependent packages'),
+                        SUGGESTED : _('Open bugs in suggested packages'),
+                        DONE      : _('Done bugs')
+                       }
+    data['nobugs']   = {DEPENDENT : _('No open bugs in dependent packages'),
+                        SUGGESTED : _('No open bugs in suggested packages'),
+                        DONE      : _('No done bugs')
+                       }
+    data['cssclass'] = {DEPENDENT : 'bugsdependent',
+                        SUGGESTED : 'bugssuggested',
+                        DONE      : 'bugsdone'
+                       }
+    
+    data['nbugs']           = nbugs
+    data['ndone']           = ndone
+    data['buglistcat']      = BUGLISTCAT
+    data['severities']      = SEVERITIES
+    data['weight']          = weight
+    data['DEPENDENT']       = DEPENDENT
+    data['SUGGESTED']       = SUGGESTED
+    data['nohomepage']      = _('Homepage not available')
+    data['novcsbrowser']    = _('Not maintained in Vcs')
+    data['vcslocation']     = _('Vcs')
+    
+    data['weighttask']      = weighttask
+    data['weightedclass']   = weightedclass
+    
+    for task in bugs_data:
+    	data['task']            = task
+    	#data['buglist']         = buglist[task]
+    	#data['severitysummary'] = severitysummary[task]
+    	#data['weightedsev']     = weightedsev[task]
+    	#data['severitystat']    = severitystat[task]
+    
+    	template = loader.load('bugs_udd.xhtml')
+    	f = open(outputdir + '/' + task + '.html', 'w')
+    	print >> f, template.generate(**data).render('xhtml')
+    
+    	f.close()
+    
+    template = loader.load('bugs_idx_udd.xhtml')
+    outputfile = outputdir + '/index.html'
     try:
-        os.unlink(outputfile)
-        os.unlink(uoutputfile)
+    	os.unlink(outputfile)
     except: # simply continue if file does not exist
-        pass
-
+    	pass
     f = open(outputfile, 'w')
-    template = loader.load('thermometer.xhtml')
     print >> f, template.generate(**data).render('xhtml')
     f.close()
-    f = open(uoutputfile, 'w')
-    utemplate = loader.load('uthermometer.xhtml')
-    print >> f, utemplate.generate(**data).render('xhtml')
-    f.close()
 
 if __name__ == '__main__':
     main()

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list