ok

Mini Shell

Direktori : /lib/python3.6/site-packages/dnf/cli/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/dnf/cli/__pycache__/cli.cpython-36.pyc

3

��f���@stdZddlmZddlmZddlmZyddlmZWn ek
rXddlmZYnXddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlmZdd	lmZdd
lmZmZddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddl$Zddl%Zddl&Zddl'Zddl(Zddl)Zddl*Zddl+Zddl,Zddl-Zddl.Zddl/Zddl0Zddl1Zddl2Zddl3Zddl4Zddl5Zddl6Zddl7Zddl8Zddl9Zddl:Zddl;Zddl<Zddl=Zddl>Zddl?Zddl@ZddlAZddlBZddlCZddlDZe
jEd�ZFdd
d�ZGdd�ZHdd�ZIdd�ZJGdd�dejK�ZLGdd�deM�ZNdS)z/
Command line interface yum class and related.
�)�print_function)�absolute_import)�unicode_literals)�SequenceN�)�output)�CliError)�ucd�_�dnf�cCs�t|j�dt|j�t|�}t|j�}t|j�}xFd|fd|fd|ffD],\}}||j|d�|||d7<qLWdS)zl Get the length of each pkg's column. Add that to data.
        This "knows" about simpleList and printVer. r�na�ver�ridrN)�len�name�archZevrZ
_from_repo�
setdefault)�data�pkg�indentr
rr�d�v�r�/usr/lib/python3.6/cli.py�_add_pkg_simple_list_lens]s 

 rcCs�iiid�}x<|j|j|j|j|j|jfD]}x|D]}t||�q4Wq*Wt|j�dkr�x*|j	D] \}}t||�t||dd�q`W|d|d|dg}|j
|d	d
�}|d|d	|dfS)
zA Work out the dynamic size of the columns to pass to fmtColumns. )r
rrr� �)rr
rrr)Zremainder_column�z    )�	installed�	available�extras�
autoremove�updates�recentrr�	obsoletes�obsoletesTuplesZcalcColumns)r�yplrZlstrZnpkgZopkg�columnsrrr�_list_cmd_calc_columnshs

r)c	Cs�dd�}tjj|�}d}x�|j�j�j|d�D]�}|r>td�d}|jdkrbd|j|j	|j
f}nd	|j|j|j	|j
f}|jj|j
�}ttd
�||||j�f�ttd�|jr�|jnd||j�f�q.WdS)NcSstjdtj|��S)Nz%c)�time�strftimeZgmtime)�xrrr�
sm_ui_timezsz"print_versions.<locals>.sm_ui_timeF)rrT�0z%s-%s.%sz%s:%s-%s.%sz  Installed: %s-%s at %sz  Built    : %s at %s)r�sack�
rpmdb_sack�queryr�filterm�printZepoch�version�releaser�term�boldrr
ZinstalltimeZpackagerZ	buildtime)	�pkgs�baserr-r0�donerrrrrr�print_versionsys 
r;cCs>td�}x0|j�D]$\}}tj|j||d|d��qWdS)NzTThe operation would result in switching of module '{0}' stream '{1}' to stream '{2}'rr)r
�items�logger�warning�format)�switchedModulesZmsg1Z
moduleNameZstreamsrrr�report_module_switch�srAcs�eZdZdZd �fdd�	Zff�fdd�	Zdd�Zd	d
�Zdd�Zd
d�Z	fdddfdd�Z
dd�Zggdfdd�Zdfdfdd�Z
d!dd�Z�fdd�Zdd�Z�ZS)"�BaseCliz#This is the base class for yum cli.Ncs4|ptjj�}tt|�j|d�tj||j�|_dS)N)�conf)rrCZConf�superrB�__init__rZOutput)�selfrC)�	__class__rrrE�szBaseCli.__init__cstjjrJ|jjsJt|jj��}|rJt|�t	d�j
tjjd�}tj
j|��|j}|jj|�}|rjtj|�|r�g}g}d}xF|D]>}	|	jtjjkr�|j|	j�q�|	jtjjkr�d}|j|	j�q�W|`|s�|jj|�n|jj||�|�s|jj��s|j�r�|jj�s|jj�r�|jj �r:tjt	d�j
tjj!d��n(d|jj"k�rbtjt	d�j
tjj!d��|j#��r�|jj$�s�|jj%��r�t&t	d���ntjt	d	��d
S|�rD|�r:tjt	d��y|jj'}
|j(||jj)|
�Wn\tj
j*k
�r8}z:tj+j
j,t-|��}t	d�d
|}
t.�tj
j|
��WYd
d
}~XnX|j/|�|jj �rRd
St0|t1��sd|g}tj2�gt3|�}t4t5|�j6|�}|d
k	�r�|j7j8|g�d}tj9jj:|j7|j;�}nd
}|�rt.�t.dj<|jj=|���t.�x.|D]&}	|	j>t?jj@k�r�tj
jt	d����q�W|S)z�Take care of package downloading, checking, user
        confirmation and actually running the transaction.

        :param display: `rpm.callback.TransactionProgress` object(s)
        :return: history database transaction ID or None
        aQIt is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch.
