[c@sddkZddkZddkZddkZddkZddkZddkZddkTddkl Z ddk Z ddk Z dddYZ dddYZ de fd YZd dd YZd dd YZdS(iN(t*(t_tNoOutputCallBackcBs5eZdZdZdZdZdZRS(cCsdS(N((tself((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt__init__ scCsdS(s @param package: A yum package object or simple string of a package name @param action: A yum.constant transaction set state or in the obscure rpm repackage case it could be the string 'repackaging' @param te_current: current number of bytes processed in the transaction element being processed @param te_total: total number of bytes in the transaction element being processed @param ts_current: number of processes completed in whole transaction @param ts_total: total number of processes in the transaction. N((Rtpackagetactiont te_currenttte_totalt ts_currenttts_total((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pytevent#scCsdS(sPpackage is the package. msgs is the messages that were output (if any).N((RRtmsgs((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt scriptout3scCsdS(stakes a simple error msg stringN((Rtmsg((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyterrorlog8scCsdS(svpackage is the same as in event() - a package object or simple string action is also the same as in event()N((RRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pytfilelog=s(t__name__t __module__RR R RR(((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRs     tRPMBaseCallbackcBsDeZdZdZdZdZdZdZdZRS(s@ Base class for a RPMTransaction display callback class cCshtdt6tdt6tdt6tdt6tdt6tdt6tdt6tdd6|_hdt6d t6d t6d t6dt6d t6dt6|_ t i d |_ dS( NtUpdatingtErasingt Installingt ObsoletedtCleanupt Repackagingt repackagingtUpdatedtErasedt Installeds"yum.filelogging.RPMInstallCallback( Rt TS_UPDATEtTS_ERASEt TS_INSTALLtTS_TRUEINSTALLt TS_OBSOLETEDt TS_OBSOLETINGt TS_UPDATEDRt fileactiontloggingt getLoggertlogger(R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRGs         cCs tdS(s @param package: A yum package object or simple string of a package name @param action: A yum.constant transaction set state or in the obscure rpm repackage case it could be the string 'repackaging' @param te_current: Current number of bytes processed in the transaction element being processed @param te_total: Total number of bytes in the transaction element being processed @param ts_current: number of processes completed in whole transaction @param ts_total: total number of processes in the transaction. N(tNotImplementedError(RRRRRR R ((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR Zs cCsdS(sPpackage is the package. msgs is the messages that were output (if any).N((RRR ((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR hscCsti|IJdS(N(tsyststderr(RR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRmscCsO||ijod|i||f}nd||f}|ii|dS(Ns%s: %s(R%R(tinfo(RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRqscCsdS(sC Callback for post transaction when we are in verifyTransaction(). N((Rtbasettxmbrtcount((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt verify_txmbrzs( RRt__doc__RR R RRR0(((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRCs     tSimpleCliCallBackcBs,eZdZdZdZdZRS(cCs#ti|d|_d|_dS(N(RRtNonetlastmsgt lastpackage(R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRs  cCsRd|i||||||f}||ijo |GHn||_||_dS(Ns%s: %s %s/%s [%s/%s](RR4R5(RRRRRR R R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR s   cCs|o|GndS(N((RRR ((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR scCs%td|t|i|fGHdS(sC Callback for post transaction when we are in verifyTransaction(). sVerify: %u/%u: %sN(RtlenttsInfo(RR-R.R/((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR0s(RRRR R R0(((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR2s  t_WrapNoExceptionscBseZdZdZRS(cCs ||_dS(N(t_WrapNoExceptions__parent(Rtparent((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRscsPt|i|fd}i|_i|_|iii|S(s Wraps all access to the parent functions. This is so it'll eat all exceptions because rpm doesn't like exceptions in the callback. csHy||Wn0tj o$}ydGdG|GHWqDqDXnXdS(NsError:sdisplay callback failed:(t Exception(targstkwargste(tfunc(s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pytnewFuncs(tgetattrR9RR1t__dict__tupdate(RtnameR@((R?s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt __getattr__s   (RRRRE(((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR8s tRPMTransactioncBsLeZeedZdZdZddZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&RS($cCst|p ||_n ||_t|i|_||_||_t|_h|_d|_d|_ d|_ g|_ d|_ t id|_t|_|i|iitii|iiipti|iiindS(Nis"yum.filelogging.RPMInstallCallback(tcallabletdisplayR8R-ttesttFalset trans_runningt filehandlest total_actionsttotal_installedtcomplete_actionstinstalled_pkg_namest total_removedR&R'R(Rt_setupOutputLoggingtconft rpmverbositytostpathtexistst persistdirtmakedirs(RR-RIRH((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRs$             cCsLti}ti|ti}||@odSti|ti||BdS(s1 Set the Non-blocking flag for a filedescriptor. N(RUt O_NONBLOCKtfcntltF_GETFLtF_SETFL(Rtfdtflagt current_flags((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt_fdSetNonblocks   cCsLti}ti|ti}||@odSti|ti||BdS(s3 Set the close on exec. flag for a filedescriptor. N(R[t FD_CLOEXECtF_GETFDtF_SETFD(RR^R_R`((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt_fdSetCloseOnExecs   R,cCsti}||_t|id|_|ii|iii_ hdd6dd6dd6dd 6d d 6i ||}d |i }t t |p d }nt itt |t i|idS(Nsw+btcrittcriticaltemergt emergencyterrterrorR,t informationtwarningtwarntRPMLOG_t RPMLOG_INFO(ttempfiletNamedTemporaryFilet _readpipetopenRDt _writepipetfilenoR-ttstscriptFdtgettupperthasattrtrpmt setVerbosityRAt setLogFile(RRTtio_r((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRRs    cCs?titititiy|iiWnnXdS(N(R|R}t RPMLOG_NOTICER~R*R+Rutclose(R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt_shutdownOutputLoggings cCs=y#|ii}|pdS|SWntj onXdS(N(RstreadR3tIOError(Rtout((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt _scriptOutputscCs9|i}|ii|||iii||dS(N(RRHR R-thistorytlog_scriptlet_output(RtdataR ((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt _scriptouts cCs|idS(N(R(R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt__del__scCsP|d}|djo d}n t|}|d|d||d|dfS(Ntepocht0RDtarchtversiontrelease(R3tstr(RthdrttmpepochR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt _dopkgtups    cCs1d|d|d|d|d|df}|S(Ns%s:%s.%s-%s-%sRRDRRR((RRthandle((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt _makeHandlescCs@|iiidjo|S|itii|iiidS(s+ Remove the installroot from the filename. t/t(R-RSt installroottreplaceRURVtnormpath(Rtfilename((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt_fn_rm_installrootscCs|iotSt|dotSd|iii|if|_|i |i}yt |d|_ Wn9t t fj o'}|iid|d|_ tSX|i|i itS(sQ Open the transaction done file, must be started outside the chroot. t_ts_dones%s/transaction-done.%stwscould not open ts_done file: %sN(RIRJR{tTrueR-RSRXt_ts_timet ts_done_fnRRtRRtOSErrorRHRR3ReRv(RRR>((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt ts_done_opens  cCs|idjodSy!|ii||iiWnHttfj o6}|iid|d|_ti |i nXdS(s/ Write some data to the transaction done file. Ns#could not write to ts_done file: %s( RR3twritetflushRRRHRtmisctunlink_fR(RRR>((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt ts_done_write4s cCst|to[|i|d}|iiid|}t|djpt|di|dfSt|t o |dfSdSdS(Nitpkgtupi(NN( t isinstancettupleRR-R7t getMembersR6tAssertionErrorRDt basestringR3(RtcbkeyRttxmbrs((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyt _getTxmbrFs c Csf|ipdSt|idjodS|id\}}}}}}d||||f} |tjo(|djo|ii|| qn|tjo(|djo|ii|| qnt|ti jo |} n |i } || jo'd||f} |ii|| nd||||||f} |i | |ii ddS(s?writes out the portions of the transaction which have completedNis&ts_done state is %s %s should be %s %sterasetinstalls%ts_done name in te is %s should be %ss%s %s:%s-%s-%s.%s ( RR6t _te_tuplestTS_REMOVE_STATESRHRtTS_INSTALL_STATESttypettypest StringTypesRDRtpop( RRRttR>tntvtrtaRRD((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pytts_doneRs*         c Csst|dp g|_nx|iiD]}|i}|i}|i}|i}|i}|d jo d}n|i djo d}n*|i djo d}n |i }|ii ||||||fq*Wt i d|_d|iii|if}||_|i|}yOtiitii|ptitii|nt|d } Wn9ttfj o'}|iid |d |_d SXygxL|iD]A\}}}}}}d ||||||f} | i| qW| i| i WnEttfj o3}|iid |t!i"|d |_nXd S(s&write out what our transaction will doRRiRiRs%Y-%m-%d.%H:%M.%Ss%s/transaction-all.%sRscould not open ts_all file: %sNs%s %s:%s-%s-%s.%s s"could not write to ts_all file: %s(#R{RR-RwtNtAtVtRtER3tTypetappendttimetstrftimeRRSRXt ts_all_fnRRURVRWtdirnameRYRtRRRHRRRRRRR( RtteRRRRR>RttsfntfoR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pytts_all}sP            &     cCs|tijo|i|||n|tijo|i|||nw|tijo|i|||nP|tijo|i|||S|ti jo|i |||n|ti jo|i |||n|ti jo|i|||n|tijo|i|||n|tijo|i|||ni|tijo|i|||nB|tijo|i|||n|tijo|i|||n|tijo|i|||n|tijo|i|||nttdo'|tijo|i|||nottdo'|ti jo|i!|||n8ttdo'|ti"jo|i#|||ndS(NtRPMCALLBACK_SCRIPT_ERRORtRPMCALLBACK_SCRIPT_STARTtRPMCALLBACK_SCRIPT_STOP($R|tRPMCALLBACK_TRANS_STARTt _transStarttRPMCALLBACK_TRANS_PROGRESSt_transProgresstRPMCALLBACK_TRANS_STOPt _transStoptRPMCALLBACK_INST_OPEN_FILEt _instOpenFiletRPMCALLBACK_INST_CLOSE_FILEt_instCloseFiletRPMCALLBACK_INST_PROGRESSt _instProgresstRPMCALLBACK_UNINST_STARTt _unInstStarttRPMCALLBACK_UNINST_PROGRESSt_unInstProgresstRPMCALLBACK_UNINST_STOPt _unInstStoptRPMCALLBACK_REPACKAGE_STARTt_rePackageStarttRPMCALLBACK_REPACKAGE_STOPt_rePackageStoptRPMCALLBACK_REPACKAGE_PROGRESSt_rePackageProgresstRPMCALLBACK_CPIO_ERRORt _cpioErrortRPMCALLBACK_UNPACK_ERRORt _unpackErrorR{Rt _scriptErrorRt _scriptStartRt _scriptStop(Rtwhattbytesttotalthtuser((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pytcallbacksD   cCsJ|djo9||_|iodSt|_|i|indS(Ni(RMRIRRKRR(RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRs     cCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRscCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRsc Csd|_d}|dj o|d|d}}|i|}yti|ti}Wn/tj o#}|iid||fqX||i |<|i o6|i d7_ |i d7_ |i i|dn|Sn|iiddS(NiisError: Cannot open file %s: %sRDs"Error: No Header to INST_OPEN_FILE(R3R4RRURttO_RDONLYRRHRRLRKRNRORPR( RRRRRtrpmlocRR^R>((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRs     c Cs0d}|dj o|d|d}}|i|}ti|i|d}|iodS|io|i|}|ii i d|} x| D]} |i i | i | i|i| i |iii| i } |iii| } |iii| | |i| i | iqWq,ndS(NiiR(R3RRURRLRIRKRR-R7RRHRtpot output_stateRRtpkg2pidt txmbr2statettrans_data_pid_endR( RRRRRRRR^RRR.tpidtstate((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRs&   c Cs|dj ot|tdjo)|ii|d|||i|iq|d|d}}|i|}|iii d|}xC|D]7}|i } |ii|i | |||i|iqWndS(NRRiiR( R3RRHR RORMRR-R7RRR( RRRRRRRRR.R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRs  cCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR!scCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR$scCs|id7_|id7_||ijo|ii|tt}nt}|ii||dd|i|i|i ||i odS|i ||dS(Niid( RQRORPRHRRR$R RMRRIR(RRRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR's    cCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR8scCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR;scCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR>sc Csw|d|d}}|i|}|iiid|}x4|D],}d|i} t|_|ii| qCWdS(NiiRs'Error in cpio payload of rpm package %s( RR-R7RRt TS_FAILEDRRHR( RRRRRRRRR.R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRAs  c Csw|d|d}}|i|}|iiid|}x4|D],}t|_d|i} |ii| qCWdS(NiiRsError unpacking rpm package %s( RR-R7RRRRRHR( RRRRRRRRR.R((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRKs  c Cs+t|tip|df}n|d|d}}t}t|tip|g}t}n(|i|}|i i i d|}x|D]} ti i |d} |o | } n | i} |o(d| | f} |p t| _qnd| | f} |ii| |i| qWdS(NiiRs s'Error in %s scriptlet in rpm package %ss0Non-fatal %s scriptlet failure in rpm package %s(RRt TupleTypeR3RJR|RRRR-R7RttagnamesRyRRRRHRR( RRRRRRt remove_hdrRRtpkgtscriptlet_namet package_nameR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRVs0      cCsdS(N((RRRR((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRxscCs-|i|\}}|i|p|dS(N(RR(RRRRRDR.((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR{scCs5t|idpdS|ii|i||dS(sC Callback for post transaction when we are in verifyTransaction(). R0N(R{RHR0R-(RR.R/((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyR0s('RRRJRRRaReRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR0(((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyRFsF          + 5 '             "  (((((R|RUR[RR&RR*t yum.constantstyumRRRqRRR2R8RF(((s0/usr/lib/python2.6/site-packages/yum/rpmtrans.pyts          $<