ok

Mini Shell

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

3

��f�<�@s�ddlZddlZddlZddlZddlmZddlm	Z	ddl
Z
Gdd�de�ZGdd�de�Z
Gdd	�d	e�ZGd
d�de�ZdS)�N)�_)�loggerc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�
PersistorBasecCsBt|tjjj�s ttt|����||_i|_i|_	i|_
i|_dS)N)�
isinstance�dnf�db�historyZ
SwdbInterface�AssertionError�str�type�
_installed�_removed�	_upgraded�_downgraded)�selfr�r�/usr/lib/python3.6/group.py�__init__ s zPersistorBase.__init__cCs(t|j�t|j�t|j�t|j�S)N)�lenrr
rr)rrrr�__len__(szPersistorBase.__len__cCsi|_i|_i|_i|_dS)N)rr
rr)rrrr�clean+szPersistorBase.cleancCst�dS)N)�NotImplementedError)r�objrrr�_get_obj_id1szPersistorBase._get_obj_idcCs*|jjj|d|tjj�}|jtjj�dS)N�)r�swdb�addItem�libdnf�transaction�TransactionItemReason_USERZsetStateZTransactionItemState_DONE)r�item�action�tirrr�_add_to_history4szPersistorBase._add_to_historycCs$||j|j|�<|j|tjj�dS)N)rrr#rr�TransactionItemAction_INSTALL)rrrrr�install8szPersistorBase.installcCs$||j|j|�<|j|tjj�dS)N)r
rr#rr�TransactionItemAction_REMOVE)rrrrr�remove<szPersistorBase.removecCs$||j|j|�<|j|tjj�dS)N)rrr#rr�TransactionItemAction_UPGRADE)rrrrr�upgrade@szPersistorBase.upgradecCs$||j|j|�<|j|tjj�dS)N)rrr#rr�TransactionItemAction_DOWNGRADE)rrrrr�	downgradeDszPersistorBase.downgradecCst�dS)N)r)r�obj_id�name�translated_name�	pkg_typesrrr�newHszPersistorBase.newcCst�dS)N)r)rr,rrr�getKszPersistorBase.getcCst�dS)N)r)r�patternrrr�search_by_patternNszPersistorBase.search_by_patternN)�__name__�
__module__�__qualname__rrrrr#r%r'r)r+r0r1r3rrrrrsrc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�GroupPersistorcCs"|jjj�}dd�|D�}t|�S)NcSsg|]}|j�r|�qSr)�getCompsGroupItem)�.0�irrr�
<listcomp>Vsz+GroupPersistor.__iter__.<locals>.<listcomp>)rr�getItems�iter)r�itemsrrr�__iter__TszGroupPersistor.__iter__cCs|j�S)N)�
getGroupId)rrrrrrYszGroupPersistor._get_obj_idcCsH|jjj�}|j|�|dk	r(|j|�|dk	r:|j|�|j|�|S)N)rrZcreateCompsGroupItemZ
setGroupId�setName�setTranslatedName�setPackageTypes)rr,r-r.r/�
swdb_grouprrrr0\s