It is recommended to rather remove all installed content from the module, and reset the module using '{prog} module reset <module_name>' command. After you reset the module, you can install the other stream.)�progTFz7{prog} will only download packages for the transaction.ZtestzP{prog} will only download packages, install gpg keys, and check the transaction.zOperation aborted.zNothing to do.NzDownloading Packages:zError downloading packages:z
%sr�
zTransaction failed)Arr9ZWITH_MODULESrCZmodule_stream_switch�dictZ_moduleContainerZgetSwitchedStreamsrAr
r?�util�	MAIN_PROG�
exceptions�ErrorZtransactionrZlist_transactionr=�info�actionZFORWARD_ACTIONS�appendrZBACKWARD_ACTIONSZ_tsZreportRemoveSizeZreportDownloadSizeZ	isChangedZ_history�group�env�downloadonly�MAIN_PROG_UPPERZtsflags�
_promptWanted�assumeno�userconfirmrZdownload_callback_total_cbZdownload_packages�progressZ
DownloadError�cliZindent_blockr	r3�gpgsigcheck�
isinstancerZCliTransactionDisplay�listrDrB�do_transaction�history�oldZdbZRPMTransactionZ_trans�joinZpost_transaction_output�state�libdnfZTransactionItemState_ERROR)rFZdisplayr@�msgZtransZpkg_strZinstall_pkgsZrmpkgsZinstall_onlyZtsiZtotal_cb�eZspecificZerrstr�tid)rGrrr^�s�







zBaseCli.do_transactionc
sg}x�|D]�}�j|�\}}|dkr(q
q
|dkrĈjjo@�jj}tjsVtjj�rl|rltjj	t
d����fdd�}y�j||�Wq�tjj	tfk
r�}z|j
t|��WYdd}~Xq�Xq
|j
|�q
W|r�x|D]}	tj|	�q�Wtjj	t
d���dS)aPerform GPG signature verification on the given packages,
        installing keys if possible.

        :param pkgs: a list of package objects to verify the GPG
           signatures of
        :raises: Will raise :class:`Error` if there's a problem
        rrzTRefusing to automatically import keys when running unattended.
