[/\c@@sddlmZmZddlmZddlZddlmZmZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZdZdZdZdZd Zd Zd Zd ZeeegZeeegZejd ZdZ de!fdYZ"de"fdYZ#de#fdYZ$de!fdYZ%dS(i(tprint_functiontabsolute_import(tunicode_literalsN(t_tucdi ii(i2i<iFiZidudnfc@stfd}|S(ub Wrapper to return a deprecated action constant while printing a deprecation warning. c@sEd|jjf}tj|tddttj}|S(Nu1%s.%s is deprecated. Use dnf.callback.%s instead.t stackleveli(t __class__t__name__twarningstwarntDeprecationWarningtgetattrtdnftcallback(tselftmsgtvalue(tname(s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt_func9s (tproperty(RR((Rs4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt_add_deprecated_action4stTransactionDisplaycB@seZdZedZedZedZeZedZedZ edZ edZ edZ ed Z ed Zed Zd Zd ZdZdZdZRS(cC@sdS(N((R((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt__init__Esu PKG_CLEANUPu PKG_DOWNGRADEu PKG_REMOVEu PKG_INSTALLu PKG_OBSOLETEu PKG_REINSTALLu PKG_UPGRADEu PKG_VERIFYuTRANS_PREPARATIONu PKG_SCRIPTLETu TRANS_POSTcC@sdS(uReport ongoing progress on a transaction item. :api :param package: a package being processed :param action: the action being performed :param ti_done: number of processed bytes of the transaction item being processed :param ti_total: total number of bytes of the transaction item being processed :param ts_done: number of actions processed in the whole transaction :param ts_total: total number of actions in the whole transaction N((Rtpackagetactiontti_donetti_totaltts_donetts_total((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pytprogressVscC@sdS(u/msgs is the messages that were output (if any).N((Rtmsgs((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt scriptoutgscC@sdS(u:Report an error that occurred during the transaction. :apiN((Rtmessage((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyterrorkscC@sdS(u|package is the same as in progress() - a package object or simple string action is also the same as in progress()N((RRR((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pytfilelogoscC@s&|j|tjjdd||dS(Nid(RR t transactiont PKG_VERIFY(Rtpkgtcountttotal((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pytverify_tsi_packageus(Rt __module__RRt PKG_CLEANUPt PKG_DOWNGRADEt PKG_REMOVEt PKG_ERASEt PKG_INSTALLt PKG_OBSOLETEt PKG_REINSTALLt PKG_UPGRADER$tTRANS_PREPARATIONt PKG_SCRIPTLETt TRANS_POSTRRR!R"R((((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRCs$                tErrorTransactionDisplaycB@seZdZdZRS(u@An RPMTransaction display that prints errors to standard output.cC@s3tt|j|tjjd|tjdS(Nuprint(tsuperR5R!R tutilt_terminal_messengertsyststderr(RR ((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR!~s(RR)t__doc__R!(((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR5zstLoggingTransactionDisplaycB@s)eZdZdZdZdZRS(u@ Base class for a RPMTransaction display callback class cC@s)tt|jtjd|_dS(Nudnf.rpm(R6R<Rtloggingt getLoggert rpm_logger(R((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRscC@s|jj|dS(N(R?R!(RR ((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR!scC@s=tjj|}d||f}|jjtjj|dS(Nu%s: %s(R R#t FILE_ACTIONSR?tlogR=tSUBDEBUG(RRRt action_strR((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR"s(RR)R;RR!R"(((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR<s  tRPMTransactioncB@seZeddZddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZRS(cC@s|stg}n||_||_||_t|_d|_d|_d|_ d|_ t |_ d|_ t|_|j|jjg|_d|_d|_dS(Ni(R5tdisplaystbasettesttFalset trans_runningtNonetfdt total_actionsttotal_installedtcomplete_actionstsettinstalled_pkg_namest total_removedR"t_setupOutputLoggingtconft rpmverbosityt_te_listt _te_indext _tsi_cache(RRFRGRE((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRs"             uinfocC@stj}||_t|jd|_|jjj|jidd6dd6dd6dd 6d d 6j ||}d |j }t t |sd }nt j tt |t j|jdS(Nuw+bucritucriticaluemergu emergencyuerruerroruinfou informationuwarninguwarnuRPMLOG_u RPMLOG_INFO(ttempfiletNamedTemporaryFilet _readpipetopenRt _writepipeRFt_tst setScriptFdtgettupperthasattrtrpmt setVerbosityR t setLogFile(RRTtio_r((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRRs    cC@s?tjtjtjtjy|jjWnnXdS(N(RbRct RPMLOG_NOTICERdR9R:R\tclose(R((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt_shutdownOutputLoggings cC@sRy:|jj|jj|jj}|s5dS|SWntk rMnXdS(N(RZtseekttelltreadRJtIOError(Rtout((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt _scriptOutputs cC@sD|j}x|jD]}|j|qW|jjj|dS(N(RnRERRFthistorytlog_scriptlet_output(RRtdisplay((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt _scriptouts cC@s|jdS(N(Rh(R((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt__del__scC@st|dr|}|gS|j|j}tjj|}|jrjt|jd|krj|jSng}xQ|jj D]C}|j t j j krq}nt||kr}|j |q}q}W|r||_|Std|dS(u3Obtain the package related to the calling callback.upkgiu%TransactionItem not found for key: %sN(RaRURVR R7t _te_nevraRWtstrRFR#RtlibdnftTransactionItemAction_REINSTALLtappendt RuntimeError(Rtcbkeyttsittette_nevratitems((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyt_extract_cbkeys$   c C@sPyt|tr!t|}n|tjkr@|j|n|tjkrRn|tjkrt|j||n|tj kr|j ||na|tj kr|j |S|tj kr|j|n&|tjkr|j|||n|tjkr|j|n|tjkr4|j|n|tjkrY|j|||n|tjkrx|j|n|tjkr|j|n`|tjkr|j|||n;|tjkr|j|n|tjkr|j nWnQt!k rKt"j#\}}}t$j%|||} t&j'dj(| nXdS(Nu()t isinstanceRuRRbtRPMCALLBACK_TRANS_STARTt _transStarttRPMCALLBACK_TRANS_STOPtRPMCALLBACK_TRANS_PROGRESSt_trans_progresstRPMCALLBACK_ELEM_PROGRESSt _elemProgresstRPMCALLBACK_INST_OPEN_FILEt _instOpenFiletRPMCALLBACK_INST_CLOSE_FILEt_instCloseFiletRPMCALLBACK_INST_PROGRESSt _instProgresstRPMCALLBACK_UNINST_STARTt _uninst_starttRPMCALLBACK_UNINST_STOPt _unInstStoptRPMCALLBACK_UNINST_PROGRESSt_uninst_progresstRPMCALLBACK_CPIO_ERRORt _cpioErrortRPMCALLBACK_UNPACK_ERRORt _unpackErrortRPMCALLBACK_SCRIPT_ERRORt _scriptErrortRPMCALLBACK_SCRIPT_STARTt _script_starttRPMCALLBACK_SCRIPT_STOPt _scriptStopt ExceptionR9texc_infot tracebacktformat_exceptiontloggertcriticaltjoin( RtwhattamountR'tkeyt client_datatexc_typet exc_valuet exc_tracebackt except_list((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR sJ  cC@s8||_|jrdSt|_t|jj|_dS(N(RLRGtTrueRItlistRFR]RU(RR'((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR s    cC@sDtjj}x1|jD]&}|jd||d|ddqWdS(Nui(R R#R2RER(RRR'RRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR&s cC@si||_|jd7_|jse|j|}x2|jD]$}|j|dj|djq:WndS(Nii(RVRNRGRRER"R%R(RRtindexttransaction_listRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR+s   cC@sd|_|j|}|dj}|j}yt||_Wn>tk r}xg|jD]}|j d||fq`Wn<X|j r|j d7_ |j j |jn|jjSdS(NiuError: Cannot open file %s: %si(RJtlastmsgRR%tlocalPkgR[RKRlRER!RIRMRPtaddRtfileno(RRRR%trpmlocteRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR3s    c C@s|j|}|jjd|_|js8|j r<dSx6|D].}|jtjj krCtjj |_PqCqCWx'|j D]}|j |j |jqW|j|j|jkrtjj}x0|j D]"}|jd|ddddqWndS(N(RRKRgRJRGRItstateRvR#tTransactionItemState_UNKNOWNtTransactionItemState_DONERER"R%RRrRNRLR R4R(RRRR{RqR((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRCs      cC@sc|j|}|dj}|dj}x3|jD](}|j|||||j|jq3WdS(Ni(RR%RRERRNRL(RRR'RRR%RRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRYs   cC@s|jd7_dS(Ni(RQ(RR((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR`scC@sc|j|}|dj}|dj}x3|jD](}|j|||||j|jq3WdS(Ni(RR%RRERRNRL(RRR'RRR%RRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRcs   cC@s|j|}x6|D].}|jtjjkrtjj|_PqqWx'|jD]}|j|j|j qRW|j rdS|j dS(N( RRRvR#RRRER"R%RRGRr(RRRR{Rq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRjs  cC@sE|j|}d|dj}x|jD]}|j|q*WdS(Nu'Error in cpio payload of rpm package %si(RR%RER!(RRRRRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRyscC@sZ|j|}|d}d|j}x|jD]}|j|q0Wtjj|_dS(NiuError unpacking rpm package %s(RR%RER!RvR#tTransactionItemState_ERRORR(RRRR{RRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRs   c C@sitjj|d}|j|}|djj}d||f}x|jD]}|j|qNWdS(Nu iu'Error in %s scriptlet in rpm package %s(RbttagnamesR_RR%RRER!( RRR'Rtscriptlet_nameRRRRq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRs c C@stjj}|dkr0|jgkr0d}n|j|}|dj}|jdkrs|jdkrs|jnd}|jdkr|jdkr|jnd}x-|j D]"}|j ||dd||qWdS(NuNoneiiid( R R#R3RJRURR%RLRNRER(RRRR%RtcompleteR'Rq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRs   '-cC@s|jdS(N(Rr(R((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRscC@s+x$|jD]}|j|||q WdS(N(RER((RR%R&R'Rq((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyR(s((RR)RHRRRRhRnRrRsRR RRRRRRRRRRRRRRR((((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyRDs.      *             (&t __future__RRRtlibdnf.transactionRvtdnf.i18nRRt dnf.callbackR tdnf.transactiontdnf.utilRbtosR=R9RXRRt TS_UPDATEt TS_INSTALLtTS_ERASEt TS_OBSOLETEDt TS_OBSOLETINGt TS_AVAILABLEt TS_UPDATEDt TS_FAILEDtTS_INSTALL_STATEStTS_REMOVE_STATESR>RRtobjectRR5R<RD(((s4/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.pyts:            7