%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/dnf/cli/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/dnf/cli/__pycache__/cli.cpython-39.opt-1.pyc

a

�2�hS��@s�dZddlmZddlmZddlmZzddlmZWneyVddlmZYn0ddlm	Z	ddl
Z
ddlmZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZd	d
lmZddlmZddlmZmZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddl$Zddl%Zddl&Zddl'Zddl(Zddl)Zddl*Zddl+Zddl,Zddl-Zddl.Zddl/Zddl0Zddl1Zddl2Zddl3Zddl4Zddl5Zddl6Zddl7Zddl8Zddl9Zddl:Zddl;Zddl<Zddl=Zddl>Zddl?Zddl@ZddlAZddlBZddlCZddlDZddlEZddlFZe�Gd
�ZHddd�ZIdd�ZJdd�ZKdd�ZLGdd�dejM�ZNGdd�deO�ZPdS)z/
Command line interface yum class and related.
�)�print_function)�absolute_import)�unicode_literals)�Sequence)�defaultdictN)�fnmatch�)�output)�CliError)�ucd�_�dnf�cCs|t|j�dt|j�t|�}t|j�}t|j�}d|fd|fd|ffD],\}}||�|d�|||d7<qJdS)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�indentrrr�d�v�r�//usr/lib/python3.9/site-packages/dnf/cli/cli.py�_add_pkg_simple_list_lens_s 

rcCs�iiid�}|j|j|j|j|j|jfD]}|D]}t||�q0q(t|j�dkrx|j	D] \}}t||�t||dd�qV|d|d|dg}|j
|dd	�}|d|d|d
fS)zA Work out the dynamic size of the columns to pass to fmtColumns. )rrrrz    )rrrrr)Zremainder_column�)�	installed�	available�extras�
autoremove�updates�recentrr�	obsoletes�obsoletesTuplesZcalcColumns)r	�yplrZlstrZnpkgZopkg�columnsrrr�_list_cmd_calc_columnsjs�
r)c	Cs�dd�}tj�|�}d}|����j|d�D]�}|r<td�d}|jdkr`d|j|j	|j
f}nd	|j|j|j	|j
f}|j�|j
�}ttd
�||||j�f�ttd�|jr�|jnd||j�f�q,dS)NcSst�dt�|��S)Nz%c)�time�strftime�gmtime)�xrrr�
sm_ui_time|sz"print_versions.<locals>.sm_ui_timeF)rrT�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�baser	r.r1Zdonerrrrrr�print_versions{s&
���r;c	Cs:td�}|��D]$\}}t�|�||d|d��qdS)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�	Zd"�fdd�	Zdd	�Zd
d�Zdd
�Zdd�Z	d#dd�Z
dd�Zggdfdd�Zd$dd�Z
d%dd�Z�fdd�Zdd �Z�ZS)&�BaseCliz#This is the base class for yum cli.Ncs4|ptj��}tt|�j|d�t�||j�|_dS)N)�conf)r
rCZConf�superrB�__init__r	ZOutput)�selfrC��	__class__rrrE�szBaseCli.__init__rc
s�tjjrJ|jjsJt|j���}|rJt|�t	d�j
tjjd�}tj
�|��|j}|j�|�}|rjt�|�|r�g}g}d}|D]>}	|	jtjjvr�|�|	j�q~|	jtjjvr~d}|�|	j�q~|`|s�|j�|�n|j�||�|�s|j���s|j�r(|jj�s|jj�r(|jj �r6t�t	d�j
tjj!d��n(d|jj"v�r^t�t	d�j
tjj!d��tjj#�$��o�t%j&�'|jj(�dk�o�|jj }
d	}|
�r�|jj)d
k�r�t�t	d��t*t	d���tj�#�}|�+��s|jj)d
k�r�t�t	d��t*t	d���|�,��st�t	d��t-jj.|_/t0t1�}|D]D}
t2|
j3�D]2}|jj4D]"}t5||��rB||
j6�|��qB�q6�q(|�r�t�t	d��|�7�D].\}}t�|�|D]}t�d|��q��q�t*t	d���n$|jj)dk�r�t*t	d���t-jj8|_/|�9��r|jj:�s|j�;��st*t	d���|�r:|�<�nt�t	d��d	S|�r�|�r�t�t	d��z|jj=}|�>||jj?|�Wn^tj
j@�y�}z@tjAj
�BtC|��}t	d�d|}tD�tj
�|��WYd	}~n
d	}~00|�E|�|jj �r�d	StF|tG��s�|g}t�H�gt1|�}tItJ|��K|�}|d	u�rP|jL�M|g�d}tjNj�O|jL|jP�}nd	}|�r�tD�tDd�Q|j�R|���tD�|D]&}	|	jSt-jjTk�r�tj
�t	d����q�|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.�testzP{prog} will only download packages, install gpg keys, and check the transaction.�/NZpersistz:Persistent transactions aren't supported on bootc systems.zOperation aborted.�autoz�This bootc system is configured to be read-only. Pass --transient to perform this transaction in a transient overlay which will reset when the system reboots.z�A transient overlay will be created on /usr that will be discarded on reboot. Keep in mind that changes to /etc and /var will still persist, and packages commonly modify these directories.z�This operation would modify the following paths, possibly introducing inconsistencies when the transient overlay on /usr is discarded. See the usr_drift_protected_paths configuration option for more information.z  %szeOperation aborted. Pass --setopt=usr_drift_protected_paths= to disable this check and proceed anyway.Z	transientz;Transient transactions are only supported on bootc systems.zNothing to do.zDownloading Packages:zError downloading packages:z
%sr�
zTransaction failed)Ur
r:ZWITH_MODULESrCZmodule_stream_switch�dictZ_moduleContainerZgetSwitchedStreamsrArr?�util�	MAIN_PROG�
exceptions�ErrorZtransactionr	Zlist_transactionr=�info�actionZFORWARD_ACTIONS�appendrZBACKWARD_ACTIONSZ_tsZreportRemoveSizeZreportDownloadSizeZ	isChangedZ_history�group�env�downloadonly�MAIN_PROG_UPPERZtsflagsZ_BootcSystemZis_bootc_system�os�path�realpath�installrootZpersistencer
Zis_writableZis_unlocked_transient�libdnfZ TransactionPersistence_TRANSIENTZ_persistencer�list�sorted�filesZusr_drift_protected_pathsr�nevrar<ZTransactionPersistence_PERSIST�
_promptWanted�assumeno�userconfirmZ
make_writableZdownload_callback_total_cbZdownload_packages�progressZ
DownloadError�cliZindent_blockrr4�gpgsigcheck�
isinstancerZCliTransactionDisplayrDrB�do_transaction�history�oldZdbZRPMTransactionZ_trans�joinZpost_transaction_output�stateZTransactionItemState_ERROR)rFZdisplayr@�msgZtransZpkg_strZinstall_pkgsZrmpkgsZinstall_onlyZtsiZis_bootc_transactionZbootc_systemZtransaction_protected_pathsrZ
pkg_file_pathZprotected_patternrcZprotected_pathsZprotected_pathZtotal_cb�eZspecificZerrstr�tidrGrrrk�s��
���
�
���







"


zBaseCli.do_transactionc
s�g}|D]�}��|�\}}|dkr&qq|dkr��jjo>�jj}tjrPtj��sd|sdtj�	t
d����fdd�}z��||�Wq�tjj	tfy�}z|�
t|��WYd}~q�d}~00q|�
|�q|r�|D]}	t�|	�q�tj�	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
�j��S�N)r	rf)r-�y�z�rFrr�<lambda>a�z%BaseCli.gpgsigcheck.<locals>.<lambda>NzGPG check FAILED)Z_sig_check_pkgrC�	assumeyesre�sys�stdin�isattyr
rRrSrZ_get_key_for_package�
ValueErrorrV�strr=�critical)
rFr9Zerror_messages�po�result�errmsgZay�fnrqrprrvrriIs&&zBaseCli.gpgsigcheckcsVd�|jj�d|j�D]&}|tj}|rtj�|d��q>q�fdd�|j	D�}|S)zBReturn list of changelogs for package newer then installed versionNrrcs$g|]}�dus|d�kr|�qS)N�	timestampr)�.0Zchlog�Znewestrr�
<listcomp>zs�z-BaseCli.latest_changelogs.<locals>.<listcomp>)
Z_rpmconnZreadonly_tsZdbMatchr�rpmZRPMTAG_CHANGELOGTIME�datetime�dateZ
fromtimestamp�
changelogs)rF�package�miZchangelogtimesZchlogsrr�r�latest_changelogsps
zBaseCli.latest_changelogscCs4d|d�d�tj�|d�tj�|d�f}|S)z*Return changelog formatted as in spec filez* %s %s
%s
r�z%a %b %d %X %YZauthor�text)r+r
Zi18nr)rFZ	changelogZ	chlog_strrrr�format_changelog~s�zBaseCli.format_changelogcCs�t�}|D]}|�|jp|jg��|�q
t|���D]P}||}ttd��	d�
dd�|D����|�|d�D]}t|�|��qrq6dS)NzChangelogs for {}�, cSsg|]}t|��qSr)r~)r�rrrrr��rxz,BaseCli.print_changelogs.<locals>.<listcomp>r)
rOr�source_namerrVra�keysr4rr?rnr�r�)rFZpackagesZbysrpm�pr�Zbin_packagesZchlrrr�print_changelogs�s"zBaseCli.print_changelogsTFc	CsJ|jd||d�}|jjs |jjr@|jd||d�}|j|_|j|_|�r<t|j|�}t|j�dkr�i}|jj	j
d}	|	r�t|j�D]0}
|
��}t
j�|�r�|
��r�|
||
j|
jf<q�|jj}|jj}
|jj|jdd||||
d�d	�|r�|�|j�t|j�dk�r<ttd
��t|jt�d�d�D]}|jj|d|d��q"|j�pH|jS)
z?Check updates matching given *patterns* in selected repository.Zupgrades)�reponamer%rr8rr`��=�not in)Z
outputType�highlight_nar(�highlight_modes�Obsoleting Packages��key�r()�returnPkgListsrCr%�verboser&r)r	rr#r7�MODEraZlocalPkgr[r\�existsZverifyLocalPkgrr�color_update_local�color_update_remote�listPkgsr�r4r�operator�
itemgetter�updatesObsoletesList)rF�patternsr��print_r�r'Ztyplr(�
local_pkgs�	highlightr��local�cul�cur�obtuprrr�
check_updates�s@��

�
zBaseCli.check_updatescCsl|j��}t|�dkr |��n|D]}|�|�q$|j��|}|dkrh|j��shtd�}tj�|��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r
rRrS)rFZuserlistZoldcount�pkg_specZcntrprrr�distro_sync_userlist�s

zBaseCli.distro_sync_userlistc
CsFd}|D]`}z|j||d�d}Wqtjjyf}z(t�td�|jj�	|j
��WYd}~qd}~00q|D]�}z|j||d�d}Wqntjjy�}z*td�}	t�|	|jj�	|��WYd}~qnd}~0tjj
�y}z(t�td�|jj�	|j��WYd}~qnd}~0tjj�y(Yqn0qn|�sBtj�td���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_downgrader
rRZMarkingErrorr=rTrr	r7r8�locationZdowngrade_toZPackageNotFoundErrorZPackagesNotInstalledErrorr�rS)
rFZspecsZ	file_pkgsr�r�rrq�arg�errrprrr�
downgradePkgs�s0	
�*
�zBaseCli.downgradePkgs�allc!Cs<z$|jjjd}|j||||d�}Wn6tjjyZ}zdt|�gfWYd}~Sd}~00i}i}	i}
d}|dkr�t|j|�}|r�|j	r�|j
|j|jD],}|j
|jf}
|
|vs�|||
kr�|||
<q�|�r|j�r|jD].}|j
|jf}
|
|	v�s||	|
kr�||	|
<q�|�rL|j�rLt|j�D]$}|jtjk�r&||
|j
|jf<�q&|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��t|j(t)�*d�d�D]}|jj+|d|d��q�n|jj|j&td�||d�}|jj|j,td�||d�} t%|��r8| dk�r8|dk�r8|dk�r8|dk�r8|dk�r8|dk�r8|dk�r8tj�td���dS)zJOutput selection *pkgnarrow* of packages matching *patterns* and *repoid*.r8)�installed_availabler�rNr`zInstalled Packages)�>�<r�r�)r�r(r�zAvailable Packages)r�r�r�r�zAutoremove Packagesr�zExtra PackageszAvailable Upgradesr�rr�r�r%zRecently Added PackageszNo matching Packages to list)-r	r7r�r�r
rRrSr~r)r�hidden_available�reinstall_availableZ
old_availablerrr �hidden_installedr#rar��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%r4r&r�r�r�r$)!rF�basecmd�	pkgnarrowr�r�r�r'rqZupdate_pkgsZ	inst_pkgsr�r(rr�r�ZclioZclinZclirZclieZripZclauZcladZclarZclaiZrapZraepZrepr�r�ZrupZropr�Zrraprrr�output_packages�s��
$
��


�������
�

���
�������zBaseCli.output_packagesc	Cs�d}d}|r|dkrd}d}n|r2|dkr2d}d}|j||d|d�}|jjrn|jD]}|jsR|sR|j�|�qR|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 rVr�r�)	rFr�r�r�r�Zdone_hidden_availableZdone_hidden_installedr'rrrrr�Js.�

zBaseCli.returnPkgListsc	s�|jj}d|j_g}g}|D],}tt|��|�\}}|�|�|�|�qt|�D]}|j�|||�qR||j_|s�t	j
�t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
        Tz{No matches found. If searching for a file, try specifying the full path or using a wildcard prefix ("*/") at the beginning.N)
rCr�rDrB�provides�extendrar	Zmatchcallback_verboser
rRrSr)	rF�argsZold_sdup�matchesZused_search_strings�specr2Zused_search_stringrrGrrr�|s
zBaseCli.providescCs|jjr|jjsdSdS)NFT)rCryrervrrrrd�szBaseCli._promptWanted)N)r)rNTF)r�rN)r�NFN)�__name__�
__module__�__qualname__�__doc__rErkrir�r�r�r�r�r�r�r�r�rd�
__classcell__rrrGrrB�s"''
&"
Y�
2!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|_tjj��|_|�tjj	j
j�|�tjj	jj
�|�tjj	jj�|�tjj	jj�|�tjj	jj�|�tjj	jj�|�tjj	jj�|�tjj	jj�|�tjj	jj�|�tjj	jj�|�tjj	jj�|�tjj	j j!�|�tjj	j"j#�|�tjj	j$j%�|�tjj	j&j'�|�tjj	j(j)�|�tjj	j*j+�|�tjj	j,j-�|�tjj	j.j/�|�tjj	j0j1�|�tjj	j2j3�|�tjj	j4j5�|�tjj	j6j7�|�tjj	j8�|�tjj	j9�|�tjj	j:�|�tjj	j;�|�tjj	j<�|�tjj	j=�dSrs)>r:�cli_commands�commandr
rhZdemandZDemandSheet�demands�register_commandZcommands�aliasZAliasCommandr"ZAutoremoveCommand�checkZCheckCommandZcleanZCleanCommandZ
distrosyncZDistroSyncCommandZdeplistZDeplistCommandZ	downgradeZDowngradeCommandrWZGroupCommandrlZHistoryCommand�installZInstallCommandZ	makecacheZMakeCacheCommandZmarkZMarkCommand�moduleZ
ModuleCommandZ	reinstallZReinstallCommand�removeZ
RemoveCommand�repolistZRepoListCommandZ	repoqueryZRepoQueryCommand�searchZ
SearchCommand�shellZShellCommandZswapZSwapCommandZ
updateinfoZUpdateInfoCommandZupgradeZUpgradeCommandZupgrademinimalZUpgradeMinimalCommandZInfoCommandZListCommandZProvidesCommandZCheckUpdateCommandZRepoPkgsCommandZHelpCommand)rFr:rrrrE�sBzCli.__init__c
Cs|j�|�|jrZ|j��D]<\}}|jjj||jj|gd�}|�|�|j�	|df�q|j
r�|j�dd�|j�dd�|j
D��t
�}zt|jD]h\}}|jj�|�}|s�|jjjr�|dkr�td�}	tj�|	|��|�|�|dkr�|��q�|��q�WnHtjj�yH}
z*t�|
�|j��t�d�WYd}
~
n
d}
~
00|D]}t�td	�|��qN|jj� �}|du�r�|jj�!�}|D]$}|jj�"|�}|�r�|j#�$��q�|jj%�&�\}
|j_'|jj�(��)|
�t%�*|j|jj%�}|jj�(��+|�dS)
N)Zbaseurl�enabler)�*�disablecSsg|]}|df�qS)r�r)r��rrrrr��rxz(Cli._configure_repos.<locals>.<listcomp>zUnknown repo: '%s'rzNo repository match: %s),r:Zread_all_reposZrepofrompathr<�reposZadd_new_reporC�_configure_from_optionsZrepos_edrV�repo�insertr��setZget_matchingr�rr
rRZ	RepoError�addr�r��ConfigErrorr=r�	optparser�
print_helprz�exitr>Z_repo_persistorZget_expired_reposr��get�_repo�expirer	Zsetup_progress_callbacksZ_ds_callbackr��set_progress_barZCliKeyImportZ_set_key_import)rF�optsZlabelr\Z	this_repoZnotmatchr�Z	operationr�rprqZ
expired_reposrZbarZ
key_importrrr�_configure_repos�sL




 
zCli._configure_reposcCsvt�djtjjd�tjj�t�tj	j
d|j�t�tj	j
d|jj
j�t�tj	j
d|jj
j�t�d|jj
j�dS)Nz{prog} version: %srIzCommand: %szInstallroot: %szReleasever: %szcachedir: %s)r=�debugr?r
rPrZ�const�VERSION�log�logging�DDEBUG�	cmdstringr:rCr^�
releasever�cachedirrvrrr�_log_essentials�s�
�

��zCli._log_essentialscCs�|j}|jj}|jr.tj��s.tj�t	d���|j
rH|��D]
}d|_q<|j
sX|jjj
r�d|jj_
|��D]}|j�tjj�qjnD|jr�|��D]}|j��q�n$|js�|��D]}|j�tjj�q�|jr�|jj|jjr�dnd|jjd�dS)Nz[This command has to be run with superuser privileges (under the root user on most systems).TrMF)�load_system_repoZload_available_repos)r�r:r�Z	root_userr
rPZ	am_i_rootrRrSr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_demandss2
�
�zCli._process_demandscCs�|j}|j�|�}|dur~t�td�|tjd�|jj	j
r`t�td�jtj
jtj
jd�|�nt�td�jtj
jd��t�||�|_t�tjjd|�t�t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)'")rJZPROGzRIt could be a {prog} plugin command, but loading of plugins is currently disabled.rIzBase command: %szExtra commands: %s)r�r�r�r=rrrz�argvr:rCZpluginsr?r
rPrQrZr
r�r�r�)rFr�r�r��command_clsrrr�_parse_commands&s&

