FTc*@sddkZddkZddkZddkZddkZddkZddkZddkZddkZddk Z ddk Z ddk Z ddk Z ddk ZddkiZddkiZddkiiZddkiiZddkiiZddkiZddkiZddk i!i"Z"ddk#i!i$Z$ddk%i&Z&ddk'i(Z(ddk)i*Z*ddk+Z,ddk-i.Z.ddk/i0Z0ddk1i2Z2ddk3Z,ddk4i5Z6ddk7i8Z9ddk:i;iZ<ddk=i;i8Z>ddk?i;i@ZAddkBiCZDddkEZ,dZFdZGdZHdZIdZJdZKdZLdZMd ZNd ZOd ZPdZQdZRdd kSlTZTd eUfdYZVdeVfdYZWdeVfdYZXdeVfdYZYdeVfdYZZdeVfdYZ[deVfdYZ\deVfdYZ]deVfdYZ^deVfd YZ_d!eVfd"YZ`d#eVfd$YZad%eVfd&YZbd'eVfd(YZcd)eVfd*YZdd+eVfd,YZed-eVfd.YZfd/eVfd0YZgd1eVfd2YZhd3eVfd4YZid5eVfd6YZjd7eVfd8YZkd9elfd:YZmd;elfd<YZnd=elfd>YZoe2ipeqd?ZrdS(@iNispkg5-quarantineiiiiiiiic(t PkgGzipFiletRepositoryErrorcBs)eZdZdZdZdZRS(s3Base exception class for all Repository exceptions.cGs,ti|||o|d|_ndS(Ni(t Exceptiont__init__tdata(tselftargs((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRWscCs t|S(N(tstr(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __unicode__\scCs t|iS(N(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__str__bs(t__name__t __module__t__doc__RRR (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRTs  tRepositoryExistsErrorcBseZdZdZRS(s]Used to indicate that a repository already exists at the specified location. cCstd|iS(NsJA package repository (or a directory with content) already exists at '%s'.(t_R(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR ks (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR fstRepositoryFileNotFoundErrorcBseZdZdZRS(s[Used to indicate that the hash name provided for the requested file does not exist.cCstd|iS(Ns9No file could be found for the specified hash name: '%s'.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR ts (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRpstRepositoryInvalidErrorcBseZdZdZRS(s^Used to indicate that a valid repository could not be found at the specified location.cCs&|ip tdStd|iS(Ns?The specified path does not contain a valid package repository.s:The path '%s' does not contain a valid package repository.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR }s   (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRystRepositoryInvalidFMRIErrorcBseZdZRS(s3Used to indicate that the FMRI provided is invalid.(R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryUnqualifiedFMRIErrorcBseZdZdZRS(s_Used to indicate that the FMRI provided is valid, but is missing publisher information.cCstd|iS(NspThis operation requires that a default publisher has been set or that a publisher be specified in the FMRI '%s'.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRst#RepositoryInvalidTransactionIDErrorcBseZdZdZRS(s=Used to indicate that an invalid Transaction ID was supplied.cCstd|iS(Ns,No transaction matching '%s' could be found.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryLockedErrorcBs&eZdZdddZdZRS(suUsed to indicate that the repository is currently locked by another thread or process and cannot be modified.cCs#ti|||_||_dS(N(RRthostnametpid(RRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRs  cCs=|idj o#tdh|id6|id6StdS(NshThe repository cannot be modified as it is currently in use by another process: pid %(pid)s on %(host)s.RthostsOThe repository cannot be modified as it is currently in use by another process.(RtNoneRR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s  N(R R R RRR (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryManifestNotFoundErrorcBseZdZdZRS(s@Used to indicate that the requested manifest could not be found.cCstd|iS(Ns.No manifest could be found for the FMRI: '%s'.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryMirrorErrorcBseZdZdZRS(sqUsed to indicate that the requested operation could not be performed as the repository is in mirror mode.cCs tdS(NsWThe requested operation cannot be performed when the repository is used in mirror mode.(R(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryNoPublisherErrorcBseZdZdZRS(sUsed to indicate that the requested repository operation could not be completed as not default publisher has been set and one was not specified. cCs tdS(Ns^The requested operation could not be completed as a default publisher has not been configured.(R(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryNoSuchFileErrorcBseZdZdZRS(s7Used to indicate that the file provided does not exist.cCstd|iS(NsNo such file '%s'.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryReadOnlyErrorcBseZdZdZRS(svUsed to indicate that the requested operation could not be performed as the repository is currently read-only.cCs tdS(Ns3The repository is read-only and cannot be modified.(R(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositorySearchTokenErrorcBseZdZdZRS(sXUsed to indicate that the token(s) provided to search were undefined or invalid.cCs3|idjotd|iStd|iS(Ns No token was provided to search.s+The specified search token '%s' is invalid.(RRR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRst RepositorySearchUnavailableErrorcBseZdZdZRS(s8Used to indicate that search is not currently available.cCs tdS(Ns0Search functionality is temporarily unavailable.(R(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRstRepositoryDuplicatePublishercBseZdZdZRS(ssRaised when the publisher specified for an operation already exists, and so cannot be added again. cCstd|iS(NsPublisher '%s' already exists.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR stRepositoryUnknownPublishercBseZdZdZRS(scRaised when the publisher specified for an operation is unknown to the repository. cCs&|ip tdStd|iS(NsZNo publisher was specified or no default publisher has been configured for the repository.s*No publisher matching '%s' could be found.(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s   (R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR!stRepositoryVersionErrorcBs eZdZdZdZRS(snRaised when the repository specified uses a format greater than the current format (version). cCs,ti|||_||_||_dS(N(RRtlocationtversiontcurrent_version(RR#R$R%((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRs   cCs d|iS(NsqThe repository at '%(location)s' is version '%(version)s'; only versions up to %(current_version)s are supported.(t__dict__(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R RR (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR"s tRepositoryInvalidVersionErrorcBs eZdZdZdZRS(s\Raised when the repository specified uses an unsupported format. (version). cCs,ti|||_||_||_dS(N(RRR#R$t supported(RR#R$R(((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRs   cCs d|iS(NsqThe repository at '%(location)s' is version '%(version)s'; only version %(supported)s repositories are supported.(R&(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s(R R R RR (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR's t#RepositoryUnsupportedOperationErrorcBseZdZdZRS(stRaised when the repository is unable to support an operation, based upon its current configuration. cCsdS(Ns/Operation not supported for this configuration.((R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR +s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR)&st$RepositoryQuarantinedPathExistsErrorcBseZdZdZRS(sRaised when the repository is unable to quarantine a file because a file of that name is already in quarantine. cCs tdS(Ns Quarantined path already exists.(R(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR 4s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR*/st"RepositorySigNoTrustAnchorDirErrorcBseZdZdZRS(svRaised when the repository trust anchor directory could not be found while performing repository verification.cCstd|iS(Ns(Unable to find trust anchor directory %s(RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR <s(R R R R (((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR+8st _RepoStorec BsbeZdZedJdJdJedJedJeidJd ZdZdZ dJdZ dJdZ dZ dZ edZed Zd Zd Zd Zd ZdZeedZdeidZdZeedJedZdZedZedZdJdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(ed Z)dJd!Z*d"Z+d#Z,e-d$Z.d%Z/d&Z0d'Z1ed(Z2d)Z3d*Z4d+Z5e-d,Z6e-d-Z7d.Z8d/Z9d0Z:d1Z;dJd2Z<eed3Z=d4Z>d5Z?e-d6Z@d7ZAd8ZBd9ZCd:ZDeEiFd;ZGd<ZHd=ZId>ZJd?ZKdJdJdJdJed@ZLdJdJdJdJdJedAZMdBZNdCZOe-dDZPe-dEZQe-dFZRe-dGeZSe-dHZTe-dIZURS(KsThe _RepoStore object provides an interface for performing operations on a set of package data contained within a repository. This class is intended only for use by the Repository class. c Cs~d |_d |_||_d |_h|_||_d |_| |_d |_ d |_ d |_ d|_ d |_ d |_||_||_||_|o|i|n|i||i| t|_t|_tii|_|i oFtitii |i ddti!dti"dt#dt|_$n d |_$|i%dt&z|i'd|Wd |i(Xd S( sPrepare the repository for use.itlockt set_lockstrt get_lockstrt failure_exct provide_mutextblockingt allow_invalidN()Rt_RepoStore__catalogt_RepoStore__catalog_roott_RepoStore__file_layoutt_RepoStore__file_roott_RepoStore__in_flight_transt_RepoStore__read_onlyt_RepoStore__roott_RepoStore__sort_file_max_sizet_RepoStore__tmp_roott_RepoStore__writable_roott cache_storetcatalog_versiont manifest_roott trans_roottlog_objtmirrort publishert_RepoStore__set_file_roott_RepoStore__set_roott_RepoStore__set_writable_roottFalset_RepoStore__search_availablet_RepoStore__refresh_againtpkgtnrlocktNRLockt_RepoStore__locktlockfiletLockFiletostpathtjointgeneric_lock_set_strtgeneric_lock_get_strRt_RepoStore__lockfilet_RepoStore__lock_rstoretTruet_RepoStore__init_statet_RepoStore__unlock_rstore( RR3t file_layoutt file_rootRBRCtpubt read_onlytroottsort_file_max_sizet writable_root((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyREsH                         cCs|i}||_|io||i_n|io||i_n|o;|i o0|idtz|iWd|iXndS(NR2( R9R4R^R>treadonlyRWRXRYRZ(Rtvaluetold_ro((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__set_read_onlys    cCs|ipdS|io |i}n |i}tiitii|d}ti|yti d|SWnjt j o^}|i t i jot i|in|i t ijot i|innXdS(sXCreate a temp directory under repository directory for various purposes.Nttmptdir(R_RaRQRRtnormpathRStmisctmakedirsttempfiletmkdtemptEnvironmentErrorterrnotEACCEStapxtPermissionsExceptiontfilenametEROFStReadOnlyFileSystemException(RR_ttempdirte((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __mkdtemps"    ! cCs@|p|i|dt}n|i}|i|d|dS(sKPrivate version; caller responsible for repository locking.tsigtmanifestN(t _get_manifestRXtcatalogt add_package(RtpfmriRytc((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __add_packages cCsM|p|i|dt}n|i}|i||i|d|dS(sKPrivate version; caller responsible for repository locking.RxRyN(RzRXR{tremove_packageR|(RR}RyR~((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__replace_packages   cCs|ipdSti|i|i|id|id|i}t}y|i}Wnt i j onX|o2|i p|id|i nt |_ n/|i o|id|i nt|_ dS(NtlogR`sSearch AvailablesSearch Unavailable(t index_roottindexertIndexerRzRyt_RepoStore__index_logR;RHtcheck_index_existencetsetInconsistentIndexExceptionRIt reset_searchRX(Rtindtcie((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__check_searchs(         cCsAd|_|io*tii|ioti|indS(sDestroy the catalog.N(RR4t catalog_rootRQRRtexiststshutiltrmtree(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__destroy_catalogs  cCsOtiiti|d}tititi i |}||_|S(sHelper method that takes the full path to the package directory and the name of the manifest file, and returns an FMRI constructed from the information in those components.N( RKR$tVersionturllibtunquoteRtfmritPkgFmriRQRRtbasename(tpkgpathtvertvtf((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__fmri_from_paths$ cCs|i|}tii|}y|id|d|Wn>tj o2}|itijot|innX|S(siThis function should be private; but is protected instead due to its usage as a callback.tpathnamet signatures( RyRKtManifestt set_contentRmRntENOENTRRr(RR}RxtmpathtmRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRzscCs|i|dS(NtINDEX(t_RepoStore__log(Rtmsg((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __index_logscCs|ipt|ny|i|SWn}tj oqti}y|i||Wn"tij ot|nX|pt|n||i|<|SXdS(sMReturn the in-flight transaction with the matching trans_id. N(RARR8tKeyErrorttranst TransactiontreopentTransactionUnknownIDError(Rttrans_idtt((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__get_transactions     cCs|ii|ddS(s7Discard any state information cached for a Transaction.N(R8tpopR(RR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__discard_transactionscCst}y|iWntj o t}nn X|it}|iotii|io|i p |i ozmyDt i |i|i |id|id|i}|idtWn"tij o t}nnXWd|o| o|inXn||fS(shReturns a tuple of booleans of the form (storage_locked, index_locked). RR`R2N(RHRWRRXRZRRQRRRR^RaRRRzRyRR;R-RtIndexLockedExceptiontunlock(Rtstorage_lockedt index_lockedR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytget_lock_statuss2       cCsy1|i}|i}|i}ti|i}Wnd}d}d}nX|i\}}|o d}n|o d}nd}h|d6|d6|d6|d 6S( soReturn a dictionary of status information about the repository storage object. itt processingtindexingtonlines package-countspackage-version-countslast-catalog-updatetstatus(R{t package_counttpackage_version_counttdatetime_to_basic_tst last_modifiedR(Rtcatt pkg_countt pkg_ver_countt lcat_updateRRtrstatus((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt get_status?s*      cCsa|iid|p tn| p6|io |i p!|iotii|i odSy|i i d|Wnt j o}|i t i jo#|iiti|in|i t ijo#|iiti|in|i t ijo#|iiti|in|iin|iinXdS(sgLocks the repository preventing multiple consumers from modifying it during operations.R2N(RNtacquireRR^RaR<RQRRRRVR-RmRnRotreleaseRpRqRrRsRttEINVALtInvalidLockException(RR2tprocessRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __lock_rstore_s4      RcCs1|io#|iid|d|d|ndS(NRtcontexttseverity(RBR(RRRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__logs cCs5|i ptii|i odSti|i|i|id|id|i }|i dt |i t i|i|idyti|idWntj ou}|itijoti|in|itijoti|in|itijoq'nX|idS(s7Private helper function to dump repository search data.NRR`R2s.old(RRQRRRRRRzRyRR;R-RHRtportabletrenameRRRmRnRoRpRqRrRsRtRR(RRRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__purge_search_indexs,"      c s|p| p i odS|o|piniioti_nti_|i_fd}x t i iD]}|dijoqnxt i |dD]}y$i |d|}||Wqt itititiifj oG} t ii|d|} itdh| d6| d6qt ij o} |pqqXqWqWti_ti_ii_iiid|n|pin|oin idS(sKPrivate version; caller responsible for repository locking.Ncsi|dt}d|joti|d}no|i o |_ni|d|it|dS(NRxspkg.fmriRy(RzRXRRRDt_RepoStore__add_packageRR(RR(t default_pubR(s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR|s  is.Skipping %(name)s; invalid manifest: %(error)stnameterrortlm( R@t_RepoStore__destroy_catalogRDR^RHR{RXt batch_modet log_updatesRQtwalktlistdirt_RepoStore__fmri_from_pathRptInvalidPackageErrorstactionst ActionErrorRt FmriErrorRKR$t VersionErrorRRRSRRtDuplicateCatalogEntrytfinalizet_RepoStore__save_catalogt_RepoStore__purge_search_indext_RepoStore__refresh_indext_RepoStore__check_search( Rt build_catalogt build_indexRt incrementalR|RtfnameRRvR((RRs;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __rebuildsV         cCs|ipdS|io|i o tn|i}|idtii|i|}|o |i Sti|i|i |i d|id|i }|i |ip|idnt|_dS(sKPrivate version; caller responsible for repository locking.Ns"Checking for updated package data.RR`sSearch Available(RR^RaRR{RRRtcheck_for_updatest_RepoStore__run_update_indexRzRyR;tsetupRIRX(RRtfmris_to_indexR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__refresh_indexs&            cCsqd|_|id||i|iodS|i o&|io|ii o|i n|i dS(sKPrivate version; caller responsible for repository locking.R3N( RR4t_RepoStore__init_catalogRRCR^RR{RRR(RR3((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __init_state$s   c Csd|_|i p |iodSd}t}tii|id}d}d}|io4tii|id}t i d|dt }nd}tii |o=||}| p|i p||i jo t }qn|oP|i oEti|t d}tii |o|i i o t }qjn*|o"|o|io|i|n|io t}n|o|io|i o t}n|o|i i|itd|id ||i o|io|tii|idd}x8||fD]*} tii | oti| qqWtitii|id t qpntii |od}|io>|io4tii|id}t i d|dt }n|o'|i od |_|i|iqd |_n}y|i i o d |_nWn[tij oL} |pn|it| t i d|i|_d |_dSX|id joF|i o;t d |i i!D} | o| d |_qndS(sVPrivate function to determine version and location of catalog data. This will also perform any necessary transformations of existing catalog data if the repository is read-only and a writable_root has been provided. 'allow_invalid', if True, will assume the catalog is version 1 and use an empty, in-memory catalog if the existing, on-disk catalog is invalid (i.e. corrupted). This assumes that the caller intends to use the repository as part of a rebuild operation.iNcSsYyti|i}Wn0tj o$}|itijodSnXtii|S(N( RQtstattst_mtimeRmRnRRtdatetimetutcfromtimestamp(Rtmod_timeRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt get_file_lmSstattrsR{t meta_rootR^sBTransforming repository catalog; this process will take some time.Rt updatelogiicssx|] }|VqWdS(N((t.0tp((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pys s ("R?RRCRHRQRRRSRRaR{tCatalogRXRRR^RRt_RepoStore__set_catalog_roottdestroyRRt_RepoStore__rebuildR_RtremoveRRpt CatalogErrorRR4tcatalog_verisonRDtlistt publishers( RR3Rtneed_transformtv0_attrstv1_catt writ_cat_roottv0_lmtv0_catRRvtpubs((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__init_catalogAs      !             c CsY|i}|i}yKtii|o!ti|ti||nti |ti Wnt j o}t |ti ot|idtjoud}xY|iD]N}xE|D]=}t|tjo|d|d7}q|d|7}qWqWti|nf|itijp|itijoti|in*|itijoti|innX|i||o||i_n|iid}tii|oEtii tii!|dtii"|}ti#||nti#|||i||oti|n|ii$|_%dS(s_Private helper function that attempts to save the catalog in an atomic fashion.iRs%s isold.N(&Rt_RepoStore__mkdtempRQRRRRRRitcopytreetchmodt PKG_DIR_MODERmt isinstancetErrorttypeRRttupleRpt UnknownErrorsRnRotEPERMRqRrRsRtRR{RtsaveRRStdirnameRtmoveR$R?( RRt old_cat_roott tmp_cat_rootRvRtelisttentryt orig_cat_root((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__save_catalogsT    &    cCs'||_|io||i_ndS(N(R5R4R{R(RR_((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__set_catalog_root s  cCs|otii|}||_tii|d|_|itii|dtii|d|_tii|d|_tii|d|_ |i p |i tii|dqn2d|_|idd|_d|_d|_ dS(NRfR{tindexRKRtfile( RQRRtabspathR:RSR<RRR@RAR\RER(RR_((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __set_root's  $    cCsC||_|pd|_dSti||id|i|_dS(Ntlayouts(R7RR>t file_managert FileManagerR^R6(RR_((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__set_file_root9s    cCs|oFtii|}tii|d|_tii|d|_nW|io:tii|id|_tii|id|_nd|_d|_||_dS(NRfR%( RQRRR'RSR<RR_RR=(RR_((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__set_writable_rootBs   cCs4z|io|iinWd|iiXdS(s8Unlocks the repository so other consumers may modify it.N(RVRRNR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__unlock_rstorePs cCs|ipt|oeti|i|i|id|id|i}|i||i p|idnt |_ ndS(sCreates an indexer then hands it fmris; it assumes that all needed locking has already occurred. RR`sSearch AvailableN( RtAssertionErrorRRRzRyRR;tserver_update_indexRIRX(Rtfmrist index_inst((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__update_searchdb_unlockedYs     cCs|io tn|io tn|ip tn|i|}y!|i}|i||SWn$t i j o}t |nXdS(sjAborts a transaction with the specified Transaction ID. Returns the current package state.N( RCRR^RRAR)t_RepoStore__get_transactiontabandont_RepoStore__discard_transactionRtTransactionErrorR(RRRtpstateRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR5is        cCs|io tn|io tn|ip tn|i|}y|i|Wn$ti j o}t |nXdS(sbAdds an action and its content to a transaction with the specified Transaction ID.N( RCRR^RRAR)R4t add_contentRR7R(RRtactionRRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytadd|s      c Cs{|io tn|i p|idjo tn|iz |idtd|dtWd|iXdS(sLooks for packages added to the repository that are not in the catalog and adds them. 'refresh_index' is an optional boolean value indicating whether search indexes should be updated. iRRRN( RCRRR?R)RWRRXRZ(Rt refresh_index((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR9s    cCs|io tn|io tn|ip tn|i|}y|i||Wn$ti j o}t |nXdS(sAdds a file to an in-flight transaction. 'trans_id' is the identifier of a transaction that the file should be added to. 'data' is the string object containing the payload of the file to add. 'size' is an optional integer value indicating the size of the provided payload. N( RCRR^RRAR)R4tadd_fileRR7R(RRRtsizeRRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR=s      cCs|io tn|io tn|i p|idjo tn|idtz|i ||i Wd|i XdS(s4Adds the specified FMRI to the repository's catalog.iR2N( RCRR^RRR?R)RWRXRRRZ(RR}((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR|s      cCs|io tn|io tn|i p|idjo tn|idtz|i ||i Wd|i XdS(s\Replaces the information for the specified FMRI in the repository's catalog.iR2N( RCRR^RRR?R)RWRXt_RepoStore__replace_packageRRZ(RR}((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytreplace_packages      cCs|io|iS|io tn|ip tn|idjo ti|idtd|i St i d|idtd|i |_|iS(s8Returns the Catalog object for the repository's catalog.iR^RDRR( R4RCRRR)R?t old_catalogt ServerCatalogRXRDR{RR^(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR{s     ccs|i p|idjo tn|idjoy|ip tnti|idtd|i}ti}|i ||i dx|D] }|VqWdS|i }d|i i VdVd|iVx,|iD]\}}}d||fVqWdS( sReturns a generator object for the full version of the catalog contents. Incremental updates are not provided as the v0 updatelog does not support renames, obsoletion, package removal, etc.iR^RDNsS Last-Modified: %s sS prefix: CRSV s S npkgs: %s s V pkg:/%s@%s (RR?R)RDRARBRXt cStringIOtStringIOtsendtseekR{Rt isoformatRttuples(RR~toutputtlR]tstemR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt catalog_0s*          cCso|io tn|i p|idjo tn|pttiitii |i|S(s8Returns the absolute pathname of the named catalog file.i( RCRRR?R)R/RQRRRhRS(RR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt catalog_1s    cCs&|ipdStii|idS(sDiscards currenty loaded search data so that it will be reloaded the next a search is performed. N(Rtsqpt TermQueryt clear_cache(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR&s cCs|io tn|ip tn|i|}y3|id|\}}|i|||fSWn-tit i fj o}t |nXdS(sCloses the transaction specified by 'trans_id'. Returns a tuple containing the package FMRI and the current package state in the catalog.tadd_to_catalogN( RCRRAR)R4tcloseR6RpRRR7R(RRRQRR}R8Rv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRR/s      cCsh|ip tn|djot|n|ii|}|dj o|St|dS(sReturns the absolute pathname of the file specified by the provided SHA-n hash name. (At present, the repository format always uses the least-preferred hash to content in order to remain backwards compatible with older clients. Actions may be published that have additional hashes set, but those do not influence where the content is stored in the repository.)N(R\R)RRR>tlookup(Rtfhashtfp((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR&Gs    cCs|ip tn|ioYtii|id}tii|o*tid|}|o |ddSqznti |iS(snReturn the Publisher object for this storage object or None if not available. spub.p5iR#i( RDR)R_RQRRRSRtp5itparset Publisher(Rtp5ipathR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt get_publisherZs   cCs0y|i|tSWntj otSXdS(svReturns a boolean value indicating whether the given in-flight Transaction ID exists. N(R4RXRRH(RR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pythas_transactionqs  cCs t|iS(s/The number of transactions awaiting completion.(tlenR8(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytin_flight_transactions|scCs|io |iiS(sMA boolean value indicating whether the repository is locked. (RVtlocked(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR^scCsJ|io tn|ip tntii|i|iS(sZReturns the absolute pathname of the manifest file for the specified FMRI.(RCRR@R)RQRRRSt get_dir_path(RR}((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRys     cCs|io tn|io tn|ip tny@ti}|i|||||i |i <|i SWn$ti j o}t |nXdS(sStarts a transaction for the specified client release and FMRI. Returns the Transaction ID for the new transaction.N( RCRR^RRAR)RRtopenR8t get_basenameR7R(Rtclient_releaseR}RRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR`s       cCs|io tn|io tn|ip tny@ti}|i|||||i |i <|i SWn$ti j o}t |nXdS(sStarts an append transaction for the specified client release and FMRI. Returns the Transaction ID for the new transaction.N( RCRR^RRAR)RRtappendR8RaR7R(RRbR}RRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRcs       cCs|io tn|ip tn|idtz9yy|iWntij ow}t d|i }|i |dy|i dtdt Wqtij o}|i t|dqXn/tij o}|i t|dnXWnjtj o^}|ititifjo6|iott dntt dnnXWd|iXdS( sfThis function refreshes the search indexes if there any new packages. RsaIndex corrupted or out of date. Removing old index directory (%s) and rebuilding search indexes.RRRs7writable root not writable by current user id or group.s#unable to write to index directory.N(RCRRR)RWRHRRRRtcauseRRRXtIndexingExceptionRRmRnRoRsRaRRZ(RRvts((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR<s:          csio tnio tni pidjo tnip tn|pti }nfd}i i }zy|i |i |i|i i|i|i |i|i |i |it|_t}xQ|D]I}|i|iy|i|Wntij o qnXt}qW|i|it|_|o|id||in|i|it}|i |idt|x1|D])}|i|||i|iqW|i|i|otii}t fd|D} |i |i!d| x1|D])} yt"i#| } Wnt$j o qrnXti%i&i| } xti| D]} |p|i|i!qnt"i#| }y+t'i(di&| |fdi)}Wn&t$j o|i|i!qnX||jo|i|i!qn|||8}|i|i!qWqrW|i|i!n|i |i*dt|x:|D]2}i+|}t,i-||i|i*qW|i|i*|i |i.dt|xN|D]F}i/i0|}|d j o!t,i-||i|i.q?q?W|i|i.d}x:td |DD]"} |ti%i&i| qWi2osy=x6tii2D]"}|ti%i&i2|qWWq\t3j o#}|i4t4i5joqXq\XnWn$t3j o}ti6|nXWd t|_i7Xd S( s$Removes the specified packages from the repository store. No other modifying operations may be performed until complete. 'packages' is a list of FMRIs of packages to remove. 'progtrack' is an optional ProgressTracker object. icsi|}t}x|iD]z}|ipq%nti|\}}}|i||idjo.x+|idt D]}|i|qWq%q%W|S(sGiven an FMRI, return a set of tuples containing all of the hashes of the files its manifest references. Each tuple is of the form (hash value, hash function)t signaturetleast_preferred( Rztsett gen_actionst has_payloadtdigesttget_least_preferred_hashR;Rtget_chain_certsRX(R}RthashestathattrthvalthfuncR~(R(s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt get_hashess     tpfmristgoalc3sEx>|]7}x.titiii|D] }dVq.WqWdS(iN(RQRRRRSR@(RRfR(R(s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pys Ss t@RDcSsPyti|Wn8tj o,}|ititifjoqLnXdS(s)rmdir; but ignores non-empty directories.N(RQtrmdirtOSErrorRnt ENOTEMPTYtEEXIST(tdRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRxscss%x|]}|idtVqWdS(tstemonlyN(R_RX(RR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pys s N(8RCRR^RRR?R)R@tprogresstNullProgressTrackerRWR{t job_starttJOB_REPO_DELSEARCHtjob_add_progressRtjob_donetJOB_REPO_UPDATE_CATRXRRHRRptUnknownCatalogEntryRRRitJOB_REPO_ANALYZE_RMR\tupdateRQRtsumtJOB_REPO_ANALYZE_REPORRRRRRSRRRDtJOB_REPO_RM_MFSTRyRRtJOB_REPO_RM_FILESR>RSRR\RmRnRt_convert_errorRZ(Rtpackagest progtrackRtR~t save_catalogR}tpfilestslistt remainingRtpnametpdirRtpverRthtfpathRxR!Rv((Rs;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytremove_packagess                                  cCs|io tn|io tn|i p|idjo tn|iz|id|d|Wd|i XdS(sRebuilds the repository catalog and search indexes using the package manifests currently in the repository. 'build_catalog' is an optional boolean value indicating whether package catalogs should be rebuilt. If True, existing search data will be discarded. 'build_index' is an optional boolean value indicating whether search indexes should be built. iRRN( RCRR^RRR?R)RWRRZ(RRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytrebuilds       cCs|io tn|i p|idjo tn|i}tii|i|}|o|i d|i |n_ti|i|i |i d|i d|i }|i|ip|i dnt|_dS(sM Determines which fmris need to be indexed and passes them to the indexer. Note: Only one instance of this method should be running. External locking is expected to ensure this behavior. Calling refresh index is the preferred method to use to reindex. isUpdating search indexesRR`sSearch AvailableN(RCRRR?R)R{RRRRt$_RepoStore__update_searchdb_unlockedRzRyR;RRIRX(RR~RR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__run_update_indexs$           c sio tni p i o tniip tnfd}g}yRxK|D]C}t|t i p|i t i i |qz|i |qzWWn$t ij o}t|nXg}|D]}|||q~S(sSearches the index for each query in the list of queries. Each entry should be the output of str(Query), or a Query object.c siptti}|iti|}|i|i}|id|i d|i didi d|i |i tiijo|in|iiiS(Nt num_to_returnt start_pointt index_dirtget_manifest_pathtcase_sensitive(RR/RNt QueryLexertbuildt QueryParserRWttexttset_infoRRRyRt return_typetQuerytRETURN_PACKAGEStpropagate_pkg_returntsearchR{R1(tqRJtqqptquery(R(s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt_searchs      (RCRRRR)Rtsearch_availableRRtqpRRcRNtfromstrtQueryExceptionR(RtqueriesRt query_lstRfRvt_[1]R((Rs;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRs&      cCs4|io |iotii|ip |iS(N(RIRRQRRRR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR-sc Cs|io tn|io tn|ip tntii|id}d}zytii |}t i d|\}}d}yti |}Wn/tj o#}|itijoqnX|ooti|t i|iyti||i|iWqgtj o#}|itijoqPqgXnti|titi|dii}zO|~} ti| dii} z | ~ } t i!| |gWdQXWdQXti"||Wnjt#j o^}|iti$jot%i&|i'n*|iti(jot%i)|i'nnXWd|o$tii*|oti+|nXdS(sUpdates the configuration information for the publisher defined by the provided Publisher object. spub.p5iRgtwbsutf-8N(,RCRR^RR_R)RQRRRSRRRktmkstempRRyRnRtfchmodtS_IMODEtst_modeRtchowntst_uidtst_gidRRit PKG_FILE_MODEtfdopent__exit__t __enter__tcodecst EncodedFileRVtwriteRRmRoRpRqRrRsRtRtunlink( RR]RYtfnRtfdtstRvRRt_[2]tef((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytupdate_publisher2sN       )) c Csk|id}|id}|o|o|i|}x|itiiD]}xUtiD]J}|ii||jo+|iid} | o| |d         ccs tii|ipdS|i|idd}|o|i|VdSti|i}t|}xy|D]q} yPtii |i| } tti| } | djo|| d7}nWqrt j o } qrqrXqrW|d7}|i ||i ddt |i\} }| p)|itdh|d6|id6Vn|idx|D]} tii |i| }|i|dd}|o|i|Vqgnyti| }Wn^tj oR|i d|id|it|ht| d6V|idqgnXxti|D]}tii ||}ti|}yRtidi ||fd|i}tii|ptd |nWn`tj oT} |i d|id|it|ht| d6V|idq:nX|i ||i||}|o"|i|V|idq:n|i||\}}x|D]}|i|VqW|i||||||}x|D]}|i|VqWg}x|D]\}}}y|ii |d t!}WnKt"i#j o<} |i$t%|h|d 6t&d d |d6fqnX|i|||}|o|i$|qn|i'|||d|}|o|i$|qqWx|D]}|i|VqW|itq:WqgW|i(|i)dS(svA generator that produces verify errors, each a tuple of the form (error_code, path, message, details)Nitrepository_scantpermissionspathR]RRwRDs%s is not a filetcheck_existenceRsPermission denied.RRR(*RQRRRR@t_RepoStore__verify_permRt_RepoStore__build_verify_errorRR\RSRytrepo_verify_starttrepo_verify_start_pkgRXt_RepoStore__verify_permissionsRtprefixtrepo_verify_end_pkgRRRtrepo_verify_add_progressRRRRRDtisfilet_RepoStore__verify_manifestt_RepoStore__get_hashest_RepoStore__verify_signatureR>RSRHRpRqRcRRt_RepoStore__verify_hashRtJOB_REPO_VERIFY_REPO(RRR]RRRRtmflistRvRtmfdirtversRvt valid_permsRRRRRRR}RoRterrsRRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __gen_verifys                      ccs|i p|idjo tn|ip tn|p|i}ntidd}||_h}ti i |pt |nxti |D]z}ti i ||} ti i| oqntii| } | ii} |i| g|| i| qW|izyy/x(|i|||||D] } | VqTWWnCttfj o1} ddk}|i| ti| nXWd|iti |XdS(sA generator which verifies the contents of the repository store, checking for several different types of errors. No modifying operations may be performed until complete. 'progtrack' is an optional ProgressTracker object. 'trust_anchor_dir' is set in the repository configuration and corresponds to the image property of the same name. 'sig_required_names' is set in the repository configuration and corresponds to the image property of the same name. 'use_crls' is set in the repository configuration and corresponds to the image property of the same name. The generator yields tuples of the form: (error_code, path, message, reason) where 'error_code' an integer error, correponding to REPO_VERIFY_* 'path' the path to the broken file in the repository 'message' a human-readable summary of the error 'reason' a dictionary of strings containing more detail about the nature of the error. iR"spkgrepo-verify.iN(!RR?R)R@RRkRlRRQRRtisdirR+RRStislinktm2tX509t load_certt get_subjecttas_hasht setdefaultRcRWt_RepoStore__gen_verifyRRmt tracebackt print_excRpRRZRR(RR]Rttrust_anchor_dirRRt tmp_metarootRRRt trusted_caRfRRvR:((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytverify sD           c#sio tn|pti}nt}xid|d|d|d|d|D]l\}} } } |o|||| | | fn|tjoqbn| id} |i| | fqbWd} fd}x^|i D]P\} } | pqni | }| |joqn|i|| fqW|i |i dt|t}x|D]\} } |i|i | |joqtntii| p)t| td | h| d6fVqtntii| }tii| }|iid d id }| p |} ntii| |}yti|Wn/tj o#}|itijoqnXtii||}tii|o tntd h| d6|d6} t}h|d6| d6} zay!t i!| ||i| Wn9t"j o-}t#}tdh| d6|d6} nXWd|| | | fVXqtW|i$|i |oi%ndS(s(Verify, then quarantine any packages in the repository that were found to be faulty, according to self.verify(..). This method yields tuples of the form: (status_code, fmri, message, reason) where 'status_code' an int status code, corresponding to REPO_FIX_* 'path' the path that was fixed 'message' a summary of the operation performed 'reason' a dictionary of strings describing the operation Note, the 'fmri' value may not be a valid FMRI if the manifest being fixed was corrupt, in which case a path to the corrupted manifest in the repository is used instead. If any object referred to by a manifest is quarantined, then the manifest for that package is also quarantined, however other files referenced by the manifest are not moved to quarantine in case they are referenced by other packages. R]RR<RRRKcsXtiiit}tii|pti|ntiddd|}|S(s1Make a directory where we can quarantine content.R"sfix.Rg( RQRRRSR_RRtmkdirRkRl(tquarantine_basetqroot(R(s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt_make_quarantine_root s  Rvs:Missing file %s must be fixed by republishing the package.RiRsMoving %(src)s to %(dest)stsrctdests&Unable to quarantine %(path)s: %(err)sRRRN(&R^RR~RRiR?RRR;RtcopyRyRtJOB_REPO_FIX_REPOR\RRQRRRt REPO_FIX_ITEMRRRtreplaceR_tlstripRSRjRyRnR{R*RRRtREPO_FIX_FAILEDRR(RR]Rtverify_callbackR<RRt broken_itemsRRRRRRtquarantine_rootRCRt fixed_pathsRRgtqdirRvRER((Rs;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytfixb s              !     cCsz|io tn|ip tnti|iptS|iptS|i }|i |}|djS(sCheck that the FMRI supplied as an argument would be valid to add to the repository catalog. This checks to make sure that any past catalog operations (such as a rename or freeze) would not prohibit the caller from adding this FMRI.N( RCRRR)Rtis_valid_pkg_nametget_nameRHR$R{t get_entryR(RR}R~R!((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytvalid_new_fmri s      cCs|io tn|ip tnti|iptS|iptS|ii ptS|i }|i |}|dj S(N( RCRRR)RRRRSRHR$ttimestrR{RTR(RR}R~R!((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytvalid_append_fmri s       cCs|iS((R5(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt scCs|iS((R6(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRX scCs|iS((R7(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRX scCs|iS((R9(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRX scCs|iS((R:(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRX scCs|iS((R=(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRX sN(VR R R RHRRtSORT_FILE_MAX_SIZERt_RepoStore__set_read_onlyRRR?RRt staticmethodRRzRR4R6RRRXRWtloggingtINFORRRRRYRRRRFRERGRZRR5R;R9R=R|R@tpropertyR{RLRMRRRR&RZR[R]R^RyR`RcR<RRRRRRRR'R&RltDEFAULT_HASH_FUNCR)RR(R!R9R?RQRURWRR[R\R^R_Ra(((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR,?s =         % ( &  S   H           (       -   ) 2 H 5    V F |  t Repositoryc BsPeZdZedCedCdCeeiedCeidCd Z eeei dZ eeeidZ dZ deidZdZdZd Zd Zd Zd Zed ZdZdZdZedZdZdZdCdZdCdZdCdZ e!dZ"dCdZ#dCdZ$dCdZ%dZ&dZ'dZ(dZ)dZ*e+d Z,d!Z-d"Z.d#Z/e+d$Z0dCd%Z1dCd&Z2ei d'Z3e+d(Z4dCd)Z5dCdCd*Z6dCed+Z7dCd,Z8e!edCd-Z9d.Z:d/Z;dCd0Z<dCd1Z=d2Z>d3Z?dCdCd4Z@dCdCdCd5ZAd6ZBd7ZCe+d8ZDe+d9ZEe+d:ZFe+d;ZGe+d<ZHe+d=eZIe+d>ZJe+d?eZKe+d@ZLe+dAZMe+dBZNRS(DsA Repository object is a representation of data contained within a pkg(5) repository and an interface to manipulate it.c Cs tii|_tii|_||_d|_d|_d|_ d|_ |i | |i | d|_ d|_d|_||_d|_||_||_d|_| |_||_d|_|iz |id|d|d|Wd|iXdS(sPrepare the repository for use.iiR3tcreatet propertiesN(RKRLRMt_Repository__lockt_Repository__prop_lockt_Repository__file_rootRt_Repository__pub_roott_Repository__roott_Repository__tmp_roott_Repository__writable_roott_Repository__set_roott_Repository__set_writable_roott_Repository__catalog_requestst_Repository__file_requestst_Repository__manifest_requestst_Repository__cfgpathnamet_Repository__cfgt_Repository__mirrort_Repository__read_onlyt_Repository__rstorest_Repository__sort_file_max_sizeRBR$t_Repository__lock_repositoryt_Repository__init_statet_Repository__unlock_repository( RR3t cfgpathnameRaR\RBRCRbR^R_R`Ra((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s2                    cCsy?| o3|io)tii|iot|inWn$tj o}ti|nXd}|i o |i }n'|iotii |id}n|ioTtii |id}|otii | ptii|o |}qnt d|d||_ y"t|iidd|_Wn%titfj od|_nX|idjo4|io*tii |id }tii |id }tii |p'|iid jo!tii | o d |_n|iotii |o]tii tii |d o d|_n d |_t d|d|d|i|_ qt|in t|iidd|in(|idjo|io d |_n|ioR|i oGtii |id} |i o tii | o | |_q0n|itjot|i|itn|id jo|io*|i otii |id |_n| o|otii | otii |ip\tii tii |ido7ttitii |ididdd j ot|iqPn|iid d} |id jo|i} | ptii |id} ntdtid| d|id|i d|i!} | |i"| i#<|ioJtii |io4x1ti$|iD]} |i%| d|qWn| o'| |i"jo|i%| d|qn\td|d|id|id| d|i d|i!d|id|i&} | |i"| i#<|ipdSyti'|i} Wngt(j o[}|i)t)i*joti+|i,n'|i)t)i-jot|innXt'i.t'i/| i0pt|in|id jof|i! o[tii |id}x@d D]4}yti1||Wqt(j o qqXqWndS(!sePrivate helper function to determine repository format and validity. t cfg_cachespkg5.repositoryttargett overridest repositoryR$iiRDR{iiRiR&s pkg5.imagetimageR"R[R\RBRCR^R3R]R_RaNRs.pags.dir(s.pags.dir(2R_RQRRR%RRmRpRRRoRSRtRepositoryConfigRptinttcfgt get_propertyR$tPropertyConfigErrorRt set_propertyR\RetCURRENT_REPO_VERSIONR"tpub_rootRft FileConfigR,tlayouttV1LayoutRBRCR^RsRDRt_Repository__new_rstoreRaRRyRnRoRqRrRRtS_IFMTRR(RR3RaRbRvRxtcfgpathRtcat_roottfroottdef_pubtrstoreR]tfst searchdb_filetext((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __init_format= s                          cCs3h|_|id|d|d||idS(s,Private helper function to initialize state.R3RaRbN(Rst_Repository__init_formatt_Repository__write_config(RR3RaRb((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s cCs|iidS(sgLocks the repository preventing multiple consumers from modifying it during operations.N(RcR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__lock_repository sRcCs1|io#|iid|d|d|ndS(NRRR(RBR(RRRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s cCsL|iiz*||_x|iD]}||_q#WWd|iiXdS(N(RdRRqtrstoresRCR(RRcR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __set_mirror s   cCsL|iiz*||_x|iD]}||_q#WWd|iiXdS(N(RdRRrRR^R(RRcR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRe s   cCsm|iizK|o7tii|}||_tii|d|_n d|_Wd|ii XdS(NRf( RdRRQRRR'RgRSRhRR(RR_((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR(% s   cCs|iizt|o.tii|}tii|d|_n3|iotii|id|_n d|_||_ Wd|ii XdS(NRf( RdRRQRRR'RSRhR_RRiR(RR_((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR-1 s    cCs|iidS(s8Unlocks the repository so other consumers may modify it.N(RcR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__unlock_repository@ scCse|iodSy|iiWn>tj o2}|itititifjoqanXdS(s1Save the repository's current configuration data.N(R^RRRmRnRRoRs(RRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__write_configF s cCsK|pt||ijot|n|iotii|i|}n |i}d}|i otii|i d|}n|i }|io$|o|i |io d}nd}|i djot i}ntd|d|d|d|id|id|d |id |d |id | }||i|<|S( NRDiR3R[R\RBRCR]R^R_R`Ra(R/RsR RRQRRRSR_RRaR\t startswithR$RRR,RBRCR^Rt(RR]R3R_t writ_rootRR[R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __new_rstoreX s2          cCs|i|}|i|S(s{Aborts a transaction with the specified Transaction ID. Returns the current package state. (tget_trans_rstoreR5(RRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR5 scCs|i|}|i||S(ssAdds an action and its content to a transaction with the specified Transaction ID. (RR;(RRR:R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR; scCs|io tn|io tn|i p|idjo tn|i|i}y|i |Wn@t i \}}}zt i |iWd|d|XnXdS(sCreates a repository storage area for the publisher defined by the provided Publisher object and then stores the publisher's configuration information. Only supported for version 4 and later repositories. iN(RCRR^RRR$R)RR"Rtsystexc_infoRRR_R(RR]Rtexc_typet exc_valuetexc_tb((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt add_publisher s     c Cs|io tn|io tn|i p|idjo tng}|izyx||D]t}|i|}|i |t i i |d|}t i i |o't i i |oti||qsqsWWnjtj o^}|itijoti|in|itijoti|innXWd|iXtt id} ddi |} |pd| } nti| dtd | d | } |o| indS( sRemoves a repository storage area and configuration information for the publisher defined by the provided publisher prefix. pfxs must be an iterable. iRDNtws/usr/bin/rm -rf t s/usr/bin/nohup tshelltstdouttstderr(RCRR^RRR$R)Rut_Repository__mkdtemppubRcRQRRRSRRRRmRnRoRpRqRrRsRtRwR`tdevnullt subprocesstPopenRXtwait( Rtpfxst repo_pathtsyncht tmp_pathstpfxt repo_tmp_pathtpub_pathRvtnullfRtsubp((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytremove_publisher sJ           cCs|ipdS|io |i}n |i}tiitii|d}y/ti|ti dd|dd|SWnjt j o^}|i t i jot i|in|i t ijot i|innXdS(sCreate a temp directory under repository directory and corresponding temp pub folder with format rm.pubname.xxxxxx under this folder NRfR"srm.t.Rg(R_RaRQRRRhRSRiRjRkRlRmRnRoRpRqRrRsRt(RRR_RuRv((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt __mkdtemppub s$    !  cCs|i|i}|i|S(s4Adds the specified FMRI to the repository's catalog.(tget_pub_rstoreRDR|(RR}R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR| sc Csy-t|tipti||}nWn$tij o}t|nX|o|i o ||_ny|i|i}Wn2tj o&}|ipt|nnX|i ||S(sStarts an append transaction for the specified client release and FMRI. Returns the Transaction ID for the new transaction.( RRRRRRDRR!RRc(RRbR}R]RvR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRc s  cCs#|i|i|}|iS(sReturns a generator object for the full version of the catalog contents. Incremental updates are not provided as the v0 updatelog does not support renames, obsoletion, package removal, etc. 'pub' is the prefix of the publisher to return catalog data for. If not specified, the default publisher will be used. If no default publisher has been configured, an AssertionError will be raised. (t inc_catalogRRL(RR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRL s cCs&|i|i|}|i|S(sQReturns the absolute pathname of the named catalog file. 'pub' is the prefix of the publisher to return catalog data for. If not specified, the default publisher will be used. If no default publisher has been configured, an AssertionError will be raised. (RRRM(RRR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRM- s cCs,|i|i|}|i|d|S(sCloses the transaction specified by 'trans_id'. Returns a tuple containing the package FMRI and the current package state in the catalog. RQ(RRRR(RRRQR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRR: s cCsy|i|o|i|}|i|Sx8|iD]-}y|i|SWq8tj oq8Xq8Wt|dS(s|Returns the absolute pathname of the file specified by the provided SHA1-hash name. 'pub' is the prefix of the publisher to return catalog data for. If not specified, the default publisher will be used. If no default publisher has been configured, an AssertionError will be raised. N(tinc_fileRR&RR(RRTR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR&E s   cCsKy|i|}|iSWn*tj o|ontnXdS(sReturn the catalog object for the given publisher. 'pub' is the optional name of the publisher to return the catalog for. If not provided, the default publisher's catalog will be returned. N(RR{R!R)(RR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt get_cataloga s cCst|djo|iidd}n|pt|ny|i|}Wntj ot|nX|S(sdReturn a repository storage object matching the given publisher (if provided). If not provided, a repository storage object for the default publisher will be returned. A RepositoryUnknownPublisher exception will be raised if no storage object for the given publisher exists. RDR"N(RRRR!RsR(RR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRt s c Cs|idjpt|iidd}h}x'dD]}|iid ||| s (RR(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR] scCs|id7_dS(Ni(Rl(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR scCs|id7_dS(Ni(Rm(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR scCs|id7_dS(Ni(Rn(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt inc_manifest scCs|io |iiS(sMA boolean value indicating whether the repository is locked. (RcR^(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR^ sc CsS|iy*t|tipti|}nWn$tij o}t|nX| o|io |i}n |o|i o ||_n|oEy|i|}Wn!tj o}t |nX|i |Sd}xU|i D]J}|ipqn|i |}| pt ii| oqn|SWt |dS(skReturns the absolute pathname of the manifest file for the specified FMRI. N(RRRRRRRDRR!RRyRRRQRRR(RR}R]RvRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRy s4     c Csy-t|tipti||}nWn$tij o}t|nX|o|i o ||_ny|i|i}WnAtj o5}|ipt|n|i |i}nX|i ||S(sStarts a transaction for the specified client release and FMRI. Returns the Transaction ID for the new transaction. ( RRRRRRDRR!RRR`(RRbR}R]RvR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR`! s  c Csd}h}h}d}x|iD]}|i p |i oq%n|o|i|joq%n|ii|\}} } ||||| ||djo | }n|i| ~~ ~ q%W|otid|n|ptid|n||fS(sGiven a user-specified list of FMRI pattern strings, return a tuple of ('matching', 'references'), where matching is a dict of matching fmris and references is a dict of the patterns indexed by matching FMRI respectively: { pkgname: [fmri1, fmri2, ...], pkgname: [fmri1, fmri2, ...], ... } { fmri1: [pat1, pat2, ...], fmri2: [pat1, pat2, ...], ... } 'patterns' is the list of package patterns to match. 'pubs' is an optional set of publisher prefixes to restrict the results to. Constraint used is always AUTO as per expected UI behavior when determining successor versions. Note that patterns starting w/ pkg:/ require an exact match; patterns containing '*' will using fnmatch rules; the default trailing match rules are used for remaining patterns. Exactly duplicated patterns are ignored. Routine raises PackageMatchErrors if errors occur: it is illegal to specify multiple different patterns that match the same package name. Only patterns that contain wildcards are allowed to match multiple packages. cSsMxF|iD]8\}}||jo||i|q |||(RR=(RRRR>R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR= scCsgx`|iD]U}|ipq n|o!|io|i|joq n|id|d|q WdS(sRebuilds the repository catalog and search indexes using the package manifests currently in the repository. 'build_catalog' is an optional boolean value indicating whether package catalogs should be rebuilt. If True, existing search data will be discarded. 'build_index' is an optional boolean value indicating whether search indexes should be built. RRN(RRDR(RRRR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR s  !cCs"|i|i|idS(s)Reloads the repository state information.N(RuRvRw(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytreloads  cCs|i|i}|i|S(s\Replaces the information for the specified FMRI in the repository's catalog.(RRDR@(RR}R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR@scCsJxC|iD]8}|o!|io|i|joq n|iq WdS(sDiscards currenty loaded search data so that it will be reloaded for the next search operation. N(RRDR(RR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRs  !cCs|i|}|i|S(sSearches the index for each query in the list of queries. Each entry should be the output of str(Query), or a Query object. (RR(RRR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRscCsh|djo|iotS|djo;|djo.x&|iD]}|idjotSq@WtStS(sReturns a boolean value indicating whether the specified operation is supported at the given version. RR{ii(R_RXRR?RH(RtopRR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytsupports(s  cCsy|io tn|io tn|i p|idjo tn|i|i}|i |dS(sUpdates the configuration information for the publisher defined by the provided Publisher object. Only supported for version 4 and later repositories. iN( RCRR^RRR$R)RR"R(RR]R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR9s     c Cs|iidddjo(t|i|iidddn|i|i}|iidd}t|iidd}|iidd}|id|d|d |d |d |S( sA generator that verifies that repository content matches expected state for all or specified publishers. 'progtrack' is an optional ProgressTracker object. 'pub' is an optional publisher prefix to limit the operation to. The generator yields tuples of the form: (error_code, path, message, details) where 'error_code' an integer error, correponding to REPO_VERIFY_* 'path' the path to the broken file in the repository 'message' a summary of the error 'details' a dictionary of strings containing more detail about the nature of the error. R|R$istrust-anchor-directoryssignature-required-namesscheck-certificate-revocationRR]R<RR(RRR'R_RR"RiR?(RRR]RR<RR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR?Ls      c Cs|iidddjo(t|i|iidddn|i|i}|iidd}t|iidd}|iidd}|id|d|d |d |d |d |S( sjA generator that corrects any problems in the repository. 'progtrack' is an optional ProgressTracker object. 'pub' is an optional publisher prefix to limit the operation to. During the operation, we emit progress, printing the details using 'verify_callback', a method which requires the following arguments, progtrack, error_code, message, reason, which correspond exactly to the tuple generated by self.verify(..) This method yields tuples of the form: (status_code, message, details) where 'status_code' an integerstatus code, corresponding to REPO_FIX* 'message' a summary of the operation performed 'details' a dictionary of strings describing the operation R|R$istrust-anchor-directoryssignature-required-namesscheck-certificate-revocationRR]RLR<RR(RRR'R_RR"RiRQ(RRR]RLRR<RR((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRQps      cCs|i|i}|i|S(sCheck that the FMRI supplied as an argument would be valid to add to the repository catalog. This checks to make sure that any past catalog operations (such as a rename or freeze) would not prohibit the caller from adding this FMRI.(RRDRU(RR}R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRUscCs*|iz|iWd|iXdS(s1Save the repository's current configuration data.N(RuRRw(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt write_configs cCs|iS((Rl(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Rp(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Rm(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Re(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Rn(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Rq(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Rf(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Rr(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Rg(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs |iiS((Rstvalues(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXscCs|iS((Ri(R((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyRXsN(OR R R RHRRit EmptyDictRRYRtEmptyIRRvRuR\R]t_Repository__logt_Repository__set_mirrort_Repository__set_read_onlyRjRkRwRRR5R;RRRR|RcRLRMRXRRR&RRRRRZRRR^R]RRRR^RyR`RRR<RR9R=RRR@RRRRR?RQRURRRRR\RRCRR^R_RRa(((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR` s   ,     )   0              ( R 9     $( R~cBsteZdZheideideidgeideidddgddeid eid eid eid eid eideidddeidei dddeideidg eidei deidddeid eiddddgddeiddddgddei d dd!ggd"6eideideidgeideidddgddeid eid eid eid eid eideidddeidei dddeideidg eidei deidddeid eiddddgddeiddddgddei d dd!ggd#6eideidgeidei d$ei d%dd&ei d'ei d(deggd)6Zd+eid+d*ZRS(,sReturns an object representing a configuration interface for a a pkg(5) repository. The class of the object returned will depend upon the specified configuration target (which is used as to retrieve and store configuration data). 'target' is the optional location to retrieve existing configuration data or store the configuration data when requested. The location can be the pathname of a file or an SMF FMRI. If a pathname is provided, and does not exist, it will be created. 'overrides' is a dictionary of property values indexed by section name and property name. If provided, it will override any values read from an existing file or any defaults initially assigned. 'version' is an integer value specifying the set of configuration data to use for the operation. If not provided, the version will be based on the target if supported. If a version cannot be determined, the newest version will be assumed. RDRR"R|Rtcoret supplementaltdefaultRt detailed_urlRt maintainertmaintainer_urlRRspackage repositoryRRi@8RRtfeedtidspackage repository feedticontallowedRs sweb/_themes/pkg-block-icon.pngtlogosweb/_themes/pkg-block-logo.pngtwindowiiiR$strust-anchor-directorys/etc/certs/CA/ssignature-required-namesscheck-certificate-revocationicCs||p tid|id|d|S|ido#ti|d|id|d|Sti|d|id|d|S(Nt definitionsR{R$ssvc:(RtConfigt_RepositoryConfig__defsRt SMFConfigR(tclsRzR{R$((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyt__new__!sN(R R R RtPropertySectiont PropPublishert PropDefinedt PropPubURItPropSimplePubURIListtPropInttPropUUIDtPropertytPropListtPropBoolRHRRRiRR(((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyR~s                                       "c Cst|totiti|}n|i}|ptt|n|d j o'|djp |t jo t nyt i |tiWn tj o}|i|joj|itijpt ii|ioAt i|i}|o$|dgj ot|iqq|itijoti|iq|itijoti|iq|itijp|i|joqnX|djox*dD]"}ti t ii||qWyLtt ii|d d ii}z|~}|i d Wd QXWqtj ou}|itijoti|in|itijoti|iq|itijoqqXnt!d t"dt#d|d|S(s'Create a repository at given location and return the Repository object for the new repository. If a repository (or directory at the given location) already exists, a RepositoryExistsError will be raised. Other errors can raise exceptions of class ApiException. is.zfsR{R&R%RKRRfRyRs NRaR^RbR_(scatalogsfilesindexspkgstransstmp($Rt basestringRDt RepositoryURIRit parse_urit get_pathnameRRRRR)RQRjRRmRrRnR{RRRRR RoRpRqRsRtRSR&RRRR`RXRH( trepo_uriRbR$RRRvtentriesR|Rtcf((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pytrepository_create,sP   ##   5(sRCRRRnR\RQtos.pathRRRRkRRtM2CryptoR3t pkg.actionsRt pkg.catalogR{tpkg.client.api_errorstclientt api_errorsRptpkg.client.progressR~tpkg.client.publisherRDt pkg.configtconfigRt pkg.digestRltpkg.file_layout.file_managerR[R*tpkg.file_layout.layoutRtpkg.fmriRt pkg.indexerRt pkg.lockfileROt pkg.manifestRKtpkg.p5iRVt pkg.portableRtpkg.miscRit pkg.nrlocktpkg.search_errorst search_errorsRtpkg.query_parsert query_parserRtpkg.server.catalogtserverRAtpkg.server.query_parserRNtpkg.server.transactiont transactionRtpkg.pkgsubprocesst pkgsubprocessRt pkg.versionRRRRRRRRRRRRHRKt pkg.pkggzipRRRR RRRRRRRRRRRRRR R!R"R'R)R*R+tobjectR,R`R~RRR(((s;/usr/lib/python2.6/vendor-packages/pkg/server/repository.pyts                            u