Your IP : 3.21.162.69
3
�ft`]�@slddlmZddlmZddlmZddlmZddlmZddl Z
ddlZejd�Z
Gdd �d ej�ZdS)
�)�absolute_import)�unicode_literals)�commands)�OptionParser)�_N�dnfc@s8eZdZdZdZed�Zedd��Zdd�Z d d
�Z
dS)
�ReinstallCommandzSA class containing methods needed by the cli to execute the reinstall command.
� reinstall�reizreinstall a packagecCs"|jddtd�tjtd�d�dS)N�packages�+zPackage to reinstallZPACKAGE)�nargs�help�action�metavar)�add_argumentrrZParseSpecGroupFileCallback)�parser�r�/usr/lib/python3.6/reinstall.py�
set_argparser(szReinstallCommand.set_argparsercCsH|jj}d|_d|_d|_d|_tj|j|j�|j j
sDtj|j�dS)aVerify that conditions are met so that this command can
run. These include that the program is being run by the root
user, that there are enabled repositories with gpg keys, and
that this command is called with appropriate arguments.
TN)Zcli�demandsZsack_activationZavailable_reposZ resolvingZ root_userrZ_checkGPGKey�base�opts� filenamesZ_checkEnabledRepo)�selfrrrr� configure.szReinstallCommand.configurecCs�d}xp|jj|jjd|jjjd�D]P}y|jj|�Wn6tjj k
rlt
jtd�|jjj
j|j��Yq"Xd}q"W�xR|jjdd�|jjD�D�]2}y|jj|�W�ntjjk
�r}zPx,|jD]"}t
jtd�|jj
j|j��Pq�Wt
jtd�|jjj
j|��WYdd}~Xq�tjjk
�r�}z^xV|jD]L}d}|jjj|�}|�rdtd �|}td
�}t
j||jjj
j|�|��q<WWYdd}~Xq�tjj k
�r�d�s�td��Yq�Xd}q�W|�s�tjjtd���dS)
NF)�strict�progresszNo match for argument: %sTcSsg|]}d|�qS)�@r)�.0�xrrr�
<listcomp>Lsz(ReinstallCommand.run.<locals>.<listcomp>z(Package %s available, but not installed.�z
(from %s)z%Installed package %s%s not available.z+Only the above marking errors are expected.z!No packages marked for reinstall.)rZadd_remote_rpmsrr�outputrZpackage_reinstallr�
exceptionsZMarkingError�logger�inforZtermZbold�locationZ pkg_specsZ grp_specsr ZPackagesNotInstalledErrorr�nameZPackagesNotAvailableError�historyZrepo�AssertionError�Error)r�doneZpkgZpkg_spec�errZxmsgZpkgrepo�msgrrr�run=sB
$
"zReinstallCommand.runN)r r
)�__name__�
__module__�__qualname__�__doc__�aliasesrZsummary�staticmethodrrr/rrrrr!sr)Z
__future__rrZdnf.clirZdnf.cli.option_parserrZdnf.i18nrZdnf.exceptionsrZloggingZ getLoggerr%ZCommandrrrrr�<module>s
?>