Ñò é=ûQc@sdZddkZddkZddkZddkiiZddkZddk Zddk l Z dZ d Z deifd„ƒYZdS(s¹Action describing a package dependency. This module contains the DependencyAction class, which represents a relationship between the package containing the action and another package. iÿÿÿÿN(tFirmwaret conditionaltexcludetgroupt incorporatetoptionaltorigintparenttrequires require-anysfeature/package/dependency/selftDependencyActioncBsreZdZgZdZdZeieZd d„Z d„Z d„Z d„Z d„Zd„Zd d „ZRS( s'Class representing a dependency packaging object. The fmri attribute is expected to be the pkg FMRI that this package depends on. The type attribute is one of these: optional - optional dependency on minimum version of other package. In other words, if installed, other packages must be at least at specified version level. require - dependency on minimum version of other package is needed for correct function of this package. conditional - dependency on minimum version of specified package if predicate package is installed at specified version or newer. require-any - dependency on minimum version of any of the specified packages. origin - specified package must be at this version or newer in order to install this package; if root-image=true, dependency is on version installed in / rather than image being modified. parent - dependency on same version of this package being present in the parent image. if the current image is not a child then this dependency is ignored. incorporate - optional dependency on precise version of other package; non-specified portion of version is free to float. exclude - package may not be installed together with named version or higher - reverse logic of require. group - a version of package is required unless stem is in image avoid list; version part of fmri is ignored. Obsolete packages are assumed to satisfy dependency.tdependtfmricKs™tii|||yH|idtjo0tiit|ƒt dƒ|idƒ‚nWn4t j o(tiit|ƒt dƒƒ‚nXdS(Nttypes"Unknown type (%s) in depend actionsMissing type attribute( tgenerictActiont__init__tattrst known_typestpkgtactionstInvalidActionErrortstrt_tKeyError(tselftdataR((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pyRhs  cCsU|iiƒpgStg}|iiƒD]}||i|fq,~ƒ}g}|i|jo|itdƒ|iƒ|S||i}|io/|i|ijo|itdƒ|ƒ|S|i|ijp|ii |it ii ƒogS|ii |it ii ƒo|itdƒ|ƒn|itdƒ|ƒ|S(Ns+Package is not installed in parent image %ss3Package in parent is from a different publisher: %ss.Parent image has a newer version of package %ss/Parent image has an older version of package %s( tlinkedtischildtdictt parent_fmristpkg_nametappendRt publishertversiont is_successorRtCONSTRAINT_AUTOtCONSTRAINT_NONE(RtimageR t_[1]tit ppkgs_dictterrorstpf((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pyt__check_parent_installedss2/   c Cs6g}|p|S|i}|oW|ioM|ii|tiiƒo1|itdƒh|d6|d6|d6ƒ|S|oh|io^||ijoN|i|itiiƒ o1|itdƒh|d6|d6|d6ƒ|S|oCti|i |ƒjo*|itdƒh|d6|d6ƒ|S|S(Ns=%(dep_type)s dependency %(dep_val)s is downrev (%(inst_ver)s)tdep_typetdep_valtinst_vers;%(dep_type)s dependency %(dep_val)s is uprev (%(inst_ver)s)sg%(dep_type)s dependency on an obsolete package (%(obs_pkg)s); this package must be uninstalled manuallytobs_pkg( R!R"RR$RRR#tpkgdefstPKG_STATE_OBSOLETEt get_pkg_state( RR%tinstalled_versiontmin_fmritmax_fmritrequiredtctypeR)tvi((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pyt__check_installedœs<         c sg}g}g}|ipt‚‡fd†}|id}|tjo%|itdƒ|ƒ|||fSg} xZ|idƒD]I} tii | ˆidƒ} | i t jo |} n| i| ƒq‡W|djoEt | ƒdjpt‚|i |iˆ| dƒƒ|||fSg} | D]} | ˆi| ƒq1~ } | d}| d}d}d}t}|d jot}|}n+|d jo|}|}n|d jo |}n÷|d jo"|}|iƒ}|ƒ|_nÈ|d joctii |idˆidƒ}ˆi|ƒ}|dj o |i|ƒo|}t}q½nX|djo.|i ˆiƒˆiƒBjo t}q½n|djo«xet| | ƒD]T\}}|iˆ||dt|ƒ}|o| ogggfS|i |ƒq¾W|p.|itdƒdid„| Dƒƒƒn|||fS|djoW|i idƒoDtƒi||i ƒ\}}|ogggfS|i|ƒn|i |iˆ|||||ƒƒ|o#| o|itdƒ|ƒn|||fS(s»Returns a tuple of lists of the form (errors, warnings, info). The error list will be empty if the action has been correctly installed in the given image.cstiidˆidƒS(Nt0s Build-Release(RR!tVersionR((R%(s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pyt __min_versionÍs R s"Unknown type (%s) in depend actionR s Build-ReleaseRiiRRRRRt predicateRs require-anys(Required dependency on one of %s not mets, cssx|]}t|ƒVqWdS(N(R(t.0tp((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pys s Rsfeature/firmware/s'Required dependency %s is not installedN(R tAssertionErrorRRRRtattrlistRR tPkgFmriRt DEPEND_SELFtlentextendt)_DependencyAction__check_parent_installedtget_version_installedtNonetFalsetTruetcopyR!R"t avoid_set_gettobsolete_set_gettzipt"_DependencyAction__check_installedtjoint startswithRtcheck_firmware(RR%tpfmritargsR)twarningstinfot_DependencyAction__min_versionR7tpfmrisR'tfR&tinstalled_versionsR3R4R5R6tcfmritinstalled_cversiontifmritrpfmritetoktreason((R%s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pytverify¿sš    #                 cCsÛ|id}|id}|tjogSt|tƒo |g}ng}tidƒ}xv|D]n}|id|ƒ}|id||dfƒd|jo0|i dƒd}|id||dfƒqeqeW|S( swGenerates the indices needed by the search dictionary. See generic.py for a more detailed explanation.R R spkg:///|pkg://[^/]*/|pkg:/tR t@iN( RRt isinstancet basestringtretcompiletsubRRHtsplit(RR7RXtindstpatR?tstem((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pytgenerate_indices1s"      !csªd}|‰|ˆi}tˆdƒo%ˆidjo|dˆi7}n‡fd†‰‡fd†‰d|‰t‡fd†‰‡‡‡‡fd †}||ƒS( s­Write a dependency action across multiple lines. This is designed to be used in exceptions for cleaner printing of unsatisfied dependencies.s thashtNOHASHt cs”|didƒodS|didƒodSt|dtƒodS|ddjodS|dd jodS|dˆijod SdS( Nisvariant.isfacet.iiiR R i(RQRetlisttkey_attr(ta(tact(s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pytkvordbscs<tˆ|ƒˆ|ƒƒ}|o|St|d|dƒS(Ni(tcmp(Rttbtc(Rv(s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pytcmpkv}ss \ csˆ|pu|idƒ}|djo d}n|djo d}nd}t|ƒ|t|ƒ|jo |d|Sn|ˆ|S(Ns iÿÿÿÿiiiPiNRq(trfindRD(RtRxt rem_valuestforce_nltlastnltmax_len(tJOIN_TOK(s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pytgrow…s    !c st}t‡fd†ˆiDƒƒ}xítˆiiƒdˆƒD]Ð\}}t|tƒp t|tƒp|g}t}n |}t}x‚t|ƒD]t}|o |i dƒ}ˆ|di |t i |ƒfƒ|d|ƒ}|oˆ|jo t}n|d8}q™WqAW|S(Nc3s(x!|]}tˆi|ƒƒVqWdS(N(RDRA(R>tk(Ru(s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pys ¢s Rws pkg.debugt=R}i( RJtsumRtsortedt iteritemsReRrtsetRIRQRPR tquote_attr_value( taoutt first_linet rem_countR‚tvtnvt use_force_nltlmtR}(RzRR€Ru(s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pytastrœs.       (tnamethasattrRoRI(Rt base_indenttoutR((RvR€RzRuRs8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pyt pretty_printUs   "c CsÆdg}|iidƒ}|djo|idƒntii|d|dtd|ddƒ}d|ijo*|djo|idtd ƒfƒnd|ijo*|d jo|idtd ƒfƒnxÂdD]º}x±|i|ƒD] }yt i i |d ƒWqôt i i t i ifj ob}|djo|d joqôn|i|tdƒh|d6|d6t|ƒd6fƒqôXqôWqÞW|ot ii||d|ƒ‚ndS(s9Performs additional validation of action attributes that for performance or other reasons cannot or should not be done during Action object creation. An ActionError exception (or subclass of) will be raised if any attributes are not valid. This is primarily intended for use during publication or during error handling to provide additional diagonostics. 'fmri' is an optional package FMRI (object or string) indicating what package contained this action.R RR=R t raise_errorstrequired_attrst single_attrss root-images>a predicate may only be specified for conditional dependenciesRs>the root-image attribute is only valid for origin dependenciess5.11t__TBDs-invalid %(attr)s value '%(value)s': %(error)stattrtvalueterrorN(s predicates root-image(s predicateR (RtgetRR Rt _validateRIRRARR RBR!t VersionErrort FmriErrorRRtInvalidActionAttributesError(RR R—tdtypeR)RšRYR_((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pytvalidateÀs6      ) N(t__name__t __module__t__doc__t __slots__R‘RsR t _orderdictt ordinalityRHRRFRORbRnR•R£(((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pyR >s"  ) # r $ k( s conditionalsexcludesgroups incorporatesoptionalsoriginsparentsrequires require-any(R¦R Rgt pkg.actionsRtpkg.client.pkgdefstclientR0tpkg.fmrit pkg.versiontpkg.client.firmwareRRRCRR (((s8/usr/lib/python2.6/vendor-packages/pkg/actions/depend.pyt s$