manifest.py revision 39
39N/A# The contents of this file are subject to the terms of the 39N/A# Common Development and Distribution License (the "License"). 39N/A# You may not use this file except in compliance with the License. 39N/A# See the License for the specific language governing permissions 39N/A# and limitations under the License. 39N/A# When distributing Covered Code, include this CDDL HEADER in each 39N/A# If applicable, add the following below this CDDL HEADER, with the 39N/A# fields enclosed by brackets "[]" replaced with your own identifying 39N/A# information: Portions Copyright [yyyy] [name of copyright owner] 39N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 39N/A# Use is subject to license terms. 39N/A# The type member is used for the ordering of actions. 39N/A # XXX generalize to superclass? 39N/A """A Manifest is the representation of the actions composing a specific 39N/A package version on both the client and the repository. Both purposes 39N/A utilize the same storage format. 39N/A The serialized structure of a manifest is an unordered list of package 39N/A attributes, followed by an unordered list of actions (such as files to 39N/A The special action, "set", represents an attribute setting. 39N/A The reserved attribute, "fmri", represents the package and version 39N/A described by this manifest. It is available as a string via the 39N/A attributes dictionary, and as an FMRI object from the fmri member. 39N/A The list of manifest-wide reserved attributes is 39N/A base_directory Default base directory, for non-user images. 39N/A isa Package is intended for a list of ISAs. 39N/A licenses Package contains software available under a list 39N/A platform Package is intended for a list of platforms. 39N/A relocatable Suitable for User Image. 39N/A All non-prefixed attributes are reserved to the framework. Third 39N/A parties may prefix their attributes with a reversed domain name, domain 39N/A name, or stock symbol. An example might be 39N/A com.example,supported 39N/A as an indicator that a specific package version is supported by the 39N/A vendor, example.com. 39N/A XXX Need one or more differences methods, so that we can build a list of 39N/A the actions we must take and the actions that are no longer relevant, 39N/A which would include deletions. 39N/A """An attribute line is 39N/A set attribute = str 39N/A where str becomes the value of the attribute. 39N/A XXX For now, the value is left as a simple string. We could in 39N/A principle parse into specific types.""" 39N/A """A file action line is 39N/A file mode owner group path hash n=v 39N/A m =
re.
match(
"^file (\d+) ([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+)\s?(.*)",
str)
39N/A # if any name value settings, add to action's tags 39N/A # XXX what if v is empty? syntax error? 39N/A """str is the text representation of the manifest""" 39N/Aset com.sun,test = true