a º&cgã@s|ddlmZddlmZddlZddlZddlZddlmZm Z m Z ddl Z ddl Z dd„Z e jjGdd„de jjƒƒ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 d d „Z d 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)Z ignore_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Ú setdefaultZ source_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Ú fsÿz6ChangelogCommand.filter_changelogs..)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}t tdƒ 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Ú {óz'ChangelogCommand.run..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Ús