Use "-y" to override.cs
�jj�S)N)rrX)r,�y�z)rFrr�<lambda>$sz%BaseCli.gpgsigcheck.<locals>.<lambda>NzGPG check FAILED)Z_sig_check_pkgrC�	assumeyesrW�sys�stdin�isattyrrMrNr
Z_get_key_for_package�
ValueErrorrQ�strr=�critical)
rFr8Zerror_messages�po�result�errmsgZay�fnrerdr)rFrr[s&
"
zBaseCli.gpgsigcheckcsXd�x:|jjjd|j�D]$}|tj}|rtjj|d��PqW�fdd�|j	D�}|S)zBReturn list of changelogs for package newer then installed versionNrrcs$g|]}�dks|d�kr|�qS)N�	timestampr)�.0Zchlog)�newestrr�
<listcomp>=sz-BaseCli.latest_changelogs.<locals>.<listcomp>)
Z_rpmconnZreadonly_tsZdbMatchr�rpmZRPMTAG_CHANGELOGTIME�datetimeZdateZ
fromtimestamp�
changelogs)rF�packageZmiZchangelogtimesZchlogsr)rwr�latest_changelogs3s
zBaseCli.latest_changelogscCs4d|djd�tjj|d�tjj|d�f}|S)z*Return changelog formatted as in spec filez* %s %s
%s
ruz%a %b %d %X %YZauthor�text)r+rZi18nr	)rFZ	changelogZ	chlog_strrrr�format_changelogAs
zBaseCli.format_changelogcCs�t�}x&|D]}|j|jp|jg�j|�qWxdt|j��D]T}||}ttd�j	dj
dd�|D����x$|j|d�D]}t|j|��qzWq<WdS)NzChangelogs for {}z, cSsg|]}t|��qSr)ro)rvrrrrrxQsz,BaseCli.print_changelogs.<locals>.<listcomp>r)
rJr�source_namerrQ�sorted�keysr3r
r?rar}r)rFZpackagesZbysrpm�pr�Zbin_packagesZchlrrr�print_changelogsIs
"zBaseCli.print_changelogsTFc	CsR|jd||d�}|jjs |jjr@|jd||d�}|j|_|j|_|�rDt|j|�}t|j�dkr�i}|jj	j
d}	|	r�x>t|j�D]0}
|
j�}t
jj|�r�|
j�r�|
||
j|
jf<q�W|jj}|jj}
|jj|jdd||||
d�d	�|r�|j|j�t|j�dk�rDttd
��x0t|jtjd�d�D]}|jj|d|d��q(W|j�pP|jS)
z?Check updates matching given *patterns* in selected repository.Zupgrades)�reponamer%rr7rr])�=znot in)Z
outputType�highlight_nar(�highlight_modeszObsoleting Packages)�key)r()�returnPkgListsrCr%�verboser&r)rrr#r6�MODEr�ZlocalPkg�os�path�existsZverifyLocalPkgrr�color_update_local�color_update_remote�listPkgsr�r3r
�operator�
itemgetter�updatesObsoletesList)rF�patternsr�Zprint_r{r'Ztyplr(�
local_pkgs�	highlightrqZlocal�cul�cur�obtuprrr�
check_updatesUs:
zBaseCli.check_updatescCsr|jj�}t|�dkr |j�nx|D]}|j|�q&W|jj�|}|dkrn|jj�rntd�}tjj|��dS)ab Upgrade or downgrade packages to match the latest versions available
            in the enabled repositories.

            :return: (exit_code, [ errors ])

            exit_code is::
                0 = we're done, exit
                1 = we've errored, exit with error string
                2 = we've got work yet to do, onto the next stage
        rz4No packages marked for distribution synchronization.N)	Z_goalZ
req_lengthrZdistro_syncZreq_has_distupgrade_allr
rrMrN)rFZuserlistZoldcount�pkg_specZcntrdrrr�distro_sync_userlist{s


zBaseCli.distro_sync_userlistc
CsTd}xf|D]^}y|j||d�d}Wq
tjjk
rf}z"tjtd�|jjj	|j
��WYdd}~Xq
Xq
Wx�|D]�}y|j||d�d}Wqrtjjk
r�}z$td�}	tj|	|jjj	|��WYdd}~Xqrtjj
k
�r}z"tjtd�|jjj	|j��WYdd}~Xqrtjjk
�r4d�s0t�YqrXqrW|�sPtjjtd���dS)	aaAttempt to take the user specified list of packages or
        wildcards and downgrade them. If a complete version number is
        specified, attempt to downgrade them to the specified version

        :param specs: a list of names or wildcards specifying packages to downgrade
        :param file_pkgs: a list of pkg objects from local files
        F)�strictTzNo match for argument: %sNzNo package %s available.z6Packages for argument %s available, but not installed.z!No packages marked for downgrade.)Zpackage_downgraderrMZMarkingErrorr=rOr
