Sindbad~EG File Manager
3
�gt`��@sVddlmZddlmZddlmZddlZGdd�dej�ZGdd�dej j
�ZdS) �)�absolute_import)�unicode_literals)�_Ncs eZdZdZ�fdd�Z�ZS)�RepoClosure�repoclosurecs,tt|�j||�|dkrdS|jt�dS)N)�superr�__init__Zregister_command�RepoClosureCommand)�self�base�cli)� __class__��!/usr/lib/python3.6/repoclosure.pyr!szRepoClosure.__init__)�__name__�
__module__�__qualname__�namer�
__classcell__rr)r
rrsrc@s>eZdZdZed�Zdd�Zdd�Zd
dd �Ze d
d��Z
dS)r rz:Display a list of unresolved dependencies for repositoriescCsd|jj}d|_d|_|jjr`xB|jjj�D]2}|j |jjkrT|j |jj
krT|j�q*|j�q*WdS)NT)
r�demandsZsack_activationZavailable_repos�opts�repor�repos�all�id�check�disable�enable)r
rrrrr� configure,s
zRepoClosureCommand.configurecCs�|jjr|j|jj�}n|j�}xRt|j��D]B}tdjt|�|j��td�x||D]}tdj|��qZWq.Wt |�dkr�t
d�}tjj
|��dS)Nzpackage: {} from {}z unresolved deps:z {}rz/Repoclosure ended with unresolved dependencies.)r�arches�_get_unresolved�sorted�keys�print�format�str�reponame�lenr�dnf�
exceptions�Error)r
�
unresolved�pkgZdep�msgrrr�run7szRepoClosureCommand.runNcsLi}t�}|jjr�|jjj�jdd��|jjj�jdd�}xv|jjj�D]D}�j |jjj�j|j
d�j���|j |jjj�j|j
d�j��}qHWn |jjj�j��|jjj�j�}|jj
�rN|jjj�jdd�}g}xT|jj
D]H}tjj|�} |j| j|jjdddd��}
|
�r|j |
�}q�|j|�q�W|�rJtjjtd�dj|���|}|jj�rh|j|jjd�|dk �r~|j|d�|jjj�r��jdd ��j�|j�xf|D]^}t�||<xL|jD]B}t|�}|jd
��s�|jd��r�q�|j |�||j |��q�W�q�Wt�fdd
�|D����fdd�|j!�D�}
dd�|
j!�D�S)NT)�empty)r&F)Z
with_nevraZ
with_providesZwith_filenameszno package matched: %sz, )�arch)Zlatest_per_archz solvable:zrpmlib(c3s|]}�j|d�s|VqdS))ZprovidesN)�filter)�.0�x)� availablerr� <genexpr>�sz5RepoClosureCommand._get_unresolved.<locals>.<genexpr>cs(i|] \}}t�fdd�|D��|�qS)c3s|]}|�kr|VqdS)Nr)r2r3)�unresolved_depsrrr5�sz@RepoClosureCommand._get_unresolved.<locals>.<dictcomp>.<genexpr>)�set)r2�k�v)r6rr�
<dictcomp>�sz6RepoClosureCommand._get_unresolved.<locals>.<dictcomp>cSsi|]\}}|r||�qSrr)r2r8r9rrrr:�s)"r7rZnewestrZsackZqueryr1rZiter_enabled�unionrZlatestr4�pkglistr(ZsubjectZSubject�intersectionZget_best_query�appendr)r*r�joinrZfiltermZconfZbestZapplyZrequiresr%�
startswith�add�items)r
r0r+ZdepsZto_checkrZ pkglist_q�errorsr,ZsubjZpkg_qZreqZreqnameZunresolved_transitionr)r4r6rr Es\ &
z"RepoClosureCommand._get_unresolvedcCs`|jdgddtd�d�|jdgdtd�d�|jd d
dtd�d
�|jdgdtd�dd�dS)Nz--archr>rzBcheck packages of the given archs, can be specified multiple times)�default�action�dest�helpz--checkzSpecify repositories to check)rDrErGz-nz--newest�
store_truez+Check only the newest packages in the repos)rErGz--pkgz#Check closure for this package onlyr<)rDrErGrF)�add_argumentr)�parserrrr�
set_argparser�s
z RepoClosureCommand.set_argparser)r)N)rrr�aliasesrZsummaryrr.r �staticmethodrKrrrrr (s
Qr )Z
__future__rrZdnfpluginscorerZdnf.clir(ZPluginrrZCommandr rrrr�<module>s
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists