관리-도구
편집 파일: debuginfo-install.cpython-36.pyc
3 �gt`L+ � @ sN d dl mZmZ d dlZd dlmZ G dd� dej�ZG dd� dejj �Z dS )� )�_�loggerN)�Packagec s, e Zd ZdZdZ� fdd�Zdd� Z� ZS )�DebuginfoInstallz5DNF plugin supplying the 'debuginfo-install' command.zdebuginfo-installc s4 t t| �j||� || _|| _|dk r0|jt� dS )zInitialize the plugin instance.N)�superr �__init__�base�cliZregister_command�DebuginfoInstallCommand)�selfr r )� __class__� �'/usr/lib/python3.6/debuginfo-install.pyr s zDebuginfoInstall.__init__c C sf | j | jj�}|jd�o.|jdd�o.|jdd�}|rbtjj| j�j � j dd�}t|�rb| jjj � d S )N�main� autoupdatez*-debuginfo)Z name__glob)Zread_configr �confZhas_sectionZ has_optionZ getboolean�dnf�sackZ_rpmdb_sack�query�filterm�len�repos�enable_debug_repos)r Zcpr Zdbginfor r r �config( s zDebuginfoInstall.config)�__name__� __module__�__qualname__�__doc__�namer r � __classcell__r r )r r r s r c sh e Zd ZdZdZed�Z� fdd�Zedd� �Z dd � Z d d� Zdd � Zdd� Z dd� Zdd� Z� ZS )r z! DebuginfoInstall plugin for DNF �debuginfo-installzinstall debuginfo packagesc s4 t t| �j|� t� | _t� | _t� | _t� | _d S )N)r r r �set�available_debuginfo_missing�available_debugsource_missing�installed_debuginfo_missing�installed_debugsource_missing)r r )r r r r : s z DebuginfoInstallCommand.__init__c C s | j ddd� d S )N�package�+)�nargs)�add_argument)�parserr r r � set_argparserB s z%DebuginfoInstallCommand.set_argparserc C s0 | j j}d|_d|_d|_d|_| jjj� d S )NT) r �demandsZ resolvingZ root_userZsack_activationZavailable_reposr r r )r r, r r r � configureF s z!DebuginfoInstallCommand.configurec C s� g }t tj�}t tj�}�x�| jjD �]�}tjj|�j | j jdd�}|d }|sxtj td�| j jjj|�� |j|� q$|j� j� }|j|j� j� � xdt|j� �D ]T}|jtj�r�|d | � |kr�|j|� |jtj�r�|d | � |kr�|j|� q�W �x�|j� D �]�} | d } | j�r�i }x"| D ]}|j|jg �j|� �q(W xj|j� D ]^} | d }| j|j |��s�| j|j!|��s�| j"j#t$|�� | j|j%|��sP| j&j#t$|�� �qPW �q| j'jtj��s�| j'jtj��r�| j(| � �q|d d k �rb| j)| j |d ��s2| j)| j!|d ��s2| j*j#dj+| j'| j,�� | j)| j%|d ��s| j-j#dj+| j'| j,�� �q| j.| j | ��s�| j.| j!| ��s�| j*j#dj+| j'| j,�� | j.| j%| ��s| j-j#dj+| j'| j,�� �qW q$W | j*�r�tj td�d j/t0| j*��� | j-�rtj td �d j/t0| j-��� | j"�r8tj td�d j/t0| j"��� | j&�r\tj td�d j/t0| j&��� |�r�| j j1j2�r�tj3j4td �dj/|�d��d S )NF)Zwith_srcr zNo match for argument: %sr Znevraz{}-{}zICould not find debuginfo package for the following available packages: %sz, zKCould not find debugsource package for the following available packages: %szICould not find debuginfo package for the following installed packages: %szKCould not find debugsource package for the following installed packages: %szUnable to find a match� )Zpkg_spec)5r r ZDEBUGINFO_SUFFIXZDEBUGSOURCE_SUFFIXZoptsr&