# HG changeset patch # User Thomas Arendsen Hein # Date 1335280423 -7200 # Node ID 9a602d8eaa60e302adc7f29c8287816567e8983a # Parent f0aa5a8af05648e39a667046170d42140e4a63a5 initial revision of the subversion repository diff -r f0aa5a8af056 -r 9a602d8eaa60 README --- a/README Tue Apr 17 13:06:59 2007 +0200 +++ b/README Tue Apr 24 17:13:43 2012 +0200 @@ -102,10 +102,10 @@ above), you can create the directories, the pbuilder configuration and the chroot environment with the script initpbuilder.py like this: - ./initpbuilder.py --mirrorsite= + bin/initpbuilder.py --mirrorsite= You can specify some more mirrors with the --othermirror option. For -more information run "./initpbuilder.py --help" and consult the pbuilder +more information run "bin/initpbuilder.py --help" and consult the pbuilder documentation. @@ -123,7 +123,7 @@ The default configuration should be OK in most cases. If you want you can customize it in cherrypy.cfg. Start the web front-end with - ./starttreepkgweb.py + bin/starttreepkgweb.py starttreepkgweb has some options to specify which configuration files to use. @@ -137,11 +137,12 @@ the files with createstaticweb.py and copies the files from the tree packager host to a third host. -The config file for publishstaticweb.py is demostaticweb.cfg. Copy this -file to staticweb.cfg and adapt it to your system. The comments in the -file describe the options. Afterwards, run the script with +The configuration file for publishstaticweb.py is demostaticweb.cfg. +Copy this file to staticweb.cfg and adapt it to your system. The +comments in the file describe the options. Afterwards, run the script +with - ./publishstaticweb.py + bin/publishstaticweb.py Running the Tree Packager @@ -149,16 +150,16 @@ After configuration, run the tree packager with - ./runtreepkg.py [options] [packager...] + bin/runtreepkg.py [options] [packager...] For each packager listed on the command line -- or all configured -packagers if none are given -- the tree packager checks our or updates +packagers if none are given -- the tree packager checks out or updates the sources and builds binary packages if the new revision hasn't been packaged yet. If the option --once has been given, the tree packager exits after it has checked each packager once. Without it, the check is done -repeatedly. The interval between two checks can be set in the config +repeatedly. The interval between two checks can be set in the configuration file. Call runtreepkg.py with the --help option to see a list of the available diff -r f0aa5a8af056 -r 9a602d8eaa60 bin/createstaticweb.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/createstaticweb.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,29 @@ +#! /usr/bin/python2.4 +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Creates a static web-site with a status report""" + +import sys +import os + +import treepkgcmd +from treepkg.options import create_parser +from treepkg.web import Status + +def parse_commandline(): + return create_parser().parse_args() + +def create_static_site(treepkg_config, destdir): + status = Status(treepkg_config=treepkg_config) + status.create_static_site(destdir) + +def main(): + options, args = parse_commandline() + create_static_site(options.config_file, args[0]) + +main() diff -r f0aa5a8af056 -r 9a602d8eaa60 bin/initpbuilder.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/initpbuilder.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,125 @@ +#! /usr/bin/python2.4 +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Script to initialize the pbuilder environment for the tree packager + +The script assumes that the config file for the tree packager already +contains the pbuilder settings. Also, this script assumes that there is +only one pbuilder setting for all packagers. +""" + +import sys +import os +from optparse import OptionParser + +import treepkgcmd +from treepkg.options import create_parser +from treepkg.packager import create_package_track, PackagerGroup +from treepkg.readconfig import read_config +from treepkg.util import ensure_directory, writefile +from treepkg.run import call + + +pbuilderrc_template = '''\ +# This file was automatically generated by initpbuilder.py. +# for the possible settings see "man pbuilderrc" + +BASETGZ=%(basedir)s/base.tgz +BUILDPLACE=%(builddir)s +USEPROC=yes +USEDEVPTS=yes +BUILDRESULT=%(resultdir)s +DISTRIBUTION=%(distribution)s +APTCACHE=%(basedir)s/aptcache +APTCACHEHARDLINK=yes +REMOVEPACKAGES=lilo +MIRRORSITE="%(mirrorsite)s" +OTHERMIRROR="%(othermirror)s" +BINDMOUNTS="%(extra-pkgdir)s" +PKGNAME_LOGFILE=yes +''' + + +def init_pbuilder(pbuilderrc, distribution, mirrorsite, extramirrors, root_cmd): + if not os.path.isabs(pbuilderrc): + print >>sys.stderr, "pbuilderrc must be an absolute filename" + sys.exit(1) + + if os.path.exists(pbuilderrc): + print >>sys.stderr, "pbuilderrc %r already exists." % pbuilderrc + sys.exit(1) + + basedir = os.path.dirname(pbuilderrc) + replacements = dict(basedir=basedir, + distribution=distribution, + mirrorsite=mirrorsite) + + # create the pbuilder directories. basedir is created implicitly by + # creating its subdirectories. + for subdir in ["base", "build", "result", "aptcache", "extra-pkg"]: + directory = os.path.join(basedir, subdir) + replacements[subdir + "dir"] = directory + print "creating directory:", repr(directory) + ensure_directory(directory) + + # build OTHERMIRROR value. We always include the extra-pkg dir. + othermirror = "deb file://%(extra-pkgdir)s ./" % replacements + if extramirrors: + othermirror += " | " + extramirrors + replacements["othermirror"] = othermirror + + # create the pbuilderrcfile + print "creating pbuilderrc:", repr(pbuilderrc) + writefile(pbuilderrc, pbuilderrc_template % replacements) + + # turn the extra-pkg directory into a property deb archive + print "turning the extra-pkg dir into a debian archive" + extra_pkgdir = replacements["extra-pkgdir"] + call(["apt-ftparchive", "packages", "."], + stdout=open(os.path.join(extra_pkgdir, "Packages"), "w"), + cwd=extra_pkgdir) + + # create the base.tgz chroot + print "running pbuilder create" + call(root_cmd + ["pbuilder", "create", "--configfile", pbuilderrc]) + + +def parse_commandline(): + parser = create_parser() + parser.set_defaults(distribution="etch") + parser.add_option("--mirrorsite", + help=("The debian mirror site" + " (pbuilder MIRRORSITE setting). Required.")) + parser.add_option("--othermirror", + help=("Extra contents of the OTHERMIRROR setting." + " See the pbuilder documentation for the format.")) + parser.add_option("--distribution", + help=("The debian distribution for the pbuilder chroot." + " Default is etch.")) + return parser.parse_args() + + +def main(): + options, args = parse_commandline() + + if options.mirrorsite is None: + print >>sys.stderr, "Missing required option --mirrorsite" + sys.exit(1) + + treepkg_opts, packager_opts = read_config(options.config_file) + group = PackagerGroup([create_package_track(**opts) + for opts in packager_opts], + **treepkg_opts) + track = group.get_package_tracks()[0] + init_pbuilder(track.pbuilderrc, + distribution=options.distribution, + mirrorsite=options.mirrorsite, + extramirrors=options.othermirror, + root_cmd=track.root_cmd) + +main() diff -r f0aa5a8af056 -r 9a602d8eaa60 bin/publishstaticweb.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/publishstaticweb.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,75 @@ +#! /usr/bin/python2.4 +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Publishes a static web-site with a status report""" + +import sys +import os +from optparse import OptionParser +from ConfigParser import SafeConfigParser + +import treepkgcmd +from treepkg.readconfig import read_config_section +from treepkg.run import call +from treepkg.cmdexpand import cmdexpand +from treepkg.util import ensure_directory + +def remove_trailing_slashes(s): + return s.rstrip("/") + +def expand_filename(filename): + """ + Applies os.path.expanduser and os.path.expandvars to filename + """ + return os.path.expandvars(os.path.expanduser(filename)) + +staticweb_desc = ["build_user", "build_host", "build_create", + ("build_dir", remove_trailing_slashes), + "publish_user", "publish_host", + ("publish_dir", remove_trailing_slashes), + ("cachedir", + lambda s: expand_filename(remove_trailing_slashes(s)))] + +def read_config(filename): + parser = SafeConfigParser() + parser.read([filename]) + return read_config_section(parser, "staticweb", staticweb_desc) + +def parse_commandline(): + parser = OptionParser() + parser.set_defaults(config_file=os.path.join(treepkgcmd.topdir, + "staticweb.cfg")) + parser.add_option("--config-file", + help=("The tree packager config file." + " Default staticweb.cfg")) + return parser.parse_args() + +def publish_static_site(config_filename): + config = read_config(config_filename) + + # create web-page on build host + call(cmdexpand("ssh $build_user$@$build_host $build_create $build_dir", + **config)) + + # rsync the new web-pages to the local cache + ensure_directory(config["cachedir"]) + call(cmdexpand("rsync -rL --delete $build_user$@$build_host:$build_dir/" + " $cachedir", + **config)) + + # rsync the web pages from the local cache to the publishing host + call(cmdexpand("rsync -rL --delete $cachedir/" + " $publish_user$@$publish_host:$publish_dir", + **config)) + + +def main(): + options, args = parse_commandline() + publish_static_site(options.config_file) + +main() diff -r f0aa5a8af056 -r 9a602d8eaa60 bin/reportstatus.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/reportstatus.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,40 @@ +#! /usr/bin/python2.4 +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Reports the current status of the tree packager""" + +import sys +import os +from optparse import OptionParser + +import treepkgcmd +from treepkg.options import create_parser +from treepkg.report import get_packager_group, prepare_report + +def parse_commandline(): + return create_parser().parse_args() + + +def report_text(group): + report = prepare_report(group) + for revno, row in report.revisions: + for col in row: + if col: + print "%s %s: %s" % (col.name, revno, col.status.desc) + if col.status.start: + print " Start:", col.status.start + print " Stop:", col.status.stop + print + +def main(): + options, args = parse_commandline() + group = get_packager_group(options.config_file) + report_text(group) + + +main() diff -r f0aa5a8af056 -r 9a602d8eaa60 bin/runtreepkg.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/runtreepkg.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,64 @@ +#! /usr/bin/python2.4 +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Starts the tree packager""" + +import sys +import os +import logging +from optparse import OptionParser + +import treepkgcmd +from treepkg.options import create_parser +from treepkg.packager import create_package_track, PackagerGroup +from treepkg.readconfig import read_config + +def initialize_logging(): + """Initializes the logging system""" + root = logging.getLogger() + root.setLevel(logging.DEBUG) + hdlr = logging.StreamHandler() + fmt = logging.Formatter("%(asctime)s %(levelname)s %(message)s") + hdlr.setFormatter(fmt) + root.addHandler(hdlr) + +def parse_commandline(): + parser = create_parser() + parser.add_option("--once", action="store_true", + help=("Check the packagers only once and exit afterwards." + " Without this option, the tree packager will" + " check periodically.")) + return parser.parse_args() + +def main(): + options, args = parse_commandline() + + initialize_logging() + + treepkg_opts, packager_opts = read_config(options.config_file) + + if args: + packager_opts = [opts for opts in packager_opts if opts["name"] in args] + # check whether we got all of the names in args: + for opts in packager_opts: + name = opts["name"] + if name in args: + args.remove(name) + for name in args: + print >>sys.stderr, "No package tracks found named %r" % name + + if packager_opts: + group = PackagerGroup([create_package_track(**opts) + for opts in packager_opts], + **treepkg_opts) + if options.once: + group.check_package_tracks() + else: + group.run() + +main() diff -r f0aa5a8af056 -r 9a602d8eaa60 bin/starttreepkgweb.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/starttreepkgweb.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,32 @@ +#! /usr/bin/python2.4 +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Starts the tree packager webinterface""" + +import sys +import os +from optparse import OptionParser + +import treepkgcmd +from treepkg.options import create_parser +from treepkg.web import runserver + +def parse_commandline(): + parser = create_parser() + parser.set_defaults(cherrypy_config=os.path.join(treepkgcmd.topdir, + "cherrypy.cfg")) + parser.add_option("--cherrypy-config", + help=("The cherrypy config file for the web interface." + " Default cherrypy.cfg")) + return parser.parse_args() + +def main(): + options, args = parse_commandline() + runserver(options.config_file, options.cherrypy_config) + +main() diff -r f0aa5a8af056 -r 9a602d8eaa60 bin/treepkgcmd.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/treepkgcmd.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,16 @@ +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Initializes the Python interpreter for the treepkg frontends""" + +import sys +import os + +# make sure we can import treepkg. The topdir variable may be +# referenced by users of this module. +topdir=os.path.join(os.path.dirname(__file__), os.pardir) +sys.path.insert(0, topdir) diff -r f0aa5a8af056 -r 9a602d8eaa60 createstaticweb.py --- a/createstaticweb.py Tue Apr 17 13:06:59 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#! /usr/bin/python2.4 -# Copyright (C) 2007 by Intevation GmbH -# Authors: -# Bernhard Herzog -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. - -"""Creates a static web-site with a status report""" - -import os -from optparse import OptionParser - -from treepkg.web import Status - -def parse_commandline(): - parser = OptionParser() - dirname = os.path.dirname(__file__) - parser.set_defaults(config_file=os.path.join(dirname, "treepkg.cfg")) - parser.add_option("--config-file", - help=("The tree packager config file." - " Default treepkg.cfg")) - return parser.parse_args() - -def create_static_site(treepkg_config, destdir): - status = Status(treepkg_config=treepkg_config) - status.create_static_site(destdir) - -def main(): - options, args = parse_commandline() - create_static_site(options.config_file, args[0]) - -main() diff -r f0aa5a8af056 -r 9a602d8eaa60 demostaticweb.cfg --- a/demostaticweb.cfg Tue Apr 17 13:06:59 2007 +0200 +++ b/demostaticweb.cfg Tue Apr 24 17:13:43 2012 +0200 @@ -5,8 +5,8 @@ [staticweb] # Username and host on which the treepackager runs. publishstaticweb.py -# has to be able to connect to that host as the builduser via ssh -# without knowning the password. This is best achieved with the +# has to be able to connect to that host as the build_user via ssh +# without knowing the password. This is best achieved with the # ssh-agent. Also, publishstaticweb.py uses rsync to copy files from # build_host to the local host. build_user: builder diff -r f0aa5a8af056 -r 9a602d8eaa60 initpbuilder.py --- a/initpbuilder.py Tue Apr 17 13:06:59 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -#! /usr/bin/python2.4 -# Copyright (C) 2007 by Intevation GmbH -# Authors: -# Bernhard Herzog -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. - -"""Script to initialize the pbuilder environment for the tree packager - -The script assumes that the config file for the tree packager already -contains the pbuilder settings. Also, this script assumes that there is -only one pbuilder setting for all packagers. -""" - -import sys -import os -from optparse import OptionParser - -from treepkg.packager import create_package_track, PackagerGroup -from treepkg.readconfig import read_config -from treepkg.util import ensure_directory, writefile -from treepkg.run import call - - -pbuilderrc_template = '''\ -# This file was automatically generated by initpbuilder.py. -# for the possible settings see "man pbuilderrc" - -BASETGZ=%(basedir)s/base.tgz -BUILDPLACE=%(builddir)s -USEPROC=yes -USEDEVPTS=yes -BUILDRESULT=%(resultdir)s -DISTRIBUTION=%(distribution)s -APTCACHE=%(basedir)s/aptcache -APTCACHEHARDLINK=yes -REMOVEPACKAGES=lilo -MIRRORSITE="%(mirrorsite)s" -OTHERMIRROR="%(othermirror)s" -BINDMOUNTS="%(extra-pkgdir)s" -PKGNAME_LOGFILE=yes -''' - - -def init_pbuilder(pbuilderrc, distribution, mirrorsite, extramirrors, root_cmd): - if not os.path.isabs(pbuilderrc): - print >>sys.stderr, "pbuilderrc must be an absolute filename" - sys.exit(1) - - if os.path.exists(pbuilderrc): - print >>sys.stderr, "pbuilderrc %r already exists." % pbuilderrc - sys.exit(1) - - basedir = os.path.dirname(pbuilderrc) - replacements = dict(basedir=basedir, - distribution=distribution, - mirrorsite=mirrorsite) - - # create the pbuilder directories. basedir is created implicitly by - # creating its subdirectories. - for subdir in ["base", "build", "result", "aptcache", "extra-pkg"]: - directory = os.path.join(basedir, subdir) - replacements[subdir + "dir"] = directory - print "creating directory:", repr(directory) - ensure_directory(directory) - - # build OTHERMIRROR value. We always include the extra-pkg dir. - othermirror = "deb file://%(extra-pkgdir)s ./" % replacements - if extramirrors: - othermirror += " | " + extramirrors - replacements["othermirror"] = othermirror - - # create the pbuilderrcfile - print "creating pbuilderrc:", repr(pbuilderrc) - writefile(pbuilderrc, pbuilderrc_template % replacements) - - # turn the extra-pkg directory into a property deb archive - print "turn the extra-pkg dir into a debian archive" - extra_pkgdir = replacements["extra-pkgdir"] - call(["apt-ftparchive", "packages", "."], - stdout=open(os.path.join(extra_pkgdir, "Packages"), "w"), - cwd=extra_pkgdir) - - # create the base.tgz chroot - print "Run pbuilder create" - call(root_cmd + ["pbuilder", "create", "--configfile", pbuilderrc]) - - -def parse_commandline(): - parser = OptionParser() - parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), - "treepkg.cfg"), - distribution="etch") - parser.add_option("--config-file", - help=("The tree packager config file." - " Default is treepkg.cfg")) - parser.add_option("--mirrorsite", - help=("The debian mirror site" - " (pbuilder MIRRORSITE setting). Required.")) - parser.add_option("--othermirror", - help=("Extra contents of the OTHERMIRROR setting." - " See the pbuilder documentation for the format.")) - parser.add_option("--distribution", - help=("The debian distribution for the pbuilder chroot." - " Default is etch.")) - return parser.parse_args() - - -def main(): - options, args = parse_commandline() - - if options.mirrorsite is None: - print >>sys.stderr, "Missing required option --mirrorsite" - sys.exit(1) - - treepkg_opts, packager_opts = read_config(options.config_file) - group = PackagerGroup([create_package_track(**opts) - for opts in packager_opts], - **treepkg_opts) - track = group.get_package_tracks()[0] - init_pbuilder(track.pbuilderrc, - distribution=options.distribution, - mirrorsite=options.mirrorsite, - extramirrors=options.othermirror, - root_cmd=track.root_cmd) - -main() diff -r f0aa5a8af056 -r 9a602d8eaa60 publishstaticweb.py --- a/publishstaticweb.py Tue Apr 17 13:06:59 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -#! /usr/bin/python2.4 -# Copyright (C) 2007 by Intevation GmbH -# Authors: -# Bernhard Herzog -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. - -"""Publishes a static web-site with a status report""" - -import os -from optparse import OptionParser -from ConfigParser import SafeConfigParser - -from treepkg.readconfig import read_config_section -from treepkg.run import call -from treepkg.cmdexpand import cmdexpand -from treepkg.util import ensure_directory - -def remove_trailing_slashes(s): - return s.rstrip("/") - -def expand_filename(filename): - """ - Applies os.path.expanduser and os.path.expandvars to filename - """ - return os.path.expandvars(os.path.expanduser(filename)) - -staticweb_desc = ["build_user", "build_host", "build_create", - ("build_dir", remove_trailing_slashes), - "publish_user", "publish_host", - ("publish_dir", remove_trailing_slashes), - ("cachedir", - lambda s: expand_filename(remove_trailing_slashes(s)))] - -def read_config(filename): - parser = SafeConfigParser() - parser.read([filename]) - return read_config_section(parser, "staticweb", staticweb_desc) - -def parse_commandline(): - parser = OptionParser() - dirname = os.path.dirname(__file__) - parser.set_defaults(config_file=os.path.join(dirname, "staticweb.cfg")) - parser.add_option("--config-file", - help=("The tree packager config file." - " Default staticweb.cfg")) - return parser.parse_args() - -def publish_static_site(config_filename): - config = read_config(config_filename) - - # create web-page on build host - call(cmdexpand("ssh $build_user$@$build_host $build_create $build_dir", - **config)) - - # rsync the new web-pages to the local cache - ensure_directory(config["cachedir"]) - call(cmdexpand("rsync -rL --delete $build_user$@$build_host:$build_dir/" - " $cachedir", - **config)) - - # rsync the web pages from the local cache to the publishing host - call(cmdexpand("rsync -rL --delete $cachedir/" - " $publish_user$@$publish_host:$publish_dir", - **config)) - - -def main(): - options, args = parse_commandline() - publish_static_site(options.config_file) - -main() diff -r f0aa5a8af056 -r 9a602d8eaa60 reportstatus.py --- a/reportstatus.py Tue Apr 17 13:06:59 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -#! /usr/bin/python2.4 -# Copyright (C) 2007 by Intevation GmbH -# Authors: -# Bernhard Herzog -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. - -"""Reports the current status of the tree packager""" - -import os -from optparse import OptionParser - -from treepkg.report import get_packager_group, prepare_report - -def parse_commandline(): - parser = OptionParser() - parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), - "treepkg.cfg")) - parser.add_option("--config-file") - return parser.parse_args() - - -def report_text(group): - report = prepare_report(group) - for revno, row in report.revisions: - for col in row: - if col: - print "%s %s: %s" % (col.name, revno, col.status.desc) - if col.status.start: - print " Start:", col.status.start - print " Stop:", col.status.stop - print - -def main(): - options, args = parse_commandline() - group = get_packager_group(options.config_file) - report_text(group) - - -main() diff -r f0aa5a8af056 -r 9a602d8eaa60 runtreepkg.py --- a/runtreepkg.py Tue Apr 17 13:06:59 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -#! /usr/bin/python2.4 -# Copyright (C) 2007 by Intevation GmbH -# Authors: -# Bernhard Herzog -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. - -"""Starts the tree packager""" - -import sys -import os -import logging -from optparse import OptionParser - -from treepkg.packager import create_package_track, PackagerGroup -from treepkg.readconfig import read_config - -def initialize_logging(): - """Initializes the logging system""" - root = logging.getLogger() - root.setLevel(logging.DEBUG) - hdlr = logging.StreamHandler() - fmt = logging.Formatter("%(asctime)s %(levelname)s %(message)s") - hdlr.setFormatter(fmt) - root.addHandler(hdlr) - -def parse_commandline(): - parser = OptionParser() - parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__), - "treepkg.cfg")) - parser.add_option("--config-file", - help=("The tree packager config file." - " Default treepkg.cfg")) - parser.add_option("--once", action="store_true", - help=("Check the packagers only once and exit afterwards." - " Without this option, the tree packager will" - " check periodically.")) - return parser.parse_args() - -def main(): - options, args = parse_commandline() - - initialize_logging() - - treepkg_opts, packager_opts = read_config(options.config_file) - - if args: - packager_opts = [opts for opts in packager_opts if opts["name"] in args] - # check whether we got all of the names in args: - for opts in packager_opts: - name = opts["name"] - if name in args: - args.remove(name) - for name in args: - print >>sys.stderr, "No package tracks found named %r" % name - - if packager_opts: - group = PackagerGroup([create_package_track(**opts) - for opts in packager_opts], - **treepkg_opts) - if options.once: - group.check_package_tracks() - else: - group.run() - -main() diff -r f0aa5a8af056 -r 9a602d8eaa60 starttreepkgweb.py --- a/starttreepkgweb.py Tue Apr 17 13:06:59 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#! /usr/bin/python2.4 -# Copyright (C) 2007 by Intevation GmbH -# Authors: -# Bernhard Herzog -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. - -"""Starts the tree packager webinterface""" - -import os -from optparse import OptionParser - -from treepkg.web import runserver - -def parse_commandline(): - parser = OptionParser() - dirname = os.path.dirname(__file__) - parser.set_defaults(config_file=os.path.join(dirname, "treepkg.cfg"), - cherrypy_config=os.path.join(dirname, "cherrypy.cfg")) - parser.add_option("--config-file", - help=("The tree packager config file." - " Default treepkg.cfg")) - parser.add_option("--cherrypy-config", - help=("The cherrypy config file for the web interface." - " Default cherrypy.cfg")) - return parser.parse_args() - -def main(): - options, args = parse_commandline() - runserver(options.config_file, options.cherrypy_config) - -main() diff -r f0aa5a8af056 -r 9a602d8eaa60 treepkg/options.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/treepkg/options.py Tue Apr 24 17:13:43 2012 +0200 @@ -0,0 +1,23 @@ +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Common command line options""" + +import os +from optparse import OptionParser + + +def create_parser(): + """Creates an OptionParser with common tree packager options""" + parser = OptionParser() + dirname = os.path.dirname(__file__) + parser.set_defaults(config_file=os.path.join(dirname, os.pardir, + "treepkg.cfg")) + parser.add_option("--config-file", + help=("The tree packager config file." + " Default treepkg.cfg")) + return parser diff -r f0aa5a8af056 -r 9a602d8eaa60 treepkg/packager.py --- a/treepkg/packager.py Tue Apr 17 13:06:59 2007 +0200 +++ b/treepkg/packager.py Tue Apr 24 17:13:43 2012 +0200 @@ -358,7 +358,7 @@ previous_revision = self.last_packaged_revision() logging.info("Previously packaged revision was %d", previous_revision) if current_revision > previous_revision: - logging.info("New revision is not packaged yet") + logging.info("New revision has not been packaged yet") return self.revision_packager_cls(self, current_revision) else: logging.info("New revision already packaged.") @@ -382,8 +382,8 @@ def run(self): """Runs the packager group indefinitely""" - logging.info("Tree packager starts. Will check every %d seconds", - self.check_interval) + logging.info("Starting in periodic check mode." + " Will check every %d seconds", self.check_interval) last_check = -1 while 1: now = time.time() diff -r f0aa5a8af056 -r 9a602d8eaa60 treepkg/web-status.html --- a/treepkg/web-status.html Tue Apr 17 13:06:59 2007 +0200 +++ b/treepkg/web-status.html Tue Apr 24 17:13:43 2012 +0200 @@ -48,7 +48,8 @@
- report generated at ${report.date} + report generated at ${report.date}, + powered by Tree Packager