zGroupPersistor.newcCs"|jjj|�}|sdS|j�}|S)N)rrr8)rr,rDrrrr1fs
zGroupPersistor.getcCs|jjj|�S)N)rrZgetCompsGroupItemsByPattern)rr2rrrr3msz GroupPersistor.search_by_patterncCs|jjj|�S)N)rrZgetPackageCompsGroups)r�pkg_namerrr�get_package_groupspsz!GroupPersistor.get_package_groupscCs�|jjj|dd�}|tjjkr"dSt|j|��}xJ|jj	�D]<\}}x2|j
�D]&}|j�|kr`qN|j�sjqN|j
|�qNWq<WxJ|jj	�D]<\}}x2|j
�D]&}|j�|kr�q�|j�s�q�|j|�q�Wq�W|r�dSdS)Nr�FT���)rr�resolveRPMTransactionItemReasonrrZTransactionItemReason_GROUP�setrFr
r>ZgetPackagesZgetName�getInstalledr'r�add)rrE�reasonZpackage_groups�group_id�group�pkgrrr�is_removable_pkgss*zGroupPersistor.is_removable_pkgN)
r4r5r6r?rr0r1r3rFrQrrrrr7Rs
r7c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�EnvironmentPersistorcCs"|jjj�}dd�|D�}t|�S)NcSsg|]}|j�r|�qSr)�getCompsEnvironmentItem)r9r:rrrr;�sz1EnvironmentPersistor.__iter__.<locals>.<listcomp>)rrr<r=)rr>rrrr?�szEnvironmentPersistor.__iter__cCs|j�S)N)ZgetEnvironmentId)rrrrrr�sz EnvironmentPersistor._get_obj_idcCsH|jjj�}|j|�|dk	r(|j|�|dk	r:|j|�|j|�|S)N)rrZcreateCompsEnvironmentItemZsetEnvironmentIdrArBrC)rr,r-r.r/�swdb_envrrrr0�s



zEnvironmentPersistor.newcCs"|jjj|�}|sdS|j�}|S)N)rrrS)rr,rTrrrr1�s
zEnvironmentPersistor.getcCs|jjj|�S)N)rrZ!getCompsEnvironmentItemsByPattern)rr2rrrr3�sz&EnvironmentPersistor.search_by_patterncCs|jjj|�S)N)rrZgetCompsGroupEnvironments)rrNrrr�get_group_environments�sz+EnvironmentPersistor.get_group_environmentscCs�|jjj|�}|sdSt|j|��}xJ|jj�D]<\}}x2|j�D]&}|j�|krTqB|j	�s^qB|j
|�qBWq0WxJ|jj�D]<\}}x2|j�D]&}|j�|kr�q�|j	�s�q�|j|�q�Wq|W|r�dSdS)NFT)
rrOr1rJrUr
r>Z	getGroupsr@rKr'rrL)rrNrDZgroup_environmentsZenv_id�envrOrrr�is_removable_group�s*z'EnvironmentPersistor.is_removable_groupN)
r4r5r6r?rr0r1r3rUrWrrrrrR�s
rRc@s�eZdZd,dd�Zdd�Zdd�Zdd	�Zd-d
d�Zdd
�Zdd�Z	dd�Z
d.dd�Zd/dd�Zd0dd�Z
d1dd�Zd2dd�Zd3dd�Zd4dd�Zd d!�Zd"d#�Zed$d%��Zed&d'��Zd(d)�Zd*d+�ZdS)5�RPMTransactionNc	Cs:||_||_|js0y|jjj�WnYnXi|_dS)N)rrrZinitTransaction�_swdb_ti_pkg)rrrrrrr�szRPMTransaction.__init__cs8�jr�jj�}n�jjj�}�fdd�|D�}t|�S)Ncs&g|]}|j�rtjjj�j|��qSr)�
getRPMItemrrr�RPMTransactionItemWrapper)r9r:)rrrr;�sz+RPMTransaction.__iter__.<locals>.<listcomp>)rr<rrr=)rr>r)rrr?�s
zRPMTransaction.__iter__cs8�jr�jj�}n�jjj�}�fdd�|D�}t|�S)Ncs&g|]}|j�rtjjj�j|��qSr)rZrrrr[)r9r:)rrrr;�sz*RPMTransaction.__len__.<locals>.<listcomp>)rr<rrr)rr>r)rrr�s
zRPMTransaction.__len__cCsP|jjj�}|j|j�|j|jp$d�|j|j�|j	|j
�|j|j�|S)Nr)
rrZ
createRPMItemrAr-ZsetEpochZepochZ
setVersion�versionZ
setRelease�releaseZsetArch�arch)rrP�rpm_itemrrr�_pkg_to_swdb_rpm_item�sz$RPMTransaction._pkg_to_swdb_rpm_itemcCsV|j|�}|j|�}|dkr&|j|�}|jjj||||�}|rH|j|�||j|<|S)N)r`�
get_repoid�
get_reasonrrr�
addReplacedByrY)rrPr!rM�replaced_byr_Zrepoid�resultrrrr0�s




zRPMTransaction.newcCst|dd�}|r|S|jS)NZ_force_swdb_repoid)�getattrZreponame)rrPrerrrra�szRPMTransaction.get_repoidcCs|jjj|j|jd�S)zGet reason for package����)rrrIr-r^)rrPrrrrbszRPMTransaction.get_reasoncCstjj|j|��S)zGet reason for package)rrZTransactionItemReasonToStringrb)rrPrrr�get_reason_nameszRPMTransaction.get_reason_namecCs8|pg}x*|D]"}|j|tjj�}|r|j|�qWdS)N)r0rr�TransactionItemAction_OBSOLETEDrc)r�	obsoletedrdZobsr"rrr�_add_obsoleted
s

