a &cg@s|ddlmZddlmZddlZddlZddlZddlmZm Z m Z ddl Z ddl Z ddZ e jjGddde jjZdS) )absolute_import)unicode_literalsN)_P_loggerc CsDztjj|ddWStttfy>ttd |Yn0dS)NT)ZfuzzyzNot a valid date: "{0}".) dateutilparserparse ValueError TypeError OverflowErrorargparseArgumentTypeErrorrformat)valr9/usr/lib/python3.9/site-packages/dnf-plugins/changelog.py validate_date!src@sLeZdZdZedZeddZddZddZ d d Z d d Z d dZ dS)ChangelogCommand)Z changelogzShow changelog data of packagescCsd|}|jdddttdd|jddttdd|jdd d td d |jd dtdddS)Nz--sinceZDATEzZshow changelog entries since DATE. To avoid ambiguosity, YYYY-MM-DD format is recommended.)metavardefaulttypehelpz--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.)ractionrpackage*ZPACKAGE)nargsr)add_mutually_exclusive_group add_argumentrrint)rZ filter_grouprrr set_argparser-szChangelogCommand.set_argparsercCs|jj}d|_d|_d|_dS)NT)clidemandsZavailable_reposZsack_activation changelogs)selfr#rrr configure>szChangelogCommand.configurecCs|jj}|jjr|jdd|jjD]d}tjj|ddj |jjdddd}|jj rf|j|jj d|rz| | }q(t td|q(n|jj r|j|jj d|jjr|}n|}|S)NT)empty)Z ignore_caseF)Z with_nevraZ with_providesZwith_filenames)ZreponamezNo match for argument: %s)baseZsackqueryoptsrZfiltermdnfZsubjectZSubjectZget_best_queryZrepounionZlatestrinforupgradesZ available)r%qpkgZpkg_qrrrr)Ds&    zChangelogCommand.querycCs:t}t|D]$}||jp"|j|jfg|q|S)N) collections OrderedDictsorted setdefaultZ source_namenameZevrappend)r%Zpackagesby_srpmr0rrrr7Zs "zChangelogCommand.by_srpmcsTjjrj|Sjjr.|jdjjSjjrJfdd|jDS|jSdS)Ncs$g|]}|djjkr|qS)Z timestamp)r*sincedate).0chlogr%rr fsz6ChangelogCommand.filter_changelogs..)r*r.r(Zlatest_changelogscountr$r8)r%rrr<rfilter_changelogs`s z"ChangelogCommand.filter_changelogsc Cs|jjr"ttd|jjnP|jjrLttdd|jj|jjn&|jjrdttdnttd| | }|D]V}t tdd t dd ||D|||d D]}t |j|qqdS) 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 {z'ChangelogCommand.run..r)r*r8rr-rrr>rr.r7r)printjoinr3r?r(Zformat_changelog)r%r7r5r;rrrrunks* zChangelogCommand.runN) __name__ __module__ __qualname__aliasesrZsummary staticmethodr!r&r)r7r?rErrrrr(s  r)Z __future__rrr r1Zdateutil.parserrZdnfpluginscorerrrr+Zdnf.clirZpluginZregister_commandr"ZCommandrrrrrs