<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
gt`g                 @   s|   d dl mZ d dl mZ d dlZd dlZd dlZd dlmZm	Z	m
Z
 d dlZd dlZdd ZejjG dd dejjZdS )	    )absolute_import)unicode_literalsN)_P_loggerc             C   sD   yt jj| ddS  tttfk
r>   tjtdj	| Y nX d S )NT)ZfuzzyzNot a valid date: "{0}".)
dateutilparserparse
ValueError	TypeErrorOverflowErrorargparseZArgumentTypeErrorr   format)val r   /usr/lib/python3.6/changelog.pyvalidate_date!   s    r   c               @   sL   e Zd ZdZedZedd Zdd Zdd Z	d	d
 Z
dd Zdd ZdS )ChangelogCommand	changelogzShow changelog data of packagesc             C   sd   | j  }|jddd ttdd |jdd ttdd |jdd	d
tdd | jddtdd d S )Nz--sinceZDATEzZshow 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)r   r   r   z
--upgradesF
store_truezmshow only new changelog entries for packages, that provide an upgrade for some of already installed packages.)r   actionr   package*ZPACKAGE)nargsr   )Zadd_mutually_exclusive_groupadd_argumentr   r   int)r   Zfilter_groupr   r   r   set_argparser-   s    zChangelogCommand.set_argparserc             C   s   | j j}d|_d|_d|_d S )NT)clidemandsZavailable_reposZsack_activation
changelogs)selfr"   r   r   r   	configure>   s    zChangelogCommand.configurec             C   s   | j jj }| jjr|jdd x| jjD ]d}tjj|ddj	| j jdddd}| jj
rh|j| jj
d |r||j|j }q*tjtd|  q*W n| jj
r|j| jj
d | jjr|j }n|j }|S )NT)empty)Zignore_caseF)Z
with_nevraZwith_providesZwith_filenames)ZreponamezNo match for argument: %s)baseZsackqueryoptsr   ZfiltermdnfZsubjectZSubjectZget_best_queryZrepounionZlatestr   infor   upgradesZ	available)r$   qpkgZpkg_qr   r   r   r(   D   s$    

zChangelogCommand.queryc             C   s>   t j }x0t|D ]$}|j|jp$|j|jfg j| qW |S )N)collectionsOrderedDictsorted
setdefaultZsource_namenameZevrappend)r$   Zpackagesby_srpmr/   r   r   r   r6   Z   s    $zChangelogCommand.by_srpmc                sT    j jr jj|S  j jr.|jd  j j S  j jrJ fdd|jD S |jS d S )Nc                s$   g | ]}|d   j jj kr|qS )Z	timestamp)r)   sinceZdate).0chlog)r$   r   r   
<listcomp>f   s    z6ChangelogCommand.filter_changelogs.<locals>.<listcomp>)r)   r-   r'   Zlatest_changelogscountr#   r7   )r$   r   r   )r$   r   filter_changelogs`   s    z"ChangelogCommand.filter_changelogsc             C   s   | j jr"tjtdj| j j nP| j jrLtjtdd| j jj| j j n&| j jrdtjtd ntjtd | j	| j
 }xb|D ]Z}ttdjdjtdd	 || D  x*| j|| d
 D ]}t| jj| qW qW d S )NzListing changelogs since {}zListing only latest changelogzListing {} latest changelogszBListing only new changelogs since installed version of the packagezListing all changelogszChangelogs for {}z, c             S   s   h | ]}t |qS r   )str)r8   r/   r   r   r   	<setcomp>{   s    z'ChangelogCommand.run.<locals>.<setcomp>r   )r)   r7   r   r,   r   r   r;   r   r-   r6   r(   printjoinr2   r<   r'   Zformat_changelog)r$   r6   r4   r9   r   r   r   runk   s     

 zChangelogCommand.runN)r   )__name__
__module____qualname__aliasesr   Zsummarystaticmethodr    r%   r(   r6   r<   rA   r   r   r   r   r   (   s   r   )Z
__future__r   r   r   r0   Zdateutil.parserr   Zdnfpluginscorer   r   r   r*   Zdnf.clir   ZpluginZregister_commandr!   ZCommandr   r   r   r   r   <module>   s   