Author: hwright
Date: Sat Jun 11 00:14:03 2011
New Revision: 1134489
URL: http://svn.apache.org/viewvc?rev=1134489&view=rev
Log:
The first bits of a script to handle releases. This is far from finished,
but should eventually supplant construct-rolling-environment.sh, dist.sh,
roll.sh, getsigs.py, and a whole host of other manual steps.
Improvements welcomed.
* tools/dist/release.py:
New.
Added:
subversion/trunk/tools/dist/release.py (with props)
Added: subversion/trunk/tools/dist/release.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1134489&view=auto
==============================================================================
--- subversion/trunk/tools/dist/release.py (added)
+++ subversion/trunk/tools/dist/release.py Sat Jun 11 00:14:03 2011
@@ -0,0 +1,136 @@
+#!/usr/bin/env python
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+# About this script:
+# This script is intended to simplify creating Subversion releases, by
+# automating as much as is possible. It works well with our Apache
+# infrastructure, and should make rolling, posting, and announcing
+# releases dirt simple.
+#
+# This script may be run on a number of platforms, but it is intended to
+# be run on people.apache.org. As such, it may have dependencies (such
+# as Python version) which may not be common, but are guaranteed to be
+# available on people.apache.org.
+
+
+# Stuff we need
+import os
+import sys
+import shutil
+import urllib2
+import argparse # standard in Python 2.7
+
+
+def get_prefix(base_dir):
+ return os.path.join(base_dir, 'prefix')
+
+def get_tempdir(base_dir):
+ return os.path.join(base_dir, 'tempdir')
+
+
+def cleanup(base_dir):
+ 'Remove generated files and folders.'
+
+ shutil.rmtree(get_prefix(base_dir), True)
+ shutil.rmtree(get_tempdir(base_dir), True)
+
+
+def build_env(base_dir, args):
+ 'Download prerequisites for a release and prepare the environment.'
+
+ # Versions of our environment
+ params = { 'autoconf' : 'autoconf-2.68',
+ 'libtool' : 'libtool-2.4',
+ 'swig' : 'swig-2.0.4',
+ 'sf_mirror' : args.sf_mirror,
+ }
+
+ prefix = get_prefix(base_dir)
+ if os.path.exists(prefix):
+ raise RuntimeError("Directory exists: '%s'" % prefix)
+ os.mkdir(prefix)
+
+ tempdir = get_tempdir(base_dir)
+ if os.path.exists(tempdir):
+ raise RuntimeError("Directory exists: '%s'" % tempdir)
+ os.mkdir(tempdir)
+
+ objects = { 'autoconf' :
'http://ftp.gnu.org/gnu/autoconf/%(autoconf)s.tar.gz',
+ 'libtool' :
'http://ftp.gnu.org/gnu/libtool/%(libtool)s.tar.gz',
+ 'swig' :
'http://sourceforge.net/projects/swig/files/swig/%(swig)s/%(swig)s.tar.gz/download?use_mirror=%(sf_mirror)s'
+ }
+
+ # Grab each of the prerequisite tarballs
+ for key, value in objects.items():
+ url = value % params
+ response = urllib2.urlopen(url)
+ target = open(os.path.join(get_tempdir(base_dir), key + '.tar.gz'),
'w')
+ target.write(response.read())
+
+
+def roll_tarballs(base_dir, args):
+ 'Create the release artifacts.'
+
+
+def announce(base_dir, args):
+ 'Write the release announcement.'
+
+
+def main():
+ 'Parse arguments, and drive the appropriate subcommand.'
+
+ # Setup our main parser
+ parser = argparse.ArgumentParser(
+ description='Create an Apache Subversion release.')
+ parser.add_argument('--clean', action='store_true', default=False,
+ help='Remove any directories previously created by
%(prog)s')
+ parser.add_argument('--base-dir', default=os.getcwd(),
+ help='''The directory in which to create needed files and
+ folders. The default is the current working
+ directory.''')
+ subparsers = parser.add_subparsers(title='subcommands')
+
+ # Setup the parser for the build-env subcommand
+ build_env_parser = subparsers.add_parser('build-env',
+ help='''Download release prerequisistes, including
autoconf,
+ libtool, and swig.''')
+ build_env_parser.set_defaults(func=build_env)
+ build_env_parser.add_argument('--sf-mirror', default='softlayer',
+ help='''The mirror to use for downloading files from
+ SourceForge. If in the EU, you may want to use
+ 'kent' for this value.''')
+
+ # Parse the arguments
+ args = parser.parse_args()
+
+ # first, process any global operations
+ if args.clean:
+ cleanup(args.base_dir)
+
+ sys.path.append(os.path.join(get_prefix(args.base_dir), 'bin'))
+
+ # finally, run the subcommand, and give it the parsed arguments
+ args.func(args.base_dir, args)
+
+
+if __name__ == '__main__':
+ main()
Propchange: subversion/trunk/tools/dist/release.py
------------------------------------------------------------------------------
svn:executable = *