ok

Mini Shell

Direktori : /lib/python3.6/site-packages/dnf/db/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/dnf/db/__pycache__/history.cpython-36.pyc

3

�ft`%:�@s�ddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
mZmZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZdS)�N)�ucd)�misc)�
DatabaseError�)�GroupPersistor�EnvironmentPersistor�RPMTransactionc@sjeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zejd'd&��Zed(d)��Zejd*d)��Zed+d,��Zed-d.��Zed/d0��Zejd1d0��Zed2d3��Zd4d5�Zed6d7��Zd8d9�Zed:d;��Z ed<d=��Z!ed>d?��Z"d@S)A�RPMTransactionItemWrappercCs|dk	st�||_||_dS)N)�AssertionError�_swdb�_item)�self�swdb�item�r�/usr/lib/python3.6/history.py�__init__#sz"RPMTransactionItemWrapper.__init__cCs|jj�j�S)N)rZgetItemZtoStr)r
rrr�__str__(sz!RPMTransactionItemWrapper.__str__cCs|j|jkS)N)r)r
�otherrrr�__lt__+sz RPMTransactionItemWrapper.__lt__cCs|j|jkS)N)r)r
rrrr�__eq__.sz RPMTransactionItemWrapper.__eq__cCs
|jj�S)N)r�__hash__)r
rrrr1sz"RPMTransactionItemWrapper.__hash__cCsdS)NTr)r
�patternrrr�match4szRPMTransactionItemWrapper.matchcCs|jj�dk	S)N)r�
getRPMItem)r
rrr�
is_package7sz$RPMTransactionItemWrapper.is_packagecCs|jj�dk	S)N)r�getCompsGroupItem)r
rrr�is_group:sz"RPMTransactionItemWrapper.is_groupcCs|jj�dk	S)N)r�getCompsEnvironmentItem)r
rrr�is_environment=sz(RPMTransactionItemWrapper.is_environmentcCs
|jj�S)N)rr)r
rrr�	get_group@sz#RPMTransactionItemWrapper.get_groupcCs
|jj�S)N)rr)r
rrr�get_environmentCsz)RPMTransactionItemWrapper.get_environmentcCs|jj�j�S)N)rrZgetName)r
rrr�nameFszRPMTransactionItemWrapper.namecCs|jj�j�S)N)rrZgetEpoch)r
rrr�epochJszRPMTransactionItemWrapper.epochcCs|jj�j�S)N)rrZ
getVersion)r
rrr�versionNsz!RPMTransactionItemWrapper.versioncCs|jj�j�S)N)rrZ
getRelease)r
rrr�releaseRsz!RPMTransactionItemWrapper.releasecCs|jj�j�S)N)rrZgetArch)r
rrr�archVszRPMTransactionItemWrapper.archcCs*|jrdj|j|j|j�Sdj|j|j�S)Nz{}:{}-{}z{}-{})r#�formatr$r%)r
rrr�evrZszRPMTransactionItemWrapper.evrcCs|jj�j�S)N)rrZgetNEVRA)r
rrr�nevra`szRPMTransactionItemWrapper.nevracCs
|jj�S)N)rZ	getAction)r
rrr�actiondsz RPMTransactionItemWrapper.actioncCs|jj|�dS)N)rZ	setAction)r
�valuerrrr*hscCs
|jj�S)N)rZ	getReason)r
rrr�reasonlsz RPMTransactionItemWrapper.reasoncCs|jj|�S)N)rZ	setReason)r
r+rrrr,pscCs$y
|jj�Stk
rdSXdS)N�)rZ
getActionName�AttributeError)r
rrr�action_namets
z%RPMTransactionItemWrapper.action_namecCs$y
|jj�Stk
rdSXdS)Nr-)rZgetActionShortr.)r
rrr�action_short{s
z&RPMTransactionItemWrapper.action_shortcCs
|jj�S)N)r�getState)r
rrr�state�szRPMTransactionItemWrapper.statecCs|jj|�dS)N)r�setState)r
r+rrrr2�scCs
|jj�S)N)r�	getRepoid)r
rrr�	from_repo�sz#RPMTransactionItemWrapper.from_repocCs|jj�sdSd|jj�S)Nr-�@)rr4)r
rrr�ui_from_repo�s
z&RPMTransactionItemWrapper.ui_from_repocCsdS)Nr)r
rrr�
obsoleting�sz$RPMTransactionItemWrapper.obsoletingcCs|jjj|�S)N)r�rpm�
get_reason)r
rrrr:�sz$RPMTransactionItemWrapper.get_reasoncCs|jjj|jS)N)rr9Z_swdb_ti_pkgr)r
rrr�pkg�szRPMTransactionItemWrapper.pkgcCs|jjS)N)r;�files)r
rrrr<�szRPMTransactionItemWrapper.filescCs|jS)N)r;)r
rrr�_active�sz!RPMTransactionItemWrapper._activeN)#�__name__�
__module__�__qualname__rrrrrrrrrr r!�propertyr"r#r$r%r&r(r)r*�setterr,r/r0r2r5r7r8r:r;r<r=rrrrr	"sBr	c@s�eZdZdZdZdd�Zedd��Zedd��Zedd	��Z	ed
d��Z
edd
��Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(S))�TransactionWrapperFcCs
||_dS)N)�_trans)r
�transrrrr�szTransactionWrapper.__init__cCs
|jj�S)N)rD�getId)r
rrr�tid�szTransactionWrapper.tidcCs
|jj�S)N)rDZ
getCmdline)r
rrr�cmdline�szTransactionWrapper.cmdlinecCs
|jj�S)N)rDZ
getReleasever)r
rrr�
releasever�szTransactionWrapper.releasevercCs
|jj�S)N)rDZ
getDtBegin)r
rrr�
beg_timestamp�sz TransactionWrapper.beg_timestampcCs
|jj�S)N)rDZgetDtEnd)r
rrr�
end_timestamp�sz TransactionWrapper.end_timestampcCs
|jj�S)N)rD�getRpmdbVersionBegin)r
rrr�beg_rpmdb_version�sz$TransactionWrapper.beg_rpmdb_versioncCs
|jj�S)N)rD�getRpmdbVersionEnd)r
rrr�end_rpmdb_version�sz$TransactionWrapper.end_rpmdb_versioncCst|jj�tjjk�S)N)�intrDr1�libdnf�transaction�TransactionItemState_DONE)r
rrr�return_code�szTransactionWrapper.return_codecCs
|jj�S)N)rDZ	getUserId)r
rrr�loginuid�szTransactionWrapper.loginuidcCs|jS)N)�packages)r
rrr�data�szTransactionWrapper.datacCs|jj�}t|�S)N)rD�getConsoleOutput�bool)r
�outputrrr�	is_output�s
zTransactionWrapper.is_outputcCs
|jj�S)N)rDZ
getComment)r
rrr�comment�szTransactionWrapper.commentcCs|jj�gS)N)rDrF)r
rrr�tids�szTransactionWrapper.tidscCsgS)Nr)r
rrr�performed_with�sz!TransactionWrapper.performed_withcs�jj�}�fdd�|D�S)Ncsg|]}t�|��qSr)r	)�.0�i)r
rr�
<listcomp>�sz/TransactionWrapper.packages.<locals>.<listcomp>)rDZgetItems)r
�resultr)r
rrV�s
zTransactionWrapper.packagescCsdd�|jj�D�S)NcSsg|]}|d�qS)rr)r_r`rrrra�sz-TransactionWrapper.output.<locals>.<listcomp>)rDrX)r
rrrrZ�szTransactionWrapper.outputcCsgS)Nr)r
rrr�error�szTransactionWrapper.errorcCs|jj�|k|_dS)N)rDrN�altered_gt_rpmdb)r
Zrpmdbvrrr�compare_rpmdbv�sz!TransactionWrapper.compare_rpmdbvN)r>r?r@�altered_lt_rpmdbrdrrArGrHrIrJrKrMrOrTrUrWr[r\r]r^rVrZrcrerrrrrC�s*rCc@sheZdZdd�Zdd�Zedd��Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��Zdd�ZdS)�MergedTransactionWrappercCstjj|j�|_dS)N)rQrRZMergedTransactionrD)r
rErrrr�sz!MergedTransactionWrapper.__init__cCs|jj|j�dS)N)rD�merge)r
rErrrrh�szMergedTransactionWrapper.mergecCs
|jj�S)N)rDZlistUserIds)r
rrrrU�sz!MergedTransactionWrapper.loginuidcCs
|jj�S)N)rDZlistIds)r
rrrr]szMergedTransactionWrapper.tidscCsdd�|jj�D�S)NcSsg|]}t|tjjk��qSr)rPrQrRrS)r_r`rrrrasz8MergedTransactionWrapper.return_code.<locals>.<listcomp>)rDZ
listStates)r
rrrrTsz$MergedTransactionWrapper.return_codecCs
|jj�S)N)rDZlistCmdlines)r
rrrrHsz MergedTransactionWrapper.cmdlinecCs
|jj�S)N)rDZlistReleasevers)r
rrrrIsz#MergedTransactionWrapper.releasevercCs
|jj�S)N)rDZlistComments)r
rrrr\sz MergedTransactionWrapper.commentcCsdd�|jj�D�S)NcSsg|]}|d�qS)rr)r_r`rrrrasz3MergedTransactionWrapper.output.<locals>.<listcomp>)rDrX)r
rrrrZszMergedTransactionWrapper.outputN)
r>r?r@rrhrArUr]rTrHrIr\rZrrrrrg�srgc@s�eZdZd6dd�Zdd�Zedd��Zedd	��Zed
d��Zedd
��Z	edd��Z
dd�Zdd�Zedd��Z
dd�Zd7dd�Zd8dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd9d(d)�Zd*d+�Zd,d-�Zd:d.d/�Zd;d0d1�Zd2d3�Zd4d5�ZdS)<�
SwdbInterfacer-cCs8t|�|_d|_d|_d|_d|_d|_||_g|_dS)N)	�strrI�_rpm�_group�_envZ_addon_datar�_db_dir�_output)r
Zdb_dirrIrrrrs
zSwdbInterface.__init__cCs|j�dS)N)�close)r
rrr�__del__%szSwdbInterface.__del__cCs|jdkrt|�|_|jS)N)rkr)r
rrrr9(s

zSwdbInterface.rpmcCs|jdkrt|�|_|jS)N)rlr)r
rrr�group.s

zSwdbInterface.groupcCs|jdkrt|�|_|jS)N)rmr)r
rrr�env4s

zSwdbInterface.envcCstjj|jtjjj�S)N)�os�path�joinrnrQrR�SwdbZdefaultDatabaseName)r
rrr�dbpath:szSwdbInterface.dbpathcCsZ|jsTytjj|j�|_Wn.tk
rH}ztt|���WYdd}~XnX|jj�|jS)z Lazy initialize Swdb object N)	rrQrRrwrx�RuntimeErrorrrj�initTransaction)r
Zexrrrr>s
zSwdbInterface.swdbcCstjj||j�}|j�dS)N)rQrRZTransformerrx�	transform)r
Z	input_dirZtransformerrrrr{KszSwdbInterface.transformcCsZy|`Wntk
rYnXd|_d|_d|_|jrJ|jj�|jj�d|_g|_dS)N)	�_tidr.rkrlrmrZcloseTransactionZ
closeDatabasero)r
rrrrpOs

