depot.py revision 145
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] 2339N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 395N/A# Use is subject to license terms. 454N/A# pkg.depotd - package repository daemon 448N/A# XXX The prototype pkg.depotd combines both the version management server that 290N/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 383N/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 395N/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 1516N/A# XXX We should support simple "last-modified" operations via HEAD queries. 849N/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 290N/A# dumb clients (like a notification service). 448N/A --readonly Read-only operation; modifying operations disallowed 290N/A """The request is an encoded pkg FMRI. If the version is specified 2494N/A incompletely, we return an error, as the client is expected to form 2494N/A correct requests, based on its interpretation of the catalog and its 1498N/A # Parse request into FMRI component and decode. 2046N/A with the requested filenames.""" 1506N/A # If the sender doesn't specify the content length, reject this request. 395N/A # Calling read() with no size specified will force the server to block 395N/A # until the client sends EOF, an undesireable situation 395N/A """The request is the SHA-1 hash name for the file.""" 395N/A # XXX Authentication will be handled by virtue of possessing a signed 395N/A # certificate (or a more elaborate system). 395N/A # Pull transaction ID from headers. 1191N/A # Pull transaction ID from headers. 395N/A # Make sure that we have a integer protocol version 2339N/A # If we get here, we know that 'operation' is supported. 2339N/A # Assume 'version' is not supported for that operation. 2339N/A vns =
"Version '%s' not supported for operation '%s'\n" 290N/A print "pkg.depotd: unknown option '%s'" % e.
opt