incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1185452 - /incubator/public/trunk/clutch.py
Date Tue, 18 Oct 2011 01:36:10 GMT
Author: sebb
Date: Tue Oct 18 01:36:10 2011
New Revision: 1185452

URL: http://svn.apache.org/viewvc?rev=1185452&view=rev
Log:
Read list of SVN entries.
Quicker than checking each one when recreating pickle jar
Also shows which ones are not being used

Modified:
    incubator/public/trunk/clutch.py

Modified: incubator/public/trunk/clutch.py
URL: http://svn.apache.org/viewvc/incubator/public/trunk/clutch.py?rev=1185452&r1=1185451&r2=1185452&view=diff
==============================================================================
--- incubator/public/trunk/clutch.py (original)
+++ incubator/public/trunk/clutch.py Tue Oct 18 01:36:10 2011
@@ -60,9 +60,6 @@ Note: The 'svn log' queries might only r
 # FIXME: Better deal with input/output/unicode.
 # FIXME: See some other suggestions in issue INCUBATOR-78.
 
-# subprocess.getoutput is broken on Windows in Python 3.2.2
-# see http://bugs.python.org/issue10197 for a fix
-
 import subprocess
 import datetime
 from html.parser import HTMLParser
@@ -658,6 +655,35 @@ for k in sorted(projectNames, key=str.lo
 
 # end of processing
 
+
+print("Collect SVN directory names")
+incubatorSvnDirs = {} # top-level SVN incubator dirs
+outputString = subprocess.Popen(['svn', 'ls', '--xml', 'http://svn.apache.org/repos/asf/incubator/'],
stdout=subprocess.PIPE).communicate()[0]
+dom = xml.dom.minidom.parseString(outputString)
+"""
+Sample output
+<lists>
+  <list path="http://svn.apache.org/repos/asf/incubator">
+    <entry kind="file">
+    <name>REPO-ORGANISATION.txt</name>
+    ...
+    </entry>
+    <entry kind="dir">
+    <name>accumulo</name>
+    ...
+"""
+for entry in dom.getElementsByTagName("entry"):
+  if entry.getAttribute("kind") == 'dir':
+    name = entry.getElementsByTagName("name")[0].firstChild.data
+    if name not in ('trunk', 'public'): # skip non-podling entries
+      incubatorSvnDirs["http://svn.apache.org/repos/asf/incubator/%s/" % name] = True
+
+def normaliseSVNurl(url):
+    rc = url.replace('https://','http://')
+    if not rc[-1] == '/':
+      rc = rc + '/'
+    return rc
+
 print("Detect certain resources ...")
 for k in sorted(projectNames, key=str.lower):
   print(k)
@@ -699,6 +725,7 @@ for k in sorted(projectNames, key=str.lo
   # then, try URLs based on their resourceNames.
   if optionUseClutchState and projects[k]['hasClutchState'] and state[k]['urlSvn']:
     projects[k]['urlSvn'] = state[k]['urlSvn']
+    incubatorSvnDirs[normaliseSVNurl(state[k]['urlSvn'])] = 'used'
   else:
     urls = []
     try:
@@ -713,6 +740,10 @@ for k in sorted(projectNames, key=str.lo
     for url in urls:
       if optionVerbose:
         print('DEBUG: Trying SVN URL %s' % url)
+      if normaliseSVNurl(url) in incubatorSvnDirs:
+        projects[k]['urlSvn'] = url
+        incubatorSvnDirs[url] = name # mark used
+        break
       try:
         urllib.request.urlopen(url)
       except IOError:
@@ -886,6 +917,11 @@ for k in sorted(projectNames, key=str.lo
   if not projects[k]['hasMailListCommits'] and optionInfo:
     print("INFO: %s: Does not yet have 'commits' mail list" % k)
 
+if if optionInfo:
+  for entry in sorted(incubatorSvnDirs):
+    if incubatorSvnDirs[entry] == True:
+      print("INFO: unused SVN directory %s" % entry)
+
 # end of processing
 
 print("Output the data ...")



---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message