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

Andreas Tille tille at alioth.debian.org
Fri Jun 8 19:45:52 UTC 2012


Author: tille
Date: 2012-06-08 19:45:51 +0000 (Fri, 08 Jun 2012)
New Revision: 2369

Modified:
   udd/udd/blends_prospective_gatherer.py
Log:
Do not warn about valid Vcs URLs


Modified: udd/udd/blends_prospective_gatherer.py
===================================================================
--- udd/udd/blends_prospective_gatherer.py	2012-06-08 08:09:15 UTC (rev 2368)
+++ udd/udd/blends_prospective_gatherer.py	2012-06-08 19:45:51 UTC (rev 2369)
@@ -217,36 +217,38 @@
     	  cpr = open(cprfile,'r')
     	except:
     	  self.log.debug("Unable to open Copyright file for source '%s' of %s (%s)" % (source, sprosp['blend'], cprfile))
+    	  cpr = None
     	linenr = 0
     	found_files = False
     	sprosp['license'] = ''
-    	for line in cpr.readlines():
-    	  line = line.strip()
-    	  if line == '':
-    	    if found_files:
-    	      found_files = False
-    	      break # We might leave the 'Files: *' paragraph again
-    	    continue
-    	  try:
-    	    (field,value) = line.split(': ')
-    	  except ValueError:
-    	    # either no DEP5 file or no line we want to read here
-    	    continue
-    	  if linenr == 0:
-    	    if field != 'Format':
-    	      self.log.debug("Copyright file for source '%s' of %s does not seem to regard DEP5.  Found line `%s`" % (source, sprosp['blend'], line.strip()))
-    	      found_files = True # one flag is enough to control this - we do not need another warning in the logs
+    	if cpr:
+    	  for line in cpr.readlines():
+    	    line = line.strip()
+    	    if line == '':
+    	      if found_files:
+    	        found_files = False
+    	        break # We might leave the 'Files: *' paragraph again
+    	      continue
+    	    try:
+    	      (field,value) = line.split(': ')
+    	    except ValueError:
+    	      # either no DEP5 file or no line we want to read here
+    	      continue
+    	    if linenr == 0:
+    	      if field != 'Format':
+    	        self.log.debug("Copyright file for source '%s' of %s does not seem to regard DEP5.  Found line `%s`" % (source, sprosp['blend'], line.strip()))
+    	        found_files = True # one flag is enough to control this - we do not need another warning in the logs
+    	        break
+    	    linenr += 1
+    	    field = field.strip()
+    	    value = value.strip()
+    	    if field == 'Files' and value == '*':
+    	      found_files = True
+    	    if field == 'License' and found_files:
+    	      sprosp['license'] = value
     	      break
-    	  linenr += 1
-    	  field = field.strip()
-    	  value = value.strip()
-    	  if field == 'Files' and value == '*':
-    	    found_files = True
-    	  if field == 'License' and found_files:
-    	    sprosp['license'] = value
-    	    break
-    	if not found_files:
-          self.log.debug("No 'Files: *' specification found in copyright file for source '%s' of %s" % (source, sprosp['blend']))
+    	  if not found_files:
+            self.log.debug("No 'Files: *' specification found in copyright file for source '%s' of %s" % (source, sprosp['blend']))
 
     	# Try to read debian/control
     	ctrl = None
@@ -267,19 +269,22 @@
     	      self.log.warning("Control file for source '%s' of %s is lacking source field" % (source, sprosp['blend']))
     	    if src.has_key('vcs-browser'):
     	      if sprosp['vcs_browser'] != src['vcs-browser']:
-                tmp_prosp = re.sub('/$', '', sprosp['vcs_browser']) # ignore forgotten '/' at end of Vcs-Browser
+    	        tmp_prosp = re.sub('/$', '', sprosp['vcs_browser']) # ignore forgotten '/' at end of Vcs-Browser
                 tmp_src = re.sub('/$', '', src['vcs-browser'])     # same with string in debian/control to enable comparison after further changes below
                 tmp_src = re.sub('\.git;a=summary$', '.git', tmp_src)
                 tmp_src = re.sub('/viewsvn/', '/wsvn/', tmp_src) # machine-readable gatherer implies /wsvn/ but specifying /viewsvn/ does no harm
                 tmp_src = re.sub('/anonscm.debian.org/gitweb/\?p=', '/git.debian.org/?p=', tmp_src)
                 tmp_src = re.sub('/anonscm.debian.org/git/([^?])', '/git.debian.org/?p=\\1', tmp_src) # Add missing '?p='
-                tmp_src = re.sub('/anonscm.debian.org/viewvc', '/svn.debian.org/wsvn', tmp_src) # FIXME: is it correct to assume SVN here??? - probably not
+                tmp_src = re.sub('/anonscm\.debian\.org/viewvc', '/svn.debian.org/wsvn', tmp_src) # FIXME: is it correct to assume SVN here??? - probably not
+                tmp_src = re.sub('\.debian\.org/viewvc', '.debian.org/wsvn', tmp_src) # somehow there seem some viewvc calls to remain
+                tmp_src = re.sub('/\?op=log', '', tmp_src) # Some SVN URLs specify this parameter which should not be regarded here
     	        if tmp_prosp != tmp_src:
     	          tmp_src = re.sub('^git:', 'http:', tmp_src) # check for usual error in specifying Vcs-Browser by just leaving 'git:' as protocol
     	          if tmp_src == sprosp['vcs_browser']:
     	            self.log.error("%s of %s - Wrong Vcs-Browser: Use 'http:' instead of 'git:' in '%s' ('%s')." % (source, sprosp['blend'], src['Vcs-Browser'], sprosp['vcs_browser']))
     	          else:
-                    tmp_prosp = re.sub('/trunk$', '', tmp_prosp) # sometimes the trailing trunk/ is forgotten which is no real problem
+                    tmp_prosp = re.sub('/trunk/?$', '', tmp_prosp) # sometimes the trailing trunk/ is forgotten which is no real problem
+                    tmp_src   = re.sub('/trunk/?$', '', tmp_src)   # also in tmp_src there is sometimes a remaining /trunk
     	            if tmp_prosp != tmp_src:
                       self.log.warning("%s of %s - Differing Vcs-Browser:  Obtained from Vcs-Browser='%s' <-> control has '%s'." % (source, sprosp['blend'], sprosp['vcs_browser'], src['Vcs-Browser']))
             else:




More information about the Collab-qa-commits mailing list