Your IP : 3.144.252.243


Current Path : /usr/lib/python3.6/site-packages/dnf/db/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/db/__pycache__/group.cpython-36.opt-1.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)�
PersistorBasecCs"||_i|_i|_i|_i|_dS)N)�history�
_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)�lenrrrr	)r
rrr�__len__(szPersistorBase.__len__cCsi|_i|_i|_i|_dS)N)rrrr	)r
rrr�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)rrrrr�TransactionItemAction_INSTALL)r
rrrr�install8szPersistorBase.installcCs$||j|j|�<|j|tjj�dS)N)rrrrr�TransactionItemAction_REMOVE)r
rrrr�remove<szPersistorBase.removecCs$||j|j|�<|j|tjj�dS)N)rrrrr�TransactionItemAction_UPGRADE)r
rrrr�upgrade@szPersistorBase.upgradecCs$||j|j|�<|j|tjj�dS)N)r	rrrr�TransactionItemAction_DOWNGRADE)r
rrrr�	downgradeDszPersistorBase.downgradecCst�dS)N)r)r
�obj_id�name�translated_name�	pkg_typesrrr�newHszPersistorBase.newcCst�dS)N)r)r
r&rrr�getKszPersistorBase.getcCst�dS)N)r)r
�patternrrr�search_by_patternNszPersistorBase.search_by_patternN)�__name__�
__module__�__qualname__r
rrrrrr!r#r%r*r+r-rrrrrsrc@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)r
rrrrrYszGroupPersistor._get_obj_idcCsH|jjj�}|j|�|dk	r(|j|�|dk	r:|j|�|j|�|S)N)rrZcreateCompsGroupItemZ
setGroupId�setName�setTranslatedName�setPackageTypes)r
r&r'r(r)�
swdb_grouprrrr*\s



zGroupPersistor.newcCs"|jjj|�}|sdS|j�}|S)N)rrr2)r
r&r>rrrr+fs
zGroupPersistor.getcCs|jjj|�S)N)rrZgetCompsGroupItemsByPattern)r
r,rrrr-msz 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�setr@rr8ZgetPackagesZgetName�getInstalledr!r�add)r
r?�reasonZpackage_groups�group_id�group�pkgrrr�is_removable_pkgss*zGroupPersistor.is_removable_pkgN)
r.r/r0r9rr*r+r-r@rKrrrrr1Rs
r1c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�EnvironmentPersistorcCs"|jjj�}dd�|D�}t|�S)NcSsg|]}|j�r|�qSr)�getCompsEnvironmentItem)r3r4rrrr5�sz1EnvironmentPersistor.__iter__.<locals>.<listcomp>)rrr6r7)r
r8rrrr9�szEnvironmentPersistor.__iter__cCs|j�S)N)ZgetEnvironmentId)r
rrrrr�sz EnvironmentPersistor._get_obj_idcCsH|jjj�}|j|�|dk	r(|j|�|dk	r:|j|�|j|�|S)N)rrZcreateCompsEnvironmentItemZsetEnvironmentIdr;r<r=)r
r&r'r(r)�swdb_envrrrr*�s



