YSc@sddkZddkZddkZddkZddkZddkZddkZddkZddk Z ddk Z ddk Z ddk Z ddk Z ddkZddkZddklZddklZeiZddkZddkiiZddkiiZddkiiZddkiZddk i!Z!ddk"i#Z#ddk$i%i&Z'ddk(Z)ddk l*Z*l+Z+l,Z,l-Z-l.Z.dZ/dZ0hde/6de06Z1e2ddd fZ3dZ4e2d fZ5d Z6hd e66Z7hd d dfd6dddfd6Z8hdgd6Z9hd gd6dgd6Z:hdgd6Z;e9e:e;gZ<dZ=de>fdYZ?de?fdYZ@de?fdYZAde>fdYZBde>fdYZCdS(iN(tglobal_settings(t DebugValues(t EmptyDicttEmptyItSIGNATURE_POLICYt DictPropertytPKG_RO_FILE_MODEtcoret supplementaltfilethttpthttpstprioritycCs|i|ifS((R turi(tobj((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytcssCA:TRUEsCA:FALSEsPATHLEN:tbasicConstraintssDIGITAL SIGNATUREsCERTIFICATE SIGNsCRL SIGNtkeyUsages t RepositoryURIcBseZdZd!Zd!Zd!Zd!Zd!Zd!Z d!Z d!d!d!e d!e d!dZ dZdZdZdZdZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZeded!dZ eded!dZ!eded!dZ"eded!dZ#eeed!dZ$eded!dZ%edZ&eded!d Z'RS("sRClass representing a repository URI and any transport-related information.c Cs||_d|_d|_g|_||_||_||_||_|o|ot i dn|ot |g|_ n|o ||_ n||_ dS(NsMBoth 'proxies' and 'proxy' values were used to create a RepositoryURI object.(t_RepositoryURI__trailing_slashtNonet_RepositoryURI__schemet_RepositoryURI__netloct_RepositoryURI__proxiesR R tssl_certtssl_keyt api_errorstPublisherErrortProxyURItproxiestsystem( tselfR R RRttrailing_slashtproxyRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__init__s         cCsXt|id|id|id|id|id|id|i}t||_ |S(NR RRR RR( Rt_RepositoryURI__urit_RepositoryURI__priorityt_RepositoryURI__ssl_certt_RepositoryURI__ssl_keyRRRtidt_source_object_id(RR ((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__copy__s  cCsCt|to|i|ijSt|to|i|jStS(N(t isinstanceRR tstrtFalse(Rtother((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__eq__s cCsCt|to|i|ijSt|to|i|jStS(N(R*RR R+tTrue(RR-((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__ne__s cCs?|pdSt|tpt|}nt|i|iS(Ni(R*RtcmpR (RR-((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__cmp__s cCsY|dj o?yt|}WqLttfj oti|qLXn||_dS(N(Rtintt TypeErrort ValueErrorRtBadRepositoryURIPriorityR$(Rtvalue((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_prioritys  cCs!|ipdS|idiSdS(Ni(RRR (R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __get_proxys cCsB|pdSt|tpt|}n|}|g|_dS(N(R*RR(RR!tp((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_proxys cCsx7|D]/}t|tptidd|qqW|o,|idjotidd|int|tp t|tptidd|nt|djotidd|n|o ||_ n g|_ dS(NRR7R tschemei( R*RRtBadRepositoryAttributeValueR<t!UnsupportedRepositoryURIAttributetlistttupletlenR(RRR!((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_proxiess$ cCs|itjo#|otidd|in|o?t|tptidd|ntii |}n|djo d}n||_ dS(NRR<R7t( R<t SSL_SCHEMESRR>R*t basestringR=tostpathtnormpathRR%(Rtfilename((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_ssl_certs  cCs|itjo#|otidd|in|o?t|tptidd|ntii |}n|djo d}n||_ dS(NRR<R7RC( R<RDRR>R*RER=RFRGRHRR&(RRI((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_ssl_keys  cCs9|ttfjotidd|n||_dS(NR R7(R/R,RR=R(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_trailing_slashscCs|djoti|n||ijodSt|to t}nt}ti |dd\}}}}}|i |_ ||_ |o#|i t joti|n$|i tjoti|n|i ido| pti|d| oti|n|i djo|oti|n|i||i d}|io"|id}ti|}n|i tjod|_d|_n||_dS(Ntallow_fragmentsiR R!R it/(RRtBadRepositoryURIR#R*RR/R,turlparseturlsplittlowerRRtSUPPORTED_PROXY_SCHEMEStUnsupportedProxyURItSUPPORTED_SCHEMEStUnsupportedRepositoryURIt startswithtmisct valid_pub_urltreplaceRtrstripturl_affix_trailing_slashRDR%R&(RR tis_proxyR<tnetlocRGtparamstquery((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_uri"s8  $      cCs3|dtgjoti|n||_dS(sVAllow the __uri field of the object to be overridden in special cases.N(Rt SYSREPO_PROXYRROR#(RR ((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt _override_uriXscCs t|iS(N(R+R#(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__str___scCsu|iptti|idt\}}}}}}||jodSti||||||f|_dS(sChange the scheme of this uri.RMN(R#tAssertionErrorRPR,t urlunparseR (Rt new_schemeR<R^RGR_R`tfragment((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt change_schemebs * cCs@ti|idd\}}}}}}|djo|SdS(s5Get the host and port of this URI if it's a http uri.RMiR RC(RPR#(RR<R^RGR_R`Rh((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytget_hostms* cCsIti|idd\}}}}}}|djoti|SdS(s\Returns the URI path as a pathname if the URI is a file URI or '' otherwise.RMiR RC(RPR#turllibt url2pathname(RR<R^RGR_R`Rh((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt get_pathnamevs* cCs|iS((R%(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss<The absolute pathname of a PEM-encoded SSL certificate file.cCs|iS((R&(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss4The absolute pathname of a PEM-encoded SSL key file.cCs|iS((R#(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss$The URI used to access a repository.cCs|iS((R$(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRssWAn integer value representing the importance of this repository URI relative to others.s+The proxy to use to access this repository.cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRssA list of proxies that can be used to access this repository.At runtime, a $http_proxy environment variable might override this.cCs)|ipdSti|idddS(sThe URI scheme.RCRMi(R#RPRQ(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR<s cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRssA boolean value indicating whether any URI provided for this object should have a trailing slash appended when setting the URI property.N((t__name__t __module__t__doc__RR$RR%R&RR#R(R/R,R"R)R.R0R2t_RepositoryURI__set_priorityt_RepositoryURI__get_proxyt_RepositoryURI__set_proxyt_RepositoryURI__set_proxiest_RepositoryURI__set_ssl_certt_RepositoryURI__set_ssl_keyt"_RepositoryURI__set_trailing_slasht_RepositoryURI__set_uriRcRdRiRjRmtpropertyRRR R R!RR<R (((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRsT          6         RcBseZdZedZdZdZededdZ ededdZ ededd Z ed edd Z ed edd Z ededdZRS(sjA class to represent the URI of a proxy. The 'uri' value can be 'None' if 'system' is set to True.cCs*d|_||_|p ||_ndS(N(Rt_ProxyURI__systemRR (RR R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR"s  cCs^|ttfjotidd|n||_|o|itn|iddS(sA property to specify whether we should use the system publisher as the proxy. Note that this method modifies the 'uri' property when set or cleared.RR7N(R/R,RR=RzRcRbR(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_systems cCstd|dS(s{A method used to prevent certain properties defined in the parent class from being set on ProxyURI objects.s7This property cannot be set to %s on a ProxyURI object.N(R5(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __unsupportedscCs|iS((Rz(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss7True, if we should use the system publisher as a proxy.cCsdS(N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss6proxies is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss7ssl_cert is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss6ssl_key is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss7priority is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRss=trailing_slash is an invalid property for ProxyURI propertiesN(RnRoRpR,R"t_ProxyURI__set_systemt_ProxyURI__unsupportedRyRRRRRR R (((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRs         tTransportRepoURIcBseZdZd d d ed edZdZdZdZ dZ dZ dZ dZ ed Zed e d d Zee e d d ZRS(sA TransportRepoURI allows for multiple representations of a given RepositoryURI, each with different properties. One RepositoryURI could be represented by several TransportRepoURIs, used to allow the transport to properly track repo statistics for for each discrete path to a given URI, perhaps using different proxies or trying one of several SSL key/cert pairs.c CsMd|_d|_||_ti||d|d|d|d|d|dS(NR RRR R(Rt_TransportRepoURI__proxyt _TransportRepoURI__runtime_proxyR!RR"(RR R RRR R!R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR"s     cCsft|to$|i|ijo|i|ijSt|to|i|jo |idjStS(N(R*RR R!RERR,(RR-((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR.s cCsft|to$|i|ijp|i|ijSt|to|i|jp |idjStS(N(R*RR R!RERR/(RR-((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR0s cCs|pdSt|tot|}nt|tpdSt|i|i}|djot|i|iS|SdS(Nii(R*RERR1R R!(RR-tres((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR2s cCs<|i}|i}|io|iid}n||fS(suReturns a value that can be used to identify this RepoURI uniquely for the transport system. Normally, this would be done using __hash__() however, TransportRepoURI objects are not guaranteed to be immutable. The key is a (uri, proxy) tuple, where the proxy is the proxy used to reach that URI. Note that in the transport system, we may choose to override the proxy value here. If this key format changes, a corresponding change should be made in pkg.client.transport.engine.__cleanup_requests(..)RN(R RR[(RtuR:((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytkey s   cCs|i pt|i pt|o,|idjotidd|in|o|id|_n d|_d|_ dS(NR R!R<RN( RReRR<RR>R[RRR(RR!((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR;!s cCsB|io|iS|ipti|i|i|_n|iS(sReturns the proxy that should be used at runtime, which may differ from the persisted proxy value. We check for http_proxy, https_proxy and all_proxy OS environment variables. To avoid repeated environment lookups, we cache the results.(RR!RRXtget_runtime_proxyRR (R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__get_runtime_proxy0s  cCstp tddS(soThe runtime proxy value is always computed dynamically, we should not allow a caller to set it.s&Refusing to set a runtime_proxy value.N(R,Re(Rt runtime_proxy((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_runtime_proxyAscCsg}|iojx|iD]X}t|id|id|id|id|id|id|i}|i|qWnD|it|id|id|id|id|id|i|S(sBuild a list of TransportRepositoryURI objects using properties from the given RepositoryURI, 'repouri'. This is to allow the transport to try different paths to a given RepositoryURI, if more than one is possible.R RRRR R!( RRR R RRRR tappend(trepourittrans_repourisR:tt((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt fromrepouriGs&              cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyResstThe proxy that is used to access this repository.At runtime, a $http_proxy environnent variable might override this.sThe proxy to use to access this repository. This value checksOS environment variables, and expands any $user:$password values.N(RnRoRpRR/R,R"R.R0R2Rt_TransportRepoURI__set_proxyt$_TransportRepoURI__get_runtime_proxyt$_TransportRepoURI__set_runtime_proxyt staticmethodRRyR!R(((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRs         t Repositoryc Bs{eZdZd,ZgZgZgZd,Zd,Z gZ e Z d,Z d,Zd,ZeZed,d,d,d,d,d,ed,d,e d Zd,d,d,d,edZdZedZdZdZdZdZd Zd Zd Zd Zd,d,d,d Z d,d,d,dZ!d,d,d,dZ"d,d,d,dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+d,d,d,dZ,d,d,d,dZ-dZ.dZ/e0ded,dZ1e0ded,d Z2e0d!ed,d"Z3e0d#ed,d"Z4e0d$ed,d%Z5e0d&ed,d'Z6e0d(ed,d)Z7e0d*ed,d+Z8RS(-sClass representing a repository object. A repository object represents a location where clients can publish and retrieve package content and/or metadata. It has the following characteristics: - may have one or more origins (URIs) for publication and retrieval of package metadata and content. - may have zero or more mirrors (URIs) for retrieval of package content.c Csg| |_||_||_||_||_||_||_||_||_| |_ | |_ dS(s|Initializes a repository object. 'collection_type' is an optional constant value indicating the type of packages in the repository. 'description' is an optional string value containing a descriptive paragraph for the repository. 'legal_uris' should be a list of RepositoryURI objects or URI strings indicating where licensing, legal, and terms of service information for the repository can be found. 'mirrors' is an optional list of RepositoryURI objects or URI strings indicating where package content can be retrieved. 'name' is an optional, short, descriptive name for the repository. 'origins' should be a list of RepositoryURI objects or URI strings indicating where package metadata can be retrieved. 'refresh_seconds' is an optional integer value indicating the number of seconds clients should wait before refreshing cached repository catalog or repository metadata information. 'registered' is an optional boolean value indicating whether a client has registered with the repository's publisher. 'registration_uri' is an optional RepositoryURI object or a URI string indicating a location clients can use to register or obtain credentials needed to access the repository. 'related_uris' is an optional list of RepositoryURI objects or a list of URI strings indicating the location of related repositories that a client may be interested in. 'sort_policy' is an optional constant value indicating how legal_uris, mirrors, origins, and related_uris should be sorted.N( t sort_policytcollection_typet descriptiont legal_uristmirrorstnametoriginstrefresh_secondst registeredtregistration_urit related_uris( RRRRRRRRRRRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR"s3          c Cst|tp(t|d|d|d|d|}n|o||nt||}|i||idt|idS(NR RRR R(R*RtgetattrRtsorttURI_SORT_POLICIESt_Repository__sort_policy( RtattrR t dup_checkR RRR tulist((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __add_uris   c Cs'g}|iD]}|ti|q~}g}|iD]}|ti|q;~}g}|iD]}|ti|qh~}g}|iD]}|ti|q~} td|id|id|d|d|id| d|i d|i d ti|i d | } t || _ | S( NRRRRRRRRRR(RtcopyRRRRRRRRRRR'R(( Rt_[1]Rtclurist_[2]tcmirrorst_[3]tcrurist_[4]tcoriginstrepo((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR)s----    cCs|djo g}nt|tpti|d|ng}xa|D]Y}t|tpt|d|}n!|oti|i|_n|i |qMW|i dt |i |S(NR7R R( RR*R?RR=RRXR\R RRRR(RRR7R turisR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__replace_uriss       cCs-|tjoti|n||_dS(N(tREPO_COLLECTION_TYPESRtBadRepositoryCollectionTypet_Repository__collection_type(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_collection_types cCs|id|dt|_dS(NRR (t_Repository__replace_urisR,t_Repository__legal_uris(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_legal_urisscCs|id||_dS(NR(Rt_Repository__mirrors(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_mirrors scCs|id||_dS(NR(Rt_Repository__origins(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_origins scCs;|o't|t ot|dt}n||_dS(NR (R*RR,t_Repository__registration_uri(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_registration_uriscCs|id|dt|_dS(NRR (RR,t_Repository__related_uris(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_related_uriss cCs|dj okyt|}Wn.ttfj otidd|nX|djotidd|qxn||_dS(NRR7i(RR3R4R5RR=t_Repository__refresh_seconds(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_refresh_secondss  cCs-|tjoti|n||_dS(N(RRtBadRepositoryURISortPolicyR(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_sort_policy%s c Cs,|id|d|d|d|dtdS(sAdds the specified legal URI to the repository. 'uri' can be a RepositoryURI object or a URI string. If it is a RepositoryURI object, all other parameters will be ignored.RR RRR N(t_Repository__add_uriR,(RR R RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt add_legal_uri*sc s;fd}id|d|d|d|d|dS(sAdds the specified mirror to the repository. 'mirror' can be a RepositoryURI object or a URI string. If it is a RepositoryURI object, all other parameters will be ignored.csSi|o?i|}|ioti|nti|ndS(N(t has_mirrort get_mirrorRRtDuplicateSyspubMirrortDuplicateRepositoryMirror(tmirrorto(R(s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR=s  RRR RRN(R(RRR RRR((Rs:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt add_mirror5s c s;fd}id|d|d|d|d|dS(sAdds the specified origin to the repository. 'origin' can be a RepositoryURI object or a URI string. If it is a RepositoryURI object, all other parameters will be ignored.csSi|o?i|}|ioti|nti|ndS(N(t has_origint get_originRRtDuplicateSyspubOrigintDuplicateRepositoryOrigin(toriginR(R(s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRQs  RRR RRN(R(RRR RRR((Rs:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt add_originIs c Cs,|id|d|d|d|dtdS(sAdds the specified related URI to the repository. 'uri' can be a RepositoryURI object or a URI string. If it is a RepositoryURI object, all other parameters will be ignored.RR RRR N(RR,(RR R RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytadd_related_uri]scCs_t|tpti|}nx&|iD]}||ijo|Sq-Wti|dS(sReturns a RepositoryURI object representing the mirror that matches 'mirror'. 'mirror' can be a RepositoryURI object or a URI string.N(R*RRXR\RR RtUnknownRepositoryMirror(RRtm((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRhs  cCs_t|tpti|}nx&|iD]}||ijo|Sq-Wti|dS(sReturns a RepositoryURI object representing the origin that matches 'origin'. 'origin' can be a RepositoryURI object or a URI string.N(R*RRXR\RR RtUnknownRepositoryOrigin(RRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRus  cCs-t|tpt|}n||ijS(sReturns a boolean value indicating whether a matching 'mirror' exists for the repository. 'mirror' can be a RepositoryURI object or a URI string.(R*RR(RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRscCs-t|tpt|}n||ijS(sReturns a boolean value indicating whether a matching 'origin' exists for the repository. 'origin' can be a RepositoryURI object or a URI string.(R*RR(RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRscCsRx<t|iD]+\}}||ijo|i|=dSqWti|dS(sRemoves the legal URI matching 'uri' from the repository. 'uri' can be a RepositoryURI object or a URI string.N(t enumerateRR RtUnknownLegalURI(RR tiR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytremove_legal_uris    cCst|tpti|}nxZt|iD]I\}}||ijo-|ioti |in|i|=dSq3Wti |dS(sRemoves the mirror matching 'mirror' from the repository. 'mirror' can be a RepositoryURI object or a URI string.N( R*RRXR\RRR RRtRemoveSyspubMirrorR(RRRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt remove_mirrors    cCst|tpt|}nx\t|iD]K\}}||ijo/|ioti|in|i|=dSq0Wti|dS(sRemoves the origin matching 'origin' from the repository. 'origin' can be a RepositoryURI object or a URI string.N( R*RRRR RRtRemoveSyspubOriginR(RRRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt remove_origins    cCsRx<t|iD]+\}}||ijo|i|=dSqWti|dS(sRemoves the related URI matching 'uri' from the repository. 'uri' can be a RepositoryURI object or a URI string.N(RRR RtUnknownRelatedURI(RR RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytremove_related_uris    cCst|tp"t|d|d|d|}n|i|}|i|_|i|_|i|_|i|_|iidt |i dS(sUpdates an existing mirror object matching 'mirror'. 'mirror' can be a RepositoryURI object or a URI string. This method is deprecated, and may be removed in future API versions.R RRRN( R*RRR RRRRRRR(RRR RRttarget((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt update_mirrors     cCst|tp"t|d|d|d|}n|i|}|i|_|i|_|i|_|i|_|iidt |i dS(sUpdates an existing origin object matching 'origin'. 'origin' can be a RepositoryURI object or a URI string. This method is deprecated, and may be removed in future API versions.R RRRN( R*RRR RRRRRRR(RRR RRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt update_origins     cCs g|_dS(s0Discards the current list of repository mirrors.N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt reset_mirrorsscCs g|_dS(s0Discards the current list of repository origins.N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt reset_originsscCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRssA constant value indicating the type of packages in the repository. The following collection types are recognized: REPO_CTYPE_CORE The "core" type indicates that the repository contains all of the dependencies declared by packages in the repository. It is primarily used for operating system repositories. REPO_CTYPE_SUPPLEMENTAL The "supplemental" type indicates that the repository contains packages that rely on or are intended to be used with packages located in another repository.cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRssA list of RepositoryURI objects indicating where licensing, legal, and terms of service information for the repository can be found.cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRssA list of RepositoryURI objects indicating where package content can be retrieved. If any value in the list provided is a URI string, it will be replaced with a RepositoryURI object.cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR!scCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR&ssA RepositoryURI object indicating a location clients can use to register or obtain credentials needed to access the repository. If the value provided is a URI string, it will be replaced with a RepositoryURI object.cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR-ssA list of RepositoryURI objects indicating the location of related repositories that a client may be interested in. If any value in the list provided is a URI string, it will be replaced with a RepositoryURI object.cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR4ssAn integer value indicating the number of seconds clients should wait before refreshing cached repository metadata information. A value of None indicates that refreshes should be performed at the client's discretion.cCs|iS((R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR;ss}A constant value indicating how legal_uris, mirrors, origins, and related_uris should be sorted. The following policies are recognized: URI_SORT_PRIORITY The "priority" policy indicate that URIs should be sorted according to the value of their priority attribute.N(9RnRoRpRRRRRRRRtURI_SORT_PRIORITYRR(RRR,RtREPO_CTYPE_CORER"R/RR)Rt _Repository__set_collection_typet_Repository__set_legal_urist_Repository__set_mirrorst_Repository__set_originst!_Repository__set_registration_urit_Repository__set_related_urist _Repository__set_refresh_secondst_Repository__set_sort_policyRRRRRRRRRRRRRRRRRyRRRRRRRR(((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRos   =                                t PublishercBs=eZdZdXZdXZdXZeZdXZ dXZ dXZ dXZ e ZdXZdXZeZdXdXdXedXdXdXe dXeeed ZdZedZdZdZdZdZdZd Zd Zd Zd Z d Z!dZ"dZ#dZ$dZ%dZ&e'dZ(e'dZ)dZ*dZ+dZ,e'dZ-dZ.dZ/dZ0dZ1dZ2dXedZ3dXedZ4edXed Z5eedXed!Z6d"Z7d#Z8dXd$Z9d%Z:d&Z;d'Z<ed(Z=edXd)Z>d*Z?eee@iAd+ZBd,ZCd-ZDeeEeEed.ZFd/ZGd0ZHd1ZId2ZJd3ZKd4ZLdXdXd5ZMe'd6ed7d8ZNe'd9e#d7d:ZOe'd;ed7d<ZPe'eed7d=ZQe'd>e d7d?ZRe'd@e!d7dAZSe'dBe"d7dCZTe'dDe$d7dEZUdFZVedGZWdHZXdIZYdJZZdKZ[dLZ\dMZ]dNZ^dOZ_dPZ`dQZaebeVeXeYe[e\e]eZd7dRdSe^dTe_dUe`dVeaZce'dWZdRS(YsClass representing a publisher object and a set of interfaces to set and retrieve its information. A publisher is a forward or reverse domain name identifying a source (e.g. "publisher") of packages.cCs.|o| pt|djo|in ||_t|_||_||_||_||_ ||_ | |_ d|_ t|_ h|_h|_| o | |_n g|_| o | |_n g|_| o|ii| nd|_|o ||_n| |_h|_||_dS(s Initialize a new publisher object. 'catalog' is an optional Catalog object to use in place of retrieving one from the publisher's meta_root. This option may only be used when meta_root is not provided. N(ReRtreset_client_uuidt_Publisher__client_uuidR,tsys_pubtaliastdisabledtprefixt transportt meta_roottstickyt_Publisher__sig_policyt_Publisher__delay_validationt_Publisher__propertiest_Publisher__tmp_crlstrevoked_ca_certstapproved_ca_certst propertiestupdatetca_dictt repositoryt_Publisher__issuerst_catalog(RRRtcatalogt client_uuidRRRRRtpropsRRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR"ds:                      cCsF|djodSt|tot|i|iSt|i|S(Ni(RR*RR1R(RR-((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR2s  cCs |djS( s,Supports deprecated compatibility interface.RRRRRRR(s client_uuidsdisabledsmirrorssoriginsprefixsssl_certsssl_key((R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __contains__scCsd}t|id|id|id|id|idti|id|i d|i d|i d |i d |i d |i }|i|_t||_|S( NRRRRRRRR RRR(RRt_Publisher__prefixt_Publisher__aliasRt_Publisher__disabledRRRRt_Publisher__stickyRRRRRR'R((Rtselectedtpub((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR)s      cCsCt|to|i|ijSt|to|i|jStS(N(R*RRR+R,(RR-((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR.s cCs|djo|iS|djo|iS|djo|iS|i}|djo)g}|iD]}|t|qc~S|djo"|idpd S|idiS|djo"|idpd S|idi S|djo"|idpd S|idi Sd S( spDeprecated compatibility interface allowing publisher attributes to be read as pub["attribute"].RRRRRiRRN( RR R RRR+RRR RR(RRRRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __getitem__s*     )   cCs|ipdStii|id}yti|i}Wn0tj o$}|iti jodSnXt i i |S(Ntlast_refreshed( RRRFRGtjointstattst_mtimetEnvironmentErrorterrnotENOENTtdttdatetimetutcfromtimestamp(Rtlcfiletmod_timete((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__get_last_refresheds cCsCt|to|i|ijSt|to|i|jStS(N(R*RRR+R/(RR-((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR0s cCsh|iotidn|dj o1|djo$ti| oti|n||_dS(Ns*Cannot set the alias of a system publisherRC(RRtModifyingSyspubExceptionRRXtvalid_pub_prefixtBadPublisherAliasR (RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_aliass  cCsD|iotitdn|o t|_n t|_dS(Ns+Cannot enable or disable a system publisher(RRR t_R/R R,(RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_disabled s   c sn|ipdSdj o-tti otiddntii |idpWyt i Wn>t j o2}|i t it it ifjoqnXdSfd}y |Wnt j o}|i t ijony|iWnDtij oqjt j o#}|i t ijoqeqjX|nXdS(NRR7c sy`tititiBtiB}ti|dtiti i ti |Wnt j os}|i t ijo4titiitii|i n|i t it ifjoqnXdS(Ns%s (RFtopentO_WRONLYt O_NOFOLLOWtO_CREATtwriteRXttime_to_timestamptcalendarttimegmt utctimetupletcloseRRtELOOPRtUnexpectedLinkErrorRGtdirnametbasenametEACCEStEROFS(tfdR(R7R(s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytcreate_tracker+s (RRR*RRRR=RFRGRtportabletremoveRRRR4R5tcreate_meta_roottPermissionsException(RR7RR7((R7Rs:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_last_refresheds8 !   cCs|otii|}n||_|io|i|i_n|ioptii|id|_tii|id|_ tii|i d|_ tii|i d|_ ndS(NRtcertstsubject_hashestcrls( RFRGtabspatht_Publisher__meta_rootRt catalog_rootRRt_Publisher__origin_roott cert_roott_Publisher__subj_roott_Publisher__crl_root(Rtpathname((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_meta_rootXs     cCs0ti|pti|n||_dS(N(RXR!RtBadPublisherPrefixR (RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __set_prefixfscCs9t|tpti|n||_d|_dS(N(R*RRtUnknownRepositoryt_Publisher__repositoryRR(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_repositoryks cCs ||_dS(N(R(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_client_uuidqscCs6|iotitdnt||_dS(Ns2Cannot change the stickiness of a system publisher(RRR R$tboolR(RR7((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__set_stickinessts cCs|iS(N(R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRdzscCstiid|dt}|ipdS|idjpdS|ipdS|i}|i|jof|i }|d}t i t dhdi d|Dd6|id 6d i |d 6tid jot i t d |idSt i t dh|id 6t|djo>t it dh|d6|id 6t|dd6dSt it dx3|D]+}t it dh|d6|d6qWt it d|indS(sPrivate helper function to check the publisher's metadata for configuration or other issues and log appropriate warnings or errors. Currently only checks catalog metadata.Rt read_onlyNis Unable to retrieve package data for publisher '%(prefix)s' from one of the following origin(s): %(origins)s The catalog retrieved from one of the origin(s) listed above only contains package data for: %(pubs)s. s cssx|]}t|VqWdS(N(R+(t.0R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pys s RRs, tpubstpkgsThis is either a result of invalid origin information being provided for publisher '%s', or because the wrong publisher name was provided when this publisher was added. sTo resolve this issue, correct the origin information provided for publisher '%(prefix)s' using the pkg set-publisher subcommand, or re-add the publisher using the correct name and remove the '%(prefix)s' publisher. isTo re-add this publisher with the correct name, execute the following commands as a privileged user: pkg set-publisher -P -g %(origin)s %(pub)s pkg unset-publisher %(prefix)s RRsThe origin(s) listed above contain package data for more than one publisher, but this issue can likely be resolved by executing one of the following commands as a privileged user: s+pkg set-publisher -P -g %(origin)s %(pub)s sAfterwards, the old publisher should be removed by executing the following command as a privileged user: pkg unset-publisher %s (RTRtCatalogR/texiststversiont package_countt publishersRRtloggerterrorR$RRt client_nameRAtwarningR?(RtcrootRtcRSRRtpfx((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__validate_metadata}sB      -   0   cCst|ip|io|iSdS|ipB|i}tii|p d}ntii d||_n|iS(spA reference to the Catalog object for the publisher's selected repository, or None if available.RN( RRRRBRFRGtisdirRTRRU(RR^((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRs      cCs%|iotii|idSdS(sThe absolute pathname of the directory containing the Catalog data for the publisher, or None if meta_root is not defined.RN(RRFRGR(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRBs cCsh|ipti|iddnx|i|ifD]}yti|Wq9tj ou}|itijoti |i n|iti joti |i q|iti joqq9Xq9Wx|i|i|i|ifD]i}yti|Wqtj oC}|ititi fjoq`|iti joq`qXqWdS(s!Create the publisher's meta_root.t operationR:N(RRtBadPublisherMetaRootRBRFtmakedirsRRR4R;RIR5tReadOnlyFileSystemExceptiontEEXISTRDRCRERF(RRGR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyR:s4  c Cs"|i p|ii ogS|i ptii|i o |igStit }xx|i D]j\}}t i i d|dt}|ip d}nt|it|if}||i|qgWg}x@t|D]2}ti|i}|||_|i|qW|S(sReturns a list of Repository objects representing the unique groups of origins available. Each group is based on the origins that share identical package catalog data.RRQN(RRRRFRGRVRCt collectionst defaultdictR?t_Publisher__gen_origin_pathsRTRRUR/RR+tcreatedt last_modifiedRtsortedR( RtosetsRtopathtcatRtrvaltktnrepo((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytget_origin_setss("       cCs;t|iip(|iip|ip|ip|iS(sfReturns whether this publisher has any configuration which should prevent its removal.(RORLRRRRR(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pythas_configuration3scCs|i p |i otS|i}|ptSti}ti|i}|ii }|ptS|||jotStS(sA boolean value indicating whether the publisher's metadata for the currently selected repository needs to be refreshed.( RRR,RR/ttimeR,R-R.R(Rtlctts_nowtts_lasttrs((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt needs_refresh;s   cCsCtii|ipdStii|iti|iiS(N( RFRGRVRCRthashlibtsha1R t hexdigest(RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__get_origin_path]sccsJtii|ipdSx(|iiD]}||i|fVq(WdS(N(RFRGRVRCRRt_Publisher__get_origin_path(RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__gen_origin_pathsfs  cCsg}|iiD]}|ti|iiq~}t}xti|i D]}ti i |i |}y||jowRnWnt j onXt }y5ti i|oti|nti|WqRtj o}ti|qRXqRW|iio1|iidjot|iidjo|S|iid|_xti|iD]~}|djp|djp|idoNy#titi i |i|Wqtj o}ti|qXqkqkWg}|i D] }||q~} t| djo| dd}xti|D]v} | idp| idoPti i || } ti i |i| } ti!t"i#| |i| qEqEW|St$ii%dt d|id t} t&i'i(}x| D]\}}t$ii%d|d t }x|i)D]}|i*|d t }|djoq/n| i*|}|id }|i+}xh|i,d |i-gD]N\}}|\}}}t.|i/}y,|i0d|d|d|d|d|Wnti1j os|pqn|i2d|d|d|}t3d|D}t3d|D}||joqqn(X|pqnhgd6gd6|d<|ddi4|i|dd}|i+djo|i4t5i6qqWq/WqWx| i,D]\}}|\}}}|d}t|dt| jo |d=nt|dt| jo |d=n,t|ddjot5i6g|ds css-x&|]}|ido |VqqWdS(s signature-N(RW(RRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pys s tsourceststatesN(;RRR|R}R R~R,RFtlistdirRCRGRt ExceptionR/RbtshutiltrmtreeR8R9RRt_convert_errorRRVRXRAtdestroyRRRBRWtapxRjtsymlinkRXtrelpathRTRURRtutcnowtpartstget_partRWt tuple_entriesRtdictt iteritemstaddtDuplicateCatalogEntryt get_entrytsetRtpkgdefst PKG_STATE_V0t update_entryRtfinalizetsave(RRRtohashestremovalstentryRoRRtopathstfnametsrctdesttncatRRtsrc_catRtsparttnparttbasetcat_verRtsentryRRRtsrc_sigst dest_sigsRtmdata((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__rebuild_catalogls2     '                   #   cCs:|i}|otii|}ntiidtd|dt}yt|i}Wnt t fj o d}nX|i oW||i joG||ijodS|i d|_tiid|dt}nx!|iD]}|i|qW||_d|_t|_|i|idS(sTransforms the contents of the provided version 0 Catalog into a version 1 Catalog, replacing the current Catalog.RRRiN(RlRTRtts_to_datetimeRUR/R,R3tnpkgsR4R5RVtpackage_version_countRRRtfmrist add_packageRWRRR(Rtv0_cattv1_roottv0_lmtv1_cattn0_pkgstf((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__convert_v0_catalog(s0          c Csu|o t}nti|dtd|i}t}d}|io|i}|p|i|ijoy|i d|Wnjt j o^}|i t i jot i|in|i t ijot i|innXt}q t}|i}n| o|i o ttfSddki} y#|ii||d|d|Wn| ij oy|i d|Wnjt j o^}|i t i jot i|in|i t ijot i|innX|ii|d|d|nXtiii|dtd|i}|i|||p||ijo ttfSttfS(sThe method to refresh the publisher's metadata against a catalog/0 source. If the more recent catalog/1 version isn't supported, this routine gets invoked as a fallback. Returns a tuple of (changed, refreshed) where 'changed' indicates whether new catalog data was found and 'refreshed' indicates that catalog data was actually retrieved to determine if there were any updates.RQt publishertrootiNRGtalt_repo(R/t old_catalogt ServerCatalogRRRVRRRRRRR4RR;RIR5RfR,RlR{t pkg.updatelogt updatelogRt get_catalogtUpdateLogExceptionRTtserverRt_Publisher__convert_v0_catalog( RR^t full_refresht immediateRRtnew_catRRtold_ulog((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __refresh_v0as^           c CsN|} | o|} tiid|} y8|ii|dgd|d| d| d|d|WnJtij o;| io| id|_ n|i ||||SXt i |dtd |i} | io| id |ng} | o5| io+| i|} | djo ttfSntiid|}xH|iD]=}|id d d }|d joqLn| i|qLW|o%x"|iD]}| i|qWn| oey5|ii|| d|d| d| d|d|Wq%tij o|i ||||SXnd|_ tiid|} t}| o| io| i|nv| io| inxTti|D]C}tii||}tii||}tii||qWt}|o\y#tiid|} | iWqDtij o#| iti |iqDXnttfS(sThe method to refresh the publisher's metadata against a catalog/1 source. If the more recent catalog/1 version isn't supported, __refresh_v0 is invoked as a fallback. Returns a tuple of (changed, refreshed) where 'changed' indicates whether new catalog data was found and 'refreshed' indicates that catalog data was actually retrieved to determine if there were any updates.Rs catalog.attrsRGt redownloadt revalidateRt progtrackRQRRt.itCN(!RTRRURt get_catalog1RtUnsupportedRepositoryOperationRVRRRt_Publisher__refresh_v0RRR/Rtget_updates_neededR,t CatalogAttrsRtsplitRtupdatest apply_updatesRFRRGRR8trenametvalidatetBadCatalogSignaturestMismatchedCatalog(RR^ttempdirRRt mismatchedRRtinclude_updatesRRRRtflistRRtlocaleRRtfntsrcpathtdstpath((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __refresh_v1s                    c Csti|i}|g|_y#ti|tid|} Wnjtj o^} | iti jot i | i n| iti jot i| i nnXzB|i|| ||||d|d|} |i||| SWdti| tXdS(sTPrivate helper method used to refresh catalog data for each origin. Returns a tuple of (changed, refreshed) where 'changed' indicates whether new catalog data was found and 'refreshed' indicates that catalog data was actually retrieved to determine if there were any updates.tdirRRN(RRRRXRettempfiletmkdtempRRR4RR;RIR5Rft_Publisher__refresh_v1t_Publisher__validate_metadataRRR/( RR^RRRRRRRRRRq((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__refresh_origin!s*     c Csg|ipt|o t}nxW|iD]I\}}ti|tiid|dt}|i p t}Pq/q/W|i | o)|ii o| o|i ot Snt } t } xi|iD][\}}|i |||||d|d|\} } | o t} n| o t} qqW| otii|_n|io t} n| S(sThe method to handle the overall refresh process. It determines if a refresh is actually needed, and then calls the first version-specific refresh method in the chain.RRQRR(RReR/RjRXReRTRRURVR:R{R,t_Publisher__refresh_originRRRRt_Publisher__rebuild_catalog( RRRRRRRRoRpt any_changedt any_refreshedtchangedt refreshed((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __refreshKs@             c Csy |i||d|d|SWntitititifj o(|on|ittd|Stij o.|on|ittdtd|Sti ti fj o|ittd|Sti ti fj o|ittd|SXdS(sRefreshes the publisher's metadata, returning a boolean value indicating whether any updates to the publisher's metadata occurred. 'full_refresh' is an optional boolean value indicating whether a full retrieval of publisher metadata (e.g. catalogs) or only an update to the existing metadata should be performed. When True, 'immediate' is also set to True. 'immediate' is an optional boolean value indicating whether a refresh should occur now. If False, a publisher's selected repository will be checked for updates only if needs_refresh is True. 'include_updates' is an optional boolean value indicating whether all catalog updates should be retrieved additionally to the catalog.RRRN( t_Publisher__refreshRtBadCatalogUpdateIdentityRtObsoleteCatalogUpdatetUnknownUpdateTypeR/RR,RtInvalidCatalogFile(RRRRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytrefreshs, cCs|ipti|iddnyti|iWntj o~}|itijoti|i n|iti joti |i n|iti ti fjoqnXdS(s"Removes the publisher's meta_root.Rctremove_meta_rootN(RRRdRRRRR4R;RIR5RfRtESRCH(RR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRs  cCstti|_dS(s1Replaces the current client_uuid with a new UUID.N(R+tuuidtuuid1R(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyRsc Cs6|o!t|t ot|}n|p |}n|}d}y|ii|}Wn titifj odSX|ptid|d|n|i |jog}|D]}||i q~}|o(ti d|d|i gd|nti d|d|i gd|i i ndS(sVerify that the publisher's configuration (such as prefix) matches that provided by the repository. If the configuration does not match as expected, an UnknownRepositoryPublishers exception will be raised. 'repo_uri' is an optional RepositoryURI object or URI string containing the location of the repository. If not provided, the publisher's repository will be used instead.NtlocationRtknowntunknownR( R*RRRtget_publisherdataRtTransportErrorRtRepoPubConfigUnavailableRtUnknownRepositoryPublishersRR(Rtrepo_uriRRSRR:R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytvalidate_configs.   $   cCsq|i|}|i|}||ijo/t|i}|i|t||_n|ii|dS(sAdd the cert as a CA for manifest signing for this publisher. The 'cert' parameter is a string of the certificate to add. N(t_Publisher__string_to_certt_Publisher__add_certRRR9R?RR(RtcertthshR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytapprove_ca_cert s cCsk|ii|tt|i|_||ijo/t|i}|i|t||_ndS(sRecord that the cert with hash 's' is no longer trusted as a CA. This method currently assumes it's only invoked as a result of user action.N(RRR?RRR9(RRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytrevoke_ca_cert% s cCs||ijo/t|i}|i|t||_n||ijo/t|i}|i|t||_ndS(siIf the cert with hash 's' has been added or removed by the user, undo the add or removal.N(RRR9R?R(RRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt unset_ca_cert2 s  cCsti|iiS(N(R|R}tas_pemR~(R_((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __hash_cert? scCsyytii|SWn^tiij oL}|dj otitd|ntitd|nXdS(s Convert a string to a X509 cert.sTThe file with hash %s was expected to be a PEM certificate but it could not be read.saThe following string was expected to be a PEM certificate, but it could not be parsed as such: %sN(tm2tX509tload_cert_stringt X509ErrorRRt BadFileFormatR$(Rtpkg_hashR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__string_to_certE s  c Csy|i|i|}tii|i|}t}yCt|dii }z |~}|i |i WdQXWnt j o}t }nX|ii}d} t} x| ptii|id|| f} tii| o| d7} qn|p6yti|| t } WqCt j o }qCXn| p&|ii|gi| t } qqW|S(stAdd the pem representation of the certificate 'cert' to the certificates this publisher knows about.twbNis%s.%si(R:t_Publisher__hash_certRFRGRRDR,R&t__exit__t __enter__R*RRR/t get_subjecttas_hashRERVR8tlinkRt setdefaultR( RRRt pkg_hash_ptht file_problemRtfhRtsubj_hshR_t made_linkR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt __add_certU s< &    c Csd|o| pttii|i|}tii|}|o |odS|o<t|dii }z|~}|i } WdQXn|i i ||d|} |i | |} |p.y|i| Wqtij oqXn|odS|oUtiti| dt| d|d} | |joti| |q`n| S(s Given a pkg5 hash, retrieve the cert that's associated with it. The 'pkg_hash' parameter contains the file hash of the certificate to retrieve. The 'verify_hash' parameter determines the file that's read from disk matches the expected hash. The 'only_retrieve' parameter determines whether a X509 object is built from the certificate retrieved or if the certificate is only stored on disk. trbNt hash_functlengthi(ReRFRGRRDRVRR&RR treadRt get_contentR RRR;RXtget_data_digestt cStringIOtStringIORAtModifiedCertificateException( RRt verify_hasht only_retrieveR,tptht pth_existsRR'RR_th((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pytget_cert_by_hash{ s2&    c Csg}d}|i}y^xWtoOtii|id||f}tii|}|i ||d7}qWWn>t j o2}t i |t ig}|o |qnX|i|ii|g|S(saGiven 'name', a M2Crypto X509_Name, return the certs with that name as a subject.is%s.%si(R"R/RFRGRRERRt load_certRRRRRRtextendRtget( RRRR_tname_hshR6RRR((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__get_certs_by_name s$   cCs|idj o|iSh|_xet|iD]T}|i|dt}|ii}|ii|g|i|i |q1W|iS(sNReturn a dictionary of the CA certificates for this publisher.R4N( RRRRR9R/R!R"R$R(RR8R_R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt get_ca_certs s c Cst|_x!|D]}|ii|dqW|ii|x?|iD]1}|ii|g|i|i||qJWx|iD]}||ijo$t i t dh|d6nt |i|t p2t i t dh|d6|i|d6nxg||D][}y|i|i|Wqtj o.t i t dh|d6|d6qXqWqWt|_|idS(sXUpdate the properties set for this publisher with the ones provided as arguments. The order of application is that any existing properties are unset, then properties are set to their new values, then values are added to properties, and finally values are removed from properties.sUCannot remove a value from the property %(name)s because the property does not exist.RsCannot remove a value from a single valued property, unset must be used. The property name is '%(name)s' and the current value is '%(value)s'R7smCannot remove the value %(value)s from the property %(name)s because the value is not in the property's list.N(R/RRtpopRRtkeysR$R;RtInvalidPropertyValueR$R*R?R9R5R,t_Publisher__validate_properties(Rt set_propstadd_prop_valuestremove_prop_valuest unset_propstntv((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt update_props s:     #  % cCsS|iitddjo3|iiddptitdqOndS(s`Check that the properties set for this publisher are consistent with each other.RCs require-namesssignature-required-namessKAt least one name must be provided for the signature-required-names policy.N(RR<RRRRBR$(R((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__validate_properties s     cCsytii|SWnntiij o\y tii|dtiiSWqtiij o titd|qXnXdS(s~CRLs seem to frequently come in DER format, so try reading the CRL using both of the formats before giving up.tformats.The CRL file %s is not in a recognized format.N(RRtload_crlRt FORMAT_DERRRR$(RR6((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt__format_safe_read_crl scCs+|i}|ido |td}|i}n|ido|d}n|id o*|id oti|intid}|omti|}ti|}titi d|i d|i d |i d |i d |i d |i}n||ijo |i|Sti|d }ti i|iptti i|i|}d}ti i|oy|i|}Wntj oq0X|ii}|ii|ti djptti!i"|i}||jo||i|<|Sn|t#i$jo|Syt%i&d|i\} } WnVtj oJ} | i't'i(t'i)fjot%i&\} } qt*i+| nXti,| di-i.} z| ~ } t/i0}|i1t/i2||i1t/i3| |i1t/i4d|i1t/i5t6i7y|i8Wn't/i9j ot#i$i:||SXWdQXy|i| }Wn$ti;j ot<i=| |SXy$t<i>| |ti?|t@WnGtj o;||i|  5             /         (DR,RhRR1RRRR|RFRaRRRvRkRPRt pkg.clientRtpkg.client.debugvaluesRRZt pkg.catalogRTtpkg.client.api_errorstclientRtpkg.client.sigpolicyRtpkg.client.pkgdefsRt pkg.digestRtpkg.miscRXt pkg.portableR8tpkg.server.catalogRRRtM2CryptoRRRRRRRtREPO_CTYPE_SUPPLEMENTALRRRURSRDRRRtCODE_SIGNING_USERR~RRbtobjectRRRRR(((s:/usr/lib/python2.6/vendor-packages/pkg/client/publisher.pyt%sr                  (      #9