[Checkins] SVN: zope.wineggbuilder/trunk/ trying git support, first with BTrees

Adam Groszer cvs-admin at zope.org
Mon Jan 21 10:06:54 UTC 2013


Log message for revision 129061:
  trying git support, first with BTrees

Changed:
  U   zope.wineggbuilder/trunk/rackspace.ini
  U   zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py
  U   zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py

-=-
Modified: zope.wineggbuilder/trunk/rackspace.ini
===================================================================
--- zope.wineggbuilder/trunk/rackspace.ini	2013-01-20 17:52:14 UTC (rev 129060)
+++ zope.wineggbuilder/trunk/rackspace.ini	2013-01-21 10:06:52 UTC (rev 129061)
@@ -67,11 +67,14 @@
 tagurl = svn://svn.zope.org/repos/main/ZODB/tags/
 
 [BTrees]
+# versions before 4.0.4 were SVN based
 package = BTrees
-minVersion =
+minVersion = 4.0.4
 maxVersion =
 excludeVersions = 4.0.0
 targets = py26_32 py26_64 py27_32 py27_64
+repotype = git
+#repourl = https://github.com/zopefoundation/BTrees.git
 
 [persistent]
 package = persistent

Modified: zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py
===================================================================
--- zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py	2013-01-20 17:52:14 UTC (rev 129060)
+++ zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py	2013-01-21 10:06:52 UTC (rev 129061)
@@ -14,19 +14,14 @@
 """base classes
 """
 __docformat__ = 'ReStructuredText'
-import StringIO
-import base64
-import httplib
 import logging
 import optparse
 import os
-import pkg_resources
 import shutil
 import subprocess
 import sys
 import stat
 import urllib2
-import urlparse
 import xmlrpclib
 
 LOGGER = logging.Logger('build')
@@ -66,8 +61,21 @@
         LOGGER.debug('Output: \n%s' % stdout)
         return stdout
 
+
+class Git(object):
+    def __init__(self, exitOnError=True):
+        self.cmd = self.commandKlass(exitOnError=exitOnError)
+
+    def clone(self, url, folder):
+        command = 'git clone %s %s' % (url, folder)
+        return self.cmd.do(command)
+
+    def checkout(self, branch):
+        command = 'git checkout %s' % branch
+        return self.cmd.do(command)
+
+
 class SVN(object):
-
     user = None
     passwd = None
     forceAuth = False

Modified: zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py
===================================================================
--- zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py	2013-01-20 17:52:14 UTC (rev 129060)
+++ zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py	2013-01-21 10:06:52 UTC (rev 129061)
@@ -14,19 +14,11 @@
 """Main builder stuff
 """
 __docformat__ = 'ReStructuredText'
-import StringIO
-import base64
-import httplib
 import logging
-import optparse
 import os
-import pkg_resources
 import re
-import subprocess
 import sys
 import tempfile
-import urllib2
-import urlparse
 from collections import defaultdict
 
 import BeautifulSoup
@@ -37,6 +29,7 @@
 
 LOGGER = base.LOGGER
 
+
 def getOption(config, section, name, default=None):
     try:
         return config.get(section, name)
@@ -128,6 +121,7 @@
     pypiKlass = base.PYPI
     urlGetterKlass = base.URLGetter
     svnKlass = base.SVN
+    gitKlass = base.Git
 
     def __init__(self, sectionName, config, options, compilers):
         self.sectionName = sectionName
@@ -138,15 +132,22 @@
         self.name = config.get(sectionName, 'package')
         self.pypiurl = getOption(config, sectionName, 'pypiurl',
                                  'http://pypi.python.org/simple/%s/' % self.name)
-        self.tagurl = getOption(config, sectionName, 'tagurl',
-                                'svn://svn.zope.org/repos/main/%s/tags' % self.name)
-        if self.tagurl.endswith('/'):
-            self.tagurl = self.tagurl[:-1]
+        self.repotype = getOption(config, sectionName, 'repotype', 'svn')
+        if self.repotype == 'svn':
+            self.tagurl = getOption(config, sectionName, 'tagurl',
+                                    'svn://svn.zope.org/repos/main/%s/tags' % self.name)
+            if self.tagurl.endswith('/'):
+                self.tagurl = self.tagurl[:-1]
+        if self.repotype == 'git':
+            self.repourl = getOption(config, sectionName, 'repourl',
+                                    'https://github.com/zopefoundation/%s.git' % self.name)
+            if self.repourl.endswith('/'):
+                self.repourl = self.repourl[:-1]
         self.minVersion = getOption(config, sectionName, 'minVersion')
         self.maxVersion = getOption(config, sectionName, 'maxVersion')
         self.needSource = bool(getOption(config, sectionName, 'needSource', 'True'))
         self.excludeVersions = getOption(
-            config, sectionName, 'excludeVersions' ,'').split()
+            config, sectionName, 'excludeVersions', '').split()
         self.targets = []
         for target in config.get(sectionName, 'targets').split():
             self.targets.append(compilers[target])
@@ -198,7 +199,7 @@
         verFiles = defaultdict(list)
         simple = self.urlGetterKlass().get(self.pypiurl)
         soup = BeautifulSoup.BeautifulSoup(simple)
-        VERSION = re.compile(self.name+r'-(\d+\.\d+(\.\d+\w*){0,2})')
+        VERSION = re.compile(self.name + r'-(\d+\.\d+(\.\d+\w*){0,2})')
         gotSource = False
 
         for tag in soup('a'):
@@ -220,7 +221,6 @@
         if self.needSource and not gotSource:
             LOGGER.info("No source release (.zip/.tar.gz/.tgz) found")
 
-        svn = self.svnKlass(exitOnError=False)
         for version in versions:
             #3 check whether we need a build
             needs = []
@@ -236,11 +236,17 @@
                 tmpfolder = tempfile.mkdtemp('wineggbuilder')
                 try:
                     try:
-                        #3.1 svn co tag
-                        svnurl = "%s/%s" % (self.tagurl, version)
-                        svn.co(svnurl, tmpfolder)
+                        if self.repotype == 'svn':
+                            #3.1 svn co tag
+                            svn = self.svnKlass(exitOnError=False)
+                            svnurl = "%s/%s" % (self.tagurl, version)
+                            svn.co(svnurl, tmpfolder)
+                        if self.repotype == 'git':
+                            git = self.gitKlass(exitOnError=False)
+                            git.clone(self.repourl, tmpfolder)
+                            git.checkout(version)
                     except OSError:
-                        status.setStatus(self, version, "SVN error")
+                        status.setStatus(self, version, "SVN/Git error")
                     else:
                         #3.2 build missing
                         for target in needs:
@@ -251,6 +257,7 @@
                     #3.3 del temp folder
                     base.rmtree(tmpfolder)
 
+
 class Status(object):
     def __init__(self, packages, targets):
         self.data = {}



More information about the checkins mailing list