depot.py revision 858
409N/A#!/usr/bin/python2.4
290N/A#
290N/A# CDDL HEADER START
290N/A#
290N/A# The contents of this file are subject to the terms of the
290N/A# Common Development and Distribution License (the "License").
290N/A# You may not use this file except in compliance with the License.
290N/A#
290N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
290N/A# or http://www.opensolaris.org/os/licensing.
290N/A# See the License for the specific language governing permissions
290N/A# and limitations under the License.
290N/A#
290N/A# When distributing Covered Code, include this CDDL HEADER in each
290N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
290N/A# If applicable, add the following below this CDDL HEADER, with the
290N/A# fields enclosed by brackets "[]" replaced with your own identifying
290N/A# information: Portions Copyright [yyyy] [name of copyright owner]
290N/A#
290N/A# CDDL HEADER END
290N/A#
849N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
395N/A# Use is subject to license terms.
395N/A#
290N/A
883N/A# pkg.depotd - package repository daemon
454N/A
290N/A# XXX The prototype pkg.depotd combines both the version management server that
448N/A# answers to pkgsend(1) sessions and the HTTP file server that answers to the
290N/A# various GET operations that a pkg(1) client makes. This split is expected to
290N/A# be made more explicit, by constraining the pkg(1) operations such that they
290N/A# can be served as a typical HTTP/HTTPS session. Thus, pkg.depotd will reduce
383N/A# to a special purpose HTTP/HTTPS server explicitly for the version management
290N/A# operations, and must manipulate the various state files--catalogs, in
395N/A# particular--such that the pkg(1) pull client can operately accurately with
290N/A# only a basic HTTP/HTTPS server in place.
395N/A
849N/A# XXX We should support simple "last-modified" operations via HEAD queries.
1099N/A
290N/A# XXX Although we pushed the evaluation of next-version, etc. to the pull
849N/A# client, we should probably provide a query API to do same on the server, for
290N/A# dumb clients (like a notification service).
290N/A
290N/A# The default authority for the depot.
290N/AAUTH_DEFAULT = "opensolaris.org"
383N/A# The default repository path.
290N/AREPO_PATH_DEFAULT = "/var/pkg/repo"
290N/A# The default path for static and other web content.
290N/ACONTENT_PATH_DEFAULT = "/usr/share/lib/pkg"
290N/A# The default port(s) to serve data from.
290N/APORT_DEFAULT = 80
290N/ASSL_PORT_DEFAULT = 443
290N/A# The minimum number of threads allowed.
290N/ATHREADS_MIN = 1
465N/A# The default number of threads to start.
465N/ATHREADS_DEFAULT = 10
465N/A# The maximum number of threads that can be started.
801N/ATHREADS_MAX = 100
465N/A# The default server socket timeout in seconds. We want this to be longer than
465N/A# the normal default of 10 seconds to accommodate clients with poor quality
465N/A# connections.
1099N/ASOCKET_TIMEOUT_DEFAULT = 60
465N/A# Whether modify operations should be allowed.
465N/AREADONLY_DEFAULT = False
465N/A# Whether the repository catalog should be rebuilt on startup.
465N/AREBUILD_DEFAULT = False
465N/A# Whether the indexes should be rebuilt
465N/AREINDEX_DEFAULT = False
465N/A# Not in mirror mode by default
1099N/AMIRROR_DEFAULT = False
465N/A
708N/Aimport getopt
708N/Aimport gettext
708N/Aimport locale
708N/Aimport logging
708N/Aimport os
708N/Aimport os.path
1099N/Aimport OpenSSL.crypto as crypto
1099N/Aimport OpenSSL.SSL as ssl
708N/Aimport pkg.portable.util as os_util
742N/Aimport subprocess
742N/Aimport sys
742N/Aimport tempfile
742N/Aimport urlparse
742N/A
742N/Atry:
1099N/A import cherrypy
742N/A version = cherrypy.__version__.split('.')
941N/A if map(int, version) < [3, 1, 0]:
941N/A raise ImportError
941N/A elif map(int, version) >= [3, 2, 0]:
941N/A raise ImportError
941N/Aexcept ImportError:
941N/A print >> sys.stderr, """cherrypy 3.1.0 or greater (but less than """ \
1099N/A """3.2.0) is required to use this program."""
941N/A sys.exit(2)
1191N/A
1191N/Aimport pkg.catalog as catalog
1191N/Afrom pkg.misc import port_available, msg, emsg, setlocale
1191N/Aimport pkg.search_errors as search_errors
1191N/Aimport pkg.server.config as config
1191N/Aimport pkg.server.depot as depot
1191N/Aimport pkg.server.repository as repo
1191N/Aimport pkg.server.repositoryconfig as rc
290N/A
290N/Aclass LogSink(object):
290N/A """This is a dummy object that we can use to discard log entries
395N/A without relying on non-portable interfaces such as /dev/null."""
395N/A
290N/A def write(self, *args, **kwargs):
395N/A """Discard the bits."""
395N/A pass
290N/A
395N/A def flush(self, *args, **kwargs):
395N/A """Discard the bits."""
290N/A pass
395N/A
395N/Adef usage(text):
290N/A if text:
448N/A emsg(text)
448N/A
534N/A print """\
534N/AUsage: /usr/lib/pkg.depotd [-d repo_dir] [-p port] [-s threads]
534N/A [-t socket_timeout] [--cfg-file] [--content-root] [--debug]
534N/A [--log-access dest] [--log-errors dest] [--mirror] [--proxy-base url]
534N/A [--readonly] [--rebuild] [--ssl-cert-file] [--ssl-dialog]
534N/A [--ssl-key-file]
534N/A
290N/A --cfg-file The pathname of the file from which to read and to
290N/A write configuration information.
954N/A --content-root The file system path to the directory containing the
954N/A the static and other web content used by the depot's
954N/A browser user interface. The default value is
954N/A '/usr/share/lib/pkg'.
534N/A --debug The name of a debug feature to enable; or a whitespace
1099N/A or comma separated list of features to enable. Possible
290N/A values are: headers.
1191N/A --log-access The destination for any access related information
1191N/A logged by the depot process. Possible values are:
1191N/A stderr, stdout, none, or an absolute pathname. The
290N/A default value is stdout if stdout is a tty; otherwise
290N/A the default value is none.
290N/A --log-errors The destination for any errors or other information
290N/A logged by the depot process. Possible values are:
661N/A stderr, stdout, none, or an absolute pathname. The
290N/A default value is stderr.
290N/A --mirror Package mirror mode; publishing and metadata operations
290N/A disallowed. Cannot be used with --readonly or
395N/A --rebuild.
290N/A --proxy-base The url to use as the base for generating internal
290N/A redirects and content.
290N/A --readonly Read-only operation; modifying operations disallowed.
290N/A Cannot be used with --mirror or --rebuild.
290N/A --rebuild Re-build the catalog from pkgs in depot. Cannot be
395N/A used with --mirror or --readonly.
430N/A --ssl-cert-file The absolute pathname to a PEM-encoded Certificate file.
395N/A This option must be used with --ssl-key-file. Usage of
395N/A this option will cause the depot to only respond to SSL
395N/A requests on the provided port.
424N/A --ssl-dialog Specifies what method should be used to obtain the
1024N/A passphrase needed to decrypt the file specified by
395N/A --ssl-key-file. Supported values are: builtin,
395N/A exec:/path/to/program, or smf:fmri. The default value
395N/A is builtin.
578N/A --ssl-key-file The absolute pathname to a PEM-encoded Private Key file.
1172N/A This option must be used with --ssl-cert-file. Usage of
395N/A this option will cause the depot to only respond to SSL
661N/A requests on the provided port.
1099N/A"""
661N/A sys.exit(2)
395N/A
849N/Aclass OptionError(Exception):
290N/A """Option exception. """
395N/A
395N/A def __init__(self, *args):
395N/A Exception.__init__(self, *args)
395N/A
395N/Aif __name__ == "__main__":
395N/A
395N/A setlocale(locale.LC_ALL, "")
395N/A gettext.install("pkg", "/usr/share/locale")
395N/A
395N/A debug_features = {
395N/A "headers": False,
395N/A }
395N/A port = PORT_DEFAULT
290N/A port_provided = False
290N/A threads = THREADS_DEFAULT
395N/A socket_timeout = SOCKET_TIMEOUT_DEFAULT
395N/A readonly = READONLY_DEFAULT
395N/A rebuild = REBUILD_DEFAULT
395N/A reindex = REINDEX_DEFAULT
395N/A proxy_base = None
395N/A mirror = MIRROR_DEFAULT
395N/A repo_config_file = None
395N/A ssl_cert_file = None
395N/A ssl_key_file = None
395N/A ssl_dialog = "builtin"
395N/A
395N/A if "PKG_REPO" in os.environ:
395N/A repo_path = os.environ["PKG_REPO"]
290N/A else:
290N/A repo_path = REPO_PATH_DEFAULT
430N/A
395N/A try:
395N/A content_root = os.environ["PKG_DEPOT_CONTENT"]
395N/A except KeyError:
395N/A try:
395N/A content_root = os.path.join(os.environ['PKG_HOME'],
395N/A 'share/lib/pkg')
290N/A except KeyError:
395N/A content_root = CONTENT_PATH_DEFAULT
1024N/A
413N/A # By default, if the destination for a particular log type is not
413N/A # specified, this is where we will send the output.
413N/A log_routes = {
1024N/A "access": "none",
395N/A "errors": "stderr"
395N/A }
413N/A log_opts = ["--log-%s" % log_type for log_type in log_routes]
395N/A
395N/A # If stdout is a tty, then send access output there by default instead
413N/A # of discarding it.
395N/A if os.isatty(sys.stdout.fileno()):
395N/A log_routes["access"] = "stdout"
395N/A
395N/A opt = None
395N/A try:
395N/A long_opts = ["cfg-file=", "content-root=", "debug=", "mirror",
1191N/A "proxy-base=", "readonly", "rebuild", "refresh-index",
395N/A "ssl-cert-file=", "ssl-dialog=", "ssl-key-file="]
395N/A for opt in log_opts:
424N/A long_opts.append("%s=" % opt.lstrip('--'))
395N/A opts, pargs = getopt.getopt(sys.argv[1:], "d:np:s:t:",
742N/A long_opts)
742N/A for opt, arg in opts:
742N/A if opt == "-n":
742N/A sys.exit(0)
742N/A elif opt == "-d":
742N/A repo_path = arg
742N/A elif opt == "-p":
742N/A port = int(arg)
742N/A port_provided = True
742N/A elif opt == "-s":
742N/A threads = int(arg)
395N/A if threads < THREADS_MIN:
395N/A raise OptionError, \
395N/A "minimum value is %d" % THREADS_MIN
395N/A if threads > THREADS_MAX:
395N/A raise OptionError, \
395N/A "maximum value is %d" % THREADS_MAX
395N/A elif opt == "-t":
954N/A socket_timeout = int(arg)
954N/A elif opt == "--cfg-file":
954N/A repo_config_file = os.path.abspath(arg)
954N/A elif opt == "--content-root":
954N/A if arg == "":
954N/A raise OptionError, "You must specify " \
954N/A "a directory path."
954N/A content_root = arg
395N/A elif opt == "--debug":
395N/A if arg is None or arg == "":
1099N/A raise OptionError, \
1099N/A "A debug feature must be specified."
395N/A
691N/A # A list of features can be specified using a
691N/A # "," or any whitespace character as separators.
691N/A if "," in arg:
395N/A features = arg.split(",")
395N/A else:
395N/A features = arg.split()
395N/A
395N/A for f in features:
290N/A if f not in debug_features:
395N/A raise OptionError, \
395N/A "Invalid debug feature: " \
591N/A "%s." % f
591N/A debug_features[f] = True
591N/A elif opt in log_opts:
395N/A if arg is None or arg == "":
395N/A raise OptionError, \
290N/A "You must specify a log " \
708N/A "destination."
708N/A log_routes[opt.lstrip("--log-")] = arg
708N/A elif opt == "--mirror":
708N/A mirror = True
708N/A elif opt == "--proxy-base":
708N/A # Attempt to decompose the url provided into
708N/A # its base parts. This is done so we can
708N/A # remove any scheme information since we
708N/A # don't need it.
708N/A scheme, netloc, path, params, query, \
708N/A fragment = urlparse.urlparse(arg,
708N/A "http", allow_fragments=0)
1099N/A
1099N/A if not netloc:
849N/A raise OptionError, "Unable to " \
708N/A "determine the hostname from " \
708N/A "the provided URL; please use a " \
708N/A "fully qualified URL."
708N/A
708N/A scheme = scheme.lower()
708N/A if scheme not in ("http", "https"):
708N/A raise OptionError, "Invalid URL; http " \
708N/A "and https are the only supported " \
708N/A "schemes."
708N/A
290N/A # Rebuild the url with the sanitized components.
290N/A proxy_base = urlparse.urlunparse((scheme, netloc,
290N/A path, params, query, fragment)
290N/A )
290N/A elif opt == "--readonly":
290N/A readonly = True
290N/A elif opt == "--rebuild":
290N/A rebuild = True
290N/A elif opt == "--refresh-index":
290N/A # Note: This argument is for internal use
290N/A # only. It's used when pkg.depotd is reexecing
290N/A # itself and needs to know that's the case.
290N/A # This flag is purposefully omitted in usage.
395N/A # The supported way to forcefully reindex is to
395N/A # kill any pkg.depot using that directory,
290N/A # remove the index directory, and restart the
290N/A # pkg.depot process. The index will be rebuilt
290N/A # automatically on startup.
290N/A reindex = True
290N/A elif opt == "--ssl-cert-file":
395N/A if arg == "none":
395N/A continue
395N/A
290N/A ssl_cert_file = arg
395N/A if not os.path.isabs(ssl_cert_file):
395N/A raise OptionError, "The path to " \
395N/A "the Certificate file must be " \
395N/A "absolute."
591N/A elif not os.path.exists(ssl_cert_file):
591N/A raise OptionError, "The specified " \
591N/A "file does not exist."
591N/A elif not os.path.isfile(ssl_cert_file):
691N/A raise OptionError, "The specified " \
691N/A "pathname is not a file."
691N/A elif opt == "--ssl-key-file":
691N/A if arg == "none":
290N/A continue
290N/A
290N/A ssl_key_file = arg
290N/A if not os.path.isabs(ssl_key_file):
290N/A raise OptionError, "The path to " \
591N/A "the Private Key file must be " \
591N/A "absolute."
691N/A elif not os.path.exists(ssl_key_file):
691N/A raise OptionError, "The specified " \
290N/A "file does not exist."
395N/A elif not os.path.isfile(ssl_key_file):
395N/A raise OptionError, "The specified " \
290N/A "pathname is not a file."
395N/A elif opt == "--ssl-dialog":
395N/A if arg != "builtin" and not \
395N/A arg.startswith("exec:/") and not \
395N/A arg.startswith("smf:"):
290N/A raise OptionError, "Invalid value " \
290N/A "specified. Expected: builtin, " \
290N/A "exec:/path/to/program, or " \
395N/A "smf:fmri."
395N/A
395N/A f = arg
395N/A if f.startswith("exec:"):
395N/A if os_util.get_canonical_os_type() != \
395N/A "unix":
290N/A # Don't allow a somewhat insecure
290N/A # authentication method on some
290N/A # platforms.
290N/A raise OptionError, "exec is not " \
290N/A "a supported dialog type for " \
430N/A "this operating system."
290N/A
290N/A f = os.path.abspath(f.split(
395N/A "exec:")[1])
290N/A
395N/A if not os.path.isfile(f):
506N/A raise OptionError, "Invalid " \
506N/A "file path specified for " \
506N/A "exec."
506N/A
506N/A f = "exec:%s" % f
506N/A
506N/A ssl_dialog = f
506N/A except getopt.GetoptError, e:
834N/A usage("pkg.depotd: %s" % e.msg)
506N/A except OptionError, e:
506N/A usage("pkg.depotd: option: %s -- %s" % (opt, e))
506N/A except (ArithmeticError, ValueError):
513N/A usage("pkg.depotd: illegal option value: %s specified " \
506N/A "for option: %s" % (arg, opt))
506N/A
506N/A if rebuild and reindex:
506N/A usage("--refresh-index cannot be used with --rebuild")
290N/A if rebuild and (readonly or mirror):
290N/A usage("--readonly and --mirror cannot be used with --rebuild")
395N/A if reindex and (readonly or mirror):
395N/A usage("--readonly and --mirror cannot be used with " \
849N/A "--refresh-index")
849N/A
883N/A if (ssl_cert_file and not ssl_key_file) or (ssl_key_file and not
883N/A ssl_cert_file):
395N/A usage("The --ssl-cert-file and --ssl-key-file options must "
413N/A "must both be provided when using either option.")
413N/A elif ssl_cert_file and ssl_key_file and not port_provided:
413N/A # If they didn't already specify a particular port, use the
395N/A # default SSL port instead.
290N/A port = SSL_PORT_DEFAULT
395N/A
395N/A # If the program is going to reindex, the port is irrelevant since
506N/A # the program will not bind to a port.
506N/A if not reindex:
395N/A available, msg = port_available(None, port)
395N/A if not available:
395N/A print "pkg.depotd: unable to bind to the specified " \
395N/A "port: %d. Reason: %s" % (port, msg)
430N/A sys.exit(1)
849N/A else:
834N/A # Not applicable for reindexing operations.
290N/A content_root = None
1191N/A
1191N/A scfg = config.SvrConfig(repo_path, content_root, AUTH_DEFAULT)
1191N/A
1191N/A if rebuild:
1099N/A scfg.destroy_catalog()
836N/A
836N/A if readonly:
849N/A scfg.set_read_only()
849N/A
849N/A if mirror:
849N/A scfg.set_mirror()
849N/A
849N/A try:
849N/A scfg.init_dirs()
849N/A except (RuntimeError, EnvironmentError), e:
849N/A print "pkg.depotd: an error occurred while trying to " \
849N/A "initialize the depot repository directory " \
849N/A "structures:\n%s" % e
849N/A sys.exit(1)
1099N/A
1099N/A key_data = None
849N/A if not reindex and ssl_cert_file and ssl_key_file and \
1099N/A ssl_dialog != "builtin":
1099N/A cmdline = None
1099N/A def get_ssl_passphrase(*ignored):
1099N/A p = None
1191N/A try:
290N/A p = subprocess.Popen(cmdline, shell=True,
883N/A stdout=subprocess.PIPE,
883N/A stderr=None)
883N/A p.wait()
883N/A except Exception, e:
883N/A print "pkg.depotd: an error occurred while " \
883N/A "executing [%s]; unable to obtain the " \
883N/A "passphrase needed to decrypt the SSL" \
883N/A "private key file: %s" (cmd, e)
883N/A sys.exit(1)
883N/A return p.stdout.read().strip("\n")
883N/A
883N/A if ssl_dialog.startswith("exec:"):
883N/A cmdline = "%s %s %d" % (ssl_dialog.split("exec:")[1],
883N/A "''", port)
883N/A elif ssl_dialog.startswith("smf:"):
883N/A cmdline = "/usr/bin/svcprop -p " \
1099N/A "pkg_secure/ssl_key_passphrase %s" % (
1099N/A ssl_dialog.split("smf:")[1])
1099N/A
1099N/A # The key file requires decryption, but the user has requested
1099N/A # exec-based authentication, so it will have to be decoded first
1099N/A # to an un-named temporary file.
1099N/A try:
1099N/A key_file = file(ssl_key_file, "rb")
1099N/A pkey = crypto.load_privatekey(crypto.FILETYPE_PEM,
1099N/A key_file.read(), get_ssl_passphrase)
1099N/A
1099N/A key_data = tempfile.TemporaryFile()
1099N/A key_data.write(crypto.dump_privatekey(
1099N/A crypto.FILETYPE_PEM, pkey))
1099N/A key_data.seek(0)
1099N/A except EnvironmentError, e:
1099N/A print "pkg.depotd: unable to read the SSL private " \
1099N/A "key file: %s" % e
1099N/A sys.exit(1)
1099N/A except crypto.Error, e:
1191N/A print "pkg.depotd: authentication or cryptography " \
1191N/A "failure while attempting to decode\nthe SSL " \
1191N/A "private key file: %s" % e
1191N/A sys.exit(1)
1191N/A else:
1191N/A # Redirect the server to the decrypted key file.
1191N/A ssl_key_file = "/dev/fd/%d" % key_data.fileno()
1191N/A
1191N/A # Setup our global configuration.
1191N/A gconf = {
1191N/A "checker.on": True,
1191N/A "environment": "production",
1191N/A "log.screen": False,
1191N/A "server.shutdown_timeout": 0,
1191N/A "server.socket_host": "0.0.0.0",
1191N/A "server.socket_port": port,
1191N/A "server.socket_timeout": socket_timeout,
1191N/A "server.ssl_certificate": ssl_cert_file,
1191N/A "server.ssl_private_key": ssl_key_file,
1191N/A "server.thread_pool": threads,
1191N/A "tools.log_headers.on": True,
1191N/A "tools.encode.on": True
1191N/A }
1191N/A
1191N/A if debug_features["headers"]:
1191N/A # Despite its name, this only logs headers when there is an
1191N/A # error; it's redundant with the debug feature enabled.
1191N/A gconf["tools.log_headers.on"] = False
1099N/A
1099N/A # Causes the headers of every request to be logged to the error
1099N/A # log; even if an exception occurs.
1099N/A gconf["tools.log_headers_always.on"] = True
1099N/A cherrypy.tools.log_headers_always = cherrypy.Tool(
1099N/A "on_start_resource",
1099N/A cherrypy.lib.cptools.log_request_headers)
465N/A
465N/A log_type_map = {
395N/A "errors": {
465N/A "param": "log.error_file",
395N/A "attr": "error_log"
395N/A },
465N/A "access": {
465N/A "param": "log.access_file",
465N/A "attr": "access_log"
395N/A }
465N/A }
395N/A
465N/A for log_type in log_type_map:
395N/A dest = log_routes[log_type]
465N/A if dest in ("stdout", "stderr", "none"):
1099N/A if dest == "none":
1099N/A h = logging.StreamHandler(LogSink())
1099N/A else:
465N/A h = logging.StreamHandler(eval("sys.%s" % \
465N/A dest))
395N/A
395N/A h.setLevel(logging.DEBUG)
1099N/A h.setFormatter(cherrypy._cplogging.logfmt)
395N/A log_obj = eval("cherrypy.log.%s" % \
1191N/A log_type_map[log_type]["attr"])
1191N/A log_obj.addHandler(h)
1191N/A # Since we've replaced cherrypy's log handler with our
1191N/A # own, we don't want the output directed to a file.
1191N/A dest = ""
1191N/A
1191N/A gconf[log_type_map[log_type]["param"]] = dest
1191N/A
1191N/A cherrypy.config.update(gconf)
1191N/A
1191N/A # Now that our logging, etc. has been setup, it's safe to perform any
1191N/A # remaining preparation.
1191N/A if reindex:
1191N/A scfg.acquire_catalog(rebuild=False)
465N/A try:
465N/A scfg.catalog.run_update_index()
465N/A except search_errors.IndexingException, e:
849N/A cherrypy.log(str(e), "INDEX")
498N/A sys.exit(1)
498N/A sys.exit(0)
849N/A
849N/A # Now build our site configuration.
849N/A conf = {
849N/A "/": {
849N/A # We have to override cherrypy's default response_class so that
849N/A # we have access to the write() callable to stream data
290N/A # directly to the client.
849N/A "wsgi.response_class": depot.DepotResponse,
465N/A },
465N/A "/robots.txt": {
1099N/A "tools.staticfile.on": True,
465N/A "tools.staticfile.filename": os.path.join(scfg.web_root,
1099N/A "robots.txt")
1099N/A },
1099N/A }
454N/A
1099N/A if proxy_base:
849N/A # This changes the base URL for our server, and is primarily
290N/A # intended to allow our depot process to operate behind Apache
430N/A # or some other webserver process.
395N/A #
395N/A # Visit the following URL for more information:
290N/A # http://cherrypy.org/wiki/BuiltinTools#tools.proxy
383N/A proxy_conf = {
383N/A "tools.proxy.on": True,
395N/A "tools.proxy.local": "",
383N/A "tools.proxy.base": proxy_base
383N/A }
384N/A
383N/A # Now merge or add our proxy configuration information into the
849N/A # existing configuration.
849N/A for entry in proxy_conf:
849N/A conf["/"][entry] = proxy_conf[entry]
849N/A
849N/A scfg.acquire_in_flight()
849N/A try:
849N/A scfg.acquire_catalog()
849N/A except catalog.CatalogPermissionsException, e:
849N/A emsg("pkg.depotd: %s" % e)
849N/A sys.exit(1)
849N/A
849N/A try:
849N/A root = cherrypy.Application(repo.Repository(scfg,
383N/A repo_config_file))
383N/A except rc.InvalidAttributeValueError, e:
383N/A emsg("pkg.depotd: repository.conf error: %s" % e)
849N/A sys.exit(1)
383N/A
422N/A try:
422N/A cherrypy.quickstart(root, config=conf)
422N/A except Exception, e:
422N/A emsg("pkg.depotd: unknown error starting depot server, " \
422N/A "illegal option value specified?")
422N/A sys.exit(1)
422N/A