zSwdbInterface.closecCs
|jj�S)N)rZgetPath)r
rrrru]szSwdbInterface.pathcCs
|jj�S)N)rZ
resetDatabase)r
rrr�reset_dbaszSwdbInterface.reset_dbTcCs|jj�}|sdSt|�S)N)rZgetLastTransactionrC)r
�complete_transactions_only�trrr�lastes
zSwdbInterface.lastNrFcs��pg�dd��D��|jj�}dd�|D�}�rD�fdd�|D�}xJt|�D]>\}}|dkr`qN||d}|jj�|jj�krNd|_d|_qNW|ddd�S)	NcSsg|]}t|��qSr)rP)r_r`rrrraosz%SwdbInterface.old.<locals>.<listcomp>cSsg|]}t|��qSr)rC)r_r`rrrraqscsg|]}|j�kr|�qSr)rG)r_r`)r]rrratsrrT���)rZlistTransactions�	enumeraterDrLrNrfrd)r
r]�limitr~rbr`rEZ
prev_transr)r]r�oldms

zSwdbInterface.oldcCst|jj��S)N)rCrZ
getCurrent)r
rrr�get_current�szSwdbInterface.get_currentcCsB|jj|�}|j|�}tjj}|jj||||�}|jtjj	�|S)zSet reason for package)
r9Z_pkg_to_swdb_rpm_item�reporQrRZ#TransactionItemAction_REASON_CHANGErZaddItemr3rS)r
r;r,�rpm_itemZrepoidr*Ztirrr�
set_reason�s
zSwdbInterface.set_reasoncCs|jjt|��S)zGet repository of package)rZ
getRPMReporj)r
r;rrrr��szSwdbInterface.repocCs*|jjt|��}|dkr|St||�}|S)zGet package data for packageN)rZgetRPMTransactionItemrjr	)r
r;rbrrr�package_data�s

zSwdbInterface.package_datacCsfy|jj�WnYnX|jjttjtj���t|�|p>dtt	j
��|�}|jj|j�||_
|S)Nr-)rrzZbeginTransactionrP�calendarZtimegm�timeZgmtimerjrZgetloginuidZ
setReleaseverrIr|)r
Z
rpmdb_versionZ
using_pkgsZtsisrHr\rGrrr�beg�s
zSwdbInterface.begcCsN|jj�}|j|j�|j|jp"d�|j|j�|j|j	�|j
|j�|S)Nr)rZ
createRPMItemZsetNamer"ZsetEpochr#Z
setVersionr$Z
setReleaser%ZsetArchr&)r
Zpor�rrr�pkg_to_swdb_rpm_item�s
z"SwdbInterface.pkg_to_swdb_rpm_itemcCsDt|d�sdS|sdSx(|j�D]}t|�}|jjd|f�q WdS)Nr|r)�hasattr�
splitlinesrro�append)r
�msg�linerrr�log_scriptlet_output�s
z"SwdbInterface.log_scriptlet_outputcCs�t|d�sdS|dkrFtjj}x&|jD]}|jtjjkr&tjj}Pq&Wx |jD]\}}|j	j
||�qNWg|_|j	jtt
j
��t|�|�dS)Nr|)r�rQrRZTransactionState_DONEr9r2ZTransactionItemState_ERRORZTransactionState_ERRORrorZaddConsoleOutputLineZendTransactionrPr�rj)r
rOrT�errorsZtsiZfile_descriptorr�rrr�end�s

zSwdbInterface.endcCs|jj|�S)z{ Search for history transactions which contain specified
            packages al. la. "yum list". Returns transaction ids. )rZsearchTransactionsByRPM)r
ZpatternsZignore_caserrr�search�szSwdbInterface.searchcCs8|jj|j|jd�}|tjjkr$dS|tjjkr4dSdS)z)Returns True if package is user installedrTFr�)r�resolveRPMTransactionItemReasonr"r&rQrR�TransactionItemReason_USER�TransactionItemReason_UNKNOWN)r
r;r,rrr�user_installed�szSwdbInterface.user_installedcCsF|r|jj|j|j|�}n|jj|j|jd�}|tjjkrBtjj}|S)a2Get reason of package before transaction being undone. If package
        is already installed in the system, keep his reason.

        :param pkg: package being installed
        :param first_trans: id of first transaction being undone
        :param rollback: True if transaction is performing a rollbackrr�)rr�r"r&rQrRr�r�)r
r;Zfirst_transZrollbackrbrrr�get_erased_reason�szSwdbInterface.get_erased_reason)r-)T)NrF)Nr-)r-NN)T)r>r?r@rrqrAr9rrrsrxrr{rprur}r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrris0




	

ri)r�rtr�Zlibdnf.transactionrQZlibdnf.utilsZdnf.i18nrZdnf.yumrZdnf.exceptionsrrrrrr�objectr	rCrgrirrrr�<module>sM"

Zerion Mini Shell 1.0