rr6r7�locationZdowngrade_toZPackageNotFoundErrorZPackagesNotInstalledErrorr��AssertionErrorrN)
rFZspecsZ	file_pkgsr�rrrre�arg�errrdrrr�
downgradePkgs�s,	

(
&
"zBaseCli.downgradePkgs�allc!CsDy$|jjjd}|j||||d�}Wn0tjjk
rT}zdt|�gfSd}~X�n�Xi}i}	i}
d}|dkrzt|j|�}|r�|j	r�xB|j
|j|jD],}|j
|jf}
|
|ks�|||
kr�|||
<q�W|o�|j�rx8|jD].}|j
|jf}
|
|	k�s||	|
kr�||	|
<q�W|�rP|j�rPx2t|j�D]$}|jtjk�r(||
|j
|jf<�q(W|jj}|jj}|jj}|jj}|jj|j	td�|||||||d�d�}|jj}|jj}|jj}|jj }|jj|jtd	�||	|||||d
�d�}|jj|j!td�||d�}|jj|j"td
�||d�}|jj#}|jj$}|jj|jtd�||
|||d�d�}t%|j&�dk�r�|dk�r�t%|j&�}t'td��xLt|j(t)j*d�d�D]}|jj+|d|d��q�Wn|jj|j&td�||d�}|jj|j,td�||d�} t%|��r@| dk�r@|dk�r@|dk�r@|dk�r@|dk�r@|dk�r@|dk�r@tjjtd���dS)zJOutput selection *pkgnarrow* of packages matching *patterns* and *repoid*.r7)�installed_availabler�rNr]zInstalled Packages)�>�<r�znot in)r�r(r�zAvailable Packages)r�r�r�znot inzAutoremove Packages)r(zExtra PackageszAvailable Upgrades)r�znot inrzObsoleting Packages)r�r%zRecently Added PackageszNo matching Packages to list)-rr6r�r�rrMrNror)r�hidden_available�reinstall_availableZ
old_availablerrr �hidden_installedr#r�r��hawkeyZSYSTEM_REPO_NAMErCZcolor_list_installed_olderZcolor_list_installed_newerZcolor_list_installed_reinstallZcolor_list_installed_extrar�r
Zcolor_list_available_upgradeZcolor_list_available_downgradeZcolor_list_available_reinstallZcolor_list_available_installr"r!r�r�rr%r3r&r�r�r�r$)!rF�basecmd�	pkgnarrowr�r�r�r'reZupdate_pkgsZ	inst_pkgsr�r(rr�rqZclioZclinZclirZclieZripZclauZcladZclarZclaiZrapZraepZrepr�r�ZrupZropr�Zrraprrr�output_packages�s�







FzBaseCli.output_packagesc	Cs�d}d}|r|dkrd}d}n|r2|dkr2d}d}|j||d|d�}|jjrvx(|jD]}|jrT|rT|jj|�qTW|r�|j|_|j|_|r�g|_|r�g|_|S)a#Return a :class:`dnf.yum.misc.GenericHolder` object containing
        lists of package objects that match the given names or wildcards.

        :param pkgnarrow: a string specifying which types of packages
           lists to produce, such as updates, installed, available, etc.
        :param patterns: a list of names or wildcards specifying
           packages to list
        :param installed_available: whether the available package list
           is present as .hidden_available when doing all, available,
           or installed
        :param reponame: limit packages list to the given repository

        :return: a :class:`dnf.yum.misc.GenericHolder` instance with the
           following lists defined::

             available = list of packageObjects
             installed = list of packageObjects
             upgrades = tuples of packageObjects (updating, installed)
             extras = list of packageObjects
             obsoletes = tuples of packageObjects (obsoleting, installed)
             recent = list of packageObjects
        FrTr�r )Zignore_caser�)	Z_do_package_listsrC�showdupesfromreposr�rr rQr�r�)	rFr�r�r�r�Zdone_hidden_availableZdone_hidden_installedr'rrrrr�
