#Tc@sddklZlZddkZddkZddkZddkZddkZddkZddk l Z l Z l Z l Z lZddklZddkiZddkiiZddkiZddkiZddkiZddkiZddki Z ddk!i"Z"ddkl#Z#l$Z$l%Z%l&Z&l'Z'ddk(l)Z)ddk*l+Z+dZ,d Z-d ed d fd YZ.d e/fdYZ0e0Z1de0fdYZ2de0fdYZ3e3Z4de5fdYZ6dS(i(t namedtuplet defaultdictN(tgroupbytchaintproducttrepeattizip(t itemgetter(t EmptyDicttEmptyIt expanddirst PKG_FILE_MODEt PKG_DIR_MODE(tAttributeAction(tDirectoryActioncCstd|iDS(sdPrivate helper function that returns a compiled version of a dictionary of fnmatch patterns.css[xT|]M\}}|g}|D](}|titi|tiiq ~fVqWdS(N(tretcompiletfnmatcht translatet IGNORECASEtmatch(t.0tkeytpatst_[1]tpat((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys 7s (tdictt iteritems(tfn_pats((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt_compile_fnpats2scCs~|ptSxk|iD]]\}}||ijoAx>|D]2}x)|i|D]}||otSqRWq<WqqWtS(sPrivate helper function: given an action, return True if any of its attributes' values matches the pattern for the same attribute in the attr_match dictionary, and False otherwise. Note that the patterns must be pre-comiled using re.compile() or _compile_fnpats.(tTrueRtattrstattrlisttFalse(tactiont attr_matchtattrtmatchesRtattrval((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt _attr_matches?s  tManifestDifferencesadded changed removedcBseZgZeeiieiifgeiieiifgeiieiifggZeeiigZ e ddZ e ddZ RS(cCs.titit|tidtid|S(sReturns the serialized state of this object in a format that that can be easily stored using JSON, pickle, etc.t commonizetje_state(tmisct json_encodeR(t__name__ttuplet _ManifestDifference__state__desct%_ManifestDifference__state__commonize(tobjR*((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytgetstate`s     cCs4titi|tidtid|}t|S(s`Allocate a new object using previously serialized state obtained via getstate().R)tjd_state(R+t json_decodeR(R-R/R0(tstateR3((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt fromstatejs     N(R-t __module__t __slots__R.tactionstgenerictNSGR/t frozensetR0t staticmethodtNoneR2R6(((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR(Qs! tManifestcBseZdZd(dZdZdZdZeedZ e dZ eedZ eedZ d Zd Zd Zd Zd ZeedZeedZedZd(edZd(edZd(edZedZedZdZd(ed(edZdZdZdZ e ed(dZ!e dZ"dZ#dZ$dZ%d Z&d!Z'd"Z(ed#Z)ed$Z*d%Z+d&Z,d'Z-RS()sA Manifest is the representation of the actions composing a specific package version on both the client and the repository. Both purposes utilize the same storage format. The serialized structure of a manifest is an unordered list of actions. The special action, "set", represents a package attribute. The reserved attribute, "fmri", represents the package and version described by this manifest. It is available as a string via the attributes dictionary, and as an FMRI object from the fmri member. The list of manifest-wide reserved attributes is base_directory Default base directory, for non-user images. fmri Package FMRI. isa Package is intended for a list of ISAs. platform Package is intended for a list of platforms. relocatable Suitable for User Image. All non-prefixed attributes are reserved to the framework. Third parties may prefix their attributes with a reversed domain name, domain name, or stock symbol. An example might be com.example,supported as an indicator that a specific package version is supported by the vendor, example.com. manifest.null is provided as the null manifest. Differences against the null manifest result in the complete set of attributes and actions of the non-null manifest, meaning that all operations can be viewed as tranitions between the manifest being installed and the manifest already present in the image (which may be the null manifest). cCs||_h|_g|_g|_h|_h|_t|_t|_ |dj o<t |ti pti |dd}n|i |_ n d|_ dS(Nt build_releases5.11(tfmrit_cachet _absent_cacheR9tactions_bytypet attributesRt signaturesR texcludesR>t isinstancetPkgFmrit publisher(tselftpfmri((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt__init__s           cCsgd}d|ijo%|idjo|d|i7}nx%t|iD]}|d|7}qKW|S(Ntspkg.fmrisset name=pkg.fmri value=%s s%s (RERAR>tsortedR9(RKtrtact((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt__str__s ccsQd|ijo |idjod|iVnx|iD]}d|Vq:WdS(sbA generator function that returns the unsorted manifest contents as lines of text.spkg.fmrisset name=pkg.fmri value=%s s%s N(RERAR>R9(RKRQ((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytas_liness   cCsdid|iDS(NRNcssx|] }|VqWdS(N((Rtl((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s (tjoinRS(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyttostr_unsortedscst|to>tg}|id|D]}|d|fq*~ggSdfd}t|||}t|||}t|i} t|i} g} | | D]} | d|| fq~ } g}| | D]} ||| dfq~}g}| | @D]7} || i|| o||| || fq!q!~}t d}t d}|i d|dt | i d||i d|t| ||S( sReturn three lists of action pairs representing origin and destination actions. The first list contains the pairs representing additions, the second list contains the pairs representing updates, and the third list contains the pairs representing removals. All three lists are in the order in which they should be executed.RGcSs"t|tj o|St|S(s#handle key values that may be lists(ttypetlistR.(tv((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pythashifysc3sx|id|D]}|idjp|idjoW|iidoD|it|i|i|iid|iidgf}n.|i|ii|it|f}||fVqWdS(NRGtlinkthardlinktmediatorsmediator-versionsmediator-implementation(t gen_actionstnameRtgetR.tkey_attrtid(tmfRGtatakey(RZ(s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytdictifys  iiRtreverseN( RHtEmptyFactoredManifestR(R^R>Rtsettiterkeyst differentRtsortR(RKtorigintorigin_excludet self_excludeRRdRftsdicttodicttssettosett_[2]titaddedt_[3]tremovedt_[4]tchangedtaddsorttremsort((RZs2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt differences* + //:  cs\|ptg}g}x|D]}h}x|iD]yOtii}|ifdidDt|}Wn"tj ot f}nX|i i |fjo$|i |i |ffq:q:W|i |q!W|ot d|ng}|D]}|t|iq4~}td|}xk|iD]]} xTtt|dD]<} || | i|| d| o|i| PqqWquWtg} tt|D]8} | g} || |D]} | || | q ~ q~ g} |D]} | |d| q9~ gS(sRLike the unix utility comm, except that this function takes an arbitrary number of manifests and compares them, returning a tuple consisting of each manifest's actions that are not the same for all manifests, followed by a list of actions that are the same in each manifest.c3s*x#|]}d|i|fVqWdS(s%s=%sN(R(RRY(Rd(s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys %s it duplicatescSs||@S(((Rdtb((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt>si(tAssertionErrorR^RiR Ratupdatetget_varcet_keysR.tKeyErrorRbt setdefaultR_tappendt ManifestErrortkeystreducetcopytrangetlenRktremove(t compare_mtdupstm_dictstmtm_dictRRtm_setst common_keystkRuRtRwRy((Rds2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytcomm sH   "(&   NcCstt|i|||S(sWhere difference() returns three lists, combined_difference() returns a single list of the concatenation of the three.(RXRR}(RKRmtovtsv((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytcombined_differenceRscCs|i|||}d}xlt|D]^\}}|p|dt|7}q(|p|dt|7}q(|d||f7}q(W|S(sOutput expects that self is newer than other. Use of sets requires that we convert the action objects into some marshalled form, otherwise set member identities are derived from the object pointers, rather than the contents.RNs+ %s s- %s s %s -> %s (R}Rtstr(RKtotherRRRTtouttsrctdest((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pythumanized_differencesWs ccscd}|i|}xD|D]<}x3||D]'}td||}t|dVq0WqWdS(sGenerate contents of dircache file containing all dirctories referenced explicitly or implicitly from self.actions. Include variants as values; collapse variants where possible.css&xt|iD] }|VqWdS(N(R tdirectory_references(Rdtd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytgen_referencesnstpaths N(t_actions_to_dictRR(RKRtdirsRRYRd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt_gen_dirs_to_stris  ccsd}|i|}x|iD]\}}h|dd6|dd6|dd6}x\|D]T}d|d d id |iDd id |iDf}|Vq_Wq%Wd S(sGenerate contents of mediatorcache file containing all mediators referenced explicitly or implicitly from self.actions. Include variants as values; collapse variants where possible.cssy|idjp|idjoUd|ijoE|iid|iid|iid|iidfVndS(NR[R\R]smediator-prioritysmediator-versionsmediator-implementation(R_RR`(Rd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR}s  ismediator-priorityismediator-versionismediator-implementations%set name=pkg.mediator value=%s %s %s it css1x*|]#}|dodi|VqqWdS(it=N(RU(Rtt((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s css"x|]}di|VqWdS(RN(RU(RR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s N(RRRU(RKRt mediatorst mediationt mvariantstvaluestmvariantRd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt_gen_mediators_to_strxs&    c#sd|j}d|j}d|jo d|j}t|||fpdSttx=|iD]2}|d djot|i||s icss)x"|]}td|DVqWdS(cssx|]}|dVqWdS(iN((Rtvpair((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s N(R.(Rtvarkey((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s c3s/x(|]!}tfd|DVqWdS(c3s3x,|]%tfdDVqWdS(c3sx|]}|fVqWdS(N((Rtval(R_(s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s N(R.(R(tvariants(R_s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s N(R(Rtvcombo(R(s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s icssx|]}|dVqWdS(iN((Rtf((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys @s RNspkg.facet.commoncssx|]}d|VqWdS(s%s%sN((RRY((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys ]s s pkg.facet.%scssx|]}|dVqWdS(iN((RR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys es cssx|]}d|VqWdS(s%s%sN((RRY((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s s pkg.sizes.%sscsz=%sssz=%sspkg.sizes.common(( tanyRRiRER^R_RR!RtaddRR.RORR+tget_pkg_otw_sizetget_action_chain_csizetget_sizeR>R tpoptitemstdifference_updateRt from_iterableRt intersectionRthashlibtsha1RUt hexdigest(RKt emit_variantst emit_facetst emit_sizesR_tfacetstrefsRdRtafacetst avariantsR$RRt varcetkeystcfacetstfnamest merge_facetstvcombostpairtvfacetstvcfacetsRRQRYRRtrcsizetrsize((Rs2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt_gen_attrs_to_strs                           "     ! "   csh}x|iD]i\}}tfd||D}xX|D]J}||jo|g||s (R9RRR(RKt referencesRRYRRtref((Rds2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs"      c Cs|i|jo t}n|tjp|itjpty|id}WnTtj oHg}|iD]}|ti|iqq~}|ids (RGR RRR>R+tyield_matchingR!Ritgen_actions_by_typeRRR RRt _get_varcets( RKRGtpatternsRRtfoundtseenRdR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt gen_facetssF $   $   c cs|i|jo t}n|tjp|itjpty|d}Wntj o d}nX|dj oL|tjo?x7tid||D] }||ii|gfVqWdSt }t t }x|i dd|D]}|i d}|djo_|id}t|djo|d d jodSxj|D]}t}|d |qHWq|d djo5x2|idD]}t}||i|qWqqW|p|id|d }nx,tid||D]}|||fVqWdS( sA generator function that yields a list of tuples of the form (variant, [values]). Where 'variant' is the variant attribute name (e.g. 'variant.arch') and '[values]' is a list of the variant values supported by this package. Variants returned are those allowed by the specified (or current) excludes that also match at least one of the patterns provided.s pkg.variantsvariant.NRiRGR_RiiRNs variant.%si(RGR RRR>R+RRER`R!RRiRRR RRRR( RKRGRRRYRRdtanameR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt gen_variantssH $    $c #ss|ijo tntjp|itjpty|id}WnTtj oHg}|iD]}|ti|iqq~}|idSs smediator-versions5.11Rsmediator-prioritysmediator-implementationN(RGR RRBRRR9RRRRiR`tversiontVersiont VersionErrorR( RKRGRRRtretRtmed_verR((RGs2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt gen_mediators=s6 $?      ccs|i|jo t}n|tjp|itjpt|ot|}n|i}xc|iD]X}xO|D]}||d|pPququW|p |Vqht||o |VqhqhWdS(s:Generate actions in manifest through ordered callable listRJN(RGR RRRJR9R'(RKR#RGtpubRdtc((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR^js  $    ccs|i|jo t}n|tjp|itjpt|ot|}n|i}xo|ii|gD]X}xO|D]}||d|pPqqW|p |Vqtt||o |VqtqtWdS(s]Generate actions in the manifest of type "type" through ordered callable listRJN(RGR RRRJRDR`R'(RKtatypeR#RGRRdR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs  $   ccs@x9|D]1}x(|i|d|d|D] }|Vq)WqWdS(saGenerate actions in the manifest of types "atypes" through ordered callable list.R#RGN(R(RKtatypesR#RGRRd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytgen_actions_by_typess  cCsd|i|d|DS(sgGenerate the value of the key attribute for each action of type "type" in the manifest.css(x!|]}|ii|iVqWdS(N(RR`Ra(RRd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys s RG(R(RKRRG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytgen_key_attribute_value_by_typesc Csd}g}g}|id|D] }||q&~}xtt|d||D]\}}t|} t} xdtt| dD]L} | | i| | do*| i| | | i| | dqqW| o|i || fqXqXW|S(sFind actions in the manifest which are duplicates (i.e., represent the same object) but which are not identical (i.e., have all the same attributes).cSs%|i|ii|it|fS(s,Return a key on which actions can be sorted.(R_RR`RaRb(Rd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytfunsRGRi( R^RRORXRiRRRkRR( RKRGRtalldupsRRdtactsRtgtglistRRu((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR~s -   ccs)d}d}g}t|to|i}nx|D]}|d7}|i}|ido||dd!7}q9n|o||}d}n| p|ddjoq9nyti|VWq9tij o+}|i|_||_ |i |q9Xq9W|ot i |ndS(NRNiis\it#( RHt basestringt splitlinestlstriptendswithR9Rt ActionErrorRAtlinenoRtapxtInvalidPackageErrors(RKtcontentt accumulateRterrorsRTte((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt__content_to_actionss2      c Csd|dj p|dj pt|o| ptg|_h|_h|_h|_g|_|ogy<t|dii }z|~}|i }WdQXWqt j o}t i |qXnt|to7|oh|i|d6|_n|i|}nx|D]}|i||q W||_t|idjptdS(sPopulate the manifest with actions. 'content' is an optional value containing either the text representation of the manifest or an iterable of action objects. 'excludes' is optional. If provided it must be a length two list with the variants to be excluded as the first element and the facets to be excluded as the second element. 'pathname' is an optional filename containing the location of the manifest content. 'signatures' is an optional boolean value that indicates whether a manifest signature should be generated. This is only possible when 'content' is a string or 'pathname' is provided. trbNssha-1i(R>RR9RDRERBRCtopent__exit__t __enter__treadtEnvironmentErrorRt_convert_errorRHRt hash_createRFt_Manifest__content_to_actionst add_actionRGR( RKRRGtpathnameRFRtmfileR R"((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt set_contents.!     & cCs|id|id|dS(sNRemove any actions from the manifest which should be excluded.RRGN(RR9(RKRG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytexclude_content scCs |i}|i}d|jod|jo|d|d(tx((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRsR s %(fp)s: %(e)stfpR ic sx |D]\}}}}|djo|djo |}qon/|djo |}n|djo |}nt|to8g}|D]}|||||fq~|q||||fjo!||||fi|q|g||||fRHRXR(tlsttcpt action_nametsubtypettokt full_valueRR(t_Manifest__handle_listt action_dict(s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt __handle_lists(       #     RRs`%(fp)s contains an action which is missing the expected attribute: %(at)s. The action is:%(act)statRQN(R>tfileRterrnotENOENTt_treadlinetstripR9RRRRthas_keyRtosRtseptgenerate_indicesRtargsttelltclose(t file_pathRGt return_linetlogt file_handleR tcur_postlineRTR"tnptindsRtarg((R-R,s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt search_dictsX    #      cCsMti}t|to|i|idn|i||iS(soThis method takes a string representing the on-disk manifest content, and returns a hash value.sutf-8(RRRHtunicodeRtencodeR(t mfstcontenttsha_1((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs   cCs*||ijoti|indS(sVerifies whether the signatures for the contents of the manifest match the specified signature data. Raises the 'BadManifestSignatures' exception on failure.N(RFRtBadManifestSignaturesRA(RKRF((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytvalidatesc Cstii|}tii|d}yti|dtWntj ou}|itijot i |i n|iti jot i |i n|itijoqnXy"tid|d|\}}Wnjtj o^}|itijot i |i n|iti jot i |i nnXti|d}|i|i|iy$ti|tti||Wnjtj o^}|itijot i |i n|iti jot i |i nnXdS(s$Store the manifest contents to disk.t.tmodetdirtprefixtwbN(R7RtdirnametbasenametmakedirsR RR1tEACCESRtPermissionsExceptiontfilenametEROFStReadOnlyFileSystemExceptiontEEXISTttempfiletmkstemptfdopentwriteRVR<tchmodR tportabletrename(RKt mfst_pathtt_dirtt_prefixR tfdtfnR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytstore sD " cCs>||ijodS|i|}t|tp|S|gS(N(RER>RHR(RKR_R((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt get_variants;s  cs&titfdiDS(s9Return a dictionary mapping variant tags to their values.c3s:x3|],}|ido|i|fVqqWdS(svariant.N(t startswithRE(RR_(RK(s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pys Fs (tvarianttVariantCombinationTemplateRRE(RK((RKs2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytget_all_variantsCs  cCs'y ||SWntj o|SXdS(N(R(RKRtdefault((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR`Ks cCsV|i||i}|djotS|djotSttd|dS(s8Returns the boolean of the value of the attribute 'key'.ttruetfalses*Attribute value '%s' not 'true' or 'false'N(R`tlowerRR!RR3(RKRRmR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytgetboolQs   cCs |i|jo t}n|tjp|itjptd}d}|i}d|jo'd|jo0|tjp|i|jo|d|dfSx=|id|D])}||i7}|ti|7}qW|tjo||d<||dRRDR(RKRRRdtnew_attr((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt __setitem__s  $  cCs ||ijS(N(RE(RKR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt __contains__sN(.R-R7t__doc__R>RMRRRSRVR R}R=RRRRRRRRRRRR^RRRR~RR!RRRRRFRRLRgRhRlR`RqRRRzR|R}(((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR?xsX#   GE  #  :5 -  #  <  ' @d  0    $ 5  tFactoredManifestcBs[eZdZdeddZdZdZdZdZ dZ dZ e dZ d Zd Zded Zeed Zeed ZedZdZedZdZdZdZdZdZdZe edZdedZedZedZ eedZ!dZ"e#dZ$RS(sThis class serves as a wrapper for the Manifest class for callers that need efficient access to package data on a per-action type basis. It achieves this by partitioning the manifest into multiple files (one per action type) and then storing an on-disk cache of the directories explictly and implicitly referenced by the manifest each tagged with the appropriate variants/facets.cCsNti||||_||_t|idjptt|_t i i |i pl|djo t|n|id||i|io|in|o|i|ndS|id}t i i |pQt|_|i|io|in|o||_|indS|i|dS(sRaises KeyError exception if factored manifest is not present and contents are None; delays reading of manifest until required if cache file is present. 'fmri' is a PkgFmri object representing the identity of the package. 'cache_root' is the pathname of the directory where the manifest and cache files should be stored or loaded from. 'contents' is an optional string to use as the contents of the manifest if a cached copy does not already exist. 'excludes' is optional. If provided it must be a length two list with the variants to be excluded as the first element and the facets to be exclduded as the second element. 'pathname' is an optional string containing the pathname of a manifest. If not provided, it is assumed that the manifest is stored in a file named 'manifest' in the directory indicated by 'cache_root'. If provided, and contents is also provided, then 'contents' will be stored in 'pathname' if it does not already exist. iRNsmanifest.dircache(R?RMt_FactoredManifest__cache_roott_FactoredManifest__pathnameRRGRR!tloadedR7RtexistsRR>RRt_FactoredManifest__finiloadt_FactoredManifest__storebackt_FactoredManifest__unloadRt_FactoredManifest__cache_pathR t_FactoredManifest__load(RKRAt cache_roottcontentsRGRtmdpath((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRMs4           cCstii|i|S(N(R7RRUR(RKR_((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt __cache_pathscCs*|id|id|i|idS(s8Load all manifest contents from on-disk copy of manifestRGRN(RRGRR(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt__loadscCs(g|_h|_h|_t|_dS(sfUnload manifest; used to reduce peak memory comsumption when downloading new manifestsN(R9RDRER!R(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt__unloads   cCs t|_dS(s_Finish loading.... this part of initialization is common to multiple code pathsN(RR(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt __finiload$scCsQ|ipty"|i|i|itSWntij otSXdS(sx store the current action set; also create per-type caches. Return True if data was saved, False if notN( RRRgRt_FactoredManifest__storebytypeRRRVR!(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt __storeback)s c siptitix]iiD]L\}}d|}y"tidd|\}}Wn$t j o}t i |nXt i |d}zuyJx|D]}|id|qW|djo|iinWn$t j o}t i |nXWd|iXy1t i|tti|id|Wq7t j o}t i |q7Xq7Wfd } | d i| d idS( s create manifest. files to accelerate partial parsing of manifests. Separate from __storeback code to allow upgrade to reuse existing on disk manifestss manifest.%s.RORPRQs%s RiNs manifest.%sc sytidd|d\}}ti|dii}z|~}|i|WdQXti|tt i |i |Wn$t j o}t i|nXdS(NRORPRMRQ(R[R\R7R]R Rt writelinesR_R R`RaRRRR(R_RReRfRRR (RKRc(s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt create_cachegs)smanifest.dircachesmanifest.mediatorcache(RRRR+RTRDRR[R\RRRR7R]R^RRR<R_R R`RaRRR( RKRRRdReRfR RRdR((RKRcs2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt __storebytype6s@        c Csyxti|D]o}|idpqny titii||Wqtj o#}|iti joqqXqWyti |WnnXWn;tj o/}|iti jot i |qnXdS(sRemove all manifest cache files found in the given directory (excluding the manifest itself) and the cache_root if it is empty afterwards. s manifest.N( R7tlistdirRiR`RRRURR1R2trmdirRR(RtcnameR ((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt clear_cachevs$c CsN|i|}tii|oyt|dii}zj|~}g}d|DD]8}|i p|i|id|i o ||q`q`~|i |s RJN(RR7RRR R RRGRRJRBRRRR9RRRt ExceptionRRR(RKR_tmpathRRRtRdR ((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt__load_cached_datas*& . cCs|idti||S(sq return a list of directories implicitly or explicitly referenced by this object smanifest.dircache(t#_FactoredManifest__load_cached_dataR?R(RKRG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs c cs$|io3x+ti||d|d|D] }|Vq)WdS|id}tii|pK|ip|inx+ti||d|d|D] }|VqWdS|tjo |i }n||i jp|i tjpt ||i jodS|id|}|ot |}nyt |dii}z|~}xt|D]l}ti|i}|o!|i|d|i oqZn|p |VqZt||o |VqZqZWWdQXWnLtj o@} | itijo|i i|dSti| nXdS(s generate actions of the specified type; use already in-memory stuff if already loaded, otherwise use per-action types filesR#RGNsmanifest.dircaches manifest.%sR RJ(RR?RRR7RRRR RGRRCRR R RR9RRRRJR'RR1R2RRR( RKRR#RGRdRRRRTR ((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRsR        '&  cCs@|i o|i o|inti|d|d|S(sQA generator function that returns the supported facet attributes (strings) for this package based on the specified (or current) excludes that also match at least one of the patterns provided. Facets must be true or false so a list of possible facet values is not returned.RGR(Rt"_FactoredManifest__load_attributesRR?R(RKRGR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRscCs@|i o|i o|inti|d|d|S(sA generator function that yields a list of tuples of the form (variant, [values]). Where 'variant' is the variant attribute name (e.g. 'variant.arch') and '[values]' is a list of the variant values supported by this package. Variants returned are those allowed by the specified (or current) excludes that also match at least one of the patterns provided.RGR(RRRR?R(RKRGR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRscCs |idti|d|S(sA generator function that yields set actions expressing the set of possible mediations for this package. smanifest.mediatorcacheRG(RR?R(RKRG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs c Cs|id}tii|ptSt|dii}zk|~}x[|D]S}ti |i }|i p|i |i d|i o|i|qTqTWWdQXtS(saLoad attributes dictionary from cached set actions; this speeds up pkg info a lots manifest.setR RJN(RR7RRR!R R RR9RRRGRRJRR(RKRRRRTRd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyt__load_attributes&s&  cCs:|i o|i o|inti|d|S(sReturns an integer tuple of the form (size, csize), where 'size' represents the total uncompressed size, in bytes, of the Manifest's data payload, and 'csize' represents the compressed version of that. 'excludes' is a list of a list of variants and facets which should be allowed when calculating the total.RG(RRRR?R(RKRG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR7scCs7|i o|i o|inti||S(N(RRRR?Rz(RKR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRzCscCsdptdS(s-No assignments to factored manifests allowed.sFactoredManifests are not dictsN(R(RKRR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR|HscCs7|i o|i o|inti||S(N(RRRR?R}(RKR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR}LscCs'y ||SWntj o|SXdS(N(R(RKRRm((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR`Qs cCs7|i o|i o|inti||S(N(RRRR?Rh(RKR_((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRhWscCs4|i o|i o|inti|S(N(RRRR?Rl(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRl\scCsti||d|S(NR>(R?RF(t cache_pathRGR>((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRFascCs1|ip|inti|d|d|S(NR#RG(RRR?R^(RKR#RG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR^fs cCs%|ip|inti|S(N(RRR?RR(RKRG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRRls cCs+|ip|inti|d|S(NRG(RRR?R~(RKRG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR~qs cCs4|ip|inti||d|d|S(NRnRo(RRR?R}(RKRmRnRo((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR}vs  cCs2|ip|intt|i|dS(s$Store the manifest contents to disk.N(RRtsuperRRg(RKRb((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRg~s cCs(|io|iStii|idS(s:The absolute pathname of the file containing the manifest.tmanifest(RR7RRUR(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs N(%R-R7R~R>R RMRRRRRRR=RRRRRRRRRRzR|R}R`RhRlR!RFR^RRR~R}RgtpropertyR(((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRsB @     @ ) B             RhcBsGeZdZdZeedZedZdZdZ RS(sSpecial class for pkgplan's need for a empty manifest; the regular null manifest doesn't support get_directories and making the factored manifest code handle this case is too ugly...cCsti|dS(N(R?RM(RK((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRMscCs=tggg}|id|D]}||dfq ~S(sReturn three lists of action pairs representing origin and destination actions. The first list contains the pairs representing additions, the second list contains the pairs representing updates, and the third list contains the pairs representing removals. All three lists are in the order in which they should be executed.RGN(R(R^R>(RKRmRnRoRRd((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyR}s cCsgS(N((RG((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRscOsdS(N((RKR:tkwargs((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRscOstddS(Ns3Cannot call set_content on an EmptyFactoredManifest(t RuntimeError(RKR:R((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs( R-R7R~RMR R}R=RRR(((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRhs   RcBs#eZdZedZdZRS(s9Simple Exception class to handle manifest specific errorscCs ||_dS(N(t_ManifestError__duplicates(RKR~((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRMscCs8g}x"|iD]}|id|qWdi|S(Ns%s %s s (RRRU(RKRR((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRRs  (R-R7R~R RMRR(((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pyRs (7t collectionsRRR1RRR7RR[t itertoolsRRRRRtoperatorRt pkg.actionsR9tpkg.client.api_errorstclientt api_errorsRt pkg.facetRttpkg.fmriRAtpkg.miscR+t pkg.portableR`t pkg.variantRjt pkg.versionRRR R R R tpkg.actions.attributeR tpkg.actions.directoryRRR'R(tobjectR?tnullRRhtNullFactoredManifestRR(((s2/usr/lib/python2.6/vendor-packages/pkg/manifest.pytsF      (( &V &