Author: hwright
Date: Fri Jun 17 13:07:26 2011
New Revision: 1136869

URL: http://svn.apache.org/viewvc?rev=1136869&view=rev
Log:
release.py: Add a new subcommand which moves the generated tarballs to a
web directory.

* tools/dist/sample-rc-warning-index.html:
  Moved to ...

* tools/dist/templates/stable-candidates.ezt:
  ... here.

* tools/dist/templates/rc-candidates.ezt:
  New.

* tools/dist/release.py
  Import ezt.
  (get_tmpldir): New.
  (post_candidates): New.
  (main): Parse arguments for the new target.

Added:
    subversion/trunk/tools/dist/templates/
    subversion/trunk/tools/dist/templates/rc-candidates.ezt
    subversion/trunk/tools/dist/templates/stable-candidates.ezt
      - copied, changed from r1136847, 
subversion/trunk/tools/dist/sample-rc-warning-index.html
Removed:
    subversion/trunk/tools/dist/sample-rc-warning-index.html
Modified:
    subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/release.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1136869&r1=1136868&r2=1136869&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Fri Jun 17 13:07:26 2011
@@ -45,6 +45,16 @@ import logging
 import subprocess
 import argparse       # standard in Python 2.7
 
+# Find ezt, using Subversion's copy, if there isn't one on the system.
+try:
+    import ezt
+except ImportError:
+    ezt_path = os.path.dirname(os.path.dirname(os.path.abspath(sys.path[0])))
+    ezt_path = os.path.join(ezt_path, 'build', 'generator')
+    sys.path.append(ezt_path)
+
+    import ezt
+
 
 # Our required / recommended versions
 autoconf_ver = '2.68'
@@ -67,6 +77,9 @@ def get_tempdir(base_dir):
 def get_deploydir(base_dir):
     return os.path.join(base_dir, 'deploy')
 
+def get_tmpldir():
+    return os.path.join(os.path.abspath(sys.path[0]), 'templates')
+
 def get_nullfile():
     # This is certainly not cross platform
     return open('/dev/null', 'w')
@@ -316,6 +329,39 @@ def roll_tarballs(base_dir, args):
     # And we're done!
 
 
+#----------------------------------------------------------------------
+# Post the candidate release artifacts
+
+def post_candidates(base_dir, args):
+    'Post the generated tarballs to web-accessible directory.'
+    version_base = args.version.split('-')[0]
+    version_extra = args.version.split('-')[1]
+
+    if args.target:
+        target = args.target
+    else:
+        target = os.path.join(os.getenv('HOME'), 'public_html', 'svn',
+                              args.version)
+
+    logging.info('Moving tarballs to %s' % target)
+    if not os.path.exists(target):
+        os.makedirs(target)
+
+    data = { 'version'      : args.version,
+             'revnum'       : 0,
+             'dirname'      : 'deploy',
+           }
+
+    template = ezt.Template(os.path.join(get_tmpldir(), 'rc-candidates.ezt'))
+    template.generate(open(os.path.join(target, 'index.html'), 'w'), data)
+
+    shutil.copytree(get_deploydir(base_dir), os.path.join(target, 'deploy'))
+
+
+
+#----------------------------------------------------------------------
+# Write announcements
+
 def announce(base_dir, args):
     'Write the release announcement.'
 
@@ -363,6 +409,17 @@ def main():
     subparser.add_argument('--branch',
                     help='''The branch to base the release on.''')
 
