[Collab-qa-commits] r239 - testing-status

lucas at alioth.debian.org lucas at alioth.debian.org
Tue Jun 19 12:06:02 UTC 2007


Author: lucas
Date: 2007-06-19 12:06:01 +0000 (Tue, 19 Jun 2007)
New Revision: 239

Modified:
   testing-status/data2html.rb
   testing-status/learn-from-sdn.rb
   testing-status/parseinfo.rb
   testing-status/pkgtestingstatus.rb
Log:
major rework, now works

Modified: testing-status/data2html.rb
===================================================================
--- testing-status/data2html.rb	2007-06-18 10:24:43 UTC (rev 238)
+++ testing-status/data2html.rb	2007-06-19 12:06:01 UTC (rev 239)
@@ -3,14 +3,20 @@
 require 'date'
 require 'pkgtestingstatus'
 
-#$curdate = Date::now
-$curdate = Date::parse('2007-06-07')
+$curdate = Date::parse('0000-01-01')
 
 pkgs = PkgTestingStatus::read(STDIN)
 
+pkgs.each_pair do |name, pkg|
+  $curdate = pkg.intesting if pkg.intesting > $curdate
+  $curdate = pkg.inunstable if pkg.inunstable > $curdate
+  $curdate = pkg.sync if pkg.sync > $curdate
+end
+
 # read comments
 comments = {}
 IO::read('comments/comments.txt').each_line do |l|
+  next l =~ /^\s*#/
   p, c = l.split(' ', 2)
   comments[p] = c
 end
@@ -23,8 +29,14 @@
 end
 
 # exclude non-interesting stuff
-pkgs = pkgs.to_a.reject { |p| ($curdate - p[1].sync < 10) or (p[1].inunstable != $curdate) }
+pkgs = pkgs.to_a.reject do |p|
+#  puts "#{p[0]} #{$curdate} #{p[1].sync} #{p[1].inunstable}<br/>"
+#  puts "cl from sync" if $curdate - p[1].sync < 10
+#  puts "notinunstable" if p[1].inunstable != $curdate
+  ($curdate - p[1].sync < 10) or (p[1].inunstable != $curdate)
+end
 
+
 puts <<-EOF
 <html>
 <head>
@@ -74,6 +86,7 @@
 <p>Packages which were last in sync less than 10 days ago are excluded.</p>
 <p><a href="#lasttesting">List sorted by how long ago the package was last in testing</a><br/>
 <a href="#lastsync">List sorted by how long ago the package was last the same in testing and unstable</a></p>
+<p>Current date: #{$curdate}</p>
 <a name="lasttesting"></a>
 <h2>List sorted by how long ago the package was last in testing</h2>
 <p>Packages in testing are excluded from the list, even if the version in unstable differs.</p>

Modified: testing-status/learn-from-sdn.rb
===================================================================
--- testing-status/learn-from-sdn.rb	2007-06-18 10:24:43 UTC (rev 238)
+++ testing-status/learn-from-sdn.rb	2007-06-19 12:06:01 UTC (rev 239)
@@ -2,21 +2,22 @@
 
 require 'date'
 
-file = 'data.orig'
-d = Date::parse('2005-03-13')
-de = Date::parse('2007-06-13')
+file = 'data.2007-06-06'
+d = Date::parse('2007-06-07')
+de = Date::parse('2007-06-19')
+incr = 1
 
 while d <= de
   puts "#{d} ..."
   newfile = "data.#{d}"
-  system("cp #{file} #{newfile}")
   nd = d.to_s.gsub('-', '/')
-  system("./parseinfo.rb #{d} http://athlon64.fsij.org/archive/#{nd}/debian/dists < #{newfile} > tmp")
+  puts("./parseinfo.rb #{d} http://athlon64.fsij.org/archive/#{nd}/debian/dists < #{file} > tmp")
+  system("./parseinfo.rb #{d} http://athlon64.fsij.org/archive/#{nd}/debian/dists < #{file} > tmp")
   if $?.exitstatus != 0
     puts "Error! exit code: #{$?}."
     exit(1)
   end
   system("mv tmp #{newfile}")
