catalog.py revision 39
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
import os
import re
import sha
import shutil
import time
import urllib
"""A Catalog is the representation of the package FMRIs available to
this client or repository. Both purposes utilize the same storage
format.
The serialized structure of the repository is an unordered list of
available package versions, followed by an unordered list of
incorporation relationships between packages. This latter section
allows the graph to be topologically sorted by the client.
XXX A authority mirror-uri ...
XXX ...
V fmri
V fmri
...
I fmri fmri
I fmri fmri
...
XXX Mirroring records also need to be allowed from client configuration,
and not just catalogs.
XXX It would be nice to include available tags and package sizes,
although this could also be calculated from the set of manifests.
XXX self.pkgs should be a dictionary, accessed by fmri string (or
package name). Current code is O(N_packages) O(M_versions), should be
O(1) O(M_versions), and possibly O(1) O(1).
"""
return
# each V line is an fmri
if m == None:
continue
return
return
#
# XXX This package is already in the catalog
# with some version set. Are we updating the
# version set or merging the two?
#
return
return
return
return
"""Iterate through the catalog's, looking for an fmri match."""
# XXX FMRI-based implementation doesn't do pattern matching, but
# exact matches only.
s = ""
s = s + p.get_catalog_entry()
s = s + "I %s\n" % r
return s
"""Return a pair of lists, the first list being those package
FMRIs present in the current object but not in the presented
catalog, the second being those present in the presented catalog
but not in the current catalog."""
return