depot.py revision 429
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# See the License for the specific language governing permissions 290N/A# and limitations under the License. 290N/A# When distributing Covered Code, include this CDDL HEADER in each 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] 3313N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 395N/A# Use is subject to license terms. 883N/A# pkg.depotd - package repository daemon 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 3234N/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 290N/A# to a special purpose HTTP/HTTPS server explicitly for the version management 383N/A# operations, and must manipulate the various state files--catalogs, in 290N/A# particular--such that the pkg(1) pull client can operately accurately with 849N/A# XXX We should support simple "last-modified" operations via HEAD queries. 2508N/A# XXX Although we pushed the evaluation of next-version, etc. to the pull 290N/A# client, we should probably provide a query API to do same on the server, for 2535N/A# dumb clients (like a notification service). 290N/A# The default authority for the depot. 2535N/A# The default repository path. 290N/A# The default port to serve data from. 383N/A# The minimum number of threads allowed. 290N/A# The default number of threads to start. 2535N/A# The maximum number of threads that can be started. 290N/A# The default server socket timeout in seconds. We want this to be longer than 2535N/A# the normal default of 10 seconds to accommodate clients with poor quality 290N/A# Whether modify operations should be allowed. 2508N/A# Whether the repository catalog should be rebuilt on startup. 1660N/A# Whether the indexes should be rebuilt 1660N/A print """cherrypy 3.0.3 or greater (but less than 3.1.0) is """ \
1660N/A """required to use this program.""" 3339N/A [-s threads] [-t socket_timeout] 534N/A --readonly Read-only operation; modifying operations disallowed 290N/A --rebuild Re-build the catalog from pkgs in depot 954N/A """Option exception. """ 290N/A [
"readonly",
"rebuild",
"refresh-index"])
2867N/A # Note: This argument is for internal use 2867N/A # only. It's used when pkg.depotd is reexecing 2310N/A # itself and needs to know that's the case. 290N/A # This flag is purposefully omitted in usage. 1674N/A # The supported way to forcefully reindex is to 1674N/A # kill any pkg.depot using that directory, 2262N/A # remove the index directory, and restart the 1674N/A # pkg.depot process. The index will be rebuilt 395N/A # automatically on startup. 1903N/A print "pkg.depotd: option: %s -- %s" % (
opt, e)
1506N/A print "pkg.depotd: illegal option value: %s specified " \
395N/A # If the program is going to reindex, the port is irrelevant since 2026N/A # the program will not bind to a port. 2310N/A print "pkg.depotd: unable to bind to the specified " \
395N/A print "pkg.depotd: an error occurred while trying to " \
849N/A "initialize the depot repository directory " \
395N/A # We have to override cherrypy's default response_class so that we 395N/A # have access to the write() callable to stream data directly to the 395N/A "environment":
"production",
395N/A "tools.staticdir.dir":
"" 290N/A print "pkg.depotd: unknown error starting depot, illegal " \