s,zBaseCli.returnPkgListsc	s�|jj}d|j_g}g}x4|D],}tt|�j|�\}}|j|�|j|�qWx t|�D]}|jj|||�qXW||j_|s�t	j
jtd���dS)a�Print out a list of packages that provide the given file or
        feature.  This a cli wrapper to the provides methods in the
        rpmdb and pkgsack.

        :param args: the name of a file or feature to search for
        :return: (exit_code, [ errors ])

        exit_code is::

            0 = we're done, exit
            1 = we've errored, exit with error string
            2 = we've got work yet to do, onto the next stage
        TzNo Matches foundN)
rCr�rDrB�provides�extendr�rZmatchcallback_verboserrMrNr
)	rF�argsZold_sdupZmatchesZused_search_strings�specr1Zused_search_stringr)rGrrr�?s

zBaseCli.providescCs|jjr|jjrdSdS)NFT)rCrjrW)rFrrrrV^szBaseCli._promptWanted)N)r�NFN)�__name__�
__module__�__qualname__�__doc__rEr^r[r}rr�r�r�r�r�r�r�rV�
__classcell__rr)rGrrB�sk'&"Y
1rBc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zddd
�Zd dd�Z	d!dd�Z
d"dd�Zej
fdd�Zdd�Zdd�Zdd�Zdd�ZdS)#�ClicCs"||_i|_d|_tjjj�|_|jtjj	j
j�|jtjj	jj
�|jtjj	jj�|jtjj	jj�|jtjj	jj�|jtjj	jj�|jtjj	jj�|jtjj	jj�|jtjj	jj�|jtjj	jj�|jtjj	jj�|jtjj	j j!�|jtjj	j"j#�|jtjj	j$j%�|jtjj	j&j'�|jtjj	j(j)�|jtjj	j*j+�|jtjj	j,j-�|jtjj	j.j/�|jtjj	j0j1�|jtjj	j2j3�|jtjj	j4j5�|jtjj	j6j7�|jtjj	j8�|jtjj	j9�|jtjj	j:�|jtjj	j;�|jtjj	j<�|jtjj	j=�dS)N)>r9�cli_commands�commandrrZZdemandZDemandSheet�demands�register_commandZcommands�aliasZAliasCommandr"ZAutoremoveCommandZcheckZCheckCommandZcleanZCleanCommandZ
distrosyncZDistroSyncCommandZdeplistZDeplistCommandZ	downgradeZDowngradeCommandrRZGroupCommandr_ZHistoryCommandZinstallZInstallCommandZ	makecacheZMakeCacheCommandZmarkZMarkCommand�moduleZ
ModuleCommandZ	reinstallZReinstallCommand�removeZ
RemoveCommand�repolistZRepoListCommandZ	repoqueryZRepoQueryCommand�searchZ
SearchCommand�shellZShellCommandZswapZSwapCommandZ
updateinfoZUpdateInfoCommandZupgradeZUpgradeCommandZupgrademinimalZUpgradeMinimalCommandZInfoCommandZListCommandZProvidesCommandZCheckUpdateCommandZRepoPkgsCommandZHelpCommand)rFr9rrrrEfsBzCli.__init__cCs|jj|�|jr^xJ|jj�D]<\}}|jjj||jj|gd�}|j|�|jj	|df�qW|j
r�|jjdd�|jjdd�|j
D��t
�}yzxt|jD]j\}}|jjj|�}|s�|jjjr�|dkr�td�}	tjj|	|��|j|�|dk�r�|j�q�|j�q�WWnFtjjk
�rP}
z$tj|
�|jj�tjd	�WYdd}
~
XnXx|D]}tjtd
�|��qXW|jjj �}|dk�r�|jjj!�}x,|D]$}|jjj"|�}|�r�|j#j$��q�W|jj%j&�\}
|j_'|jjj(�j)|
�t%j*|j|jj%�}|jjj(�j+|�dS)N)Zbaseurl�enabler�*�disablecSsg|]}|df�qS)r�r)rv�rrrrrx�sz(Cli._configure_repos.<locals>.<listcomp>zUnknown repo: '%s'rzNo repository match: %s)r�r�),r9Zread_all_reposZrepofrompathr<�reposZadd_new_reporC�_configure_from_optionsZrepos_edrQ�repo�insertr��setZget_matchingr�r
rrMZ	RepoError�addr�r��ConfigErrorr=rp�	optparser�
print_helprk�exitr>Z_repo_persistorZget_expired_reposr��get�_repo�expirerZsetup_progress_callbacksZ_ds_callbackr��set_progress_barZCliKeyImportZ_set_key_import)rF�optsZlabelr�Z	this_repoZnotmatchr�Z	operationr�rdreZ
expired_reposrZbarZ
key_importrrr�_configure_repos�sL