-  d = d + 1
+  d = d + incr
   file = newfile
 end

Modified: testing-status/parseinfo.rb
===================================================================
--- testing-status/parseinfo.rb	2007-06-18 10:24:43 UTC (rev 238)
+++ testing-status/parseinfo.rb	2007-06-19 12:06:01 UTC (rev 239)
@@ -3,6 +3,7 @@
 require 'date'
 require 'thread'
 require 'pkgtestingstatus'
+Thread::abort_on_exception = true
 
 raise "Wrong number of args" if ARGV.length != 2
 date = Date::parse(ARGV[0])
@@ -38,35 +39,34 @@
 end
 
 pkgsrcs = {}
-srcs = []
 ths = []
 mutex = Mutex::new
 ['testing', 'unstable'].each do |dist|
   ['non-free', 'contrib', 'main'].each do |sect|
     ths << Thread::new(dist, sect) do |dist, sect|
-      t = readsources(file + "/#{dist}/#{sect}/source/Sources.gz")
-      mutex.synchonize { srcs << t }
+      srcs = readsources(file + "/#{dist}/#{sect}/source/Sources.gz")
+      mutex.synchronize do
+	srcs.each_pair do |k, v|
+          pkgsrcs[k] = PkgSrc::new if not pkgsrcs.has_key?(k)
+          if dist == 'testing'
+	      pkgsrcs[k].testing = v
+          elsif dist == 'unstable'
+             pkgsrcs[k].unstable = v
+          end
+	end 
+      end
     end
   end
 end
 ths.each { |t| t.join }
-['testing', 'unstable'].each do |dist|
-  ['non-free', 'contrib', 'main'].each do |sect|
-    srcs.collect({}) { |a, b| a += b }.each_pair do |k, v|
-      pkgsrcs[k] = PkgSrc::new if not pkgsrcs.has_key?(k)
-      if dist == 'testing'
-        pkgsrcs[k].testing = v
-      elsif dist == 'unstable'
-        pkgsrcs[k].unstable = v
-      end
-    end 
-  end
-end
 
+#require 'pp'
+#PP::pp(pkgsrcs, STDERR)
+
 # combine data
 pkgsrcs.each_pair do |p, v|
   if not pkgs.has_key?(p)
-    pkgs[p] = PkgData::new($datezero, '-', $datezero, '-', $datezero, '-', date)
+    pkgs[p] = PkgTestingStatus::new($datezero, '-', $datezero, '-', $datezero, '-', date)
   end
   pkgs[p].update(date, v.testing, v.unstable)
 

Modified: testing-status/pkgtestingstatus.rb
===================================================================
--- testing-status/pkgtestingstatus.rb	2007-06-18 10:24:43 UTC (rev 238)
+++ testing-status/pkgtestingstatus.rb	2007-06-19 12:06:01 UTC (rev 239)
@@ -69,28 +69,29 @@
   end
 
   def update(curdate, testing, unstable)
+#    STDERR.puts "#{curdate} #{testing} #{unstable}" if testing != unstable
     if testing
-      if curdate > @intesting
+      if curdate >= @intesting
         @intesting = curdate 
         @testingversion = testing
       else
-        puts "[testing] #{curdate} < #{@intesting}, skipping"
+        STDERR.puts "[testing] #{curdate} < #{@intesting}, skipping"
       end
     end
     if unstable
-      if curdate > @inunstable
+      if curdate >= @inunstable
         @inunstable = curdate 
         @unstableversion = unstable
       else
-        puts "[unstable] #{curdate} < #{@inunstable}, skipping"
+        STDERR.puts "[unstable] #{curdate} < #{@inunstable}, skipping"
       end
     end
-    if unstable and unstable == testing
-      if curdate > @sync
+    if unstable and testing and unstable == testing
+      if curdate >= @sync
         @sync = curdate 
         @syncversion = unstable
       else
-        puts "[sync] #{curdate} < #{@sync}, skipping"
+        STDERR.puts "[sync] #{curdate} < #{@sync}, skipping"
       end
     end
   end




More information about the Collab-qa-commits mailing list