depot.py revision 409
20N/A# The contents of this file are subject to the terms of the 20N/A# Common Development and Distribution License (the "License"). 20N/A# You may not use this file except in compliance with the License. 20N/A# See the License for the specific language governing permissions 20N/A# and limitations under the License. 20N/A# When distributing Covered Code, include this CDDL HEADER in each 20N/A# If applicable, add the following below this CDDL HEADER, with the 20N/A# fields enclosed by brackets "[]" replaced with your own identifying 20N/A# information: Portions Copyright [yyyy] [name of copyright owner] 260N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 20N/A# Use is subject to license terms. 22N/A# pkg.depotd - package repository daemon 50N/A# XXX The prototype pkg.depotd combines both the version management server that 50N/A# answers to pkgsend(1) sessions and the HTTP file server that answers to the 50N/A# various GET operations that a pkg(1) client makes. This split is expected to 50N/A# be made more explicit, by constraining the pkg(1) operations such that they 50N/A# can be served as a typical HTTP/HTTPS session. Thus, pkg.depotd will reduce 50N/A# to a special purpose HTTP/HTTPS server explicitly for the version management 50N/A# operations, and must manipulate the various state files--catalogs, in 50N/A# particular--such that the pkg(1) pull client can operately accurately with 50N/A# XXX We should support simple "last-modified" operations via HEAD queries. 50N/A# XXX Although we pushed the evaluation of next-version, etc. to the pull 50N/A# client, we should probably provide a query API to do same on the server, for 50N/A# dumb clients (like a notification service). 382N/A# The default authority for the depot. 382N/A# The default repository path. 382N/A# The default port to serve data from. 382N/A# The minimum number of threads allowed. 382N/A# The default number of threads to start. 382N/A# The maximum number of threads that can be started. 382N/A# The default server socket timeout in seconds. We want this to be longer than 382N/A# the normal default of 10 seconds to accommodate clients with poor quality 382N/A# Whether modify operations should be allowed. 382N/A# Whether the repository catalog should be rebuilt on startup. 382N/A print """cherrypy 3.0.3 or greater (but less than 3.1.0) is """ \
382N/A """required to use this program.""" 382N/A [-s threads] [-t socket_timeout] 135N/A --readonly Read-only operation; modifying operations disallowed 157N/A --rebuild Re-build the catalog from pkgs in depot 382N/A """ Option exception. """ 157N/A [
"readonly",
"rebuild"])
382N/A print "pkg.depotd: option: %s -- %s" % (
opt, e)
382N/A print "pkg.depotd: illegal option value: %s specified " \
386N/A print "pkg.depotd: unable to bind to the specified port: " \
382N/A print "pkg.depotd: an error occurred while trying to " \
382N/A "initialize the depot repository directory " \
382N/A # We have to override cherrypy's default response_class so that we 382N/A # have access to the write() callable to stream data directly to the 382N/A "environment":
"production",
382N/A "tools.staticdir.dir":
"" 382N/A print "pkg.depotd: unknown error starting depot, illegal " \
382N/A "option value specified?"