zCli._configure_reposcCsvtjdjtjjd�tjj�tjtj	j
d|j�tjtj	j
d|jj
j�tjtj	j
d|jj
j�tjd|jj
j�dS)Nz{prog} version: %s)rHzCommand: %szInstallroot: %szReleasever: %szcachedir: %s)r=�debugr?rrKrU�const�VERSION�log�logging�DDEBUG�	cmdstringr9rC�installroot�
releasever�cachedir)rFrrr�_log_essentials�s



zCli._log_essentialscCs|j}|jj}|jr.tjj�s.tjjt	d���|j
rLx|j�D]
}d|_q>W|j
s\|jjj
r�d|jj_
xn|j�D]}|jjtjj�qpWnL|jr�xD|j�D]}|jj�q�Wn(|js�x |j�D]}|jjtjj�q�W|j�r�|jj|jjr�dnd|jjd�dS)Nz[This command has to be run with superuser privileges (under the root user on most systems).T�autoF)�load_system_repoZload_available_repos)r�r9r�Z	root_userrrKZ	am_i_rootrMrNr
r{�iter_enabledZload_metadata_other�	cacheonlyrC�valuesr�ZsetSyncStrategyr�ZSYNC_ONLY_CACHE�freshest_metadatar�Zfresh_metadataZ	SYNC_LAZYZsack_activationZ	fill_sackr�Zavailable_repos)rFr�r�r�rrr�_process_demands�s.