�
���
zCli._parse_commandsNc	
Cs�tjj��}|�|�}|dur*tjj��n||_|j�|�}|j	rpt
tjj�t
|jjj|j|jj�t�d�|jr�d|_d|_|jr�tjj|_|_zp|jr�|jj�d|jjjtjj�d|j_|jj�|�|�|j |j!|j"�d|vr�|j#|jj_#|jj�$�Wn�tj%j&t'f�yP}z&t(�)t*d�|�t�d�WYd}~nbd}~0t+�y�}z@d	t,t-|��t.|j/�f}t(�)t*d�|�t�d�WYd}~n
d}~00|j0du�r�|j0|jj_0|jjj1�s�|j2d
v�r�t(�)t*d��t�d�|j3�s|j4�r&|j2dk�r&t(�)t*d
��t�d�|j5du�rHt6�7t8�9|j5d��|j�:|j;d�|j�<|j=|j>|�|j�:|j;d�|j2�s�|j�?�t�d�||j_@|jjAd|_B|jj@D]}|jBd|7_B�q�|�C�z|�D||�WntE�yt�d�Yn0|jF�r(|j�?|j2�t�d�|j�G|j2|�}|jH�rR|jH|j_Id|j_J|jK�rd|jK|j_K|jL�rvd|jj_M|jN�r�d|jj_N|j2�O�|j�P�|j�Q�|�R|�|j�S�|jj�|�|j2�T�|jjj0�rtjU�V|jjj0�|jjj0|jjW�X�_Y|jjjZdk�r,|jjj[j\|jjjZd�t]�^d�dv�r�d}|jjW�_�D]}|j`�r\�qLd|_`d}�qL|jjja�s�d|jj_ad}|�r�t(�bt*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)Zdownloadzsystem-upgradeZreposyncZ
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.�<�mainZplugin� z%s rM)�colorz%_pkgverify_level)Z	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))cr
rh�aliasesZAliases�resolve�
option_parserZOptionParserr�Zparse_main_argsr5r4r�r�r;r:rCZhistory_record_packagesr	rzr��quietZ
debuglevelZ
errorlevelr�Z
VERBOSE_LEVELr�Z
_set_valueZsystem_cachedirZPRIO_DEFAULTr�r��_read_conf_filer��releasever_major�releasever_minorrZ_adjust_conf_optionsrRr�r}r=rr�IOErrorrr~�repr�filenameZdestdirrYr�Zset_enabledZset_disabledZ	sleeptimer*�sleep�randomZ	randrangeZadd_commandsr�Zinit_pluginsZ
disablepluginZenablepluginr�r�rJr�r�rr
�helpZparse_command_argsZallowerasingZ
allow_erasingZ_allow_erasingr�ZdebugsolverZdebug_solverr%Z
pre_configureZpre_configure_pluginsZ_activate_persistorr�Zconfigure_plugins�	configurerPZ
ensure_dirr�r�Zpkgdirrr7Zreinitr�ZexpandMacror�ZgpgcheckZlocalpkg_gpgcheckr>)	rFr�r
rr�rqr�Zforcingr�rrrr<s�
���
� 
�














