[svnbook] r3984 committed - * branches/1.0/tools/build-nightlies,...
svnbook at googlecode.com
svnbook at googlecode.com
Thu Aug 11 11:05:48 CDT 2011
Revision: 3984
Author: cmpilato at gmail.com
Date: Thu Aug 11 09:00:16 2011
Log: * branches/1.0/tools/build-nightlies,
* branches/1.1/tools/build-nightlies,
* branches/1.2/tools/build-nightlies,
* branches/1.4/tools/build-nightlies,
* branches/1.5/tools/build-nightlies,
* branches/1.6/tools/build-nightlies
Remove as unused.
http://code.google.com/p/svnbook/source/detail?r=3984
Deleted:
/branches/1.0/tools/build-nightlies
/branches/1.1/tools/build-nightlies
/branches/1.2/tools/build-nightlies
/branches/1.4/tools/build-nightlies
/branches/1.5/tools/build-nightlies
/branches/1.6/tools/build-nightlies
=======================================
--- /branches/1.0/tools/build-nightlies Fri Jul 2 05:23:07 2010
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/python
-# vim:sw=4
-
-import sys
-import os
-import shutil
-import time
-import subprocess
-import traceback
-
-SKIP_LOCALES = ()
-SKIP_PDF_LOCALES = ('ru', 'zh')
-MAIL_DESTINATION = "svnbook-dev at red-bean.com"
-MAIL_SENDER = "svnbook-build-daemon at red-bean.com"
-MAIL_SENDER_NAME = "Svnbook Build Daemon"
-DROPSPOT_URL = "http://svnbook.red-bean.com/nightly"
-
-
-def format_duration(seconds):
- seconds = int(seconds)
- hours = seconds / 3600
- minutes = seconds % 3600 / 60
- seconds = seconds % 60
- return ((hours and "%dh " % hours or "")
- + (minutes and "%dm " % minutes or "")
- + "%ds" % seconds)
-
-
-def sendmail(subject, body):
- try:
- p = subprocess.Popen(
- ['/usr/sbin/sendmail', '-f', MAIL_SENDER,
MAIL_DESTINATION],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
-
- p.stdin.write("Subject: %s\n" % subject)
- p.stdin.write("To: %s\n" % MAIL_DESTINATION)
- p.stdin.write("From: %s <%s>\n" % (MAIL_SENDER_NAME, MAIL_SENDER))
- p.stdin.write("\n")
- p.stdin.write(body)
- p.stdin.close()
- output = p.stdout.read()
- status = p.wait()
- if len(output) or status:
- sys.stderr.write("MTA output when sending email (%s):\n" %
subject)
- sys.stderr.write(output)
- sys.stderr.write("Exit status %d" % status)
- except IOError:
- etype, value, tb = sys.exc_info()
- sys.stderr.write("Failed sending email (%s):\n" % subject)
- traceback.print_exception(etype, value, tb)
- sys.stderr.write("\n")
- sys.stderr.write("Email body:\n")
- sys.stderr.write(body)
-
-
-if len(sys.argv) < 3:
- sys.stderr.write("""Usage: %s SRC-DIR TGT-DIR [--dryrun]
-
-Crawl SRC-DIR looking for book translations, building distributions of
-them, and exploding those distributions into TGT-DIR.
-""" % (os.path.basename(sys.argv[0])))
- sys.exit(1)
-
-BOOKSRC = os.path.abspath(sys.argv[1])
-DROPSPOT = os.path.abspath(sys.argv[2])
-DRYRUN = (len(sys.argv) > 3)
-
-# Update the working copy
-if DRYRUN:
- print "SVN-Update: %s" % BOOKSRC
-else:
- os.system('svn up -q ' + BOOKSRC)
-
-# Timestamp
-build_begin_time = time.time()
-
-# Find translations
-locales = []
-built_locales = []
-kids = os.listdir(BOOKSRC)
-for kid in kids:
- full_path = os.path.join(BOOKSRC, kid)
- if os.path.isfile(full_path):
- continue
- if os.path.exists(os.path.join(full_path, 'Makefile')):
- locales.append(kid)
-
-# Build the locales
-for i in SKIP_LOCALES:
- try:
- locales.remove(i)
- except ValueError:
- pass
-locales.sort()
-cwd = os.getcwd()
-for locale in locales:
- # Calculate some paths
- locale_dir = os.path.join(BOOKSRC, locale)
- temp_dir = os.path.join(locale_dir, '__TEMPINSTALL__')
- build_log = os.path.join(DROPSPOT, 'nightly-build.%s.log' % (locale))
- dropspot_locale_path = os.path.join(DROPSPOT, locale)
-
- # Figger out which book formats to build
- book_formats = ['html',
- 'html-chunk',
- 'html-arch',
- 'html-chunk-arch',
- 'pdf',
- ]
- if locale in SKIP_PDF_LOCALES:
- book_formats.remove('pdf')
-
- try:
- # Build
- make_cmd =
(['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
- + map(lambda x: 'install-%s' % x, book_formats))
- if os.path.isdir(temp_dir):
- if DRYRUN:
- print "Erase: %s" % (temp_dir)
- else:
- shutil.rmtree(temp_dir)
- os.chdir(locale_dir)
- try:
- if DRYRUN:
- print "Run: %s" % (make_cmd)
- else:
- p = subprocess.Popen(make_cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- logfp = open(build_log, 'w', 1)
- while 1:
- data = p.stdout.readline()
- if not data: break
- logfp.write(data)
- exitcode = p.wait()
- if exitcode:
- raise RuntimeError("make exited with error %d" %
exitcode)
- finally:
- os.chdir(cwd)
-
- # Move stuff into place.
- if os.path.isdir(dropspot_locale_path):
- if DRYRUN:
- print "Erase: %s" % (dropspot_locale_path)
- else:
- shutil.rmtree(dropspot_locale_path)
- if DRYRUN:
- print "Move into place: %s -> %s" % (temp_dir,
dropspot_locale_path)
- else:
- os.rename(temp_dir, dropspot_locale_path)
- built_locales.append(locale)
- except:
- if DRYRUN:
- print "Send failure email: %s" % (locale)
- else:
- sendmail("Nightly Build Failure Alert: '%s'" % locale,
- "The nightly svnbook build for the '%s' locale\n"
- "has failed. Please investigate.\n"
- "\n"
- "%s/nightly-build.%s.log\n"
- "\n"
- "-- The Svnbook Build Daemon.\n"
- % (locale, DROPSPOT_URL, locale))
-
-# Timestamp
-build_end_time = time.time()
-
-# Write out index.html
-if DRYRUN:
- print "Write index.html:"
- fp = sys.stdout
-else:
- fp = open(os.path.join(DROPSPOT, 'index.html'), 'w')
-
-fp.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Version Control with Subversion - Nightly Builds</title>
-<style type="text/css">
-h1, h2, h3 { margin: 0 }
-dl { margin-left: 3em }
-</style>
-</head>
-<body>
-<h1><i>Version Control with Subversion</i></h1>
-<h2>Automated Nightly Book Builds</h2>
-<h3>Last Build Completed At: %s GMT</h3>
-<h3>Last Build Duration: %s</h3>
-<dl>
-""" % (time.asctime(time.gmtime(build_end_time)),
- format_duration(build_end_time - build_begin_time)))
-for locale in locales:
- fp.write("<dt>%s</dt>" % (locale.upper()))
- if locale in built_locales:
- fp.write("""
-<dd>[<a href="%s/svn-book.html">single-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/index.html">multi-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/svn-book-html.tar.bz2">single-page HTML
(in .tar.bz2)</a>]</dd>
-<dd>[<a href="%s/svn-book-html-chunk.tar.bz2">multi-page HTML
(in .tar.bz2)</a>]</dd>
-""" % (locale, locale, locale, locale))
- if locale not in SKIP_PDF_LOCALES:
- fp.write('<dd>[<a href="%s/svn-book.pdf">PDF</a>]</dd>\n' %
locale)
- else:
- fp.write("""
-<dd><em>Uh-oh! No nightly build for this locale.
- (See <a href="nightly-build.%s.log">build log</a>.)</em></dd>
-""" % (locale))
-fp.write("""
-</dl>
-</body>
-</html>
-""")
=======================================
--- /branches/1.1/tools/build-nightlies Fri Jul 2 05:23:07 2010
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/python
-# vim:sw=4
-
-import sys
-import os
-import shutil
-import time
-import subprocess
-import traceback
-
-SKIP_LOCALES = ()
-SKIP_PDF_LOCALES = ('ru', 'zh')
-MAIL_DESTINATION = "svnbook-dev at red-bean.com"
-MAIL_SENDER = "svnbook-build-daemon at red-bean.com"
-MAIL_SENDER_NAME = "Svnbook Build Daemon"
-DROPSPOT_URL = "http://svnbook.red-bean.com/nightly"
-
-
-def format_duration(seconds):
- seconds = int(seconds)
- hours = seconds / 3600
- minutes = seconds % 3600 / 60
- seconds = seconds % 60
- return ((hours and "%dh " % hours or "")
- + (minutes and "%dm " % minutes or "")
- + "%ds" % seconds)
-
-
-def sendmail(subject, body):
- try:
- p = subprocess.Popen(
- ['/usr/sbin/sendmail', '-f', MAIL_SENDER,
MAIL_DESTINATION],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
-
- p.stdin.write("Subject: %s\n" % subject)
- p.stdin.write("To: %s\n" % MAIL_DESTINATION)
- p.stdin.write("From: %s <%s>\n" % (MAIL_SENDER_NAME, MAIL_SENDER))
- p.stdin.write("\n")
- p.stdin.write(body)
- p.stdin.close()
- output = p.stdout.read()
- status = p.wait()
- if len(output) or status:
- sys.stderr.write("MTA output when sending email (%s):\n" %
subject)
- sys.stderr.write(output)
- sys.stderr.write("Exit status %d" % status)
- except IOError:
- etype, value, tb = sys.exc_info()
- sys.stderr.write("Failed sending email (%s):\n" % subject)
- traceback.print_exception(etype, value, tb)
- sys.stderr.write("\n")
- sys.stderr.write("Email body:\n")
- sys.stderr.write(body)
-
-
-if len(sys.argv) < 3:
- sys.stderr.write("""Usage: %s SRC-DIR TGT-DIR [--dryrun]
-
-Crawl SRC-DIR looking for book translations, building distributions of
-them, and exploding those distributions into TGT-DIR.
-""" % (os.path.basename(sys.argv[0])))
- sys.exit(1)
-
-BOOKSRC = os.path.abspath(sys.argv[1])
-DROPSPOT = os.path.abspath(sys.argv[2])
-DRYRUN = (len(sys.argv) > 3)
-
-# Update the working copy
-if DRYRUN:
- print "SVN-Update: %s" % BOOKSRC
-else:
- os.system('svn up -q ' + BOOKSRC)
-
-# Timestamp
-build_begin_time = time.time()
-
-# Find translations
-locales = []
-built_locales = []
-kids = os.listdir(BOOKSRC)
-for kid in kids:
- full_path = os.path.join(BOOKSRC, kid)
- if os.path.isfile(full_path):
- continue
- if os.path.exists(os.path.join(full_path, 'Makefile')):
- locales.append(kid)
-
-# Build the locales
-for i in SKIP_LOCALES:
- try:
- locales.remove(i)
- except ValueError:
- pass
-locales.sort()
-cwd = os.getcwd()
-for locale in locales:
- # Calculate some paths
- locale_dir = os.path.join(BOOKSRC, locale)
- temp_dir = os.path.join(locale_dir, '__TEMPINSTALL__')
- build_log = os.path.join(DROPSPOT, 'nightly-build.%s.log' % (locale))
- dropspot_locale_path = os.path.join(DROPSPOT, locale)
-
- # Figger out which book formats to build
- book_formats = ['html',
- 'html-chunk',
- 'html-arch',
- 'html-chunk-arch',
- 'pdf',
- ]
- if locale in SKIP_PDF_LOCALES:
- book_formats.remove('pdf')
-
- try:
- # Build
- make_cmd =
(['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
- + map(lambda x: 'install-%s' % x, book_formats))
- if os.path.isdir(temp_dir):
- if DRYRUN:
- print "Erase: %s" % (temp_dir)
- else:
- shutil.rmtree(temp_dir)
- os.chdir(locale_dir)
- try:
- if DRYRUN:
- print "Run: %s" % (make_cmd)
- else:
- p = subprocess.Popen(make_cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- logfp = open(build_log, 'w', 1)
- while 1:
- data = p.stdout.readline()
- if not data: break
- logfp.write(data)
- exitcode = p.wait()
- if exitcode:
- raise RuntimeError("make exited with error %d" %
exitcode)
- finally:
- os.chdir(cwd)
-
- # Move stuff into place.
- if os.path.isdir(dropspot_locale_path):
- if DRYRUN:
- print "Erase: %s" % (dropspot_locale_path)
- else:
- shutil.rmtree(dropspot_locale_path)
- if DRYRUN:
- print "Move into place: %s -> %s" % (temp_dir,
dropspot_locale_path)
- else:
- os.rename(temp_dir, dropspot_locale_path)
- built_locales.append(locale)
- except:
- if DRYRUN:
- print "Send failure email: %s" % (locale)
- else:
- sendmail("Nightly Build Failure Alert: '%s'" % locale,
- "The nightly svnbook build for the '%s' locale\n"
- "has failed. Please investigate.\n"
- "\n"
- "%s/nightly-build.%s.log\n"
- "\n"
- "-- The Svnbook Build Daemon.\n"
- % (locale, DROPSPOT_URL, locale))
-
-# Timestamp
-build_end_time = time.time()
-
-# Write out index.html
-if DRYRUN:
- print "Write index.html:"
- fp = sys.stdout
-else:
- fp = open(os.path.join(DROPSPOT, 'index.html'), 'w')
-
-fp.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Version Control with Subversion - Nightly Builds</title>
-<style type="text/css">
-h1, h2, h3 { margin: 0 }
-dl { margin-left: 3em }
-</style>
-</head>
-<body>
-<h1><i>Version Control with Subversion</i></h1>
-<h2>Automated Nightly Book Builds</h2>
-<h3>Last Build Completed At: %s GMT</h3>
-<h3>Last Build Duration: %s</h3>
-<dl>
-""" % (time.asctime(time.gmtime(build_end_time)),
- format_duration(build_end_time - build_begin_time)))
-for locale in locales:
- fp.write("<dt>%s</dt>" % (locale.upper()))
- if locale in built_locales:
- fp.write("""
-<dd>[<a href="%s/svn-book.html">single-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/index.html">multi-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/svn-book-html.tar.bz2">single-page HTML
(in .tar.bz2)</a>]</dd>
-<dd>[<a href="%s/svn-book-html-chunk.tar.bz2">multi-page HTML
(in .tar.bz2)</a>]</dd>
-""" % (locale, locale, locale, locale))
- if locale not in SKIP_PDF_LOCALES:
- fp.write('<dd>[<a href="%s/svn-book.pdf">PDF</a>]</dd>\n' %
locale)
- else:
- fp.write("""
-<dd><em>Uh-oh! No nightly build for this locale.
- (See <a href="nightly-build.%s.log">build log</a>.)</em></dd>
-""" % (locale))
-fp.write("""
-</dl>
-</body>
-</html>
-""")
=======================================
--- /branches/1.2/tools/build-nightlies Fri Jul 2 05:23:07 2010
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/python
-# vim:sw=4
-
-import sys
-import os
-import shutil
-import time
-import subprocess
-import traceback
-
-SKIP_LOCALES = ()
-SKIP_PDF_LOCALES = ('ru', 'zh')
-MAIL_DESTINATION = "svnbook-dev at red-bean.com"
-MAIL_SENDER = "svnbook-build-daemon at red-bean.com"
-MAIL_SENDER_NAME = "Svnbook Build Daemon"
-DROPSPOT_URL = "http://svnbook.red-bean.com/nightly"
-
-
-def format_duration(seconds):
- seconds = int(seconds)
- hours = seconds / 3600
- minutes = seconds % 3600 / 60
- seconds = seconds % 60
- return ((hours and "%dh " % hours or "")
- + (minutes and "%dm " % minutes or "")
- + "%ds" % seconds)
-
-
-def sendmail(subject, body):
- try:
- p = subprocess.Popen(
- ['/usr/sbin/sendmail', '-f', MAIL_SENDER,
MAIL_DESTINATION],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
-
- p.stdin.write("Subject: %s\n" % subject)
- p.stdin.write("To: %s\n" % MAIL_DESTINATION)
- p.stdin.write("From: %s <%s>\n" % (MAIL_SENDER_NAME, MAIL_SENDER))
- p.stdin.write("\n")
- p.stdin.write(body)
- p.stdin.close()
- output = p.stdout.read()
- status = p.wait()
- if len(output) or status:
- sys.stderr.write("MTA output when sending email (%s):\n" %
subject)
- sys.stderr.write(output)
- sys.stderr.write("Exit status %d" % status)
- except IOError:
- etype, value, tb = sys.exc_info()
- sys.stderr.write("Failed sending email (%s):\n" % subject)
- traceback.print_exception(etype, value, tb)
- sys.stderr.write("\n")
- sys.stderr.write("Email body:\n")
- sys.stderr.write(body)
-
-
-if len(sys.argv) < 3:
- sys.stderr.write("""Usage: %s SRC-DIR TGT-DIR [--dryrun]
-
-Crawl SRC-DIR looking for book translations, building distributions of
-them, and exploding those distributions into TGT-DIR.
-""" % (os.path.basename(sys.argv[0])))
- sys.exit(1)
-
-BOOKSRC = os.path.abspath(sys.argv[1])
-DROPSPOT = os.path.abspath(sys.argv[2])
-DRYRUN = (len(sys.argv) > 3)
-
-# Update the working copy
-if DRYRUN:
- print "SVN-Update: %s" % BOOKSRC
-else:
- os.system('svn up -q ' + BOOKSRC)
-
-# Timestamp
-build_begin_time = time.time()
-
-# Find translations
-locales = []
-built_locales = []
-kids = os.listdir(BOOKSRC)
-for kid in kids:
- full_path = os.path.join(BOOKSRC, kid)
- if os.path.isfile(full_path):
- continue
- if os.path.exists(os.path.join(full_path, 'Makefile')):
- locales.append(kid)
-
-# Build the locales
-for i in SKIP_LOCALES:
- try:
- locales.remove(i)
- except ValueError:
- pass
-locales.sort()
-cwd = os.getcwd()
-for locale in locales:
- # Calculate some paths
- locale_dir = os.path.join(BOOKSRC, locale)
- temp_dir = os.path.join(locale_dir, '__TEMPINSTALL__')
- build_log = os.path.join(DROPSPOT, 'nightly-build.%s.log' % (locale))
- dropspot_locale_path = os.path.join(DROPSPOT, locale)
-
- # Figger out which book formats to build
- book_formats = ['html',
- 'html-chunk',
- 'html-arch',
- 'html-chunk-arch',
- 'pdf',
- ]
- if locale in SKIP_PDF_LOCALES:
- book_formats.remove('pdf')
-
- try:
- # Build
- make_cmd =
(['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
- + map(lambda x: 'install-%s' % x, book_formats))
- if os.path.isdir(temp_dir):
- if DRYRUN:
- print "Erase: %s" % (temp_dir)
- else:
- shutil.rmtree(temp_dir)
- os.chdir(locale_dir)
- try:
- if DRYRUN:
- print "Run: %s" % (make_cmd)
- else:
- p = subprocess.Popen(make_cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- logfp = open(build_log, 'w', 1)
- while 1:
- data = p.stdout.readline()
- if not data: break
- logfp.write(data)
- exitcode = p.wait()
- if exitcode:
- raise RuntimeError("make exited with error %d" %
exitcode)
- finally:
- os.chdir(cwd)
-
- # Move stuff into place.
- if os.path.isdir(dropspot_locale_path):
- if DRYRUN:
- print "Erase: %s" % (dropspot_locale_path)
- else:
- shutil.rmtree(dropspot_locale_path)
- if DRYRUN:
- print "Move into place: %s -> %s" % (temp_dir,
dropspot_locale_path)
- else:
- os.rename(temp_dir, dropspot_locale_path)
- built_locales.append(locale)
- except:
- if DRYRUN:
- print "Send failure email: %s" % (locale)
- else:
- sendmail("Nightly Build Failure Alert: '%s'" % locale,
- "The nightly svnbook build for the '%s' locale\n"
- "has failed. Please investigate.\n"
- "\n"
- "%s/nightly-build.%s.log\n"
- "\n"
- "-- The Svnbook Build Daemon.\n"
- % (locale, DROPSPOT_URL, locale))
-
-# Timestamp
-build_end_time = time.time()
-
-# Write out index.html
-if DRYRUN:
- print "Write index.html:"
- fp = sys.stdout
-else:
- fp = open(os.path.join(DROPSPOT, 'index.html'), 'w')
-
-fp.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Version Control with Subversion - Nightly Builds</title>
-<style type="text/css">
-h1, h2, h3 { margin: 0 }
-dl { margin-left: 3em }
-</style>
-</head>
-<body>
-<h1><i>Version Control with Subversion</i></h1>
-<h2>Automated Nightly Book Builds</h2>
-<h3>Last Build Completed At: %s GMT</h3>
-<h3>Last Build Duration: %s</h3>
-<dl>
-""" % (time.asctime(time.gmtime(build_end_time)),
- format_duration(build_end_time - build_begin_time)))
-for locale in locales:
- fp.write("<dt>%s</dt>" % (locale.upper()))
- if locale in built_locales:
- fp.write("""
-<dd>[<a href="%s/svn-book.html">single-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/index.html">multi-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/svn-book-html.tar.bz2">single-page HTML
(in .tar.bz2)</a>]</dd>
-<dd>[<a href="%s/svn-book-html-chunk.tar.bz2">multi-page HTML
(in .tar.bz2)</a>]</dd>
-""" % (locale, locale, locale, locale))
- if locale not in SKIP_PDF_LOCALES:
- fp.write('<dd>[<a href="%s/svn-book.pdf">PDF</a>]</dd>\n' %
locale)
- else:
- fp.write("""
-<dd><em>Uh-oh! No nightly build for this locale.
- (See <a href="nightly-build.%s.log">build log</a>.)</em></dd>
-""" % (locale))
-fp.write("""
-</dl>
-</body>
-</html>
-""")
=======================================
--- /branches/1.4/tools/build-nightlies Fri Jul 2 05:23:07 2010
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/python
-# vim:sw=4
-
-import sys
-import os
-import shutil
-import time
-import subprocess
-import traceback
-
-SKIP_LOCALES = ()
-SKIP_PDF_LOCALES = ('ru', 'zh')
-MAIL_DESTINATION = "svnbook-dev at red-bean.com"
-MAIL_SENDER = "svnbook-build-daemon at red-bean.com"
-MAIL_SENDER_NAME = "Svnbook Build Daemon"
-DROPSPOT_URL = "http://svnbook.red-bean.com/nightly"
-
-
-def format_duration(seconds):
- seconds = int(seconds)
- hours = seconds / 3600
- minutes = seconds % 3600 / 60
- seconds = seconds % 60
- return ((hours and "%dh " % hours or "")
- + (minutes and "%dm " % minutes or "")
- + "%ds" % seconds)
-
-
-def sendmail(subject, body):
- try:
- p = subprocess.Popen(
- ['/usr/sbin/sendmail', '-f', MAIL_SENDER,
MAIL_DESTINATION],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
-
- p.stdin.write("Subject: %s\n" % subject)
- p.stdin.write("To: %s\n" % MAIL_DESTINATION)
- p.stdin.write("From: %s <%s>\n" % (MAIL_SENDER_NAME, MAIL_SENDER))
- p.stdin.write("\n")
- p.stdin.write(body)
- p.stdin.close()
- output = p.stdout.read()
- status = p.wait()
- if len(output) or status:
- sys.stderr.write("MTA output when sending email (%s):\n" %
subject)
- sys.stderr.write(output)
- sys.stderr.write("Exit status %d" % status)
- except IOError:
- etype, value, tb = sys.exc_info()
- sys.stderr.write("Failed sending email (%s):\n" % subject)
- traceback.print_exception(etype, value, tb)
- sys.stderr.write("\n")
- sys.stderr.write("Email body:\n")
- sys.stderr.write(body)
-
-
-if len(sys.argv) < 3:
- sys.stderr.write("""Usage: %s SRC-DIR TGT-DIR [--dryrun]
-
-Crawl SRC-DIR looking for book translations, building distributions of
-them, and exploding those distributions into TGT-DIR.
-""" % (os.path.basename(sys.argv[0])))
- sys.exit(1)
-
-BOOKSRC = os.path.abspath(sys.argv[1])
-DROPSPOT = os.path.abspath(sys.argv[2])
-DRYRUN = (len(sys.argv) > 3)
-
-# Update the working copy
-if DRYRUN:
- print "SVN-Update: %s" % BOOKSRC
-else:
- os.system('svn up -q ' + BOOKSRC)
-
-# Timestamp
-build_begin_time = time.time()
-
-# Find translations
-locales = []
-built_locales = []
-kids = os.listdir(BOOKSRC)
-for kid in kids:
- full_path = os.path.join(BOOKSRC, kid)
- if os.path.isfile(full_path):
- continue
- if os.path.exists(os.path.join(full_path, 'Makefile')):
- locales.append(kid)
-
-# Build the locales
-for i in SKIP_LOCALES:
- try:
- locales.remove(i)
- except ValueError:
- pass
-locales.sort()
-cwd = os.getcwd()
-for locale in locales:
- # Calculate some paths
- locale_dir = os.path.join(BOOKSRC, locale)
- temp_dir = os.path.join(locale_dir, '__TEMPINSTALL__')
- build_log = os.path.join(DROPSPOT, 'nightly-build.%s.log' % (locale))
- dropspot_locale_path = os.path.join(DROPSPOT, locale)
-
- # Figger out which book formats to build
- book_formats = ['html',
- 'html-chunk',
- 'html-arch',
- 'html-chunk-arch',
- 'pdf',
- ]
- if locale in SKIP_PDF_LOCALES:
- book_formats.remove('pdf')
-
- try:
- # Build
- make_cmd =
(['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
- + map(lambda x: 'install-%s' % x, book_formats))
- if os.path.isdir(temp_dir):
- if DRYRUN:
- print "Erase: %s" % (temp_dir)
- else:
- shutil.rmtree(temp_dir)
- os.chdir(locale_dir)
- try:
- if DRYRUN:
- print "Run: %s" % (make_cmd)
- else:
- p = subprocess.Popen(make_cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- logfp = open(build_log, 'w', 1)
- while 1:
- data = p.stdout.readline()
- if not data: break
- logfp.write(data)
- exitcode = p.wait()
- if exitcode:
- raise RuntimeError("make exited with error %d" %
exitcode)
- finally:
- os.chdir(cwd)
-
- # Move stuff into place.
- if os.path.isdir(dropspot_locale_path):
- if DRYRUN:
- print "Erase: %s" % (dropspot_locale_path)
- else:
- shutil.rmtree(dropspot_locale_path)
- if DRYRUN:
- print "Move into place: %s -> %s" % (temp_dir,
dropspot_locale_path)
- else:
- os.rename(temp_dir, dropspot_locale_path)
- built_locales.append(locale)
- except:
- if DRYRUN:
- print "Send failure email: %s" % (locale)
- else:
- sendmail("Nightly Build Failure Alert: '%s'" % locale,
- "The nightly svnbook build for the '%s' locale\n"
- "has failed. Please investigate.\n"
- "\n"
- "%s/nightly-build.%s.log\n"
- "\n"
- "-- The Svnbook Build Daemon.\n"
- % (locale, DROPSPOT_URL, locale))
-
-# Timestamp
-build_end_time = time.time()
-
-# Write out index.html
-if DRYRUN:
- print "Write index.html:"
- fp = sys.stdout
-else:
- fp = open(os.path.join(DROPSPOT, 'index.html'), 'w')
-
-fp.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Version Control with Subversion - Nightly Builds</title>
-<style type="text/css">
-h1, h2, h3 { margin: 0 }
-dl { margin-left: 3em }
-</style>
-</head>
-<body>
-<h1><i>Version Control with Subversion</i></h1>
-<h2>Automated Nightly Book Builds</h2>
-<h3>Last Build Completed At: %s GMT</h3>
-<h3>Last Build Duration: %s</h3>
-<dl>
-""" % (time.asctime(time.gmtime(build_end_time)),
- format_duration(build_end_time - build_begin_time)))
-for locale in locales:
- fp.write("<dt>%s</dt>" % (locale.upper()))
- if locale in built_locales:
- fp.write("""
-<dd>[<a href="%s/svn-book.html">single-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/index.html">multi-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/svn-book-html.tar.bz2">single-page HTML
(in .tar.bz2)</a>]</dd>
-<dd>[<a href="%s/svn-book-html-chunk.tar.bz2">multi-page HTML
(in .tar.bz2)</a>]</dd>
-""" % (locale, locale, locale, locale))
- if locale not in SKIP_PDF_LOCALES:
- fp.write('<dd>[<a href="%s/svn-book.pdf">PDF</a>]</dd>\n' %
locale)
- else:
- fp.write("""
-<dd><em>Uh-oh! No nightly build for this locale.
- (See <a href="nightly-build.%s.log">build log</a>.)</em></dd>
-""" % (locale))
-fp.write("""
-</dl>
-</body>
-</html>
-""")
=======================================
--- /branches/1.5/tools/build-nightlies Fri Jul 2 05:23:07 2010
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/python
-# vim:sw=4
-
-import sys
-import os
-import shutil
-import time
-import subprocess
-import traceback
-
-SKIP_LOCALES = ()
-SKIP_PDF_LOCALES = ('ru', 'zh')
-MAIL_DESTINATION = "svnbook-dev at red-bean.com"
-MAIL_SENDER = "svnbook-build-daemon at red-bean.com"
-MAIL_SENDER_NAME = "Svnbook Build Daemon"
-DROPSPOT_URL = "http://svnbook.red-bean.com/nightly"
-
-
-def format_duration(seconds):
- seconds = int(seconds)
- hours = seconds / 3600
- minutes = seconds % 3600 / 60
- seconds = seconds % 60
- return ((hours and "%dh " % hours or "")
- + (minutes and "%dm " % minutes or "")
- + "%ds" % seconds)
-
-
-def sendmail(subject, body):
- try:
- p = subprocess.Popen(
- ['/usr/sbin/sendmail', '-f', MAIL_SENDER,
MAIL_DESTINATION],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
-
- p.stdin.write("Subject: %s\n" % subject)
- p.stdin.write("To: %s\n" % MAIL_DESTINATION)
- p.stdin.write("From: %s <%s>\n" % (MAIL_SENDER_NAME, MAIL_SENDER))
- p.stdin.write("\n")
- p.stdin.write(body)
- p.stdin.close()
- output = p.stdout.read()
- status = p.wait()
- if len(output) or status:
- sys.stderr.write("MTA output when sending email (%s):\n" %
subject)
- sys.stderr.write(output)
- sys.stderr.write("Exit status %d" % status)
- except IOError:
- etype, value, tb = sys.exc_info()
- sys.stderr.write("Failed sending email (%s):\n" % subject)
- traceback.print_exception(etype, value, tb)
- sys.stderr.write("\n")
- sys.stderr.write("Email body:\n")
- sys.stderr.write(body)
-
-
-if len(sys.argv) < 3:
- sys.stderr.write("""Usage: %s SRC-DIR TGT-DIR [--dryrun]
-
-Crawl SRC-DIR looking for book translations, building distributions of
-them, and exploding those distributions into TGT-DIR.
-""" % (os.path.basename(sys.argv[0])))
- sys.exit(1)
-
-BOOKSRC = os.path.abspath(sys.argv[1])
-DROPSPOT = os.path.abspath(sys.argv[2])
-DRYRUN = (len(sys.argv) > 3)
-
-# Update the working copy
-if DRYRUN:
- print "SVN-Update: %s" % BOOKSRC
-else:
- os.system('svn up -q ' + BOOKSRC)
-
-# Timestamp
-build_begin_time = time.time()
-
-# Find translations
-locales = []
-built_locales = []
-kids = os.listdir(BOOKSRC)
-for kid in kids:
- full_path = os.path.join(BOOKSRC, kid)
- if os.path.isfile(full_path):
- continue
- if os.path.exists(os.path.join(full_path, 'Makefile')):
- locales.append(kid)
-
-# Build the locales
-for i in SKIP_LOCALES:
- try:
- locales.remove(i)
- except ValueError:
- pass
-locales.sort()
-cwd = os.getcwd()
-for locale in locales:
- # Calculate some paths
- locale_dir = os.path.join(BOOKSRC, locale)
- temp_dir = os.path.join(locale_dir, '__TEMPINSTALL__')
- build_log = os.path.join(DROPSPOT, 'nightly-build.%s.log' % (locale))
- dropspot_locale_path = os.path.join(DROPSPOT, locale)
-
- # Figger out which book formats to build
- book_formats = ['html',
- 'html-chunk',
- 'html-arch',
- 'html-chunk-arch',
- 'pdf',
- ]
- if locale in SKIP_PDF_LOCALES:
- book_formats.remove('pdf')
-
- try:
- # Build
- make_cmd =
(['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
- + map(lambda x: 'install-%s' % x, book_formats))
- if os.path.isdir(temp_dir):
- if DRYRUN:
- print "Erase: %s" % (temp_dir)
- else:
- shutil.rmtree(temp_dir)
- os.chdir(locale_dir)
- try:
- if DRYRUN:
- print "Run: %s" % (make_cmd)
- else:
- p = subprocess.Popen(make_cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- logfp = open(build_log, 'w', 1)
- while 1:
- data = p.stdout.readline()
- if not data: break
- logfp.write(data)
- exitcode = p.wait()
- if exitcode:
- raise RuntimeError("make exited with error %d" %
exitcode)
- finally:
- os.chdir(cwd)
-
- # Move stuff into place.
- if os.path.isdir(dropspot_locale_path):
- if DRYRUN:
- print "Erase: %s" % (dropspot_locale_path)
- else:
- shutil.rmtree(dropspot_locale_path)
- if DRYRUN:
- print "Move into place: %s -> %s" % (temp_dir,
dropspot_locale_path)
- else:
- os.rename(temp_dir, dropspot_locale_path)
- built_locales.append(locale)
- except:
- if DRYRUN:
- print "Send failure email: %s" % (locale)
- else:
- sendmail("Nightly Build Failure Alert: '%s'" % locale,
- "The nightly svnbook build for the '%s' locale\n"
- "has failed. Please investigate.\n"
- "\n"
- "%s/nightly-build.%s.log\n"
- "\n"
- "-- The Svnbook Build Daemon.\n"
- % (locale, DROPSPOT_URL, locale))
-
-# Timestamp
-build_end_time = time.time()
-
-# Write out index.html
-if DRYRUN:
- print "Write index.html:"
- fp = sys.stdout
-else:
- fp = open(os.path.join(DROPSPOT, 'index.html'), 'w')
-
-fp.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Version Control with Subversion - Nightly Builds</title>
-<style type="text/css">
-h1, h2, h3 { margin: 0 }
-dl { margin-left: 3em }
-</style>
-</head>
-<body>
-<h1><i>Version Control with Subversion</i></h1>
-<h2>Automated Nightly Book Builds</h2>
-<h3>Last Build Completed At: %s GMT</h3>
-<h3>Last Build Duration: %s</h3>
-<dl>
-""" % (time.asctime(time.gmtime(build_end_time)),
- format_duration(build_end_time - build_begin_time)))
-for locale in locales:
- fp.write("<dt>%s</dt>" % (locale.upper()))
- if locale in built_locales:
- fp.write("""
-<dd>[<a href="%s/svn-book.html">single-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/index.html">multi-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/svn-book-html.tar.bz2">single-page HTML
(in .tar.bz2)</a>]</dd>
-<dd>[<a href="%s/svn-book-html-chunk.tar.bz2">multi-page HTML
(in .tar.bz2)</a>]</dd>
-""" % (locale, locale, locale, locale))
- if locale not in SKIP_PDF_LOCALES:
- fp.write('<dd>[<a href="%s/svn-book.pdf">PDF</a>]</dd>\n' %
locale)
- else:
- fp.write("""
-<dd><em>Uh-oh! No nightly build for this locale.
- (See <a href="nightly-build.%s.log">build log</a>.)</em></dd>
-""" % (locale))
-fp.write("""
-</dl>
-</body>
-</html>
-""")
=======================================
--- /branches/1.6/tools/build-nightlies Fri Jul 2 05:23:07 2010
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/python
-# vim:sw=4
-
-import sys
-import os
-import shutil
-import time
-import subprocess
-import traceback
-
-SKIP_LOCALES = ()
-SKIP_PDF_LOCALES = ('ru', 'zh')
-MAIL_DESTINATION = "svnbook-dev at red-bean.com"
-MAIL_SENDER = "svnbook-build-daemon at red-bean.com"
-MAIL_SENDER_NAME = "Svnbook Build Daemon"
-DROPSPOT_URL = "http://svnbook.red-bean.com/nightly"
-
-
-def format_duration(seconds):
- seconds = int(seconds)
- hours = seconds / 3600
- minutes = seconds % 3600 / 60
- seconds = seconds % 60
- return ((hours and "%dh " % hours or "")
- + (minutes and "%dm " % minutes or "")
- + "%ds" % seconds)
-
-
-def sendmail(subject, body):
- try:
- p = subprocess.Popen(
- ['/usr/sbin/sendmail', '-f', MAIL_SENDER,
MAIL_DESTINATION],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
-
- p.stdin.write("Subject: %s\n" % subject)
- p.stdin.write("To: %s\n" % MAIL_DESTINATION)
- p.stdin.write("From: %s <%s>\n" % (MAIL_SENDER_NAME, MAIL_SENDER))
- p.stdin.write("\n")
- p.stdin.write(body)
- p.stdin.close()
- output = p.stdout.read()
- status = p.wait()
- if len(output) or status:
- sys.stderr.write("MTA output when sending email (%s):\n" %
subject)
- sys.stderr.write(output)
- sys.stderr.write("Exit status %d" % status)
- except IOError:
- etype, value, tb = sys.exc_info()
- sys.stderr.write("Failed sending email (%s):\n" % subject)
- traceback.print_exception(etype, value, tb)
- sys.stderr.write("\n")
- sys.stderr.write("Email body:\n")
- sys.stderr.write(body)
-
-
-if len(sys.argv) < 3:
- sys.stderr.write("""Usage: %s SRC-DIR TGT-DIR [--dryrun]
-
-Crawl SRC-DIR looking for book translations, building distributions of
-them, and exploding those distributions into TGT-DIR.
-""" % (os.path.basename(sys.argv[0])))
- sys.exit(1)
-
-BOOKSRC = os.path.abspath(sys.argv[1])
-DROPSPOT = os.path.abspath(sys.argv[2])
-DRYRUN = (len(sys.argv) > 3)
-
-# Update the working copy
-if DRYRUN:
- print "SVN-Update: %s" % BOOKSRC
-else:
- os.system('svn up -q ' + BOOKSRC)
-
-# Timestamp
-build_begin_time = time.time()
-
-# Find translations
-locales = []
-built_locales = []
-kids = os.listdir(BOOKSRC)
-for kid in kids:
- full_path = os.path.join(BOOKSRC, kid)
- if os.path.isfile(full_path):
- continue
- if os.path.exists(os.path.join(full_path, 'Makefile')):
- locales.append(kid)
-
-# Build the locales
-for i in SKIP_LOCALES:
- try:
- locales.remove(i)
- except ValueError:
- pass
-locales.sort()
-cwd = os.getcwd()
-for locale in locales:
- # Calculate some paths
- locale_dir = os.path.join(BOOKSRC, locale)
- temp_dir = os.path.join(locale_dir, '__TEMPINSTALL__')
- build_log = os.path.join(DROPSPOT, 'nightly-build.%s.log' % (locale))
- dropspot_locale_path = os.path.join(DROPSPOT, locale)
-
- # Figger out which book formats to build
- book_formats = ['html',
- 'html-chunk',
- 'html-arch',
- 'html-chunk-arch',
- 'pdf',
- ]
- if locale in SKIP_PDF_LOCALES:
- book_formats.remove('pdf')
-
- try:
- # Build
- make_cmd =
(['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
- + map(lambda x: 'install-%s' % x, book_formats))
- if os.path.isdir(temp_dir):
- if DRYRUN:
- print "Erase: %s" % (temp_dir)
- else:
- shutil.rmtree(temp_dir)
- os.chdir(locale_dir)
- try:
- if DRYRUN:
- print "Run: %s" % (make_cmd)
- else:
- p = subprocess.Popen(make_cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- logfp = open(build_log, 'w', 1)
- while 1:
- data = p.stdout.readline()
- if not data: break
- logfp.write(data)
- exitcode = p.wait()
- if exitcode:
- raise RuntimeError("make exited with error %d" %
exitcode)
- finally:
- os.chdir(cwd)
-
- # Move stuff into place.
- if os.path.isdir(dropspot_locale_path):
- if DRYRUN:
- print "Erase: %s" % (dropspot_locale_path)
- else:
- shutil.rmtree(dropspot_locale_path)
- if DRYRUN:
- print "Move into place: %s -> %s" % (temp_dir,
dropspot_locale_path)
- else:
- os.rename(temp_dir, dropspot_locale_path)
- built_locales.append(locale)
- except:
- if DRYRUN:
- print "Send failure email: %s" % (locale)
- else:
- sendmail("Nightly Build Failure Alert: '%s'" % locale,
- "The nightly svnbook build for the '%s' locale\n"
- "has failed. Please investigate.\n"
- "\n"
- "%s/nightly-build.%s.log\n"
- "\n"
- "-- The Svnbook Build Daemon.\n"
- % (locale, DROPSPOT_URL, locale))
-
-# Timestamp
-build_end_time = time.time()
-
-# Write out index.html
-if DRYRUN:
- print "Write index.html:"
- fp = sys.stdout
-else:
- fp = open(os.path.join(DROPSPOT, 'index.html'), 'w')
-
-fp.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Version Control with Subversion - Nightly Builds</title>
-<style type="text/css">
-h1, h2, h3 { margin: 0 }
-dl { margin-left: 3em }
-</style>
-</head>
-<body>
-<h1><i>Version Control with Subversion</i></h1>
-<h2>Automated Nightly Book Builds</h2>
-<h3>Last Build Completed At: %s GMT</h3>
-<h3>Last Build Duration: %s</h3>
-<dl>
-""" % (time.asctime(time.gmtime(build_end_time)),
- format_duration(build_end_time - build_begin_time)))
-for locale in locales:
- fp.write("<dt>%s</dt>" % (locale.upper()))
- if locale in built_locales:
- fp.write("""
-<dd>[<a href="%s/svn-book.html">single-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/index.html">multi-page HTML (read online)</a>]</dd>
-<dd>[<a href="%s/svn-book-html.tar.bz2">single-page HTML
(in .tar.bz2)</a>]</dd>
-<dd>[<a href="%s/svn-book-html-chunk.tar.bz2">multi-page HTML
(in .tar.bz2)</a>]</dd>
-""" % (locale, locale, locale, locale))
- if locale not in SKIP_PDF_LOCALES:
- fp.write('<dd>[<a href="%s/svn-book.pdf">PDF</a>]</dd>\n' %
locale)
- else:
- fp.write("""
-<dd><em>Uh-oh! No nightly build for this locale.
- (See <a href="nightly-build.%s.log">build log</a>.)</em></dd>
-""" % (locale))
-fp.write("""
-</dl>
-</body>
-</html>
-""")
More information about the svnbook-dev
mailing list