[Collab-qa-commits] r2192 - udd/web/cgi-bin

Lucas Nussbaum lucas at alioth.debian.org
Thu Mar 29 07:45:11 UTC 2012


Author: lucas
Date: 2012-03-29 07:45:11 +0000 (Thu, 29 Mar 2012)
New Revision: 2192

Modified:
   udd/web/cgi-bin/sources_rebuild.cgi
Log:
improve generation of list of packages to rebuild

Modified: udd/web/cgi-bin/sources_rebuild.cgi
===================================================================
--- udd/web/cgi-bin/sources_rebuild.cgi	2012-03-29 07:43:52 UTC (rev 2191)
+++ udd/web/cgi-bin/sources_rebuild.cgi	2012-03-29 07:45:11 UTC (rev 2192)
@@ -1,15 +1,59 @@
 #!/usr/bin/ruby -w
-# Used by Harvest at Ubuntu
 
+CURARCH='amd64'
+
 require 'dbi'
 
 puts "Content-type: text/plain\n\n"
 
+# calculate $archs
+$archs = {}
+ENV['http_proxy=http://proxy:3128/']
+pas = `wget -q -O - "http://anonscm.debian.org/gitweb/?p=mirror/packages-arch-specific.git;a=blob_plain;f=Packages-arch-specific;hb=HEAD"`
+if $? != 0
+  puts "Proxy failed"
+  exit 1
+end
+arr = pas.split(/\n/).grep(/^%?[a-z0-9]/).map { |l| l.gsub(/\s*#.*$/,'') }
+allarchs=['alpha','amd64','arm','armeb','freebsd-i386','hppa','hurd-i386','i386','ia64','kfreebsd-i386','m32r','m68k','mips','mipsel','netbsd-i386','powerpc','s390','s390x','sh','sparc']
+arr.each do |l|
+  pkg, archsl = l.split(/:\s*/, 2)
+  if archsl.nil?
+     STDERR.puts "NIL: #{l}"
+     next
+  end
+  #next if pkg !~ /^%/ # we ignore binary packages
+  pkg = pkg.gsub(/^%/,'')
+  archs = archsl.split(' ')
+  if archsl =~ /!/
+    # remove mode
+    march = allarchs.clone
+    archs.each do |a|
+      march = march - [a.gsub(/^!/,'')]
+    end
+  else
+    march = archs
+  end
+  $archs[pkg] = march
+end
+
 dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
-sth = dbh.prepare("select source, version
+sth = dbh.prepare("select source, version, architecture
 from sources_uniq where distribution='debian' and release='sid' and component='main' and (architecture = 'all' or architecture = 'any' or architecture ~ 'amd64') order by source")
 sth.execute
 while row = sth.fetch do
-  puts "#{row['source']} #{row['version']} #{row['component']}"
+  if row['architecture'] =~ /amd64/
+    arch = 'any'
+  else
+    arch = row['architecture']
+  end
+  pkg = row['source']
+  if $archs[pkg].nil? or $archs[pkg].include?(CURARCH)
+    pas = ""
+  else
+    pas = "excluded-by-P-A-S"
+  end
+
+  puts "#{row['source']} #{row['version']} #{arch} #{pas}"
 end
 sth.finish




More information about the Collab-qa-commits mailing list