YSc@sddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZddlmZejZddlZddljjZddljjZddljjZddljZddl j!Z!ddl"j#Z#ddl$j%j&Z'ddl(Z)ddl m*Z*m+Z+m,Z,m-Z-m.Z.dZ/dZ0ide/6de06Z1e2ddd fZ3dZ4e2d fZ5d Z6id e66Z7id d dfd6dddfd6Z8idgd6Z9id gd6dgd6Z:idgd6Z;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|j|jfS(N(R turi(tobj((s:/usr/lib/python2.7/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|_||_||_||_||_|rf|rft j dn|rt |g|_ n|r||_ 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.7/vendor-packages/pkg/client/publisher.pyt__init__s          cCsXt|jd|jd|jd|jd|jd|jd|j}t||_ |S(NR RRR RR( Rt_RepositoryURI__urit_RepositoryURI__priorityt_RepositoryURI__ssl_certt_RepositoryURI__ssl_keyRRRtidt_source_object_id(RR ((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__copy__s  cCs?t|tr|j|jkSt|tr;|j|kStS(N(t isinstanceRR tstrtFalse(Rtother((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__eq__s  cCs?t|tr|j|jkSt|tr;|j|kStS(N(R*RR R+tTrue(RR-((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__ne__s  cCs;|s dSt|ts(t|}nt|j|jS(Ni(R*RtcmpR (RR-((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__cmp__s cCsU|dk rHyt|}WqHttfk rDtj|qHXn||_dS(N(Rtintt TypeErrort ValueErrorRtBadRepositoryURIPriorityR$(Rtvalue((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_prioritys  cCs|js dS|jdjSdS(Ni(RRR (R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __get_proxys cCs>|s dSt|ts(t|}n|}|g|_dS(N(R*RR(RR!tp((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __set_proxys cCsx5|D]-}t|tstjdd|qqW|rh|jdkrhtjdd|jnt|tpt|tstjdd|nt|dkrtjdd|n|r||_ n g|_ dS(NRR7R tschemei( R*RRtBadRepositoryAttributeValueR<t!UnsupportedRepositoryURIAttributetlistttupletlenR(RRR!((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __set_proxiess"  cCs|jtkr0|r0tjdd|jn|rrt|ts]tjdd|ntjj |}n|dkrd}n||_ dS(NRR<R7t( R<t SSL_SCHEMESRR>R*t basestringR=tostpathtnormpathRR%(Rtfilename((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_ssl_certs  cCs|jtkr0|r0tjdd|jn|rrt|ts]tjdd|ntjj |}n|dkrd}n||_ dS(NRR<R7RC( R<RDRR>R*RER=RFRGRHRR&(RRI((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __set_ssl_keys  cCs7|ttfkr*tjdd|n||_dS(NR R7(R/R,RR=R(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_trailing_slashscCs|dkrtj|n||jkr1dSt|trIt}nt}tj |dd\}}}}}|j |_ ||_ |r|j t krtj|n!|j tkrtj|n|j jdr| stj|d| rtj|n|j dkr;|r;tj|n|j||j d}|jr}|jd}tj|}n|j tkrd|_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.7/vendor-packages/pkg/client/publisher.pyt __set_uri"s8  $      cCs1|dtgkr$tj|n||_dS(sVAllow the __uri field of the object to be overridden in special cases.N(Rt SYSREPO_PROXYRROR#(RR ((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt _override_uriXscCs t|jS(N(R+R#(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__str___scCsq|jsttj|jdt\}}}}}}||krIdStj||||||f|_dS(sChange the scheme of this uri.RMN(R#tAssertionErrorRPR,t urlunparseR (Rt new_schemeR<R^RGR_R`tfragment((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt change_schemebs * cCs>tj|jdd\}}}}}}|dkr:|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.7/vendor-packages/pkg/client/publisher.pytget_hostms* cCsGtj|jdd\}}}}}}|dkrCtj|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.7/vendor-packages/pkg/client/publisher.pyt get_pathnamevs*  cCs|jS(N(R%(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss<The absolute pathname of a PEM-encoded SSL certificate file.cCs|jS(N(R&(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss4The absolute pathname of a PEM-encoded SSL key file.cCs|jS(N(R#(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss$The URI used to access a repository.cCs|jS(N(R$(R((s:/usr/lib/python2.7/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|jS(N(R(R((s:/usr/lib/python2.7/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'|js dStj|jdddS(sThe URI scheme.RCRMi(R#RPRQ(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR<s cCs|jS(N(R(R((s:/usr/lib/python2.7/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.7/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|_||_|s$||_ndS(N(Rt_ProxyURI__systemRR (RR R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR"s  cCsZ|ttfkr*tjdd|n||_|rI|jtn |jddS(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.7/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.7/vendor-packages/pkg/client/publisher.pyt __unsupportedscCs|jS(N(Rz(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss7True, if we should use the system publisher as a proxy.cCsdS(N(R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss6proxies is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss7ssl_cert is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss6ssl_key is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRss7priority is an invalid property for ProxyURI propertiescCsdS(N(R(R((s:/usr/lib/python2.7/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.7/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|_||_tj||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.7/vendor-packages/pkg/client/publisher.pyR"s     cCs`t|tr1|j|jko0|j|jkSt|tr\|j|ko[|jdkStS(N(R*RR R!RERR,(RR-((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR.s cCs`t|tr1|j|jkp0|j|jkSt|tr\|j|kp[|jdkStS(N(R*RR R!RERR/(RR-((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR0s cCsw|s dSt|tr(t|}nt|ts;dSt|j|j}|dkrot|j|jS|SdS(Nii(R*RERR1R R!(RR-tres((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR2s cCs:|j}|j}|jr0|jjd}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.7/vendor-packages/pkg/client/publisher.pytkey s   cCs|j st|j s t|rP|jdkrPtjdd|jn|rk|jd|_n d|_d|_ dS(NR R!R<RN( RReRR<RR>R[RRR(RR!((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR;!s cCs>|jr|jS|js7tj|j|j|_n|jS(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.7/vendor-packages/pkg/client/publisher.pyt__get_runtime_proxy0s  cCststddS(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.7/vendor-packages/pkg/client/publisher.pyt__set_runtime_proxyAscCsg}|jrxx|jD]X}t|jd|jd|jd|jd|jd|jd|j}|j|qWnC|jt|jd|jd|jd|jd|jd|j|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.7/vendor-packages/pkg/client/publisher.pyt fromrepouriGs$             cCs|jS(N(R(R((s:/usr/lib/python2.7/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.7/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.7/vendor-packages/pkg/client/publisher.pyR"s3          c Cst|ts6t|d|d|d|d|}n|rI||nt||}|j||jdt|jdS(NR RRR R(R*RtgetattrRtsorttURI_SORT_POLICIESt_Repository__sort_policy( RtattrR t dup_checkR RRR tulist((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __add_uris    cCsg|jD]}tj|^q }g|jD]}tj|^q/}g|jD]}tj|^qT}g|jD]}tj|^qy}td|jd|jd|d|d|jd|d|j d|j d tj|j d | }t ||_ |S( NRRRRRRRRRR(RtcopyRRRRRRRRRRR'R((RRtcluristcmirrorstcruristcoriginstrepo((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR)s%%%%    cCs|dkrg}nt|ts<tj|d|ng}x]|D]U}t|tsst|d|}n|rtj|j|_n|j |qIW|j dt |j |S(NR7R R( RR*R?RR=RRXR\R RRRR(RRR7R turisR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__replace_uriss       cCs+|tkrtj|n||_dS(N(tREPO_COLLECTION_TYPESRtBadRepositoryCollectionTypet_Repository__collection_type(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_collection_types cCs|jd|dt|_dS(NRR (t_Repository__replace_urisR,t_Repository__legal_uris(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_legal_urisscCs|jd||_dS(NR(Rt_Repository__mirrors(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __set_mirrors scCs|jd||_dS(NR(Rt_Repository__origins(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __set_origins scCs8|r+t|t r+t|dt}n||_dS(NR (R*RR,t_Repository__registration_uri(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_registration_uriscCs|jd|dt|_dS(NRR (RR,t_Repository__related_uris(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_related_uriss cCs|dk rryt|}Wn,ttfk rJtjdd|nX|dkrrtjdd|qrn||_dS(NRR7i(RR3R4R5RR=t_Repository__refresh_seconds(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_refresh_secondss  cCs+|tkrtj|n||_dS(N(RRtBadRepositoryURISortPolicyR(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_sort_policy%s c Cs,|jd|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.7/vendor-packages/pkg/client/publisher.pyt add_legal_uri*sc s;fd}jd|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.csOj|rKj|}|jr9tj|ntj|ndS(N(t has_mirrort get_mirrorRRtDuplicateSyspubMirrortDuplicateRepositoryMirror(tmirrorto(R(s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR=s  RRR RRN(R(RRR RRR((Rs:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt add_mirror5s c s;fd}jd|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.csOj|rKj|}|jr9tj|ntj|ndS(N(t has_origint get_originRRtDuplicateSyspubOrigintDuplicateRepositoryOrigin(toriginR(R(s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRQs  RRR RRN(R(RRR RRR((Rs:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt add_originIs c Cs,|jd|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.7/vendor-packages/pkg/client/publisher.pytadd_related_uri]scCs[t|ts!tj|}nx$|jD]}||jkr+|Sq+Wtj|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.7/vendor-packages/pkg/client/publisher.pyRhs cCs[t|ts!tj|}nx$|jD]}||jkr+|Sq+Wtj|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.7/vendor-packages/pkg/client/publisher.pyRus cCs+t|tst|}n||jkS(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.7/vendor-packages/pkg/client/publisher.pyRscCs+t|tst|}n||jkS(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.7/vendor-packages/pkg/client/publisher.pyRscCsPx:t|jD])\}}||jkr|j|=dSqWtj|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.7/vendor-packages/pkg/client/publisher.pytremove_legal_uris  cCst|ts!tj|}nxVt|jD]E\}}||jkr1|jrhtj |jn|j|=dSq1Wtj |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.7/vendor-packages/pkg/client/publisher.pyt remove_mirrors   cCst|tst|}nxXt|jD]G\}}||jkr.|jrgtj|jn|j|=dSq.Wtj|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.7/vendor-packages/pkg/client/publisher.pyt remove_origins  cCsPx:t|jD])\}}||jkr|j|=dSqWtj|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.7/vendor-packages/pkg/client/publisher.pytremove_related_uris  cCst|ts0t|d|d|d|}n|j|}|j|_|j|_|j|_|j|_|jjdt |j 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.7/vendor-packages/pkg/client/publisher.pyt update_mirrors     cCst|ts0t|d|d|d|}n|j|}|j|_|j|_|j|_|j|_|jjdt |j 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.7/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.7/vendor-packages/pkg/client/publisher.pyt reset_mirrorsscCs g|_dS(s0Discards the current list of repository origins.N(R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt reset_originsscCs|jS(N(R(R((s:/usr/lib/python2.7/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|jS(N(R(R((s:/usr/lib/python2.7/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|jS(N(R(R((s:/usr/lib/python2.7/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|jS(N(R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR!scCs|jS(N(R(R((s:/usr/lib/python2.7/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|jS(N(R(R((s:/usr/lib/python2.7/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|jS(N(R(R((s:/usr/lib/python2.7/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|jS(N(R(R((s:/usr/lib/python2.7/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.7/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@jAd+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 | st|dkr,|jn ||_t|_||_||_||_||_ ||_ | |_ d|_ t|_ i|_i|_| r| |_n g|_| r| |_n g|_| r|jj| nd|_|r||_n| |_i|_||_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.7/vendor-packages/pkg/client/publisher.pyR"ds:                       cCsB|dkrdSt|tr2t|j|jSt|j|S(Ni(RR*RR1R(RR-((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR2s  cCs |dkS( s,Supports deprecated compatibility interface.RRRRRRR(s client_uuidsdisabledsmirrorssoriginsprefixsssl_certsssl_key((R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __contains__scCsd}t|jd|jd|jd|jd|jdtj|jd|j d|j d|j d |j d |j d |j }|j|_t||_|S( NRRRRRRRRRRR(RRt_Publisher__prefixt_Publisher__aliasRt_Publisher__disabledRRRRt_Publisher__stickyRRRRRR'R((Rtselectedtpub((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR)s      cCs?t|tr|j|jkSt|tr;|j|kStS(N(R*RRR+R,(RR-((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR.s  cCs|dkr|jS|dkr&|jS|dkr9|jS|j}|dkrng|jD]}t|^qXS|dkr|jdsd S|jdjS|dkr|jdsd S|jdj S|dkr|jdsd S|jdj Sd S( spDeprecated compatibility interface allowing publisher attributes to be read as pub["attribute"].RRRRRiRRN( RR RRRR+RRR RR(RRRR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __getitem__s*            cCsz|js dStjj|jd}ytj|j}Wn,tk ri}|jtj krcdSnXt j j |S(Ntlast_refreshed( RRRFRGtjointstattst_mtimetEnvironmentErrorterrnotENOENTtdttdatetimetutcfromtimestamp(Rtlcfiletmod_timete((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__get_last_refresheds cCs?t|tr|j|jkSt|tr;|j|kStS(N(R*RRR+R/(RR-((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR0s  cCsb|jrtjdn|dk rU|dkrUtj| rUtj|n||_dS(Ns*Cannot set the alias of a system publisherRC(RRtModifyingSyspubExceptionRRXtvalid_pub_prefixtBadPublisherAliasR(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __set_aliass  cCs@|jr!tjtdn|r3t|_n t|_dS(Ns+Cannot enable or disable a system publisher(RRRt_R/R R,(RR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_disabled s   csY|js dSdk rDttj rDtjddntjj |jdsyt j Wn:t k r}|j t jt jt jfkrqnXdSfd}y |Wnt k rT}|j t jkrny|jWn>tjk rqUt k rI}|j t jkrQqQqUX|nXdS(NRR7csy`tjtjtjBtjB}tj|dtjtj j tj |Wnyt k r}|j t jkrtjtjjtjj|j n|j t jt jfkrqnXdS(Ns%s (RFtopentO_WRONLYt O_NOFOLLOWtO_CREATtwriteRXttime_to_timestamptcalendarttimegmt utctimetupletcloseRRtELOOPRtUnexpectedLinkErrorRGtdirnametbasenametEACCEStEROFS(tfdR(RR7(s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pytcreate_tracker+s (RRR*RRRR=RFRGRtportabletremoveRRRR0R1tcreate_meta_roottPermissionsException(RR7RR3((RR7s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_last_refresheds8    cCs|rtjj|}n||_|jr?|j|j_n|jrtjj|jd|_tjj|jd|_ tjj|j d|_ tjj|j 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.7/vendor-packages/pkg/client/publisher.pyt__set_meta_rootXs     cCs.tj|s!tj|n||_dS(N(RXRRtBadPublisherPrefixR(RR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __set_prefixfscCs7t|ts!tj|n||_d|_dS(N(R*RRtUnknownRepositoryt_Publisher__repositoryRR(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_repositoryks cCs ||_dS(N(R(RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_client_uuidqscCs4|jr!tjtdnt||_dS(Ns2Cannot change the stickiness of a system publisher(RRRR tboolR (RR7((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__set_stickinessts cCs|jS(N(R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRdzscCstjjd|dt}|js(dS|jdks;dS|jsHdS|j}|j|kr|j }|d}t j t didj d|Dd6|jd 6d j |d 6tjd krt j t d |jdSt j t di|jd 6t|dkr^t jt di|d6|jd 6t|dd6dSt jt dx3|D]+}t jt di|d6|d6qxWt jt d|jndS(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 css|]}t|VqdS(N(R+(t.0R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pys sRRs, 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 RR sThe 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 (RPRtCatalogR/texiststversiont package_countt publishersRRtloggerterrorR RRt client_nameRAtwarningR?(RtcrootRtcRORRtpfx((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__validate_metadata}s@      -   0    cCsl|js|jr|jSdS|jse|j}tjj|sJd}ntjj d||_n|jS(spA reference to the Catalog object for the publisher's selected repository, or None if available.RN( RRRR>RFRGtisdirRPRRQ(RRZ((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRs      cCs#|jrtjj|jdSdS(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.7/vendor-packages/pkg/client/publisher.pyR>s cCsX|js$tj|jddnx|j|jfD]}ytj|Wq7tk r}|jtjkrtj |j n|jtj krtj |j q|jtj krqq7Xq7Wx|j|j|j|jfD]c}ytj|Wqtk rO}|jtjtj fkr4qP|jtj krPqPqXqWdS(s!Create the publisher's meta_root.t operationR6N(RRtBadPublisherMetaRootR>RFtmakedirsRRR0R7RIR1tReadOnlyFileSystemExceptiontEEXISTR@R?RARB(RRGR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyR6s0  c Cs|j s|jj rgS|j s;tjj|j rE|jgStjt }xv|j D]h\}}t j j d|dt}|jsd}nt|jt|jf}||j|qaWg}x@t|D]2}tj|j}|||_|j|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.RRMN(RRRRFRGRRR?t collectionst defaultdictR?t_Publisher__gen_origin_pathsRPRRQR/RR+tcreatedt last_modifiedRtsortedR( RtosetsRtopathtcatRtrvaltktnrepo((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pytget_origin_setss$      cCs7t|jjp3|jjp3|jp3|jp3|jS(sfReturns whether this publisher has any configuration which should prevent its removal.(RKRHRRRRR(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pythas_configuration3scCsz|j s|j rtS|j}|s+tStj}tj|j}|jj }|sbtS|||krvtStS(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.7/vendor-packages/pkg/client/publisher.pyt needs_refresh;s   cCsAtjj|jsdStjj|jtj|jjS(N( RFRGRRR?Rthashlibtsha1R t hexdigest(RR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__get_origin_path]sccsHtjj|jsdSx(|jjD]}||j|fVq&WdS(N(RFRGRRR?RRt_Publisher__get_origin_path(RR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__gen_origin_pathsfscCsg|jjD]}tj|jj^q }t}xtj|j D]}tj j |j |}y||kr}wJnWnt k rnXt }y3tj j|rtj|n tj|WqJtk r}tj|qJXqJW|jjr.|jjdkr.t|jjdkr.|S|jjd|_xtj|jD]x}|dks|dks|jdrWy#tjtj j |j|Wqtk r}tj|qXqWqWWg|j D] }|^q}t|dkr|dd}xtj|D]s}|jdsF|jdr"tj j ||} tj j |j|} tj!t"j#| |j| q"q"W|St$jj%dt d|jd t} t&j'j(} x|D]\} }t$jj%d|d t }x|j)D]}|j*|d t }|dkr5qn| j*|}|jd }|j+}x^|j,d |j-gD]D\}}|\}}}t.|j/}y,|j0d|d| d|d|d|Wn|tj1k rL|squn|j2d|d|d|}t3d|D}t3d|D}||krqquqqn%X|sYqunigd6gd6|d<|ddj4| j|dd}|j+dkru|j4t5j6ququWqWqWx| j,D]\}}|\}}}|d}t|dt|kr|d=nt|dt|krC|d=n)t|ddkrlt5j6g|dscss$|]}|jdr|VqdS(s signature-N(RW(RNR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pys stsourceststatesN(;RRRxRyR RzR,RFtlistdirR?RGRt ExceptionR/R^tshutiltrmtreeR4R5RRt_convert_errorRRRRTRAtdestroyRRR>RWtapxRftsymlinkRXtrelpathRPRQRRtutcnowtpartstget_partRSt tuple_entriesRtdictt iteritemstaddtDuplicateCatalogEntryt get_entrytsetRtpkgdefst PKG_STATE_V0t update_entryRtfinalizetsave(RRtohashestremovalstentryRkRtopathstfnametsrctdesttncatRRtsrc_catRtsparttnparttbasetcat_verRtsentryR RRtsrc_sigst dest_sigsRtmdata((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__rebuild_catalogls.                     #   cCs1|j}|r'tjj|}ntjjdtd|dt}yt|j}Wnt t fk r}d}nX|j r||j kr||jkrdS|j d|_tjjd|dt}nx!|jD]}|j|qW||_d|_t|_|j|jdS(sTransforms the contents of the provided version 0 Catalog into a version 1 Catalog, replacing the current Catalog.RRRiN(RhRPRtts_to_datetimeRQR/R,R3tnpkgsR4R5RRtpackage_version_countRRRtfmrist add_packageRSRRR(Rtv0_cattv1_roottv0_lmtv1_cattn0_pkgstf((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__convert_v0_catalog(s.         c CsZ|rt}ntj|dtd|j}t}d}|jr|j}|sf|j|jkry|j d|Wndt k r}|j t j krt j|jn|j t jkrt j|jnnXt}qt}|j}n| r|j rttfSddlj} y#|jj||d|d|Wn| jk ry|j d|Wndt k r}|j t j krt j|jn|j t jkrt j|jnnX|jj|d|d|nXtjjj|dtd|j}|j|||sF||jkrPttfSttfS(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.RMt publishertrootiNRGtalt_repo(R/t old_catalogt ServerCatalogRRRRRRRRRRR0RR7RIR1RbR,RhRwt pkg.updatelogt updatelogRt get_catalogtUpdateLogExceptionRPtserverRt_Publisher__convert_v0_catalog( RRZt full_refresht immediateRRtnew_catRRtold_ulog((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __refresh_v0as^           c  Cs1|} | o|} tjjd|} y8|jj|dgd|d| d| d|d|WnFtjk r| jr| jd|_ n|j ||||SXt j |dtd |j} | jr| jd |ng} | r!| jr!| j|} | dkrttfSntjjd|}xF|jD];}|jd d d }|d krnq@n| j|q@W|rx!|jD]}| j|qWn| ry5|jj|| d|d| d| d|d|Wqtjk r |j ||||SXnd|_ tjjd|} t}| rU| jrU| j|ns| jrk| jnxTtj|D]C}tjj||}tjj||}tjj||q{Wt}|r'y#tjjd|} | jWq'tjk r#| jtj |jq'XnttfS(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 progtrackRMRRt.itCN(!RPRRQRt get_catalog1RtUnsupportedRepositoryOperationRRRRRt_Publisher__refresh_v0RRR/Rtget_updates_neededR,t CatalogAttrsRtsplitRtupdatest apply_updatesRFRRGRR4trenametvalidatetBadCatalogSignaturestMismatchedCatalog(RRZttempdirRRt mismatchedRRtinclude_updatesRRRRtflistR~RtlocaleRRtfntsrcpathtdstpath((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __refresh_v1sz                    c Cstj|j}|g|_y#tj|tjd|} Wndtk r} | jtj krzt j | j n| jtj krt j| j nnXzB|j|| ||||d|d|} |j||| SWdtj| 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(RRRRXRattempfiletmkdtempRRR0RR7RIR1Rbt_Publisher__refresh_v1t_Publisher__validate_metadataRRR/( RRZRRRRRRRRRRm((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__refresh_origin!s*     c CsS|jst|rt}nxU|jD]G\}}tj|tjjd|dt}|j s+t}Pq+q+W|j | r|jj r| r|j rt Snt } t } xe|jD]W\}}|j |||||d|d|\} } | r t} n| rt} qqW| r:tjj|_n|jrOt} 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.RRMRR(RReR/RfRXRaRPRRQRRR6RwR,t_Publisher__refresh_originRRRRt_Publisher__rebuild_catalog( RRRRRRRRkRlt any_changedt any_refreshedtchangedt refreshed((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __refreshKs<          cCsy |j||d|d|SWntjtjtjtjfk rj|rTn|jttd|Stjk r|rn|jttdtd|Stj tj fk r|jttd|Stj tj fk r|jttd|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.7/vendor-packages/pkg/client/publisher.pytrefreshs, cCs|js$tj|jddnytj|jWntk r}|jtjkrqtj|j n|jtj krtj |j n|jtj tj fkrqnXdS(s"Removes the publisher's meta_root.R_tremove_meta_rootN(RRR`RRRRR0R7RIR1RbRtESRCH(RR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRs  cCsttj|_dS(s1Replaces the current client_uuid with a new UUID.N(R+tuuidtuuid1R(R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRscCs!|r%t|t r%t|}n|s4|}n|}d}y|jj|}Wntjtjfk rvdSX|stjd|d|n|j |krg|D]}|j ^q}|rtj d|d|j gd|ntj d|d|j gd|j j 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.NtlocationR tknowntunknownR( R*RRRtget_publisherdataRtTransportErrorRtRepoPubConfigUnavailableRtUnknownRepositoryPublishersRR(Rtrepo_uriRROR:R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pytvalidate_configs.      cCso|j|}|j|}||jkr[t|j}|j|t||_n|jj|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_certRRR5R?RR(RtcertthshR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pytapprove_ca_cert s cCsi|jj|tt|j|_||jkret|j}|j|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?RRR5(RRR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pytrevoke_ca_cert% s cCs~||jkr=t|j}|j|t||_n||jkrzt|j}|j|t||_ndS(siIf the cert with hash 's' has been added or removed by the user, undo the add or removal.N(RRR5R?R(RRR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt unset_ca_cert2 s  cCstj|jjS(N(RxRytas_pemRz(R[((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __hash_cert? scCsuytjj|SWnZtjjk rp}|dk rTtjtd|ntjtd|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.7/vendor-packages/pkg/client/publisher.pyt__string_to_certE s   c CsY|j|j|}tjj|j|}t}y/t|d}|j|j WdQXWnt k r}t }nX|j j }d}t} x| sTtjj|jd||f} tjj| r|d7}qn|s&ytj|| t } Wq&t k r"}q&Xn| s|jj|gj|t } qqW|S(stAdd the pem representation of the certificate 'cert' to the certificates this publisher knows about.twbNis%s.%si(R6t_Publisher__hash_certRFRGRR@R,R"R&RRR/t get_subjecttas_hashRARRR4tlinkRt setdefaultR( RR Rt pkg_hash_ptht file_problemtfhRtsubj_hshR[t made_linkR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt __add_certU s:      c Cs>|o | sttjj|j|}tjj|}|rM|rMdS|rzt|d}|j}WdQXn|j j ||d|}|j ||} |sy|j | Wqt jk rqXn|rdS|r:tjtj|dt|d|d} | |kr:t j| |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(ReRFRGRR@RRRR"treadRt get_contentR R RR7RXtget_data_digestt cStringIOtStringIORAtModifiedCertificateException( RRt verify_hasht only_retrieveR&tptht pth_existsR!RR[th((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pytget_cert_by_hash{ s2    c Csg}d}|j}y\xUtrrtjj|jd||f}tjj|}|j ||d7}qWWn:t k r}t j |t jg}|r|qnX|j|jj|g|S(saGiven 'name', a M2Crypto X509_Name, return the certs with that name as a subject.is%s.%si(RR/RFRGRRARRt load_certRRRRRRtextendRtget( RRRR[tname_hshR0R RR((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__get_certs_by_name s"     cCs|jdk r|jSi|_xet|jD]T}|j|dt}|jj}|jj|g|j|j |q/W|jS(sNReturn a dictionary of the CA certificates for this publisher.R.N( RRRRR3R/RRRR(RR2R[R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt get_ca_certs s cCst|_x!|D]}|jj|dqW|jj|x?|jD]1}|jj|g|j|j||qJWx|jD]}||jkrt j t di|d6nt |j|t s t j t di|d6|j|d6nxe||D]Y}y|j|j|Wqtk rnt j t di|d6|d6qXqWqWt|_|jdS(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/RRtpopRRtkeysRR5RtInvalidPropertyValueR R*R?R5R5R,t_Publisher__validate_properties(Rt set_propstadd_prop_valuestremove_prop_valuest unset_propstntv((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt update_props s2    "  $ cCsO|jjtddkrK|jjddsKtjtdqKndS(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(RR6RRRR<R (R((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__validate_properties s     cCsytjj|SWnjtjjk ry tjj|dtjjSWqtjjk r|tjtd|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 (RR0((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt__format_safe_read_crl scCs|j}|jdr:|td}|j}n|jdrV|d}n|jd r|jd rtj|jntjd}|rtj|}tj|}tjtj d|j d|j d |j d |j d |j d |j}n||jkr)|j|Stj|d }tj j|jsVttj j|j|}d}tj j|ry|j|}Wntk rqX|jj}|jj|tj dksttj!j"|j}||kr||j|<|Sn|t#j$kr.|Syt%j&d|j\} } WnRtk r} | j't'j(t'j)fkrt%j&\} } qt*j+| nXtj,| d} t-j.} | j/t-j0|| j/t-j1| | j/t-j2d| j/t-j3t4j5y| j6Wn%t-j7k rGt#j$j8||SXWdQXy|j| }Wn"tj9k rt:j;| |SXy$t:j<| |tj=|t>WnCtk r||j|d |_t|trU|g}n|d}|t j j krtj tdi|d6td6n|dkr|j r|jjdg|jdj|dq-|d|jd<|jn.t|dkr-tj td |n||jtR6RpRqRwR|RfRRRRRRRRRRR RRRR R tdigesttDEFAULT_HASH_FUNCR3RzR9RRDR=RPRsRRRwR{RRRRRRRRt_Publisher__get_propRt_Publisher__set_propt_Publisher__del_propt_Publisher__prop_itert_Publisher__prop_iteritemst_Publisher__prop_keyst_Publisher__prop_valuest_Publisher__prop_getdefaultt_Publisher__prop_setdefaultt_Publisher__prop_updatet_Publisher__prop_popRRR(((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyRGs    D      D       O " % "  9 Jw)6  P   *   &*  .  f >  5             /         (DR(RdRR+RRRRxRFR[RRRrRkRPRt pkg.clientRtpkg.client.debugvaluesRRVt pkg.catalogRPtpkg.client.api_errorstclientRtpkg.client.sigpolicyRtpkg.client.pkgdefsRt pkg.digestRtpkg.miscRXt pkg.portableR4tpkg.server.catalogRRRtM2CryptoRRRRRRRtREPO_CTYPE_SUPPLEMENTALRRRURSRDRRRtCODE_SIGNING_USERRxRRbtobjectRRRRR(((s:/usr/lib/python2.7/vendor-packages/pkg/client/publisher.pyt%sr                  (      #9