�z
Cli.configurec
Csxtj�d�}|jj}|�d�|�d�|�d�}|�d�tjj	krft
j�|�sftj
�td��|���|jtjjd�|�d�}|�d�tjj	kr�d}|j}|j||�d�d�d}	d}
|dur�|jdur�tj�|j�\}}	}
n|dkr�tj�|�\}}	}
d	d
�}|||j�|_|||	|j�|_|||
|j�|_|jdu�rJt�td��dD]}|�|��qN|jj�|�|�|S)
NZconfigZconfig_file_pathzConfig file "{}" does not exist)�priorityZreposdir�varsdirrL)rcWs|D]}|dur|SqdSrsr)r�r�rrr�or_else�s
z$Cli._read_conf_file.<locals>.or_elsezPUnable to detect release version (use '--releasever' to specify release version))r�ZlogdirZ
persistdir) r
r��Timerr:rCZ_check_remote_fileZ_search_inside_installroot�
_get_valueZ
_get_priorityZPRIO_COMMANDLINEr[r\�isfilerRr�rr?�readZPRIO_MAINCONFIGZ
substitutionsZupdate_from_etcr�r�Zdetect_releaseversr^r
rr=r>Zprepend_installroot�_loggingZ_setup_from_dnf_conf)
rFr�r
rZtimerrCrZ	from_root�substZ	det_majorZ	det_minorr�optrrrr�s@



