/[collab-qa]/bapase/gen_html.rb
ViewVC logotype

Diff of /bapase/gen_html.rb

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

revision 538 by lucas, Mon Dec 3 21:47:20 2007 UTC revision 642 by lucas, Tue Jan 15 08:08:46 2008 UTC
# Line 4  require 'date' Line 4  require 'date'
4  require 'datafiles'  require 'datafiles'
5  require 'html'  require 'html'
6    
7    WAIT_RM_O = 50
8    WAIT_RM_RM = 100
9    WAIT_O_O = 50
10    WAIT_ORM_RM = 50
11    
12  DATEZERO = Date::parse('0000-01-01')  DATEZERO = Date::parse('0000-01-01')
13  CURDATE = Date::today  CURDATE = Date::today
14    
15  $testing = read_testing  $testing = read_testing
16  $srcpkg, $pkgs = read_sources  $srcpkg, $pkgs = read_sources
17    $nmus = read_nmus
18  $popcon = read_popcon  $popcon = read_popcon
19  $rcbugs, $bugs = read_bugs  $rcbugs, $bugs = read_bugs
20  $wnpp = read_wnpp  $wnpp = read_wnpp
21    $removals = read_removals
22  $actions = Actions::read('package-actions.txt')  $actions = Actions::read('package-actions.txt')
23  $orph = OrphanedPackage::readfile  $orph = OrphanedPackage::readfile
24    $uploadhistory = LastUpload::readfile
25    
26  # Compute score for all packages  ########################################################################
27    ######## -BUGGY
28  $score = {}  $score = {}
29  $pkgs.keys.each do |pkg|  $pkgs.keys.each do |pkg|
30    score = 0    score = 0
# Line 30  $pkgs.keys.each do |pkg| Line 39  $pkgs.keys.each do |pkg|
39      score += 100000 # bump score if action needed      score += 100000 # bump score if action needed
40    end    end
41    if $popcon[pkg] < 500    if $popcon[pkg] < 500
42      score += (500 - $popcon[pkg]) * 2      score += (500 - $popcon[pkg])
43      end
44      if $rcbugs[pkg] > 0
45        if $rcbugs[pkg] > 4
46          score += 5 * 300
47        else
48          score += $rcbugs[pkg] * 300
49        end
50      end
51      # score bugs
52      if $bugs[pkg] > 0
53        pc = $popcon[pkg]
54        bugs = $bugs[pkg]
55        if pc < 4000
56          norm = 1 + 0.002 * pc
57        elsif pc < 60000
58          norm = 7.85 + (16.0/56000) * pc
59        else
60          norm = 25
61        end
62        if bugs > norm
63          ret = (bugs - norm)/norm * 100 * 10 # 10 % en trop -> 100 pts
64          score += (ret > 2000 ? 2000 : ret)
65        end
66      end
67      $score[pkg] = score if score > 0
68    end
69    
70    f = File::new('scores-buggy.html', 'w')
71    gen_html($score, f)
72    f.close
73    #
74    ######## -NMUed
75    $score = {}
76    $pkgs.keys.each do |pkg|
77      score = 0
78      next if not $nmus[pkg]
79      score += $nmus[pkg] * 750
80    
81      if $testing[pkg]
82        ts = $testing[pkg]
83        score += ts.testingdays
84        score += (ts.syncdays * 0.5) if ts.syncdays > 10
85      else
86        score += 1000000
87      end
88    
89      if $actions[pkg] and $actions[pkg].act_todo
90        score += 100000 # bump score if action needed
91      end
92    
93      if $popcon[pkg] < 1000
94        score += $popcon[pkg] / 10
95      else
96        score += 1000
97    end    end
98    
99    if $rcbugs[pkg] > 0    if $rcbugs[pkg] > 0
100      if $rcbugs[pkg] > 4      if $rcbugs[pkg] > 4
101        score += 5 * 300        score += 5 * 300
# Line 39  $pkgs.keys.each do |pkg| Line 103  $pkgs.keys.each do |pkg|
103        score += $rcbugs[pkg] * 300        score += $rcbugs[pkg] * 300
104      end      end
105    end    end
106    
107    # score bugs    # score bugs
108    if $bugs[pkg] > 0    if $bugs[pkg] > 0
109      pc = $popcon[pkg]      pc = $popcon[pkg]
# Line 58  $pkgs.keys.each do |pkg| Line 123  $pkgs.keys.each do |pkg|
123    $score[pkg] = score if score > 0    $score[pkg] = score if score > 0
124  end  end
125    
126  # Compute score, orphaned packages only  f = File::new('scores-nmued.html', 'w')
127    gen_html($score, f)
128    f.close
129    ########################################################################
130    ######## -USELESS
131    $uscore = {}
132    $pkgs.keys.each do |pkg|
133      score = 0
134      if $actions[pkg] and $actions[pkg].act_todo
135        score += 100000 # bump score if action needed
136      end
137      next if $popcon[pkg] > 100
138      if $popcon[pkg] < 200
139        score += (200 - $popcon[pkg]) * 8
140      end
141      if $uploadhistory.has_key?(pkg)
142        uh = $uploadhistory[pkg]
143        if CURDATE - uh.date > 30
144          d = [ uh.nmudate, uh.date ].max
145          score += (CURDATE - d)
146          if d != uh.date
147            score += (uh.nmudate - uh.date) * 0.5 # add time between NMU and last maint upload
148          end
149        end
150      end
151      $uscore[pkg] = score if score > 0
152    end
153    
154    f = File::new('scores-useless.html', 'w')
155    gen_html($uscore, f)
156    f.close
157    ########################################################################
158    ######## -ORPHANED
159  $oscore = {}  $oscore = {}
160  $pkgs.keys.each do |pkg|  $pkgs.keys.each do |pkg|
161    next if !$orph.has_key?(pkg)    next if !$orph.has_key?(pkg)
# Line 103  $pkgs.keys.each do |pkg| Line 200  $pkgs.keys.each do |pkg|
200    $oscore[pkg] = score if score > 0    $oscore[pkg] = score if score > 0
201  end  end
202    
203  # Generate HTML files  f = File::new('scores-orphaned.html', 'w')
 f = File::new('scores.html', 'w')  
 gen_html($score, f)  
 f.close  
 f = File::new('scores_orphaned.html', 'w')  
204  gen_html($oscore, f, true)  gen_html($oscore, f, true)
205  f.close  f.close

Legend:
Removed from v.538  
changed lines
  Added in v.642

  ViewVC Help
Powered by ViewVC 1.1.5