zEnvironmentPersistor.newcCs"|jjj|�}|sdS|j�}|S)N)rrrM)r
r&rNrrrr+�s
zEnvironmentPersistor.getcCs|jjj|�S)N)rrZ!getCompsEnvironmentItemsByPattern)r
r,rrrr-�sz&EnvironmentPersistor.search_by_patterncCs|jjj|�S)N)rrZgetCompsGroupEnvironments)r
rHrrr�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)
rrIr+rDrOrr8Z	getGroupsr:rEr!rrF)r
rHr>Zgroup_environmentsZenv_id�envrIrrr�is_removable_group�s*z'EnvironmentPersistor.is_removable_groupN)
r.r/r0r9rr*r+r-rOrQrrrrrL�s
rLc@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)r
rrrrrr
�szRPMTransaction.__init__cs8�jr�jj�}n�jjj�}�fdd�|D�}t|�S)Ncs&g|]}|j�rtjjj�j|��qSr)�
getRPMItem�dnf�dbr�RPMTransactionItemWrapper)r3r4)r
rrr5�sz+RPMTransaction.__iter__.<locals>.<listcomp>)rr6rrr7)r
r8r)r
rr9�s
zRPMTransaction.__iter__cs8�jr�jj�}n�jjj�}�fdd�|D�}t|�S)Ncs&g|]}|j�rtjjj�j|��qSr)rTrUrVrrW)r3r4)r
rrr5�sz*RPMTransaction.__len__.<locals>.<listcomp>)rr6rrr)r
r8r)r
rr�s
zRPMTransaction.__len__cCsP|jjj�}|j|j�|j|jp$d�|j|j�|j	|j
�|j|j�|S)Nr)
rrZ
createRPMItemr;r'ZsetEpochZepochZ
setVersion�versionZ
setRelease�releaseZsetArch�arch)r
rJ�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�
addReplacedByrS)r
rJrrG�replaced_byr[Zrepoid�resultrrrr*�s




zRPMTransaction.newcCst|dd�}|r|S|jS)NZ_force_swdb_repoid)�getattrZreponame)r
rJrarrrr]�szRPMTransaction.get_repoidcCs|jjj|j|jd�S)zGet reason for package����)rrrCr'rZ)r
rJrrrr^szRPMTransaction.get_reasoncCstjj|j|��S)zGet reason for package)rrZTransactionItemReasonToStringr^)r
rJrrr�get_reason_nameszRPMTransaction.get_reason_namecCs8|pg}x*|D]"}|j|tjj�}|r|j|�qWdS)N)r*rr�TransactionItemAction_OBSOLETEDr_)r
�	obsoletedr`Zobsrrrr�_add_obsoleted
s

zRPMTransaction._add_obsoletedcCs6|j|tjj�}|j|tjj|d�}|j||d�dS)N)r`)r*rrr$� TransactionItemAction_DOWNGRADEDrh)r
r*�oldrg�ti_new�ti_oldrrr�
add_downgradeszRPMTransaction.add_downgradecCs|j||�dS)N)�
add_remove)r
rjrGrrr�	add_eraseszRPMTransaction.add_erasecCs4|dkrtjj}|j|tjj|�}|j||d�dS)N)r`)rrrr*rrh)r
r*rgrGrkrrr�add_installszRPMTransaction.add_installcCs6|j|tjj�}|j|tjj|d�}|j||d�dS)N)r`)r*rr�TransactionItemAction_REINSTALL�!TransactionItemAction_REINSTALLEDrh)r
r*rjrgrkrlrrr�
add_reinstallszRPMTransaction.add_reinstallcCs"|p
tjj}|j|tjj|�}dS)N)rrrr*r )r
rjrGrlrrrrn$szRPMTransaction.add_removecCs6|j|tjj�}|j|tjj|d�}|j||d�dS)N)r`)r*rrr"�TransactionItemAction_UPGRADEDrh)r
r*rjrgrkrlrrr�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 systemrc)	Z
_from_cmdlineZrepoZmodule_hotfixesZ_is_in_active_modulerZcriticalr�format�
ValueError)r
�hdrrJrrr�_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�ur4z%TransactionItemAction not handled: %szAn rpm exception occurred: %sNz1No available modular metadata for modular package)rrrr$rJZ_headerryZ
addInstallriZaddErase�idxrZTransactionItemAction_OBSOLETErfrqZaddReinstallrrr r"rtZ#TransactionItemAction_REASON_CHANGE�RuntimeError�rpm�errorrU�
exceptions�Errorr)r
ZtsZmodular_problems�tsirx�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)	rDrrUrZFORWARD_ACTIONSrFrJ�KeyErrorr|)r
rar�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)rDrrUrZBACKWARD_ACTIONSrrrrFrJr�r|)r
rar�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)rZ)r3rJrrrr5�sz3RPMTransaction._rpm_limitations.<locals>.<listcomp>z+Will not install a source rpm package (%s).rN)r�rr)r
Zsrc_installsrrr�_rpm_limitations�s

zRPMTransaction._rpm_limitationscs�fdd�|D�S)Ncsg|]}|j�kr|�qSr)r)r3r�)rrrr5�sz-RPMTransaction._get_items.<locals>.<listcomp>r)r
rr)rr�
_get_items�szRPMTransaction._get_items)N)NN)N)N)N)NN)N)N)N)r.r/r0r
r9rr\r*r]r^rerhrmrorprsrnruryr��propertyr�r�r�r�rrrrrR�s*
		







2
rR)Zlibdnf.transactionrZdnf.db.historyrUZdnf.transactionZdnf.exceptionsZdnf.i18nrZdnf.utilrr}�objectrr1rLrRrrrr�<module>s3<<

?>