[Checkins] SVN: zope.release/trunk/ Created a script that updates the Zope 3 tree based on the KGS.

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Nov 5 10:53:05 EST 2007


Log message for revision 81526:
  Created a script that updates the Zope 3 tree based on the KGS.
  

Changed:
  U   zope.release/trunk/buildout.cfg
  U   zope.release/trunk/setup.py
  A   zope.release/trunk/src/zope/release/tree.py

-=-
Modified: zope.release/trunk/buildout.cfg
===================================================================
--- zope.release/trunk/buildout.cfg	2007-11-05 15:22:32 UTC (rev 81525)
+++ zope.release/trunk/buildout.cfg	2007-11-05 15:53:04 UTC (rev 81526)
@@ -1,6 +1,6 @@
 [buildout]
 develop = .
-parts = generate-buildout generate-versions upload
+parts = generate-buildout generate-versions upload update-tree
 
 [generate-buildout]
 recipe = zc.recipe.egg:scripts
@@ -25,3 +25,10 @@
              './test/versions.cfg',
              './controlled-packages.cfg',
              'download.zope.org:/var/www/download.zope.org/zope3.4',)
+
+[update-tree]
+recipe = zc.recipe.egg:scripts
+eggs = zope.release
+scripts = update-tree
+arguments = ('./controlled-packages.cfg',
+             './Zope3-3.4',)

Modified: zope.release/trunk/setup.py
===================================================================
--- zope.release/trunk/setup.py	2007-11-05 15:22:32 UTC (rev 81525)
+++ zope.release/trunk/setup.py	2007-11-05 15:53:04 UTC (rev 81526)
@@ -22,5 +22,6 @@
         'generate-buildout = zope.release.buildout:main',
         'generate-versions = zope.release.version:main',
         'upload = zope.release.upload:main',
+        'update-tree = zope.release.tree:main',
         ])
     )

Added: zope.release/trunk/src/zope/release/tree.py
===================================================================
--- zope.release/trunk/src/zope/release/tree.py	                        (rev 0)
+++ zope.release/trunk/src/zope/release/tree.py	2007-11-05 15:53:04 UTC (rev 81526)
@@ -0,0 +1,94 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Takes a Zope 3 tree checkout, and updates the SVN externals based on the
+controlled packages list.
+
+Usage: update-tree [path-to-controlled-packages.cfg] [Zope3-Tree-Path]
+"""
+import os, sys, popen2
+from zope.release import buildout
+
+SVN_TEMPLATE = 'svn://svn.zope.org/repos/main/%s/tags/%s'
+PROPGET_TEMPLATE = 'svn propget svn:externals %s'
+PROPSET_TEMPLATE = 'svn propset svn:externals "%s" %s'
+
+def getZODBSubPackage(package, versions):
+    version = versions['ZODB3']
+    return 'svn://svn.zope.org/repos/main/ZODB/tags/%s/src/%s' %(
+        version, package)
+
+def getTwistedPackage(package, versions):
+    return ('svn://svn.twistedmatrix.com/svn/Twisted/tags/releases/'
+            'twisted-core-2.5.0/twisted')
+
+def getDocutilsPackage(package, versions):
+    return SVN_TEMPLATE %(package, '0.4.0')
+
+SPECIAL_CASES = {
+    'BTrees': getZODBSubPackage,
+    'persistent': getZODBSubPackage,
+    'ThreadedAsync': getZODBSubPackage,
+    'transaction': getZODBSubPackage,
+    'ZEO': getZODBSubPackage,
+    'ZODB': getZODBSubPackage,
+    'twisted': getTwistedPackage,
+    'docutils': getDocutilsPackage,
+    }
+
+def do(cmd):
+    print cmd
+    stdout, stdin = popen2.popen2(cmd)
+    return stdout.read()
+
+def main(args=None):
+    if args is None:
+        args = sys.argv[1:]
+
+    if len(args) < 2:
+        print __file__.__doc__
+        sys.exit(1)
+
+    cp_path = args[0]
+    tree_path = args[1]
+
+    pkg_versions = dict([
+        (pkg, versions[-1])
+        for (pkg, versions, tested) in buildout.getPackagesInfo(cp_path)
+        ])
+
+    for prefix, subpath in (('', ('src',)),
+                            ('zope.', ('src', 'zope')),
+                            ('zope.app.', ('src', 'zope', 'app')),
+                            ):
+        src_path = os.path.join(tree_path, *subpath)
+        packages = [
+            line.split(' ')[0]
+            for line in do(PROPGET_TEMPLATE %src_path).split('\n')
+            if line]
+
+        result = []
+        for pkg in packages:
+            fullpkg = prefix + pkg
+            if fullpkg in SPECIAL_CASES:
+                result.append(
+                    pkg + ' ' + SPECIAL_CASES[fullpkg](pkg, pkg_versions))
+            elif fullpkg in pkg_versions:
+                result.append(
+                    pkg +
+                    ' ' +
+                    SVN_TEMPLATE %(prefix+pkg, pkg_versions[fullpkg]))
+            else:
+                print fullpkg + ' skipped.'
+
+        do(PROPSET_TEMPLATE %('\n'.join(result), src_path))


Property changes on: zope.release/trunk/src/zope/release/tree.py
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the Checkins mailing list