+    # Setup the parser for the post-candidates subcommand
+    subparser = subparsers.add_parser('post-candidates',
+                    help='''Build the website to host the candidate tarballs.
+                            The default location is somewhere in ~/public_html.
+                            ''')
+    subparser.set_defaults(func=post_candidates)
+    subparser.add_argument('version',
+                    help='''The release label, such as '1.7.0-alpha1'.''')
+    subparser.add_argument('--target',
+                    help='''The full path to the destination.''')
+
     # A meta-target
     subparser = subparsers.add_parser('clean',
                     help='''The same as the '--clean' switch, but as a

Added: subversion/trunk/tools/dist/templates/rc-candidates.ezt
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/templates/rc-candidates.ezt?rev=1136869&view=auto
==============================================================================
--- subversion/trunk/tools/dist/templates/rc-candidates.ezt (added)
+++ subversion/trunk/tools/dist/templates/rc-candidates.ezt Fri Jun 17 13:07:26 
2011
@@ -0,0 +1,63 @@
+<!--
+
+ 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.
+
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html>
+<head>
+<title>Apache Subversion [version] tarballs</title>
+</head>
+<body style="font-size: 14pt; text-align: justify;
+  background-color: #f0f0f0; padding: 0 5%">
+<h1 style="font-size: 30pt; text-align: center;
+  text-decoration: underline">WARNING</h1>
+
+<p>The code you are about to download is a <i>Release Candidate</i>
+for Apache Subversion [version] (r[revnum]).</p>
+
+<p>These are candidate tarballs for a pre-release version of Subversion.  As
+such, they are likely to contain bugs, some known, others unknown.  You
+are welcome and encouraged to test this release, and
+<a href="http://subversion.apache.org/docs/community-guide/issues.html";>report
+bugs</a> back to the developers, but please keep in mind that this is
+not a final release of Apache Subversion.</p>
+
+<p>If you are looking for a copy of Subversion for production use, this
+is <i>not it</i>; you should instead grab the latest stable release
+from the <a
+href="http://subversion.apache.org/download/";>Download area</a>.</p>
+
+<h2 style="font-size: 18pt">Note to operating system distro package
+maintainers</h2>
+
+<p>As stated above, this is <i>not</i> an official, end-user release
+of Subversion.  It is a distribution intended for testing only, and has not
+been publicly announced.  When it has been announced, it still won't be
+suitable for production use.  If you chose to package this pre-release for
+your operating system distro's management system, you must do so in a way which
+clearly denotes that this is not the final release, and is only for testing
+purposes.  And please don't do so until it has been publicly announced.</p>
+
+<p>If you want to help us test this distribution of Subversion, you
+can find the files <a href="[dirname]/">here</a>.</p>
+
+</body>
+</html>

Copied: subversion/trunk/tools/dist/templates/stable-candidates.ezt (from 
r1136847, subversion/trunk/tools/dist/sample-rc-warning-index.html)
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/templates/stable-candidates.ezt?p2=subversion/trunk/tools/dist/templates/stable-candidates.ezt&p1=subversion/trunk/tools/dist/sample-rc-warning-index.html&r1=1136847&r2=1136869&rev=1136869&view=diff
==============================================================================
--- subversion/trunk/tools/dist/sample-rc-warning-index.html (original)
+++ subversion/trunk/tools/dist/templates/stable-candidates.ezt Fri Jun 17 
13:07:26 2011
@@ -23,7 +23,7 @@
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <html>
 <head>
-<title>Subversion @VERSION@ tarballs</title>
+<title>Apache Subversion [version] tarballs</title>
 </head>
 <body style="font-size: 14pt; text-align: justify;
   background-color: #f0f0f0; padding: 0 5%">
@@ -31,7 +31,7 @@
   text-decoration: underline">WARNING</h1>
 
 <p>The code you are about to download is a <i>Release Candidate</i>
-for Subversion @VERSION@.</p>
+for Apache Subversion [version] (r[revnum]).</p>
 
 
 <p>A <i>Release Candidate</i> is exactly what it sounds like: a
@@ -91,7 +91,7 @@ reputation as a packager and Subversion'
 but only one will deserve it.</p>
 
 <p>If you want to help us test this distribution of Subversion, you
-can find the files <a href="@DIRNAME@/">here</a>.</p>
+can find the files <a href="[dirname]/">here</a>.</p>
 
 </body>
 </html>


Reply via email to