zCli._process_demandscCs�|j}|jj|�}|dkr~tjtd�|tjd�|jj	j
r`tjtd�jtj
jtj
jd�|�ntjtd�jtj
jd��t�||�|_tjtjjd|�tjtjjd	|�dS)
z,Check that the requested CLI command exists.Nz)No such command: %s. Please use %s --helprzLIt could be a {PROG} plugin command, try: "{prog} install 'dnf-command(%s)'")rHZPROGzRIt could be a {prog} plugin command, but loading of plugins is currently disabled.)rHzBase command: %szExtra commands: %s)r�r�r�r=rpr
rk�argvr9rCZpluginsr?rrKrLrUrr�r�r�)rFr�r�r��command_clsrrr�_parse_commands�s


zCli._parse_commandsNc	Cs�tjjj�}|j|�}|dkr*tjjj�n||_|jj|�}|j	rpt
tjj�t
|jjj|j|jj�tjd�|jr�d|_d|_|jr�tjj|_|_yh|jr�|jjjd|jjjtjj�d|j_|jjj|�|j|j �d|kr�|j!|jj_!|jjj"�Wn�tj#j$t%fk
�rF}z t&j't(d�|�tjd�WYdd}~XnXt)k
�r�}z:d	t*t+|��t,|j-�f}t&j't(d�|�tjd�WYdd}~XnX|j.dk	�r�|j.|jj_.|jjj/�r�|j0dk�r�t&j't(d��tjd�|j1�s�|j2�r|j0dk�rt&j't(d��tjd�|j3dk	�r>t4j5t6j7|j3d��|jj8|j9d�|jj:|j;|j<|�|jj8|j9d�|j0�s�|jj=�tjd�||j_>|jj?d|_@x$|jj>D]}|j@d|7_@�q�W|jA�y|jB||�Wn tCk
�rtjd�YnX|jD�r$|jj=|j0�tjd�|jjE|j0|�}|jF�rN|jF|j_Gd|j_H|jI�r`|jI|j_I|jJ�rrd|jj_K|jL�r�d|jj_L|j0jM�|jjN�|jjO�|jP|�|jjQ�|jjj|�|j0jR�|jjj.�rtjSjT|jjj.�|jjj.|jjUjV�_W|jjjXdk�r(|jjjYjZ|jjjXd�t[j\d�dk�r�d}x,|jjUj]�D]}|j^�rZ�qJd|_^d}�qJW|jjj_�s�d|jj__d}|�r�t&j`t(d��dS)aParse command line arguments, and set up :attr:`self.base.conf` and
        :attr:`self.cmds`, as well as logger objects in base instance.

        :param args: a list of command line arguments
        :param option_parser: a class for parsing cli options
        Nrrr�TrzConfig error: %srz%s: %s�download�system-upgrade�reposync�
modulesynczb--destdir or --downloaddir must be used with --downloadonly or download or system-upgrade command.zconfig-managerz_--enable, --set-enabled and --disable, --set-disabled must be used with config-manager command.�<�mainZpluginrz%s r�)�colorz%_pkgverify_level�	signaturer�Fz�Warning: Enforcing GPG signature check globally as per active RPM security policy (see 'gpgcheck' in dnf.conf(5) for how to squelch this message))r�r�r�r�)r�r�)arrZ�aliasesZAliasesZresolve�
option_parserZOptionParserr�Zparse_main_argsr4r3r�r�r;r9rCZhistory_record_packagesrrkr��quietZ
debuglevelZ
errorlevelr�Z
VERBOSE_LEVELr�Z
_set_valueZsystem_cachedirZPRIO_DEFAULTr�r��_read_conf_filer�rZ_adjust_conf_optionsrMr�rnr=rpr
�IOErrorr	ro�repr�filenameZdestdirrTr�Zset_enabledZset_disabledZ	sleeptimer*Zsleep�randomZ	randrangeZadd_commandsr�Zinit_pluginsZ
disablepluginZenablepluginr�r�rHr�r�r�r�helpZparse_command_argsZallowerasingZ
allow_erasingZ_allow_erasingr�ZdebugsolverZdebug_solverr%Z
pre_configureZpre_configure_pluginsZ_activate_persistorr�Zconfigure_plugins�	configurerKZ
ensure_dirr�r�Zpkgdirr�r6ZreinitryZexpandMacror�ZgpgcheckZlocalpkg_gpgcheckr>)	rFr�r�r�r�rer�Zforcingr�rrrr��s�





















z
Cli.configurecCsBtjjd�}|jj}|jd�|jd�|jd�}|jd�tjj	krht
jj|�rhtj
jtd�j|���|jtjjd�|jd�}|jd�tjj	kr�d}|j}|j||jd�d�|dkr�|jdkr�tjj|j�}n|dkr�tjj|�}|dk	r�||_|jdk�rtjtd	��xd
D]}|j|��qW|jjj|�|�|S)N�configZconfig_file_pathzConfig file "{}" does not exist)ZpriorityZreposdir�varsdir�/)rzPUnable to detect release version (use '--releasever' to specify release version)r��logdir�
persistdir)r�rr)rr�ZTimerr9rCZ_check_remote_fileZ_search_inside_installrootZ
_get_valueZ
_get_priorityZPRIO_COMMANDLINEr�r��isfilerMr�r
r?�readZPRIO_MAINCONFIGZ
substitutionsZupdate_from_etcr�ryZdetect_releaseverr�r=r>Zprepend_installroot�_loggingZ_setup_from_dnf_conf)rFr�ZtimerrCr�Z	from_rootZsubst�optrrrr��s6




zCli._read_conf_file�eqcCs�|dkr|dkrdSg}|js"|r,|jd�|js6|r@|jd�|jsJ|rT|jd�|js^|rh|jd�|jj|||j|j|j	|j
d�dS)zz

        :param opts:
        :param cmp_type: string supported "eq", "gte"
        :param all:
        :return:
        N�bugfix�enhancement�
newpackage�security)�types�advisory�bugzilla�cves�severity)r
rQrrr
r9Zadd_security_filtersrrrr)rFr�Zcmp_typer�rrrr� _populate_update_security_filter�s







z$Cli._populate_update_security_filtercCs4|dk	r|jjjj|�|dk	r0|jjjj|�dS)z�
        Change minimal logger level for terminal output to stdout and stderr according to specific
        command requirements
        @param stdout: logging.INFO, logging.WARNING, ...
        @param stderr:logging.INFO, logging.WARNING, ...
        N)r9rZstdout_handlerZsetLevelZstderr_handler)rF�stdout�stderrrrr�redirect_logger�szCli.redirect_loggercCs.tjjj|�}||jj_|jjj�j|�dS)N)	rrZrYZMultiFileProgressMeterr9rr�r�r�)rFZforYrrr�redirect_repo_progress�s
zCli.redirect_repo_progresscCs�|jjj�}|dkrdS|jjj�j|jd�}|j�}|jdd�|}x|D]}||krL|}qLW||kr�td|�td|�dS)N)r�r
)Z
advisory_typez,Security: %s is an installed security updatez-Security: %s is the currently running version)r9r/Zget_running_kernelr1r2rrr3)rFZkernel�qZikpkgrrrr�_check_running_kernel�s
zCli._check_running_kernelcCs*t|jj��tjjtdj||����dS)Nz)argument {}: not allowed with argument {})r3r�Zprint_usagerrMrNr
r?)rFZoption_string_1Zoption_string_2rrr�_option_conflict�szCli._option_conflictcCs<x6|jD],}||jkr*tjjtd�|��||j|<qWdS)zRegister a Command. :apizCommand "%s" already definedN)r�r�rrMr�r
)rFr�rrrrr��s
zCli.register_commandcCs�|j�|jjjr8tjtd�djtt	|jjj����|jjj
rhtjtd�djtt	|jjj
����xx|jjj�D]h}|jr�tjtd�|j
ddjtt	|j����|j
rvtjtd�|j
ddjtt	|j
����qvW|jj�S)a2Call the base command, and pass it the extended commands or
           arguments.

        :return: (exit_code, [ errors ])

        exit_code is::

            0 = we're done, exit
            1 = we've errored, exit with error string
            2 = we've got work yet to do, onto the next stage
        zExcludes in dnf.conf: z, zIncludes in dnf.conf: zExcludes in repo z: zIncludes in repo )r�r9rCZexcludepkgsr=r�r
rar�r�Zincludepkgsr�r��idr��run)rFr�rrrrs
"
"(,zCli.run)N)N)r	N)NN)r�r�r�rEr�r�r�r�r�r�rrrkrrrrr�rrrrrr�es$3

-


r�)r)Or�Z
__future__rrr�collections.abcr�ImportError�collectionsrzr�r�r�r�ryrkr*r�Zlibdnf.transactionrcrrZdnf.clirZdnf.i18nr	r
rZdnf.cli.aliasesZdnf.cli.commandsZdnf.cli.commands.aliasZdnf.cli.commands.autoremoveZdnf.cli.commands.checkZdnf.cli.commands.cleanZdnf.cli.commands.deplistZdnf.cli.commands.distrosyncZdnf.cli.commands.downgradeZdnf.cli.commands.groupZdnf.cli.commands.historyZdnf.cli.commands.installZdnf.cli.commands.makecacheZdnf.cli.commands.markZdnf.cli.commands.moduleZdnf.cli.commands.reinstallZdnf.cli.commands.removeZdnf.cli.commands.repolistZdnf.cli.commands.repoqueryZdnf.cli.commands.searchZdnf.cli.commands.shellZdnf.cli.commands.swapZdnf.cli.commands.updateinfoZdnf.cli.commands.upgradeZdnf.cli.commands.upgrademinimalZdnf.cli.demandZdnf.cli.formatZdnf.cli.option_parserZdnf.confZdnf.conf.substitutionsZ	dnf.constZdnf.db.historyZdnf.exceptionsZdnf.loggingZ
dnf.persistorZ
dnf.pluginZdnf.rpmZdnf.sackZdnf.transactionZdnf.utilZdnf.yum.miscZ	getLoggerr=rr)r;rAZBaserB�objectr�rrrr�<module>s�

O

Zerion Mini Shell 1.0