�
zCli._read_conf_file�eqcCs�|dur|durdSg}|js"|r,|�d�|js6|r@|�d�|jsJ|rT|�d�|js^|rh|�d�|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!rVr"r#r$r:Zadd_security_filtersr&r'r(r))rFr�Zcmp_typer�r%rrr� _populate_update_security_filters







�z$Cli._populate_update_security_filtercCs4|dur|jjj�|�|dur0|jjj�|�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)r:rZstdout_handlerZsetLevelZstderr_handler)rF�stdout�stderrrrr�redirect_loggerszCli.redirect_loggercCs.tjj�|�}||jj_|jj���|�dSrs)	r
rhrgZMultiFileProgressMeterr:r	r�r�r�)rF�forgrrr�redirect_repo_progress*s
zCli.redirect_repo_progresscCs�|jj��}|durdS|jj��j|jd�}|��}|jdd�|}|D]}||krJ|}qJ||kr|td|�td|�dS)N)r�r$)Z
advisory_typez,Security: %s is an installed security updatez-Security: %s is the currently running version)r:r0Zget_running_kernelr2r3rrr4)rFZkernel�qZikpkgrrrr�_check_running_kernel/szCli._check_running_kernelcCs*t|j���tj�td�||����dS)Nz)argument {}: not allowed with argument {})r4r��print_usager
rRrSrr?)rFZoption_string_1Zoption_string_2rrr�_option_conflictAs�zCli._option_conflictcCs8|jD],}||jvr(tj�td�|��||j|<qdS)zRegister a Command. :apizCommand "%s" already definedN)rr�r
rRr�r)rFrrrrrr�Fs

zCli.register_commandc	Cs�|��|jjjr8t�td�d�tt	|jjj����|jjj
rht�td�d�tt	|jjj
����|jj��D]h}|jr�t�td�|j
dd�tt	|j����|j
rtt�td�|j
dd�tt	|j
����qt|j��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: r�zIncludes in dnf.conf: zExcludes in repo z: zIncludes in repo )rr:rCZexcludepkgsr=r�rrnrar�Zincludepkgsr�r��idr��run)rFr�rrrr5Ms&
�
���zCli.run)N)NNN)r N)NN)r�r�r�rEr�r�rrrrr*r-rzr,r/r1r3r�r5rrrrr��s$3

9


r�)r)Qr�Z
__future__rrr�collections.abcr�ImportError�collectionsrr�rr�r�r[rr�rzr*r�Zlibdnf.transactionr_rr	Zdnf.clir
Zdnf.i18nrrr
Zdnf.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�



Zerion Mini Shell 1.0