Ñò -x0Nc @sXdZddkZddkZddkZddklZddkiZddki Z ddk i i ZddkiiZddkiiZdefd„ƒYZdefd„ƒYZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZ defd„ƒYZ!dS(sØProvides a set of publishing interfaces for interacting with a pkg(5) repository. Note that only the Transaction class should be used directly, though the other classes can be referred to for documentation purposes.iÿÿÿÿN(t EmptyDicttTransactionErrorcBs)eZdZd„Zd„Zd„ZRS(s4Base exception class for all Transaction exceptions.cOs5ti||Œ|o|d|_n||_dS(Ni(t Exceptiont__init__tdatat_args(tselftargstkwargs((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR-scCs t|ƒS(N(tstr(R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyt __unicode__3scCs t|iƒS(N(R R(R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyt__str__9s(t__name__t __module__t__doc__RR R (((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR*s  t TransactionRepositoryConfigErrorcBseZdZRS(s„Used to indicate that the configuration information for the destination repository is invalid or is missing required values.(R R R(((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR=stTransactionRepositoryURLErrorcBs eZdZd„Zd„ZRS(sÁUsed to indicate the specified repository URL is not valid or is not supported (e.g. because of the scheme). The first argument, when initializing the class, should be the URL.cOsti|||ŽdS(N(RR(RRR((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRHscCs‡d|ijo'tdƒh|idd6|id6Sd|ijotdƒ|iStdƒh|id6|iiddƒd6S( Ntschemes2Unsupported scheme '%(scheme)s' in URL: '%(url)s'.turltnetlocsMalformed URL: '%s'.s*Invalid repository URL: '%(url)s': %(msg)stmsgt(Rt_Rtget(R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR Ks   (R R RRR (((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRBs tTransactionOperationErrorcBseZdZd„ZRS(s¨Used to indicate that a transaction operation failed. The first argument, when initializing the class, should be the name of the operation that failed.cCs d|ijoStdƒh|id6|iiddƒd6|idd6|iiddƒd6S|iiddƒo=tdƒh|id6|idd6|iiddƒd6S|io/tdƒh|id6|iiddƒd6Std ƒ|iiddƒS( NtstatussO'%(op)s' failed for transaction ID '%(trans_id)s'; status '%(status)s': %(msg)stopttrans_idRRs:'%(op)s' failed for transaction ID '%(trans_id)s': %(msg)ss8'%(op)s' failed; unable to initiate transaction: %(msg)ss"Unable to initiate transaction: %s(RRRRtNone(R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR \s"        (R R RR (((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRVst!TransactionRepositoryInvalidErrorcBseZdZRS(srUsed to indicate that the specified repository is not valid or can not be found at the requested location.(R R R(((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRrst!UnsupportedRepoTypeOperationErrorcBseZdZd„ZRS(s…Used to indicate that a requested operation is not supported for the type of repository being operated on (http, file, etc.).cCs.tdƒh|id6|iiddƒd6S(NsLUnsupported operation '%(op)s' for the specified repository type '%(type)s'.RttypeR(RRRR(R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR {s  (R R RR (((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRwstNullTransactioncBsneZdZededdddd„Zd„Zd„Zee d„Z d„Z d„Z e d„ƒZRS( sPProvides a simulated publishing interface suitable for testing purposes.c Cs1||_||_||_||_||_dS(N(t create_repot origin_urltpkg_namet progtrackR( RR"R!R#t repo_propsRtxporttpubR$((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR…s     cCsWy|id|iƒWn9tij o*}tdd|idt|ƒƒ‚nXdS(seAdds an action and its related content to an in-flight transaction. Returns nothing.tfmritaddRRN(tvalidateR#tactionst ActionErrorRRR (Rtactionte((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR)Žs  cCsFtii|ƒp/tdd|idttdƒ|ƒƒ‚ndS(sžAdds an additional file to the inflight transaction so that it will be available for retrieval once the transaction is closed.tadd_fileRRs;The file to be added is not a file. The path given was %s.N(tostpathtisfileRRR R(Rtpth((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR/šs cCs0|od}d}n|i}d}||fS(s¥Ends an in-flight transaction. Returns a tuple containing a package fmri (if applicable) and the final state of the related package.t ABANDONEDt PUBLISHEDN(RR#(Rtabandontadd_to_catalogtpkg_fmrit pkg_state((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pytclose¥s   cCsti|idƒS(saStarts an in-flight transaction. Returns a URL-encoded transaction ID on success.R(turllibtquoteR#(R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pytopen³scCs |iƒS(sƒStarts an in-flight transaction to append to an existing manifest. Returns a URL-encoded transaction ID on success.(R=(R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pytappend¸scCsdS(sXInstructs the repository to refresh its search indices. Returns nothing.N((((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyt refresh_index½sN(R R RtFalseRRRR)R/tTrueR:R=R>t staticmethodR?(((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR s     tTransportTransactioncBsweZdZed ed d d d d„Zeed„Zd„Zd„Z ee d„Z d„Z d„Z d„ZRS( s;Provides a publishing interface that uses client transport.c CsÞti|dddƒ\} } } } } }||_||_| |_| djoti| ƒ} n| |_||_||_||_ | djo|i d|d|ƒn+| djo|ot dd| ƒ‚ndS(Nthttptallow_fragmentsitfileR%R!R( turlparseR#RRR;tunquoteR1R$t transportt publishertcreate_file_repoR(RR"R!R#R%RR&R'R$RRR1tparamstquerytfragment((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRÇs *           c Cs|ii|iƒodS|ooyti|iddƒWq‘tij oq‘titi fj o!}t ddt |ƒƒ‚q‘Xnyti d|d|iƒ}Wn²tj o%}t ddtdƒ|ƒ‚nƒtij o}tt |ƒƒ‚nZtij o}tt |ƒƒ‚n1ti j o!}t ddt |ƒƒ‚nX|ii|i|ƒdS(NtversioniRt propertiestrootsTAn error occurred while trying to initialize the repository directory structures: %s(RItpublish_cache_containsRJtsrtrepository_createR1tRepositoryExistsErrortapxt ApiExceptiontRepositoryErrorRRR t RepositorytEnvironmentErrorRtcfgt ConfigErrorRtRepositoryInvalidErrorRtpublish_cache_repository(RR%R!R.trepo((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRKßs2   cCs¿y|iƒWn9tij o*}tdd|idt|ƒƒ‚nXy/|ii|id|d|id|i ƒWn?t i j o0}t|ƒ}tdd|id|ƒ‚nXdS(seAdds an action and its related content to an in-flight transaction. Returns nothing.R)RRR-R$N( R*R+R,RRR RIt publish_addRJR$RVtTransportError(RR-R.R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR)s   c Cs®tii|ƒp/tdd|idttdƒ|ƒƒ‚ny&|ii|i d|d|iƒWn?t i j o0}t|ƒ}tdd|id|ƒ‚nXdS(sžAdds an additional file to the inflight transaction so that it will be available for retrieval once the transaction is closed.R/RRs;The file to be added is not a file. The path given was %s.R3N( R0R1R2RRR RRItpublish_add_fileRJRVRa(RR3R.R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR/s   c Csï|ony(|ii|id|iƒ\}}Wqåtij o0}t|ƒ}tdd|id|ƒ‚qåXnqy.|ii|id|id|ƒ\}}Wn?tij o0}t|ƒ}tdd|id|ƒ‚nX||fS(säEnds an in-flight transaction. Returns a tuple containing a package fmri (if applicable) and the final state of the related package. If 'abandon' is omitted or False, the package will be published; otherwise the server will discard the current transaction and its related data. 'add_to_catalog' tells the depot to add a package to the catalog, if True. RR6RR7R:( RItpublish_abandonRJRRVRaR Rt publish_close(RR6R7tstateR(R.R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR:-s"       c Cs²d}y.|ii|idtiƒd|iƒ}Wn?tij o0}t |ƒ}t dd|i d|ƒ‚nX||_ |i djot ddt dƒƒ‚n|i S(saStarts an in-flight transaction. Returns a URL-encoded transaction ID on success.tclient_releaseR#R=RRs8Unknown failure; no transaction ID provided in response.N( RRIt publish_openRJtos_utiltget_os_releaseR#RVRaR RRR(RRR.R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR=Ns     c Cs²d}y.|ii|idtiƒd|iƒ}Wn?tij o0}t |ƒ}t dd|i d|ƒ‚nX||_ |i djot ddt dƒƒ‚n|i S(sƒStarts an in-flight transaction to append to an existing manifest. Returns a URL-encoded transaction ID on success.RfR#R>RRs8Unknown failure; no transaction ID provided in response.N( RRItpublish_appendRJRhRiR#RVRaR RRR(RRR.R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR>fs     cCscd}y|ii|iƒWn?tij o0}t|ƒ}t|d|id|ƒ‚nXdS(sXInstructs the repository to refresh its search indices. Returns nothing.tindexRRN(RItpublish_refresh_indexesRJRVRaR RR(RRR.R((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyR?~s  N(R R RR@RRRRKR)R/RAR:R=R>R?(((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRCÄs  &  !  t Transactionc BsQeZdZhed6ed6ed6ed6Zedededddd„Z RS(s\Returns an object representing a publishing "transaction" interface to a pkg(5) repository. The class of the object returned will depend upon the scheme of 'origin_url', and the value of the 'noexecute' parameter. The 'noexecute' parameter, when provided, will force the returned Transaction to simulate all of the requested operations acting as if they succeeded. It is intended to be used for testing of client publication tools. Each publishing operation requires different information, and as such the following parameters should be provided to the class constructor as noted: 'pkg_name' should be a partial FMRI representing the desired name of a package and its version when opening a Transaction. Required by: open. 'trans_id' should be a URL-encoded transaction ID as returned by open. Required by: add and close if open has not been called. RFRDthttpstnullc Cs—ti|dddƒ\} } } } }}| iƒ} |o d} n| djo | p| otdƒ‚n| |ijot|d| ƒ‚n| idƒo| ot|ddƒ‚n| idƒoc| ot|d d | ƒ‚n| id ƒod | id ƒ} q;| pt|ƒ‚q;nti| | | | ||fƒ}|i| |d |d |d|d|d|d|d| ƒS(NRDREiRos+Caller must supply transport and publisher.RRRFRsQ'%s' contains host information, which is not supported for filesystem operations.t/R!R#R%RR&R'R$( RGtlowerRt_Transaction__schemesRt startswithRtlstript urlunparse(tclsR"R!R#R%Rt noexecuteR&R'R$RRR1RLRMRN((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyt__new__¬s6*        N( R R RRCR RrR@RRRx(((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyRmŒs  ("RR0R;RGtpkg.miscRt pkg.actionsR+t pkg.configtconfigR[tpkg.portable.utiltportabletutilRhtpkg.server.repositorytservert repositoryRStpkg.client.api_errorstclientt api_errorsRVRRRRRRRtobjectR RCRm(((s=/usr/lib/python2.6/vendor-packages/pkg/publish/transaction.pyts$    CÈ