Your IP : 3.22.74.192
3
�ft`ن �
@ s d dl mZ d dl mZ d dl mZ d dlmZ d dlmZ d dlm Z d dl
Z
d dlZd dlZd dl
Z
d dlZd dlZd dlZd dlZd dlZd dlZd dlZejd�Zd Ze
jd
�ZdZdd
dddddddd� Zdd� ZG dd� de j�ZG dd� dej�ZG dd� de �Z!dS )� )�absolute_import)�print_function)�unicode_literals)�_)�commands)�OptionParserN�dnfz.%{name}-%{epoch}:%{version}-%{release}.%{arch}z%(-?\d*?){([:.\w]+?)}a name, arch, epoch, version, release, reponame (repoid), from_repo, evr,
debug_name, source_name, source_debug_name,
installtime, buildtime, size, downloadsize, installsize,
provides, requires, obsoletes, conflicts, sourcerpm,
description, summary, license, url, reason� conflicts�enhances� obsoletes�provides�
recommends�requiresZrequires_pre�suggests�supplements) r r
r r r
r zrequires-prer r c C s� dd� }dd� }| j dd�j dd�} x tj� D ]\}}| j ||�} q.W d }d
}x>tj| �D ]0}||| ||j� � �7 }|||�7 }|j� }qZW ||| |d� �7 }|S )z:Convert a rpm like QUERYFMT to an python .format() string.c S s^ | j � d }| j � d }|rJ|d dkr:d|dd � }nd| }d| }d|j� | d S ) Nr � �-�>�<�:z{0.�})�groups�lower)ZmatchobjZfill�key� r �/usr/lib/python3.6/repoquery.py�fmt_replD s zrpm2py_format.<locals>.fmt_replc S s | j dd�j dd�S )N�{z{{r z}})�replace)Ztxtr r r �bracketsO s zrpm2py_format.<locals>.bracketsz\n�
z\t� � r N)r �OPTS_MAPPING�items�
QFORMAT_MATCH�finditer�start�end)�queryformatr r r �valueZfmt�spos�itemr r r �
rpm2py_formatB s r- c @ s e Zd ZdZdS )�_CommaSplitCallbackz\s*,\s*N)�__name__�
__module__�__qualname__ZSPLITTERr r r r r. _ s r. c @ s� e Zd ZdZejejejd�Zd%e ej
� � Zed�Z
edd� �Zedd � �Zd
d� Zdd
� Zdd� Zdd� Zd&dd�Zd'dd�Zd(dd�Zdd� Zdd� Zdd� Zd d!� Zd*d#d$�ZdS )+�RepoQueryCommandzSA class containing methods needed by the cli to execute the repoquery command.
)zrepoquery-nzrepoquery-nazrepoquery-nevra� repoquery�rqz$search for packages matching keywordc C s, | j r|j| j d� | jr(|j| jd� |S )z'Filter query by repoid and arch options)Zreponame)�arch)Zrepo�filterm�arches)�opts�queryr r r �filter_repo_archm s
z!RepoQueryCommand.filter_repo_archc
C s� | j ddddtd�d� | j ddtd�d � | j d
ddg td
td�d� | j ddddtd�d� | j dg tdtd�d� | j dg tdtd�d� | j dg tdtd�d� | j dg tdtd�d� | j d g tdtd!�d� | j d"g tdtd#�d� | j d$g tdtd%�d� | j d&g tdtd'�d� | j d(g tdtd)�d� | j� }|j d*dtd+�d � |j d,dtd-�d � | j d.dtd/�d � | j d0dtd1�d � | j d2dtd3�d � | j d4dtd5�d � | j d6dtd7�d � | j d8d9ttd:�d;� | j d<dtd=�d � | j� }|j d>d?d@dAdtdB�dC� |j dDdEdFdAdtdG�dC� |j dHdIdJdAdtdK�dC� |j dLdMdAdtdN�dC� |j dOdPdQttdR�dS� | j dTdtdU�d � |j dVdQtdWtdX�dY� |j dZdQd[dWtd\�dY� |j d]dQd^dWtd_�dY� |j d`dtda�d � | j� }|j dbdcdddWtde�dY� |j dfdcdddWtjdY� |j dgdcdhdWtdi�dY� |j djdcdkdWtdl�dY� | j dmdtdn�d � | j� }tdo�tdp�tdq�tdr�tds�tdt�tdu�tdv�tdw�dx� }x2|j� D ]&\}}dy| }|j |dzdW||d{� �q�W | j d|dtd}�d � td~�td�td��td��j t
jjd��td��d��} | j� }
x2| j� D ]&\}}dy| }
|
j |
d�dW||d{� �q4W |
j d�d�dWd�tjd{� | j d�dtd��d � | j d�d�d�td��d�� d S )�Nz-az--allZqueryall�
store_truezNQuery all packages (shorthand for repoquery '*' or repoquery without argument))�dest�action�helpz--show-duplicatesz(Query all versions of packages (default))r= r>