zRPMTransaction._add_obsoletedcCs6|j|tjj�}|j|tjj|d�}|j||d�dS)N)rd)r0rrr*� TransactionItemAction_DOWNGRADEDrl)rr0�oldrk�ti_new�ti_oldrrr�
add_downgradeszRPMTransaction.add_downgradecCs|j||�dS)N)�
add_remove)rrnrMrrr�	add_eraseszRPMTransaction.add_erasecCs4|dkrtjj}|j|tjj|�}|j||d�dS)N)rd)rrrr0r$rl)rr0rkrMrorrr�add_installszRPMTransaction.add_installcCs6|j|tjj�}|j|tjj|d�}|j||d�dS)N)rd)r0rr�TransactionItemAction_REINSTALL�!TransactionItemAction_REINSTALLEDrl)rr0rnrkrorprrr�
add_reinstallszRPMTransaction.add_reinstallcCs"|p
tjj}|j|tjj|�}dS)N)rrrr0r&)rrnrMrprrrrr$szRPMTransaction.add_removecCs6|j|tjj�}|j|tjj|d�}|j||d�dS)N)rd)r0rrr(�TransactionItemAction_UPGRADEDrl)rr0rnrkrorprrr�add_upgrade(szRPMTransaction.add_upgradecCs^|jr
dS|jjrdSy.|drB|j�rBtjtd�j|��dSWntk
rXdSXdS)NrZmodularitylabelz\No available modular metadata for modular package '{}', it cannot be installed on the systemrg)	Z
_from_cmdlineZrepoZmodule_hotfixesZ_is_in_active_modulerZcriticalr�format�
ValueError)r�hdrrPrrr�_test_fail_safe-szRPMTransaction._test_fail_safecCsRd}�x0|D�]&}�y�|jtjjkrP|jj}||j||j�7}|j||d��n�|jtjjkrp|j	|jj
��n�|jtjjkr�|jj}||j||j�7}|j||d��nL|jtjjkr�|jj}||j||j�7}|j||d��n|jtjj
k�r|j	|jj
�n�|jtjjk�r<|jj}||j||j�7}|j||�n�|jtjjk�r\|j	|jj
�n�|jtjjk�r||j	|jj
�nz|jtjjk�r�|jj}||j||j�7}|j||d�n@|jtjjk�r�|j	|jj
�n |jtjjk�r�ntd|j��Wqtjk
�r2}ztjjtd|���WYdd}~XqXqW|�rNtjjtd���|S)z!Populate the RPM transaction set.r�ur:z%TransactionItemAction not handled: %szAn rpm exception occurred: %sNz1No available modular metadata for modular package)r!rrr*rPZ_headerr}Z
addInstallrmZaddErase�idxr$ZTransactionItemAction_OBSOLETErjruZaddReinstallrvr&r(rxZ#TransactionItemAction_REASON_CHANGE�RuntimeError�rpm�errorr�
exceptions�Errorr)rZtsZmodular_problems�tsir|�errr�_populate_rpm_ts;sR*zRPMTransaction._populate_rpm_tscCsXt�}xL|D]D}|jtjjkry|j|j�Wqtk
rNtd|��YqXqW|S)Nz*TransactionItem is has no RPM attached: %s)	rJr!rrZFORWARD_ACTIONSrLrP�KeyErrorr�)rrer�rrr�install_setms
zRPMTransaction.install_setcCsbt�}xV|D]N}|jtjjtjjgkry|j|j�Wqt	k
rXt
d|��YqXqW|S)Nz*TransactionItem is has no RPM attached: %s)rJr!rrZBACKWARD_ACTIONSrrvrLrPr�r�)rrer�rrr�
remove_setys
zRPMTransaction.remove_setcCs,dd�|jD�}t|�r(td�|dSdS)zj Ensures all the members can be passed to rpm as they are to perform
            the transaction.
        cSsg|]}|jdkr|�qS)�src)r^)r9rPrrrr;�sz3RPMTransaction._rpm_limitations.<locals>.<listcomp>z+Will not install a source rpm package (%s).rN)r�rr)rZsrc_installsrrr�_rpm_limitations�s

zRPMTransaction._rpm_limitationscs�fdd�|D�S)Ncsg|]}|j�kr|�qSr)r!)r9r�)r!rrr;�sz-RPMTransaction._get_items.<locals>.<listcomp>r)rr!r)r!r�
_get_items�szRPMTransaction._get_items)N)NN)N)N)N)NN)N)N)N)r4r5r6rr?rr`r0rarbrirlrqrsrtrwrrryr}r��propertyr�r�r�r�rrrrrX�s*
		







2
rX)Zlibdnf.transactionrZdnf.db.historyrZdnf.transactionZdnf.exceptionsZdnf.i18nrZdnf.utilrr��objectrr7rRrXrrrr�<module>s3<<

Zerion Mini Shell 1.0