Current File : //lib/python3.9/site-packages/dnf-plugins/__pycache__/changelog.cpython-39.pyc
a

�&cg�@s|ddlmZddlmZddlZddlZddlZddlmZm	Z	m
Z
ddlZddlZdd�Z
ejjGdd�dejj��ZdS)	�)�absolute_import)�unicode_literalsN)�_�P_�loggerc
CsDztjj|dd�WStttfy>t�td��	|���Yn0dS)NT)ZfuzzyzNot a valid date: "{0}".)
�dateutil�parser�parse�
ValueError�	TypeError�
OverflowError�argparse�ArgumentTypeErrorr�format)�val�r�9/usr/lib/python3.9/site-packages/dnf-plugins/changelog.py�
validate_date!src@sLeZdZdZed�Zedd��Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)�ChangelogCommand)Z	changelogzShow changelog data of packagescCsd|��}|jdddttd�d�|jddttd�d�|jdd	d
td�d�|jd
dtd�d�dS)Nz--sinceZDATEzZshow changelog entries since DATE. To avoid ambiguosity, YYYY-MM-DD format is recommended.)�metavar�default�type�helpz--countz2show given number of changelog entries per package)rrrz
--upgradesF�
store_truezmshow only new changelog entries for packages, that provide an upgrade for some of already installed packages.)r�actionr�package�*ZPACKAGE)�nargsr)�add_mutually_exclusive_group�add_argumentrr�int)rZfilter_grouprrr�
set_argparser-s���zChangelogCommand.set_argparsercCs|jj}d|_d|_d|_dS)NT)�cli�demandsZavailable_reposZsack_activation�
changelogs)�selfr#rrr�	configure>szChangelogCommand.configurecCs�|jj��}|jjr�|jdd�|jjD]d}tjj|dd�j	|jjdddd�}|jj
rf|j|jj
d�|rz|�|���}q(t
�td�|�q(n|jj
r�|j|jj
d�|jjr�|��}n|��}|S)NT)�empty)Zignore_caseF)Z
with_nevraZ
with_providesZwith_filenames)ZreponamezNo match for argument: %s)�baseZsack�query�optsrZfilterm�dnfZsubjectZSubjectZget_best_queryZrepo�unionZlatestr�infor�upgradesZ	available)r%�q�pkgZpkg_qrrrr)Ds&�
zChangelogCommand.querycCs:t��}t|�D]$}|�|jp"|j|jfg��|�q|S)N)�collections�OrderedDict�sorted�
setdefaultZsource_name�nameZevr�append)r%Zpackages�by_srpmr0rrrr7Zs"zChangelogCommand.by_srpmcsT�jjr�j�|�S�jjr.|jd�jj�S�jjrJ�fdd�|jD�S|jSdS)Ncs$g|]}|d�jj��kr|�qS)Z	timestamp)r*�since�date)�.0�chlog�r%rr�
<listcomp>fs�z6ChangelogCommand.filter_changelogs.<locals>.<listcomp>)r*r.r(Zlatest_changelogs�countr$r8)r%rrr<r�filter_changelogs`sz"ChangelogCommand.filter_changelogsc
Cs�|jjr"t�td��|jj��nP|jjrLt�tdd|jj��|jj��n&|jjrdt�td��nt�td��|�	|�
��}|D]V}ttd��d�t
dd	�||D�����|�||d
�D]}t|j�|��q�q�dS)NzListing changelogs since {}zListing only latest changelogzListing {} latest changelogszBListing only new changelogs since installed version of the packagezListing all changelogszChangelogs for {}z, cSsh|]}t|��qSr)�str)r:r0rrr�	<setcomp>{�z'ChangelogCommand.run.<locals>.<setcomp>r)r*r8rr-rrr>rr.r7r)�print�joinr3r?r(Zformat_changelog)r%r7r5r;rrr�runks*���
�zChangelogCommand.runN)
�__name__�
__module__�__qualname__�aliasesrZsummary�staticmethodr!r&r)r7r?rErrrrr(s
r)Z
__future__rrr
r1Zdateutil.parserrZdnfpluginscorerrrr+Zdnf.clirZpluginZregister_commandr"ZCommandrrrrr�<module>s