[Collab-qa-commits] r1368 - udd/udd

lucas at alioth.debian.org lucas at alioth.debian.org
Thu Dec 25 08:19:52 UTC 2008


Author: lucas
Date: 2008-12-25 08:19:52 +0000 (Thu, 25 Dec 2008)
New Revision: 1368

Modified:
   udd/udd/packages_gatherer.py
   udd/udd/sources_gatherer.py
Log:
ignore special Packages/Sources fields in Ubuntu

Modified: udd/udd/packages_gatherer.py
===================================================================
--- udd/udd/packages_gatherer.py	2008-12-25 08:19:24 UTC (rev 1367)
+++ udd/udd/packages_gatherer.py	2008-12-25 08:19:52 UTC (rev 1368)
@@ -11,6 +11,7 @@
 from aux import ConfigException
 import psycopg2
 from gatherer import gatherer
+import re
 
 def get_gatherer(connection, config, source):
   return packages_gatherer(connection, config, source)
@@ -30,7 +31,8 @@
       'SHA1':0, 'Replaces':0, 'Section':0, 'MD5sum':0, 'Bugs':0, 'Priority':0,
       'Tag':0, 'Task':0, 'Python-Version':0, 'Provides':0, 'Conflicts':0,
       'SHA256':0, 'Original-Maintainer':0}
-  ignorable = {'Filename':0, 'Npp-Name':0, 'Npp-Mimetype':0, 'Npp-Applications':0, 'Python-Runtime':0, 'Npp-File':0, 'Npp-Description':0, 'Url':0, 'Gstreamer-Elements':0, 'Gstreamer-Version':0, 'Gstreamer-Decoders':0, 'Gstreamer-Uri-Sinks':0, 'Gstreamer-Encoders':0, 'Gstreamer-Uri-Sources':0 }
+  ignorable = {'Filename':0, 'Npp-Name':0, 'Npp-Mimetype':0, 'Npp-Applications':0, 'Python-Runtime':0, 'Npp-File':0, 'Npp-Description':0, 'Url':0, 'Gstreamer-Elements':0, 'Gstreamer-Version':0, 'Gstreamer-Decoders':0, 'Gstreamer-Uri-Sinks':0, 'Gstreamer-Encoders':0, 'Gstreamer-Uri-Sources':0, 'url':0, 'Vdr-PatchLevel':0, 'originalmaintainer':0 }
+  ignorable_re = re.compile("^(Original-|Origianl-|Debian-|X-Original-|Upstream-)")
 
   warned_about = {}
   # A mapping from <package-name><version> to 1 If <package-name><version> is
@@ -62,10 +64,11 @@
 	d[k] = control[k]
     for k in control.keys():
       if k not in packages_gatherer.non_mandatory and k not in packages_gatherer.mandatory and k not in packages_gatherer.ignorable:
-	if k not in packages_gatherer.warned_about:
-	  packages_gatherer.warned_about[k] = 1
-	else:
-	  packages_gatherer.warned_about[k] += 1
+        if not packages_gatherer.ignorable_re.match(k):
+	  if k not in packages_gatherer.warned_about:
+	    packages_gatherer.warned_about[k] = 1
+	  else:
+	    packages_gatherer.warned_about[k] += 1
     return d
 
   def import_packages(self, sequence, cur):
@@ -199,4 +202,4 @@
 
   def print_warnings(self):
     for key in packages_gatherer.warned_about:
-      print("Unknown key: %s appeared %d times" % (key, packages_gatherer.warned_about[key]))
+      print("[Packages] Unknown key %s appeared %d times" % (key, packages_gatherer.warned_about[key]))

Modified: udd/udd/sources_gatherer.py
===================================================================
--- udd/udd/sources_gatherer.py	2008-12-25 08:19:24 UTC (rev 1367)
+++ udd/udd/sources_gatherer.py	2008-12-25 08:19:52 UTC (rev 1368)
@@ -12,6 +12,7 @@
 from aux import null_or_quote, quote
 from gatherer import gatherer
 import email.Utils
+import re
 
 def get_gatherer(connection, config, source):
   return sources_gatherer(connection, config, source)
@@ -27,9 +28,10 @@
   ignorable = {'Vcs-Arch': 0, 'Vcs-Bzr': 0,
       'Vcs-Cvs': 0, 'Vcs-Darcs': 0, 'Vcs-Git': 0, 'Vcs-Hg': 0, 'Vcs-Svn': 0,
       'Vcs-Mtn':0,
-      'X-Vcs-Browser': 0, 'Vcs-Browser': 0, 'X-Vcs-Bzr': 0, 'X-Vcs-Darcs': 0, 'X-Vcs-Svn': 0, 'Vcs-Browse':0,
-      'Directory':0, 'Comment':0, 'Origin':0, 'Url':0, 'X-Collab-Maint':0, 'Autobuild':0, 'Vcs-Cvs:':0, 'Python-Standards-Version':0}
+      'X-Vcs-Browser': 0, 'Vcs-Browser': 0, 'X-Vcs-Bzr': 0, 'X-Vcs-Darcs': 0, 'X-Vcs-Svn': 0, 'X-Vcs-Hg':0, 'X-Vcs-Git':0, 'Vcs-Browse':0,
+      'Directory':0, 'Comment':0, 'Origin':0, 'Url':0, 'X-Collab-Maint':0, 'Autobuild':0, 'Vcs-Cvs:':0, 'Python-Standards-Version':0, 'url':0, 'originalmaintainer':0}
       #Vcs-Cvs: is caused by a bug in python-debian, apparently.
+  ignorable_re = re.compile("^(Original-|Origianl-|Debian-|X-Original-|Upstream-)")
   vcs = { 'Arch':0, 'Bzr':0, 'Cvs':0, 'Darcs':0, 'Git':0, 'Hg':0, 'Svn':0, 'Mtn':0}
 
   warned_about = {}
@@ -76,10 +78,11 @@
     
     for k in control.keys():
       if k not in sources_gatherer.mandatory and k not in sources_gatherer.non_mandatory and k not in sources_gatherer.ignorable:
-	if k not in sources_gatherer.warned_about:
-	  sources_gatherer.warned_about[k] = 1
-	else:
-	  sources_gatherer.warned_about[k] += 1
+        if not sources_gatherer.ignorable_re.match(k):
+          if k not in sources_gatherer.warned_about:
+            sources_gatherer.warned_about[k] = 1
+          else:
+            sources_gatherer.warned_about[k] += 1
     return d
 
   def import_sources(self, file):
@@ -93,7 +96,7 @@
       d = self.build_dict(control)
       d['maintainer_name'], d['maintainer_email'] = email.Utils.parseaddr(d['Maintainer'])
       query = """EXECUTE source_insert
-	  (%(Package)s, %(Version)s, %(Maintainer)s,
+         (%(Package)s, %(Version)s, %(Maintainer)s,
 	  %(maintainer_name)s, %(maintainer_email)s, %(Format)s, %(Files)s,
 	  %(Uploaders)s, %(Binary)s, %(Architecture)s, %(Standards-Version)s,
 	  %(Homepage)s, %(Build-Depends)s, %(Build-Depends-Indep)s,
@@ -186,4 +189,4 @@
 
   def print_warnings(self):
     for key in sources_gatherer.warned_about:
-      print "Unknown key %s appeared %d times" % (key, sources_gatherer.warned_about[key])
+      print "[Sources] Unknown key %s appeared %d times" % (key, sources_gatherer.warned_about[key])




More information about the Collab-qa-commits mailing list