Viewing File: /usr/lib/python2.7/site-packages/yum/rpmtrans.pyc


v_c@sddlZddlZddlZddlZddlZddlZddlZddlTddlm	Z	ddl
mZddlZddl
Z
dddYZdddYZd	efd
YZdddYZd
ddYZdS(iN(t*(t_(tTransactionMembertNoOutputCallBackcBs5eZdZdZdZdZdZRS(cCsdS(N((tself((s0/usr/lib/python2.7/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.7/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.7/site-packages/yum/rpmtrans.pyt	scriptout4scCsdS(stakes a simple error msg stringN((Rtmsg((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyterrorlog9scCsdS(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.7/site-packages/yum/rpmtrans.pytfilelog>s(t__name__t
__module__RRRRR(((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR s
				tRPMBaseCallbackcBsDeZdZdZdZdZdZdZdZRS(s@
    Base class for a RPMTransaction display callback class
    cCsitdt6tdt6tdt6tdt6tdt6tdt6tdt6tdd6|_idt6d	t6d
t6d
t6dt6d
t6dt6|_	t
jd|_dS(NtUpdatingtErasingt
Installingt	ObsoletedtCleanuptRepackagingtrepackagingtUpdatedtErasedt	Installeds"yum.filelogging.RPMInstallCallback(
Rt	TS_UPDATEtTS_ERASEt
TS_INSTALLtTS_TRUEINSTALLtTS_OBSOLETEDt
TS_OBSOLETINGt
TS_UPDATEDRt
fileactiontloggingt	getLoggertlogger(R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRHs 







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(RRRRR	R
R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR[scCsdS(sPpackage is the package.  msgs is the messages that were
        output (if any).N((RRR
((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRiscCstj|IJdS(N(tsyststderr(RR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRnscCsM||jkr)d|j||f}nd||f}|jj|dS(Ns%s: %s(R&R)tinfo(RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRrscCsdS(sC Callback for post transaction when we are in verifyTransaction(). N((Rtbasettxmbrtcount((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pytverify_txmbr{s(	RRt__doc__RRRRRR1(((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRDs						tSimpleCliCallBackcBs,eZdZdZdZdZRS(cCs#tj|d|_d|_dS(N(RRtNonetlastmsgtlastpackage(R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRs
	cCsPd|j||||||f}||jkr:|GHn||_||_dS(Ns%s: %s %s/%s [%s/%s](RR5R6(RRRRR	R
RR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRs	cCs|r
|GndS(N((RRR
((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRscCs%td|t|j|fGHdS(sC Callback for post transaction when we are in verifyTransaction(). sVerify: %u/%u: %sN(RtlenttsInfo(RR.R/R0((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR1s(RRRRRR1(((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR3s				t_WrapNoExceptionscBseZdZdZRS(cCs
||_dS(N(t_WrapNoExceptions__parent(Rtparent((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRscsPt|j|fd}j|_j|_|jjj|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. csFy||Wn.tk
rA}ydGdG|GHWqBqBXnXdS(NsError:sdisplay callback failed:(t	Exception(targstkwargste(tfunc(s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pytnewFuncs(tgetattrR:RR2t__dict__tupdate(RtnameRA((R@s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt__getattr__s
(RRRRF(((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR9s	tRPMTransactioncBsFeZeedZdZdZddZdZdZ	dZ
dZd	Zed
Z
dZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%RS(#cCst|s||_n||_t|j|_||_||_t|_d|_d|_	d|_
d|_t|_
d|_tjd|_t|_|j|jjtjj|jjjstj|jjjndS(Nis"yum.filelogging.RPMInstallCallback(tcallabletdisplayR9R.ttesttFalset
trans_runningR4tfdt
total_actionsttotal_installedtcomplete_actionstsettinstalled_pkg_namest
total_removedR'R(R)Rt_setupOutputLoggingtconftrpmverbositytostpathtexistst
persistdirtmakedirs(RR.RJRI((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRs$									cCsJtj}tj|tj}||@r,dStj|tj||BdS(s1 Set the Non-blocking flag for a filedescriptor. N(RWt
O_NONBLOCKtfcntltF_GETFLtF_SETFL(RRMtflagt
current_flags((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt_fdSetNonblocks
	
cCsJtj}tj|tj}||@r,dStj|tj||BdS(s3 Set the close on exec. flag for a filedescriptor. N(R]t
FD_CLOEXECtF_GETFDtF_SETFD(RRMR`Ra((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt_fdSetCloseOnExecs
	
R-cCstj}||_t|jd|_|jjj|jidd6dd6dd6dd	6d
d6j	||}d|j
}tt|sd
}ntj
tt|tj|jdS(Nsw+btcrittcriticaltemergt	emergencyterrterrorR-tinformationtwarningtwarntRPMLOG_tRPMLOG_INFO(ttempfiletNamedTemporaryFilet	_readpipetopenREt
_writepipeR.ttstsetScriptFdtgettupperthasattrtrpmtsetVerbosityRBt
setLogFile(RRVtio_r((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRTs	
	cCs?tjtjtjtjy|jjWnnXdS(N(R|R}t
RPMLOG_NOTICER~R+R,Rvtclose(R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt_shutdownOutputLoggingscCs9y!|jj}|sdS|SWntk
r4nXdS(N(RttreadR4tIOError(Rtout((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt
_scriptOutputs
cCs9|j}|jj|||jjj||dS(N(RRIRR.thistorytlog_scriptlet_output(RtdataR
((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt
_scriptoutscCs|jdS(N(R(R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt__del__scCsN|d}|dkrd}nt|}|d|d||d|dfS(Ntepocht0REtarchtversiontrelease(R4tstr(RthdrttmpepochR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt	_dopkgtups

	cCst|tr|j|fSt|tr|j|d}|jjjd|}t|dksnt	|dj|dfSt|t
rd}|s|dfSxQ|jjjd|D]7}|j
tkrqn|dk	r|dfS|}qW||fSdSdS(NitpkgtupiRE(NN(t
isinstanceRREttupleRR.R8t
getMembersR7tAssertionErrort
basestringR4t
matchNaevrtoutput_statetTS_REMOVE_STATES(RtcbkeyteraseRttxmbrstretR/((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt	_getTxmbrs&




cCs>|jjjdkr|S|jtjj|jjjdS(s+ Remove the installroot from the filename. t/t(R.RUtinstallroottreplaceRWRXtnormpath(Rtfilename((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt_fn_rm_installroot/scCs|jr
tSt|dr tSd|jjj|jf|_|j	|j}yt
|d|_Wn7tt
fk
r}|jjd|d|_tSX|j|jjtS(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(RJRKR{tTrueR.RURZt_ts_timet
ts_done_fnRRuRRtOSErrorRIRR4Rftfileno(RRR?((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pytts_done_open9s		cCs|jdkrdSy!|jj||jjWnFttfk
r|}|jjd|d|_tj	|j
nXdS(s/ Write some data to the transaction done file. Ns#could not write to ts_done file: %s(RR4twritetflushRRRIRtmisctunlink_fR(RRR?((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt
ts_done_writeOs	cCsV|jsdSt|jdkr)dS|jd\}}}}}}d||||f}	|tkr|dkr|jj||	qn|tkr|dkr|jj||	qnt|tj	kr|}
n	|j
}
||
krd||f}	|jj||	nd||||||f}	|j|	|jjddS(s?writes out the portions of the transaction which have completedNis&ts_done state is %s %s should be %s %sRtinstalls%ts_done name in te is %s should be %ss%s %s:%s-%s-%s.%s
(
RR7t
_te_tuplesRRIRtTS_INSTALL_STATESttypettypestStringTypesRERtpop(RRRttR?tntvtrtaRRE((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pytts_done^s*		
cCset|dsg|_nx|jjD]}|j}|j}|j}|j}|j}|dkrd}n|j
dkrd}n'|j
dkrd}n|j
}|jj||||||fq(Wtj
d|_d|jjj|jf}||_|j|}yMtjjtjj|sjtjtjj|nt|d	}	Wn7ttfk
r}|jjd
|d|_dSXygxL|jD]A\}}}}}}d||||||f}
|	j|
qW|	j|	j WnCttfk
r`}|jjd
|t!j"|d|_nXdS(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.RwtNtAtVtRtER4tTypetappendttimetstrftimeRRURZt	ts_all_fnRRWRXRYtdirnameR[RuRRRIRRRRRRR(RtteRRRRR?RttsfntfoR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pytts_allsL			&		"

cCs|tjkr%|j|||nz|tjkrJ|j|||nU|tjkro|j|||n0|tjkr|j|||S|tj	kr|j
|||n|tjkr|j|||n|tj
kr|j|||n|tjkr%|j|||nz|tjkrJ|j|||nU|tjkro|j|||n0|tjkr|j|||n|tjkr|j|||n|tjkr|j|||n|tjkr|j|||nttdr7|tjkr7|j|||nhttdrk|tj krk|j!|||n4ttdr|tj"kr|j#|||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.7/site-packages/yum/rpmtrans.pytcallbacksDcCs7||_|jrdSt|_|j|jdS(N(RNRJRRLRR(RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRs			
cCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRscCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRscCsd|_|j|\}}|dk	r|jj}yt||_Wn-tk
r{}|jj	d||fqX|j
r|jd7_|jd7_|j
j|n|jjSn|jj	ddS(NsError: Cannot open file %s: %sis"Error: No Header to INST_OPEN_FILE(R4R5RtpotlocalPkgtfileRMRRIRRLRORPRRtaddR(RRRRRER/trpmlocR?((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRs		cCs|j|\}}|dk	r|jjd|_|jrDdS|jr|jj|j|j	|j
|j|jjj
|j}|jjj|}|jjj|||j|j|j	qndS(N(RR4RMRRJRLRIRRRRR.Rtpkg2pidttxmbr2statettrans_data_pid_endR(RRRRRER/tpidtstate((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRs
			cCs|j|\}}|dk	r|dkrU|jj|d|||j|jq|j}|jj|j||||j|jndS(NR(RR4RIRRPRNRR(RRRRRER/R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRs	cCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRscCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR"sc
Cs|j|dt\}}|jd7_|jd7_||jkr|dk	rm|jj|jt	n|jj|t	t	}nt
}|jj||dd|j|j|j
rdS|dk	r|j|jt}|r|jjjdkrtjdn|jjj|j}|jjj|}	|jjj||	|r|jjjdkrtj|jjjn|j|j|jn|j||j||dS(NRiidRt.(RRRSRPRRR4RIRRR R%RRNRJRRKR.RURRWtchrootRRRRRR(
RRRRRER/Rt
_do_chrootRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR%s4	
	
cCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRNscCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRQscCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRTscCsN|j|\}}|dk	rJd|j}t|_|jj|ndS(Ns'Error in cpio payload of rpm package %s(RR4Rt	TS_FAILEDRRIR(RRRRRER/R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRWs

	cCsN|j|\}}|dk	rJt|_d|j}|jj|ndS(NsError unpacking rpm package %s(RR4RRRRIR(RRRRRER/R((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR`s
	
c	Cstjj|d}|j|dt\}}|dkrE|}n	|j}|rd||f}|dk	rt|_qnd||f}|j	j
||j|dS(Ns	<unknown>Rs'Error in %s scriptlet in rpm package %ss0Non-fatal %s scriptlet failure in rpm package %s(R|ttagnamesRyRRR4RRRRIRR(	RRRRtscriptlet_nameRER/tpackage_nameR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRjs		

cCsdS(N((RRRR((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRscCs,|j|\}}|j|p$|dS(N(RR(RRRRRER/((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRscCs3t|jdsdS|jj|j||dS(sC Callback for post transaction when we are in verifyTransaction(). R1N(R{RIR1R.(RR/R0((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyR1s(&RRRKRRRbRfRTRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR1(((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyRGsD									
	
			+	5	'						
			)						
			(((((R|RWR]RR'RR+t
yum.constantstyumRtyum.transactioninfoRRRrRRR3R9RG(((s0/usr/lib/python2.7/site-packages/yum/rpmtrans.pyt<module>s 
$<
Back to Directory File Manager