[Checkins] SVN: zope.release/trunk/ The zope.release package is now
mainly maintaining the Zoep KGS in SVN plus contains a
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Nov 17 18:59:57 EST 2007
Log message for revision 81905:
The zope.release package is now mainly maintaining the Zoep KGS in SVN plus contains a
little bit of code to help make Zope 3 releases based on the KGS.
Changed:
_U zope.release/trunk/
U zope.release/trunk/buildout.cfg
U zope.release/trunk/controlled-packages.cfg
U zope.release/trunk/setup.py
U zope.release/trunk/src/zope/release/README.txt
D zope.release/trunk/src/zope/release/buildout.cfg.in
D zope.release/trunk/src/zope/release/buildout.py
D zope.release/trunk/src/zope/release/kgs.py
U zope.release/trunk/src/zope/release/tree.py
D zope.release/trunk/src/zope/release/version.py
-=-
Property changes on: zope.release/trunk
___________________________________________________________________
Name: svn:externals
-
+ zope.kgs svn://svn.zope.org/repos/main/zope.kgs/trunk
Modified: zope.release/trunk/buildout.cfg
===================================================================
--- zope.release/trunk/buildout.cfg 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/buildout.cfg 2007-11-17 23:59:57 UTC (rev 81905)
@@ -1,7 +1,8 @@
[buildout]
-develop = .
+develop = . zope.kgs
index = http://download.zope.org/zope3.4
-parts = test generate-buildout generate-versions upload update-tree
+parts = test upload update-tree
+ generate-buildout generate-versions generate-site
[test]
recipe = zc.recipe.testrunner
@@ -9,25 +10,28 @@
[generate-buildout]
recipe = zc.recipe.egg:scripts
-eggs = zope.release
+eggs = zope.kgs
scripts = generate-buildout
arguments = ('controlled-packages.cfg',
'./test/buildout.cfg')
[generate-versions]
recipe = zc.recipe.egg:scripts
-eggs = zope.release
+eggs = zope.kgs
scripts = generate-versions
arguments = ('controlled-packages.cfg',
'./test/versions.cfg')
+[generate-site]
+recipe = zc.recipe.egg:scripts
+eggs = zope.kgs
+scripts = generate-site
+
[upload]
recipe = zc.recipe.egg:scripts
eggs = zope.release
scripts = upload
-arguments = ('./test/buildout.cfg',
- './test/versions.cfg',
- './controlled-packages.cfg',
+arguments = ('./controlled-packages.cfg',
'download.zope.org:/var/www/download.zope.org/zope3.4',)
[update-tree]
Modified: zope.release/trunk/controlled-packages.cfg
===================================================================
--- zope.release/trunk/controlled-packages.cfg 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/controlled-packages.cfg 2007-11-17 23:59:57 UTC (rev 81905)
@@ -1,6 +1,10 @@
[DEFAULT]
tested=true
+[KGS]
+name = zope
+version = 3.4.0b2
+
[ClientForm]
tested=false
versions = 0.2.7
Modified: zope.release/trunk/setup.py
===================================================================
--- zope.release/trunk/setup.py 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/setup.py 2007-11-17 23:59:57 UTC (rev 81905)
@@ -50,10 +50,9 @@
install_requires=[
'setuptools',
'zc.buildout',
+ 'zope.kgs',
],
entry_points = dict(console_scripts=[
- 'generate-buildout = zope.release.buildout:main',
- 'generate-versions = zope.release.version:main',
'upload = zope.release.upload:main',
'update-tree = zope.release.tree:main',
]),
Modified: zope.release/trunk/src/zope/release/README.txt
===================================================================
--- zope.release/trunk/src/zope/release/README.txt 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/src/zope/release/README.txt 2007-11-17 23:59:57 UTC (rev 81905)
@@ -2,13 +2,11 @@
Zope Release Tools
==================
-This package provides a set of scripts and tools to manage Good-Known-Sets, or
-short KGSs. A KGS is a set of package distributions that are known to work
-well together. You can verify this, for example, by running all the tests of
-all the packages at once.
+This package provides some tools to manage Zope 3 releases. It extends the
+scripts provided by ``zope.kgs`` with Zope-specifc scripts, such as updating
+the Zope 3 source tree and uploading files to the download location.
-Let me show you how a typical controlled packages configuration file looks
-like:
+Here is an examplatory controlled packages configuration file:
>>> import tempfile
>>> cfgFile = tempfile.mktemp('-cp.cfg')
@@ -18,6 +16,7 @@
...
... [KGS]
... name = zope-dev
+ ... version = 1.0.0
...
... [packageA]
... versions = 1.0.0
@@ -32,135 +31,7 @@
... versions = 4.3.1
... ''')
-As you can see, this file uses an INI-style format. The "DEFAULT" section is
-special, as it will insert the specified options into all other sections as
-default. The "KGS" section specifies some global information about the KGS,
-such as the name of the KGS.
-All other sections refer to package names. Currently each package section
-supports two options. The "versions" option lists all versions that are known
-to work in the KGS. Those versions should *always* only be bug fixes to the
-first listed version. The second option, "tested", specifies whether the
-package should be part of the KGS test suite. By default, we want all packages
-to be tested, but some packages require very specific test setups that cannot
-be easily reproduced _[1], so we turn off those tests.
-
-You can also stack controlled package configurations on top of each
-other. Base configurations can be specified using the `extends` option:
-
- >>> import tempfile
- >>> cfgFile2 = tempfile.mktemp('-cp.cfg')
- >>> open(cfgFile2, 'w').write('''\
- ... [DEFAULT]
- ... tested = true
- ...
- ... [KGS]
- ... name = grok-dev
- ... extends = %s
- ...
- ... [packageA]
- ... versions = 1.0.2
- ...
- ... [packageD]
- ... versions = 2.2.3
- ... 2.2.4
- ... ''' %cfgFile)
-
-As you can see, you can completely override another package's version
-specification as well.
-
-Generating the configuration file and managing it is actually the hard
-part. Let's now see what we can do with it.
-
-.. [1]: This is usually due to bugs in setuptools or buildout, such as PYC
-files not containing the correct reference to their PY file.
-
-
-Generate Versions
------------------
-
-One of the easiest scripts, is the version generation. This script will
-generate a "versions" section that is compatible with buildout.
-
- >>> versionsFile = tempfile.mktemp('-versions.cfg')
-
- >>> from zope.release import version
- >>> version.main((cfgFile, versionsFile))
-
- >>> print open(versionsFile, 'r').read()
- [versions]
- packageA = 1.0.1
- packageB = 1.2.3
- packageC = 4.3.1
-
-Let's now ensure that the versions also work for the extended configuration:
-
- >>> versionsFile2 = tempfile.mktemp('-versions.cfg')
-
- >>> from zope.release import version
- >>> version.main((cfgFile2, versionsFile2))
-
- >>> print open(versionsFile2, 'r').read()
- [versions]
- packageA = 1.0.2
- packageB = 1.2.3
- packageC = 4.3.1
- packageD = 2.2.4
-
-
-Generate Buildout
------------------
-
-In order to be able to test the KGS, you can also generate a full buildout
-file that will create and install a testrunner over all packages for you:
-
- >>> buildoutFile = tempfile.mktemp('-buildout.cfg')
-
- >>> from zope.release import buildout
- >>> buildout.main((cfgFile, buildoutFile))
-
- >>> print open(buildoutFile, 'r').read()
- [buildout]
- parts = test
- versions = versions
- <BLANKLINE>
- [test]
- recipe = zc.recipe.testrunner
- eggs = packageA
- packageB
- <BLANKLINE>
- [versions]
- packageA = 1.0.1
- packageB = 1.2.3
- packageC = 4.3.1
- <BLANKLINE>
-
-Let's make sure that the buildout generation also honors the extensions:
-
- >>> buildoutFile2 = tempfile.mktemp('-buildout.cfg')
-
- >>> from zope.release import buildout
- >>> buildout.main((cfgFile2, buildoutFile2))
-
- >>> print open(buildoutFile2, 'r').read()
- [buildout]
- parts = test
- versions = versions
- <BLANKLINE>
- [test]
- recipe = zc.recipe.testrunner
- eggs = packageA
- packageB
- packageD
- <BLANKLINE>
- [versions]
- packageA = 1.0.2
- packageB = 1.2.3
- packageC = 4.3.1
- packageD = 2.2.4
- <BLANKLINE>
-
-
Uploading Files
---------------
@@ -171,19 +42,17 @@
>>> from zope.release import upload
>>> upload.DRY_RUN = True
- >>> upload.main((
- ... cfgFile, versionsFile, buildoutFile,
- ... 'download.zope.org:/zope-dev'
- ... ))
+Usually we only need to upload the controlled packages file, since site script
+of the ``zope.kgs`` package will do the rest for us.
+
+ >>> upload.main((cfgFile, 'download.zope.org:/zope-dev'))
scp ...-cp.cfg download.zope.org:/zope-dev/...-cp.cfg
- scp ...-versions.cfg download.zope.org:/zope-dev/...-versions.cfg
- scp ...-buildout.cfg download.zope.org:/zope-dev/...-buildout.cfg
Updating the Zope 3 Tree
------------------------
-Since we still want to create a Zope 3 source tree release, we need ot be able
+Since we still want to create a Zope 3 source tree release, we need to be able
to update its externals using the information of the controlled packages
file. Since this script is clearly Zope3-specific, we need a new controlled
packages config file that contains actual packages:
@@ -195,7 +64,8 @@
... tested = true
...
... [KGS]
- ... name = zope-dev
+ ... name = zope
+ ... version = dev
...
... [ZODB3]
... versions = 1.0.0
@@ -260,57 +130,3 @@
svn propset svn:externals
"container svn://svn.zope.org/repos/main/zope.app.container/tags/1.3.0/src/zope/app/container" Zope3/src/zope/app
-----
-
-
-Basic Parser API
-----------------
-
-The ``kgs.py`` module provides a simple class that parses the KGS
-configuration file and provides all data in an object-oriented manner.
-
- >>> from zope.release import kgs
-
-The class is simply instnatiated using the path to the config file:
-
- >>> myKGS = kgs.KGS(cfgFile)
- >>> myKGS
- <KGS 'zope-dev'>
-
-The name of the KGS is available via the `name` attribute:
-
- >>> myKGS.name
- 'zope-dev'
-
-The packages are available under `packages`:
-
- >>> myKGS.packages
- [<Package 'packageA'>, <Package 'packageB'>, <Package 'packageC'>]
-
-Each package is also an object:
-
- >>> pkgA = myKGS.packages[0]
- >>> pkgA
- <Package 'packageA'>
-
- >>> pkgA.name
- 'packageA'
- >>> pkgA.versions
- ['1.0.0', '1.0.1']
- >>> pkgA.tested
- True
-
-As we have seen in the scripts above, the KGS class also supports the
-`entends` option. Thus, let's load the KGS for the config file 2:
-
- >>> myKGS2 = kgs.KGS(cfgFile2)
- >>> myKGS2
- <KGS 'grok-dev'>
-
- >>> myKGS2.name
- 'grok-dev'
-
- >>> myKGS2.packages
- [<Package 'packageA'>,
- <Package 'packageB'>,
- <Package 'packageC'>,
- <Package 'packageD'>]
Deleted: zope.release/trunk/src/zope/release/buildout.cfg.in
===================================================================
--- zope.release/trunk/src/zope/release/buildout.cfg.in 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/src/zope/release/buildout.cfg.in 2007-11-17 23:59:57 UTC (rev 81905)
@@ -1,10 +0,0 @@
-[buildout]
-parts = test
-versions = versions
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = %(tested-packages)s
-
-[versions]
-%(versions)s
Deleted: zope.release/trunk/src/zope/release/buildout.py
===================================================================
--- zope.release/trunk/src/zope/release/buildout.py 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/src/zope/release/buildout.py 2007-11-17 23:59:57 UTC (rev 81905)
@@ -1,73 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Generate a ``buildout.cfg`` file from the controlled list of packages.
-
-Usage: generate-buildout package-cfg-path [output-cfg-path]
-
-* ``package-cfg-path``
-
- This is the path to the controlled packages configuration file.
-
-* ``output-cfg-path``
-
- The path of the file under which the generated buildout configuration file
- is stored. By default it is placed in the package configuration file's
- directory under the name 'test-buildout.cfg'.
-
-"""
-import ConfigParser
-import os
-
-from zope.release import kgs
-
-def getVersionsListing(packages):
- """Create a version listing string."""
- return '\n'.join(
- [package.name + ' = ' + package.versions[-1]
- for package in packages])
-
-
-def generateBuildout(packageConfigPath, outputPath):
- """Generate a ``buildout.cfg`` from the list of controlled packages."""
- # Load all package information from the controlled pacakge config file.
- packages = kgs.KGS(packageConfigPath).packages
-
- # Create the data dictionary
- data = {
- 'tested-packages': '\n '.join(
- [package.name for package in packages if package.tested]),
- 'versions': getVersionsListing(packages)
- }
-
- # Write a new buildout.cfg file
- templatePath = os.path.join(os.path.dirname(__file__), 'buildout.cfg.in')
- open(outputPath, 'w').write(open(templatePath, 'r').read() %data)
-
-
-def main(args=None):
- if args is None:
- args = sys.argv[1:]
-
- if len(args) < 1:
- print __file__.__doc__
- sys.exit(1)
-
- packageConfigPath = os.path.abspath(args[0])
-
- outputPath = os.path.join(
- os.path.dirname(packageConfigPath), 'test-buildout.cfg')
- if len(args) == 2:
- outputPath = args[1]
-
- generateBuildout(packageConfigPath, outputPath)
Deleted: zope.release/trunk/src/zope/release/kgs.py
===================================================================
--- zope.release/trunk/src/zope/release/kgs.py 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/src/zope/release/kgs.py 2007-11-17 23:59:57 UTC (rev 81905)
@@ -1,113 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""KGS configuration file parser."""
-import os.path
-import urllib2
-import ConfigParser
-from zc.buildout.buildout import _update, _isurl
-
-MAIN_SECTION = 'KGS'
-EXTENDS_OPTION = 'extends'
-
-def _open(base, filename, seen):
- """Open a configuration file and return the result as a dictionary,
-
- Recursively open other files based on options found.
-
- Note: Shamelessly copied from zc.buildout!
- """
-
- if _isurl(filename):
- fp = urllib2.urlopen(filename)
- base = filename[:filename.rfind('/')]
- elif _isurl(base):
- if os.path.isabs(filename):
- fp = open(filename)
- base = os.path.dirname(filename)
- else:
- filename = base + '/' + filename
- fp = urllib2.urlopen(filename)
- base = filename[:filename.rfind('/')]
- else:
- filename = os.path.join(base, filename)
- fp = open(filename)
- base = os.path.dirname(filename)
-
- if filename in seen:
- raise ValueError("Recursive file include", seen, filename)
-
- seen.append(filename)
-
- result = {}
-
- parser = ConfigParser.RawConfigParser()
- parser.optionxform = lambda s: s
- parser.readfp(fp)
- extends = None
- for section in parser.sections():
- options = dict(parser.items(section))
- if section == MAIN_SECTION:
- extends = options.pop(EXTENDS_OPTION, extends)
- result[section] = options
-
- if extends:
- extends = extends.split()
- extends.reverse()
- for fname in extends:
- result = _update(_open(base, fname, seen), result)
-
- seen.pop()
- return result
-
-
-class Package(object):
-
- def __init__(self, name, versions, tested):
- self.name = name
- self.versions = versions
- self.tested = tested
-
- def __repr__(self):
- return '<%s %r>' %(self.__class__.__name__, self.name)
-
-
-class KGS(object):
-
- name = u''
- packages = ()
-
- def __init__(self, path):
- self.path = path
- self._extract()
-
- def _extract(self):
- result = _open(os.path.dirname(self.path), self.path, [])
- if MAIN_SECTION in result:
- self.name = result[MAIN_SECTION].get('name', u'')
- del result[MAIN_SECTION]
- self.packages = []
- sections = result.keys()
- sections.sort()
- for section in sections:
- self.packages.append(
- Package(section,
- result[section]['versions'].split(),
- ConfigParser.ConfigParser._boolean_states[
- result[section]['tested']]
- )
- )
-
- def __repr__(self):
- return '<%s %r>' %(self.__class__.__name__, self.name)
-
Modified: zope.release/trunk/src/zope/release/tree.py
===================================================================
--- zope.release/trunk/src/zope/release/tree.py 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/src/zope/release/tree.py 2007-11-17 23:59:57 UTC (rev 81905)
@@ -17,7 +17,7 @@
Usage: update-tree [path-to-controlled-packages.cfg] [Zope3-Tree-Path]
"""
import os, sys, popen2
-from zope.release import kgs
+from zope.kgs import kgs
SVN_TEMPLATE = 'svn://svn.zope.org/repos/main/%s/tags/%s/%s'
PROPGET_TEMPLATE = 'svn propget svn:externals %s'
Deleted: zope.release/trunk/src/zope/release/version.py
===================================================================
--- zope.release/trunk/src/zope/release/version.py 2007-11-17 23:40:20 UTC (rev 81904)
+++ zope.release/trunk/src/zope/release/version.py 2007-11-17 23:59:57 UTC (rev 81905)
@@ -1,62 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Generate a ``latest-versions.cfg`` file from the controlled list of
-packages.
-
-This file can
-
-Usage: generate-buildout package-cfg-path [output-cfg-path]
-
-* ``package-cfg-path``
-
- This is the path to the controlled packages configuration file.
-
-* ``output-cfg-path``
-
- The path of the file under which the generated buildout configuration file
- is stored. By default it is placed in the package configuration file's
- directory under the name 'latest-versions.cfg'.
-
-"""
-import os
-
-from zope.release import buildout, kgs
-
-def generateVersions(packageConfigPath, outputPath):
- """Generate a ``buildout.cfg`` from the list of controlled packages."""
- # Load all package information from the controlled pacakge config file.
- packages = kgs.KGS(packageConfigPath).packages
-
- # Write a new versions.cfg file
- open(outputPath, 'w').write(
- '[versions]\n' +
- buildout.getVersionsListing(packages))
-
-
-def main(args=None):
- if args is None:
- args = sys.argv[1:]
-
- if len(args) < 1:
- print __file__.__doc__
- sys.exit(1)
-
- packageConfigPath = os.path.abspath(args[0])
-
- outputPath = os.path.join(
- os.path.dirname(packageConfigPath), 'latest-versions.cfg')
- if len(args) == 2:
- outputPath = args[1]
-
- generateVersions(packageConfigPath, outputPath)
More information about the Checkins
mailing list