catalog.py revision 50
23N/A# The contents of this file are subject to the terms of the 23N/A# Common Development and Distribution License (the "License"). 23N/A# You may not use this file except in compliance with the License. 23N/A# See the License for the specific language governing permissions 23N/A# and limitations under the License. 23N/A# When distributing Covered Code, include this CDDL HEADER in each 23N/A# If applicable, add the following below this CDDL HEADER, with the 23N/A# fields enclosed by brackets "[]" replaced with your own identifying 23N/A# information: Portions Copyright [yyyy] [name of copyright owner] 23N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23N/A# Use is subject to license terms. 34N/A """A Catalog is the representation of the package FMRIs available to 34N/A this client or repository. Both purposes utilize the same storage 26N/A The serialized structure of the repository is an unordered list of 26N/A available package versions, followed by an unordered list of 26N/A incorporation relationships between packages. This latter section 26N/A allows the graph to be topologically sorted by the client. 50N/A S Last-Modified: [timespec] 37N/A XXX A authority mirror-uri ... 37N/A XXX Mirroring records also need to be allowed from client configuration, 37N/A and not just catalogs. 30N/A XXX It would be nice to include available tags and package sizes, 30N/A although this could also be calculated from the set of manifests. 37N/A XXX self.pkgs should be a dictionary, accessed by fmri string (or 37N/A package name). Current code is O(N_packages) O(M_versions), should be 50N/A O(1) O(M_versions), and possibly O(1) O(1). Likely a similar need for 50N/A XXX Initial estimates suggest that the Catalog could be composed of 1e5 50N/A - 1e7 lines. Catalogs across these magnitudes will need to be spread 50N/A out into chunks, and may require a delta-oriented update interface. 36N/A # each V line is an fmri 37N/A # XXX This package is already in the catalog 37N/A # with some version set. Are we updating the 37N/A # version set or merging the two? 50N/A """Iterate through the catalogs, looking for an exact fmri 50N/A match. XXX Returns a list of Package objects.""" 50N/A """Iterate through the catalogs, looking for a regular 50N/A expression match. Returns an unsorted list of PkgFmri 50N/A s = s +
"C %s\n" % p
26N/A s = s +
"I %s\n" % r
34N/A """Return a pair of lists, the first list being those package 34N/A FMRIs present in the current object but not in the presented 34N/A catalog, the second being those present in the presented catalog 34N/A but not in the current catalog.""" 45N/A "pkg:/test@1.0,5.10-1:105",
45N/A "pkg:/test@1.0,5.11-1:50",
45N/A "pkg:/test@1.0,5.11-2",
45N/A "pkg:/test@1.0,5.11-3" 50N/A print "correctly determined no match for 'flob'"