%PDF- %PDF-
Mini Shell

Mini Shell

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

a

�2�h���@s\dZddlmZddlmZddlmZddlmZddlZddlZddlZ	ddl
mZddlm
Z
dd	lmZmZmZdd
lmZddlmZddlmZzdd
lmZWney�dd
lmZYn0ddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddl$Zddl%Zddl&Zddl'Zzddl(ZdZ)Wne�y\dZ)Yn0ddl*Zddl+Zddl,Zddl-Zddl.Zddl/Zddl0Zddl1Zddl2Zddl3Zddl4Zddl5ZddlZddl6Zddl7Z7ddl8Z8ddl9Z9ddl:Z:ddl;Z;ddl<Z<ddl=Z=ddl>Z>ddl?Z?ddl@Z@ddlAZAddlBZBddlCZCe;�Dd�ZEGdd�deF�ZGdd�ZHdS)z
Supplies the Base class.
�)�absolute_import)�division)�print_function)�unicode_literalsN)�deepcopy)�
CompsQuery)�_�P_�ucd)�_parse_specs)�
SwdbInterface)�misc)�SequenceTF�dnfc@s�eZdZd�dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Ze	dd��Z
dd�Zd�dd�Zdd�Z
edd��Zedd��Zedd��Zejdd��Zeej�d�dd ���Zed!d"��Zed#d$��Zed%d&��Zejd'd&��Zd(d)�Zd�d+d,�Zd-d.�Zd/d0�Zd1d2�Zd�d3d4�Z d�d6d7�Z!d�d8d9�Z"d:d;�Z#d<d=�Z$d�d>d?�Z%d�d@dA�Z&dBdC�Z'e(j)e(j*e(j+e(j,e(j-e(j.e(j/dD�Z0e1e(dE��r�e(j2e0dF<dGe(j3e(j4BiZ5edHdI��Z6edJdK��Z7e7jdLdK��Z7d�dMdN�Z8dOdP�Z9edQdR�dSdR�dTdR�dUdV�Z:dWdX�Z;dYdZ�Z<d[d\�Z=d]d^�Z>d_d`�Z?dadb�Z@d�dcdd�ZAd�dedf�ZBdgdh�ZCdidj�ZDdkdl�ZEd�dmdn�ZFd�dodp�ZGd�dqdr�ZHd�dsdt�ZIdudv�ZJdwdx�ZKdydz�ZLd�d|d}�ZMd�d~d�ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d�d��ZSd�d��ZTd�d�d��ZUd�d�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[d�d��Z\d�d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d�d��Zad�d�d��Zb�dd�d��Zc�dd�d��Zd�dd�d��Zed�d��Zfd�d��Zgd�d��Zh�dd�d��Zi�dd�d��Zj�dd�d��Zk�dd�d��Zl�dd�d��Zm�dd�d��Zn�d	d�d��Zod�dÄZp�d
d�dńZqd�dDŽZr�dd�dɄZsd�d˄Zt�dd�d̈́Zu�d
d�dτZv�dd�dфZwd�dӄZx�dd�dքZy�dd�d؄Zzd�dڄZ{d�d܄Z|d�dބZ}d�d�Z~d�d�Zd�d�Z�d�d�Z�d�d�Z�dS(�BaseNcCs�d|_|p|��|_d|_d|_d|_d|_d|_d|_t	j
��|_d|_
t�|_t�|_t	j��|_t	j��|_t	j��|_ttjg�|_t	j��|_d|_ d|_!d|_"g|_#i|_$d|_%t�|_&t'j(j)|_*d|_+dS)NF),�_closed�_setup_default_conf�_conf�_goal�_repo_persistor�_sack�_transaction�_priv_ts�_compsr�comps�TransactionBunch�_comps_trans�_history�set�
_tempfiles�_trans_tempfiles�callbackZDepsolve�_ds_callback�loggingZLogging�_logging�repodict�RepoDict�_repos�rpmZRPMPROB_FILTER_OLDPACKAGE�_rpm_probfilterZpluginZPlugins�_plugins�_trans_success�_trans_install_set�_tempfile_persistor�_update_security_filters�_update_security_options�_allow_erasing�_repo_set_imported_gpg_keys�libdnf�transactionZTransactionPersistence_UNKNOWN�_persistence�output)�self�conf�r8�,/usr/lib/python3.9/site-packages/dnf/base.py�__init__^s4
z
Base.__init__cCs|S�Nr8�r6r8r8r9�	__enter__|szBase.__enter__cGs|��dSr;��close)r6Zexc_argsr8r8r9�__exit__sz
Base.__exit__cCs|��dSr;r>r<r8r8r9�__del__�szBase.__del__cCs.|jr|j�|�n|jjrn|j�|�dSr;)rr �updater7�destdirr)r6�filesr8r8r9�_add_tempfiles�s
zBase._add_tempfilesc
Cs�|��td|jdd�}|jr&d|d<z|jj|jfddi|��WnVtjy�}z<t	�
td��|j
|��tj�td��|j
���WYd}~n
d}~00dS)NT�Zload_filelistsZload_prestoZload_updateinfo�
load_other�build_cache�loading repo '{}' failure: {}z"Loading repository '{}' has failed)�load�dict�deltarpm�load_metadata_otherr�	load_repo�_repo�hawkey�	Exception�logger�debugr�format�idr�
exceptions�	RepoError)r6�repo�mdload_flags�er8r8r9�_add_repo_to_sack�s��zBase._add_repo_to_sackcCsXtj��}|j}d|vrTtj�|j�\}}}||d<|durD||d<|durT||d<|S)N�
releaseverZreleasever_majorZreleasever_minor)rr7ZConf�
substitutionsr(Zdetect_releasevers�installroot)r7�substr\�major�minorr8r8r9r�s
�zBase._setup_default_confc
Cs�dd�|j��D�}z0|jj|j||jj|jjd|jj|jj	d�}Wn6t
jyz}ztj
�t|���WYd}~n
d}~00|r�t�tjj�|d��dS)NcSsg|]}|jr|j�qSr8)Zmodule_hotfixesrU��.0�ir8r8r9�
<listcomp>��z0Base._setup_modular_excludes.<locals>.<listcomp>F)Zupdate_onlyZdebugsolver�module_obsoletesr)�repos�iter_enabled�sackZfilter_modules�_moduleContainerr7r^Zmodule_platform_id�debug_solverrgrPrQrrV�Errorr
rR�warning�module�module_baseZformat_modular_solver_errors)r6Z
hot_fix_reposZ
solver_errorsrZr8r8r9�_setup_modular_excludes�s�
&�zBase._setup_modular_excludesFc
Cs�t|jj�}d|vr$tr$|��dSg}g}|�s0|j��D]�}|j|vrLq<t|j	�dkr�|j
��jdd�}t|j	�D]*}t
j�|�}|�|j|j
dddd��}qv|j|jd�|�|��|jf�|j
��jdd�}	t|j�D]*}
t
j�|
�}|	�|j|j
dddd��}	q�|	j|jd�|	r<|�|	|jf�q<d|v�r |j
��jdd�}t|jj	�dk�r�t|jj	�D],}t
j�|�}|�|j|j
dddd��}�qj|j
��jdd�}t|jj�D],}
t
j�|
�}|�|j|j
dddd��}�q�t|jj	�dk�r|j
�|�|j
�d�|�r |j
�|�|�rP|D]$\}
}|j
�|
�|j
�d|��q*|�rr|D]\}
}|j
�|
��qZ|�s�t�r�|��dS)	N�allrT��emptyF��
with_nevra�
with_provides�with_filenames��reponame�main)rr7Zdisable_excludes�WITH_MODULESrqrhrirU�lenZincludepkgsrj�query�filtermr�subject�Subject�union�get_best_query�append�applyZexcludepkgsZadd_includesZset_use_includes�add_excludes)r6�	only_mainZdisabledZ
repo_includesZ
repo_excludes�rZ
incl_queryZincl�subjZ
excl_queryZexclZ
include_query�
exclude_queryr~�repoidr8r8r9�_setup_excludes_includes�sp

�

�


�
�zBase._setup_excludes_includescCsN|jr:|jjs:dd�|j��D�}|jj�|�|j��|jrJ|j��dS)NcSs"g|]}|jr|j��r|j�qSr8)�metadatarOZ	isExpiredrU)rcr�r8r8r9re�s�z/Base._store_persistent_data.<locals>.<listcomp>)	rr7�	cacheonlyrhriZexpired_to_addrB�saver-)r6Zexpiredr8r8r9�_store_persistent_data�s
zBase._store_persistent_datacCs|jdur|jdd�|jS)NT)�arch_filter)r�
read_compsr<r8r8r9r�s
z
Base.compscCs|jSr;)rr<r8r8r9r7sz	Base.confcCs|jSr;�r'r<r8r8r9rh
sz
Base.reposcCs
d|_dSr;r�r<r8r8r9rhsZ
_priv_rpmconncCstjj�|jj�Sr;)rr(Z
connectionZ
RpmConnectionr7r^r<r8r8r9�_rpmconnsz
Base._rpmconncCs|jSr;)rr<r8r8r9rjsz	Base.sackcCsP|jdurtj�d��|jjdurHtj�d|jj	|jj
d|jj�|j_|jjS)NzSack was not initializedF�arch)rjrrVrmrkr2roZModulePackageContainerr7r^r]�
persistdirr<r8r8r9rks
�zBase._moduleContainercCs|jSr;)rr<r8r8r9r3'szBase.transactioncCs|jrtd��||_dS)Nztransaction already set)r�
ValueError�r6�valuer8r8r9r3,scCstj�|jj�|_dSr;)r�	persistorZ
RepoPersistorr7�cachedirrr<r8r8r9�_activate_persistor3szBase._activate_persistorr8cCs,|jjr|j�|j||�|j�||�dS)z&Load plugins and run their __init__().N)r7Zpluginsr*�_loadZ	_run_init)r6Z
disabled_globZenable_plugins�clir8r8r9�init_plugins6szBase.init_pluginscCs|j��dS)z#Run plugins pre_configure() method.N)r*Z_run_pre_configr<r8r8r9�pre_configure_plugins=szBase.pre_configure_pluginscCs|j��dS)zRun plugins configure() method.N)r*Z_run_configr<r8r8r9�configure_pluginsBszBase.configure_pluginscCs|j��dS)zRun plugins unload() method.N)r*Z_unloadr<r8r8r9�unload_pluginsGszBase.unload_pluginsc
Cs�|jj}|jdur|��|j}|r�tj��rDtd�}t�	|�dStj�
�durhtd�}t�	|�dS|dkr�td�}t�	|�dS|��}|dur�||kr�t�	td��dS|j�
�D]}|j�d�q�|j��s�t�	td��d	�|jj���dS|j��D]�}|��\}}	|	du�r0t�	td
�|j�nv|�r@|	dk�r^t�td�|j�|j��nH|�r�|	|k�r�td�}t�||j|	�|j��nt�td
�|j|	��q|�r�d|_|jddd�t�	td��dS)NzCMetadata timer caching disabled when running on metered connection.Fz:Metadata timer caching disabled when running on a battery.rz Metadata timer caching disabled.z"Metadata cache refreshed recently.�z*There are no enabled repositories in "{}".z", "z4%s: will never be expired and will not be refreshed.z&%s: has expired and will be refreshed.zC%s: metadata will expire after %d seconds and will be refreshed nowz!%s: will expire after %d seconds.T)�load_system_repo�load_available_reposzMetadata cache created.)r7Zmetadata_timer_syncrr�r�utilZon_metered_connectionrrR�infoZon_ac_power�since_last_makecacherh�valuesrOZsetMaxMirrorTries�_any_enabledrT�joinZreposdirriZ_metadata_expire_inrUrS�expireZreset_last_makecache�	fill_sack)
r6�timerZperiodr��msgr�rXr�Zis_cacheZ
expires_inr8r8r9�update_cacheLs^





�
�zBase.update_cacheTcCsbtj�d�}|jddd�tj�|�|_tj�|j	j
|j	j�}|���|dur~z|jjdd�Wnt
y||dkrx�Yn0|�r�g}d}t��}|j	jr�tjj��|j��D]�}z`|�|�|j��|kr�|j��}|j��|kr�|j��}t�td�|jtj�|j����Wq�tj j!�yx}	zD|j�"�|j#du�rD�t�$d	|	�|�%|j�|�&�WYd
}	~	q�d
}	~	00q�|�r�t�$td�d�'|��|j�(��r�|dk�r�|dk�r�t�)td
�t*j+t,|�d�tj�|��n|j�-��&�Wd
�n1�s0Y|j	}
|j�.|
j/|
j0|
j1�|�2�|�tj3�4|j�|_5|
j6|j5_6|j7�8�|jS)z'Prepare the Sack and the Goal objects. �
sack setupT�rj�goalF�rH�autor�%s: using metadata from %s.z	Error: %sN�Ignoring repositories: %s�, z-Last metadata expiration check: %s ago on %s.)Zseconds)9rr#�Timer�resetrj�_build_sackr�lock�build_metadata_lockr7r��exit_on_lockr��IOError�time�gpgkey_dns_verification�dnssec�RpmImportedKeys�check_imported_keys_validityrhrir[rOZgetTimestampZgetAgerRrSrrUr��normalize_time�getMaxTimestamprVrWr��skip_if_unavailablernr��disabler�r�r��datetimeZ	timedelta�intrr�
_configure�installonlypkgs�installonly_limit�allow_vendor_changer�r��Goalr�protect_running_kernelr*�run_sack)r6r�r�r�r��error_reposZmtsZager�rZr7r8r8r9r��sn


��
 �

�.

zBase.fill_sackc	Cs"tj�d�}|jddd�tj�|�|_tj�|j	j
|j	j�}|��x|dur~z|jjdd�Wnt
y||dkrx�Yn0g}|j	jr�tjj��|j��D]�}zj|jjddd�td|jdd�}|jr�d|d	<|jj|jfi|��t�td
�|jtj�|j� ���Wq�t!t"j#f�y�}z`|j$du�rNtj%�&td��'|j|���nt�td��'|j|��|�(|j�|�)�WYd}~q�d}~00q�|�r�t�*td
�d�+|��Wd�n1�s�0Y|j	}|j�,|j-|j.|j/�|�0�|�tj1�2|j�|_3|j4|j3_4|j5�6�|jS)a�
        Prepare Sack and Goal objects and also load all enabled repositories from cache only,
        it doesn't download anything and it doesn't check if metadata are expired.
        If there is not enough metadata present (repond.xml or both primary.xml and solv file
        are missing) given repo is either skipped or it throws a RepoError exception depending
        on skip_if_unavailable configuration.
        r�Tr�Fr�r�)ZthrowExceptZ
ignoreMissingrFrGr�rINr�r�)7rr#r�r�rjr�rr�r�r7r�r�r�r�r�r�r�r�rhrirOZ	loadCacherKrLrMrNrRrSrrUr�r�r��RuntimeErrorrPrQr�rVrWrTr�r�rnr�r�r�r�r�r�r�r�rr�r*r�)	r6r�r�r�r�rXrYrZr7r8r8r9�fill_sack_from_repos_in_cache�sb	���� �$

z"Base.fill_sack_from_repos_in_cachecCs�tj�|jj�|_|jjsl|�|j�|j	r\|j
�|j���|j�
�|jrl|�|j
�n|jj�|j
�|jjr�t�td��t�td�djtjjd��|jdur�|j��|��|��d|_	dS)NzRThe downloaded packages were saved in cache until the next successful transaction.z1You can remove cached packages by executing '%s'.z{prog} clean packages��progF)rr�ZTempfilePersistorr7r�r-Z	keepcache�_clean_packagesrr+r rBZget_saved_tempfilesrtr,Ztempfiles_to_addrRr�rrTr�Z	MAIN_PROGr�historyr?r��_closeRpmDBr<r8r8r9�_finalize_base�s2��
�
�

zBase._finalize_basecCsB|jr
dSt�tjjd�d|_|��|jdddd�d|_dS)ztClose all potential handles and clean cache.

        Typically the handles are to data sources and sinks.

        NzCleaning up.T)rjrhr�)	rrR�logrr#�DDEBUGr�r�r*r<r8r8r9r?sz
Base.closecCsdtjj�|j|�}|D]H}z|j�|�Wqtjjy\}zt�	|�WYd}~qd}~00qdS)z?Read repositories from the main conf file and from .repo files.N)
rr7�readZ
RepoReaderrh�addrVZConfigErrorrRrn)r6Zopts�readerrXrZr8r8r9�read_all_repos*szBase.read_all_reposcCs�|r
d|_|rtj��|_|r�d|_|jdurJtj�|j�|_|jj	|j_	|jr`|j
r`|j
��|jdurt|j
��tj��|_d|_g|_|r�|r�t��dS)z1Make the Base object forget about various things.N)rrr%r&r'rr�r�r7r�rkZrollbackrr�r?rrrrr.�gcZcollect)r6rjrhr�r8r8r9r�5s$



'z
Base.resetcCs|`dS)z6Closes down the instances of rpmdb that could be open.N)�_tsr<r8r8r9r�rszBase._closeRpmDB)Z	noscriptsZ
notriggersZnodocs�testZjustdbZ
nocontexts�nocrypto�RPMTRANS_FLAG_NOCAPSZnocapsr�cCs|jSr;)rr<r8r8r9r��sz	Base.goalcCs�|jdur|jStjj�|jj�|_|j�d�|jjD]V}|j	�
|�}|durbt�t
d�|�q8|j�|�|j�
|�}|dur8|j�|�q8|jjs�|j�tj�|jjr�|j�tj�t�tj|jd�}|j�|�|jS)zMSet up the RPM transaction set that will be used
           for all the work.Nrz!Invalid tsflag in config file: %s)rrr(r3ZTransactionWrapperr7r^�setFlagsZtsflags�_TS_FLAGS_TO_RPM�getrR�criticalrZ	addTsFlag�_TS_VSFLAGS_TO_RPM�pushVSFlagsZdiskspacecheckr)r�ZRPMPROB_FILTER_DISKSPACEZ
ignorearchZRPMPROB_FILTER_IGNOREARCH�	functools�reduce�operator�or_Z
setProbFilter)r6�flagZrpm_flagZvs_flagZ
probfilterr8r8r9r��s,
�zBase._tscCs&|jdurdS|j��|`d|_dS)z"Releases the RPM transaction set. N)rr?r<r8r8r9r��s


c
Cs�tj�d�}tj��|_t�tjjd�|j	�
�D�](}|js@q2|jsHq2|j
��}|sXq2t�tjjd|j�tj�tj�|�d�}tj�|d�}d}z.tj�|�s�tj|dd�tj||d	d
�Wn8ttjjfy�t��}|j}tj||dd
�Yn0z|j�|�WnBtjj�yN}z$t d�}	t�!|	|j|�WYd}~n
d}~00|r2|�"�q2|�r||jj#�$|j%j&d
g�|�|jS)z6Create the groups object to access the comps metadata.z
loading compszGetting group metadataz%Adding group file from repository: %s�genz
groups.xmlNi�)�modeT)�destZcheck_timestampsFz1Failed to add groups file for repository: %s - %s�basearch)'rr#r�rZCompsrrRr�r�rhriZenablegroupsr�rOZ
getCompsFnrU�os�pathr��dirname�exists�makedirsr
�
decompress�PermissionErrorrVZ	MiscError�tempfileZNamedTemporaryFile�nameZ_add_from_xml_filename�
CompsErrorrr�r?Z_ir�rr])
r6r�r�rXZcomps_fnZgen_dirZgen_fileZ	temp_filerZr�r8r8r9r��sL

�&
�zBase.read_compscCs*|jdur$|jj}t|jj|d�|_|jS)zeauto create the history object that to access/append the transaction
           history information. N)r\)rr7r\rr�)r6r\r8r8r9�_getHistory�s
zBase._getHistorycCs|��Sr;)r�r<r8r8r9�<lambda>�rfz
Base.<lambda>cCst|d|�S�Nr��setattrr�r8r8r9r�s�cCst|dd�Srrr<r8r8r9r�rfzDNF SWDB Interface Object)�fget�fset�fdel�doccs:�jj}t|�������}|��|����}|��D]H�|���}|d}�j	�
|d��j	�
�d�|��||dd��q8|��D]t��j	�
�d�|���}t
��}g}|D](}	t
|	�|kr�|�d|	�q�|�|	�q�|d}
|��|
|dd��q�|��D]���j	�
�d�|���}��fdd�|D�}|���}�|v�rf|j�jd	��rf|���}|D](}|�|�}
tj�||
�d
k�rj|
}�qj|��||��fdd�}tj�||��q|��D]ȉ|���}d}|D]}|j�jk�r�|}�q��q�|du�r|�d�}n
|�|���fd
d�|D�}�fdd�}tj�||��|v�rd|��|�n|��||��j	�
|d��j	�
�d��q�|� �}|�r6�j!j"t#j$d���}|j%|d�|��|D]h�|j�j�j&d�}|�r|d}|�|��j�'||�|���j	�
�d�|���}|�(�|��q�|S)Nr�dd�dr�r�rdcs$g|]}|�vs|j�jkr|�qSr8�r�rb��
all_obsoleted�pkgr8r9rerfz*Base._goal2transaction.<locals>.<listcomp>r
���cs�j�|d�S�NZod�r"�	pkg_added�r
r<r8r9rrfz(Base._goal2transaction.<locals>.<lambda>cs$g|]}|�vs|j�jkr|�qSr8r
rbrr8r9re+rfcs�j�|d�Srrrr<r8r9r-rfZud�u��flags)Zpkg__neq�r�r�rZ))r�r(rZlist_obsoleted�_get_installonly_queryr��	installed�list_downgradesZobsoleted_by_packager"rZ
add_downgrade�list_reinstalls�str�insertr�Z
add_reinstall�
list_installs�
get_reason�filterr�r2r3ZTransactionItemReasonCompareZadd_installrr�Zmapall�
list_upgrades�pop�removeZadd_upgradeZ
list_erasuresrjr~rP�IGNORE_EXCLUDESrr��
set_reasonZ	add_erase)r6r��tsZinstallonly_queryZinstallonly_query_installedZobsZ
downgradedZ	nevra_pkg�	obsoletesZobs_pkgZreinstalled�reasonZobsoleteZreason_obsolete�cbZupgradedrdZerasuresZremaining_installed_queryZtmp_remaining_installed_queryZ	remainingr8)rr
r6r9�_goal2transaction�s�












zBase._goal2transactioncCs`|��}|��}|����}g}g}|D].}||vrH|�||d�q(|�||�q(||fS)aJ See what packages in the query match packages (also in older
            versions, but always same architecture) that are already installed.

            Unlike in case of _sltr_matches_installed(), it is practical here
            to know even the packages in the original query that can still be
            installed.
        r)r�_na_dict�	availabler�)r6�q�instZ
inst_per_archZavail_per_archZavail_lZinst_lZnar8r8r9�_query_matches_installedEszBase._query_matches_installedcCs"|j����j|��d�}t|�S)z� See if sltr matches a patches that is (in older version or different
            architecture perhaps) already installed.
        r)rjr~rr�matches�list)r6�sltrr-r8r8r9�_sltr_matches_installedYszBase._sltr_matches_installedcs�fdd��j����D�S)z5Get iterator over the packages installed by the user.c3s|]}�j�|�r|VqdSr;)r�Zuser_installed�rcr
r<r8r9�	<genexpr>bs�z*Base.iter_userinstalled.<locals>.<genexpr>)rjr~rr<r8r<r9�iter_userinstalled`szBase.iter_userinstalledcCs0|j||jj|jjd�}|jjr,|�d�|S)N)�allow_uninstall�
force_bestZignore_weak_depsz./debugdata/rpms)�runr7�bestZinstall_weak_depsrlZwrite_debugdata)r6r��
allow_erasing�retr8r8r9�_run_hawkey_goales�
zBase._run_hawkey_goalcCsb|j��|jjr|j��|jjD]8}tj�|�}|j|j	dddd�}|�
�}|j�|�q$dS)z�
        Add exclude_from_weak from configuration and autodetect unmet weak deps exclude them from candidates to satisfy
        weak dependencies
        TFruN)rZreset_exclude_from_weakr7Zexclude_from_weak_autodetectZexclude_from_weakrr�r�r�rjr+Zadd_exclude_from_weak)r6Zweak_excluder�r~r8r8r9�_set_excludes_from_weak_to_goalms

z$Base._set_excludes_from_weak_to_goalc	Cs|d}|��tj�d�}|j��|j}|��rJ|�|j	�
���|j�n|j
jsd|��}|�|�|�|j	�
�j|j
jd��|��|�||�s�|j
jdkr�|��tj�|���}tj�|�}n|�|�|_|j��|�|jduo�t |j�dk}|�r|j�!�}|�rtj�"|�}|du�r*|�|j#�$�|j�%�}||j�&�7}||j�'�7}||j�(�7}|j	�)|j*|�|S)zBuild the transaction set.NZdepsolver
�r)+�_finalize_comps_transrr#r�r"�startrZ
req_has_eraseZpush_userinstalledrjr~rr�r7Zupgrade_group_objects_upgrade�_build_comps_solverZ'_exclude_packages_from_installed_groupsZ
add_protectedrZprotected_packagesr=r<�
debuglevelZ
log_decisionsr��_format_resolve_problems�
problem_rulesrVZ
DepsolveErrorr)r�endr}Z_rpm_limitationsrmr*Zrun_resolvedrr rrZset_modules_enabled_by_pkgsetrk)	r6r:�excr�r��solverr�Zgot_transactionZnew_pkgsr8r8r9�resolve|sP
�
�

�



zBase.resolvecCsrt|t�s|g}tjj��gt|�}|js�|j�	�|j�
�|jr�|jjsV|jj
r�d}t|d�rx|jrxd�|j�}nt|d�r�|jr�d�|j�}|j��}|dur�|j��}n|j}|jj|gg||jd�|j�|�|j��|j��d|_dSd}t�t d��tj!�"|j#j$|j#j%�}|���|j�&|j�|�'�}|�rzt d�}t�(|�|D]}t�(|��q\tj)�*|��t�t d��tj+�,d	�}	t�t d
��|j�-�|j�.�tjjj/|dd�}
|j�0|
�}t1|�dk�rV|
�2�D]}t�3t d
��4|���q�t d�d}|D]}
|dt5|
�7}�q|�6|�}|�rJ|d|7}tj)�7|��~
t�t d��|j�8t9j:��r�Wd�dS|	�|j�	�|j�
�tj+�,d�}	tjjj/||d�}|j#j;dk�r�|j<D]}d|_=�q�|j��t�t d��|j>|d�}Wd�n1�s0Y|	�|j�?|j�|j��dd�}tj@�A||j|�D]}t�B|��q\|S)N�args� �cmds)�cmdline�persistenceTzRunning transaction checkz%Error: transaction check vs depsolve:zTransaction check succeeded.ztransaction testzRunning transaction test)r�r�RPM: {}zTransaction test error:�
z  %s
zTransaction test succeeded.r3)�displays�FzRunning transaction)r(cSs(g}|D]}|�d�|t|���q|S)Nz{}: {})r�rTr)�actionZtsis�msgs�tsir8r8r9�
_pto_callbacksz*Base.do_transaction.<locals>._pto_callback)C�
isinstancerrZyumZrpmtransZLoggingTransactionDisplayr0r3rkr�ZupdateFailSafeDatar�group�env�hasattrrIr�rKr��lastr��dbCookie�end_rpmdb_version�begr4rEr*Zrun_pre_transactionZrun_transactionr+rRr�rr�Zbuild_rpmdb_lockr7r�r�Z_populate_rpm_ts�_run_rpm_check�errorrVZTransactionCheckErrorr#r��orderZcleanZRPMTransactionr�r}�messagesr�rTr
�_trans_error_summaryrm�isTsFlagSetr(�RPMTRANS_FLAG_TESTrBrPr5�_run_transactionZunload_removed_pluginsr�Z_post_transaction_outputrS)r6ZdisplayrL�oldZ
rpmdb_version�tidr�rSr�r�ZtestcbZtserrors�	errstringZdescr�summaryr(Zdisplay_rUr8r8r9�do_transaction�s�
�




�








,
zBase.do_transactioncCs�d}t�d�}i}|�|�D]t}|�d�dkr<t|�d��nt�t|�d��d�}|�d�|vrp|||�d�<||�d�|kr|||�d�<q|r�|td�d	7}|D],}|d
tdd||��	|||�d	7}q�|s�dStd
�d|}|S)z�Parse the error string for 'interesting' errors which can
        be grouped, such as disk space issues.

        :param errstring: the error string
        :return: a string containing a summary of the errors
        �z9needs (\d+)(K|M)B(?: more space)? on the (\S+) filesystemrQ�Mr�g�@�zDisk Requirements:rOz   z7At least {0}MB more space needed on the {1} filesystem.Nz
Error Summaryz
-------------
)
�re�compile�finditerrWr��mathZceilrr	rT)r6rhri�pZdisk�mZ
size_in_mb�kr8r8r9rb#s6
 ����zBase._trans_error_summarycCs|jjo|j�tj�Sr;)r7Zhistory_recordr�rcr(rdr<r8r8r9�_record_historyEs�zBase._record_historyc
Cs�d}|��r�t|jj�}|j����}|j|d���}|j	�
�}|j��}|durX|j
}|dush||kr�t�td�jtjjd��d}t|d�r�|jr�d�|j�}nt|d�r�|jr�d�|j�}|jjr�|jjnd}	|jj||g||	|jd	�}|jj�r*t�d
�}
|
�r*zt�|
�Wnd
}
Yn0t�tj j!d�|j	�|j"d�}t�tj j!d�|jj�r�zt�|
�WnYn0tj�#|j	|j$�|du�r�n�t%|�d
k�r�d
d�|j	D�}|�sb|�&�D]}
t�'td��|
���q�td�}
tj(�)|
��nft�'td��|D]}t�'t*|d
���q|���rN|j	�+t,j-��sN|j�.|�td�}
tj(�)|
��dD]X}t||��rft/||�}zt0�1|�Wn,t2t3f�y�td�}
t�'|
|�Yn0�qft4|j$j5�|_6|j	�+t,j-��s�|�7|j8�|S)zh
        Perform the RPM transaction.

        :return: history database transaction ID or None
        Nr
z RPMDB altered outside of {prog}.r�rIrJrKrk)rL�commentrMrzRPM transaction start.zRPM transaction over.cSsg|]}|��r|�qSr8)ZFailed)rc�elr8r8r9re�rfz)Base._run_transaction.<locals>.<listcomp>rNzCould not run transaction.zTransaction couldn't start:)Z	ts_all_fnZ
ts_done_fnz$Failed to remove transaction file %s)9rur0r7Zhistory_record_packagesrjr~rrr8r�r[r�rZr\rRrSrrTrr�ZMAIN_PROG_UPPERrYrIr�rKrvr]r4Z
reset_nicer��nicer�r#r�r!Z_sync_rpm_trans_with_swdbrr}rar�rVrmr
rcr(rdrE�getattrr
�unlink_fr��OSError�bool�install_setr,�_verify_transactionZverify_tsi_package)r6r(rgZusing_pkgs_pats�installed_queryZ
using_pkgs�rpmdbvZlastdbvrLrvZonice�errorsZfailedr�rZrd�fnr8r8r9reIs�

��





zBase._run_transactioncs�dd�|jD�}t|����fdd�}tj�d�}d}tj�|�}|����}t	dd�|D��}|j
jD]8}	|	��}
|
�
�D]"}|��|vr||�d�|��q|qh|D]}||j|�}q�|j��}
|j
�|
�|�d|_dS)	NcSsg|]}|jtjjkr|�qSr8)rRr2r3Z#TransactionItemAction_REASON_CHANGE�rcrTr8r8r9re�s�z,Base._verify_transaction.<locals>.<listcomp>cs |d7}�dur�||��|S�Nr�r8)r
�count��total�
verify_pkg_cbr8r9�display_banner�sz0Base._verify_transaction.<locals>.display_bannerzverify transactionrcSsg|]
}|j�qSr8r
rbr8r8r9re�rfT)r3r}rr#r�rj�
rpmdb_sackr~rrr�rWZgetCompsGroupItemZgetPackages�getNameZsetInstalledr�r
r�r[rEr+)r6r�Ztransaction_itemsr�r�r�r�r,�namesZti�grrrTr�r8r�r9r~�s,�

zBase._verify_transactioncs|tj�|jj|jj�}|���t��}tdd�|D��}tdd�|D��}	�j	j
jdkrn�j	t|�||	d�n��	t|�|�tj�
|||�����r�tj������t�fdd�|D��}
tj�d|�j�}|jj}|d	k}
�j�r�|
s�|d	k�r�|d	k�r|d
8}td�}t�|�dd��jD�}�fd
d�|D�}tdd�|D��}��	t|�|�tj�
|||������r�tj������|
t�fdd�|D��7}
tj�||i�}qވj�r�tjj��j�}t�|�Wd�n1�s�0Y|du�r||
|�|\}}||k�rx||k�r>td�}d||d}n"||k�r`td�}d||d}t�||d|d|�dS)Ncss|]}|jVqdSr;�Z
download_size�rcZploadr8r8r9r4�rfz1Base._download_remote_payloads.<locals>.<genexpr>cSsg|]}t|tjj�r|�qSr8)rVr�drpmZDeltaPayload)rcZpayloadr8r8r9re�rfz2Base._download_remote_payloads.<locals>.<listcomp>�)Ztotal_drpmsc3s|]}��|�VqdSr;�Z_bandwidth_usedr��r�r8r9r4�s�)rrrr�z,Some packages were not downloaded. Retrying.cSsg|]}|�qSr8r8r3r8r8r9re�rfcs g|]}tj�|�tjj��qSr8)rrX�_pkg2payload�
RPMPayloadr3)�progressr8r9re�s�css|]}|jVqdSr;r�r�r8r8r9r4�s�c3s|]}��|�VqdSr;r�r�r�r8r9r4�rfz?Delta RPMs reduced %.1f MB of updates to %.1f MB (%.1f%% saved)�dzIFailed Delta RPMs increased %.1f MB of updates to %.1f MB (%.1f%% wasted)i)rr�Zbuild_download_lockr7r�r�r��sumr}r@�__code__�co_argcountrXZ_download_payloadsZ_irrecoverablerVZ
DownloadErrorZ_update_savingZ_recoverable�retriesrrRr�Z
errmap2str)r6�payloadsr�r��callback_totalZ	fail_fastr�Zbeg_downloadZest_remote_sizeZ
total_drpmZremote_sizeZsavingr�Zforeverr�Zremaining_pkgs�realZfull�percentr8)r�r�r9�_download_remote_payloads�st��
�


���
��*




zBase._download_remote_payloadsc	s�|�|�\}}|rz�dur$tj���tj�|j�����|j	j
��|�dd�|D����fdd�|D�}|�|��|�|j	j
r�|D]P}|jr�tj�|��|j�d��}ntj�|jj|j�d��}t�||j	j
�q�dS)aDownload the packages specified by the given list of packages.

        `pkglist` is a list of packages to download, `progress` is an optional
         DownloadProgress instance, `callback_total` an optional callback to
         output messages about the download operation.

        NcSsg|]}|���qSr8)�localPkgr3r8r8r9re#rfz*Base.download_packages.<locals>.<listcomp>cs$g|]}tj�|��jtjj��qSr8)rrXr�Z
delta_factoryr�r3�r�r�r8r9re$s���/)�_select_remote_pkgsrr!ZNullDownloadProgressr�Z	DeltaInforjr~rr7Zdeltarpm_percentagerEr�rCZbaseurlr�r�r�Zget_local_baseurl�location�lstriprXZpkgdir�shutil�copy)	r6Zpkglistr�r��remote_pkgsZ
local_pkgsr�r
r�r8r�r9�download_packagess(	
��
�zBase.download_packagescCs�g}|s|S|j��r&tj�td���g}|D]�}tj�|�sdd|vrdtj	�
||j|�}|�|g�z|�
|j�|��Wq.ty�}z t�|�|�
|�WYd}~q.d}~00q.|jdd�|r�|r�ttd��d�|����|S)NzACannot add local packages, because transaction job already existsz://T)r�zCould not open: {}rJ)rZ
req_lengthrrVrmrr�r�r�r�Z_urlopen_progressr7rEr�rjZadd_cmdline_packager�rRrnr�rTr�)r6�	path_list�strictr��pkgsZ
pkgs_errorr�rZr8r8r9�add_remote_rpms2s*
�
"zBase.add_remote_rpmscCs|jr|jj}d}n|j|j}|j}|j}|�r|jj}tj	j
�|�}tj	j�
||���}tj�|���}~|dkr�d}	d}
n�|dkr�|r�d}	nd}	td�|}
n\|dkr�d}	td�|}
nB|dkr�|r�d}	nd}	d}	td�|}
n|d	k�rd}	td
�|}
nd}	d}
|	|
fS)a�Verify the GPG signature of the given package object.

        :param po: the package object to verify the signature of
        :return: (result, error_string)
           where result is::

              0 = GPG signature verifies ok or verification is not required.
              1 = GPG verification failed but installation of the right GPG key
                    might help.
              2 = Fatal GPG verification error, give up.
        rrkr�rQz"Public key for %s is not installedzProblem opening package %srmz Public key for %s is not trustedr�zPackage %s is not signed)�
_from_cmdliner7Zlocalpkg_gpgcheckrhr�Zgpgcheck�gpgkeyr^rr(r3�initReadOnlyTransactionZ	miscutilsZcheckSigr�r�r��basenamer)r6�po�checkZ	hasgpgkeyrX�rootr%Z	sigresultZlocalfn�resultr�r8r8r9�_sig_check_pkgJsF

zBase._sig_check_pkgcCs
|�|�S)a�Verify the GPG signature of the given package object.

        :param pkg: the package object to verify the signature of
        :return: (result, error_string)
           where result is::

              0 = GPG signature verifies ok or verification is not required.
              1 = GPG verification failed but installation of the right GPG key
                    might help.
              2 = Fatal GPG verification error, give up.
        )r��r6r
r8r8r9�package_signature_check�s
zBase.package_signature_checkc	Csh|D]^}tj�|�sqzt�|�Wn&tyJt�td�|�YqYq0t�	t
jjtd�|�qdS)NzCannot remove %sz
%s removed)
r�r�r�r
rzr{rRrnrr�rr#r�)r6�packagesr�r8r8r9r��s

�zBase._clean_packagesrrcCsv|dur|jj}|dur*|�|||||�Stj|j||||d�}|dusTt|�dkr\|d�St||�}t�dd�|�S)aRReturn a :class:`misc.GenericHolder` containing
        lists of package objects.  The contents of the lists are
        specified in various ways by the arguments.

        :param pkgnarrow: a string specifying which types of packages
           lists to produces, such as updates, installed, available,
           etc.
        :param patterns: a list of names or wildcards specifying
           packages to list
        :param showdups: whether to include duplicate packages in the
           lists
        :param ignore_case: whether to ignore case when searching by
           package names
        :param reponame: limit packages list to the given repository
        :return: a :class:`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
        N)�showdups�ignore_caserzrcSs
|�|�Sr;)Zmerge_lists)�a�br8r8r9r�rfz(Base._do_package_lists.<locals>.<lambda>)r7Zshowdupesfromrepos�
_list_patternr��partialr}�mapr�)r6�	pkgnarrow�patternsr�r�rzZlist_fnZyghsr8r8r9�_do_package_lists�s
��
zBase._do_package_listsc&sl��fdd���fdd�}�fdd�}tj|d�}g}	g}
g}g}g}
g}g}g}g}g}|}�j��}|dur�tjj||d�}|j�jd	d
�}|dk�r�i}i}|��D]<}|||j	<|r�q�|j
|jf}||vs�|||kr�|||<q�t||�
���}	||���}|�s|jdd
�}|D]�}|�rH|j	|v�r<|�|�n
|
�|�nT|j
|jf}|j	|v�rl|�|�n0||v�s�|�||��r�|
�|�n
|�|��q�n�|dk�r�||�jdd�}
�j|
dd�}
|
jddgd�|
����}
�n@|dk�r
t||����}	�n"|dk�r.|�r�||���}|����}|D]T��j
�jf}|�|g�}�fdd�|D�}t|�dk�r~|���n
|
����q6n�||���jdd
���}|������}|D]p\} }!|| |!fd�|�| |!fdg�d}"|"�r���|"��r|
���n"��|"��r|���n
|����q�n�|dk�rT||���jj�}#|#��}n�|dk�rv�fdd�|��D�}n�|dk�r�|��}$|�j���j|$d�}�j|d	dd�}|jddgd�g}|D],��j}%|��fdd�|$j|%d �D���q�n6|d!k�r,|��}|�s|jdd
�}||�� �j!j"�}|	|_|
|_||_#||_$|
|_%||_||_&||_"||_||_'|S)"Ncs�durdS�j�|��kS)z:Test whether given package originates from the repository.NT�r�rX)�package�rzr6r8r9�is_from_repo�sz(Base._list_pattern.<locals>.is_from_repocs�fdd�|D�S)�=Filter out the packages which do not originate from the repo.c3s|]}�|�r|VqdSr;r8)rcr��r�r8r9r4�rfz=Base._list_pattern.<locals>.pkgs_from_repo.<locals>.<genexpr>r8)r�r�r8r9�pkgs_from_repo�sz*Base._list_pattern.<locals>.pkgs_from_repocs�dur|S|j�d�S)r�Nry)r)r~ryr8r9�query_for_repo�sz*Base._list_pattern.<locals>.query_for_repo)�iter�r�F)rwrrT�Zlatest_per_arch_by_priority�upgrades)Zupgrades_by_priority)�upgrade�src�nosrc�Z	arch__neqrr+csg|]}|j�jkr|�qSr8)�evrr3)�	avail_pkgr8r9re%s�z&Base._list_pattern.<locals>.<listcomp>r�
autoremove�extrascsg|]}�|�r|�qSr8r8r3r�r8r9reArfr&)Zobsoletes_by_priority)rnr�csg|]}�|f�qSr8r8)rcrf)�newr8r9rePrf��provides�recent)(r
Z
GenericHolderrjr~rr�r�r�rZpkgtupr�r�r0r�r+rr�Zevr_gt�_merge_update_filters�latestr8r*r�r}Zevr_eq�	_unneededr��swdbr�rr&�extendZ_recentr7r��reinstall_available�
old_available�updates�obsoletesTuplesr�)&r6r��patternr�r�rzr�r�Zyghrr+r�r�r�r&r�r�r�r�Zicr,r�ZdinstZndinstr��keyZavailr
Zinstalled_dict�installed_pkgsZsame_verZavailable_dictr�r�Zinst_pkgZautoremove_qr-Zobsoleted_reldepsr8)r�r�r�rzr6r9r��s�






��




��

��

zBase._list_patterncCs|j|7_t|�Sr;)rr})r6�transr8r8r9�_add_comps_transgszBase._add_comps_transcs�|��}|sdS|j�jjdd�}|j�fdd�|D�d�}|�|�}|D]}�j�|tjj	�qJ|�
|�}|�
|�}|r�|D]}�jj|�j
jd�q~dS)z�
        Mark to remove packages that are not required by any user installed package (reason group
        or user)
        :param query: dnf.query.Query() object
        NF�rlcs g|]}�jj�|j�r|�qSr8)r�rWZis_removable_pkgr�rbr<r8r9rewrfz,Base._remove_if_unneeded.<locals>.<listcomp>r��
clean_deps)rZ_safe_to_remover�r�r�
differencer$r2r3Z TransactionItemReason_DEPENDENCY�intersectionr�eraser7�clean_requirements_on_remove)r6r~Z
unneeded_pkgsZunneeded_pkgs_historyZpkg_with_dependent_pkgsr
Zremove_packagesr8r<r9�_remove_if_unneededks�


zBase._remove_if_unneededcs:�j}�jjd}�fdd�}�fdd�}dd�}�j��jdd	�}|jtj|dd
�f|j	tj|dd
�f|j
|f|j|ff}|D]�\}}	|D]�}
d|
ji}|
j
r�|�d
|i��j��jfi|����}|jddgd�|�s|
j}
|
j
r�|
d|7}
t�td��|
��q�|	|||
�}�jj�|
j�q�q���|�dS)Nr�cs,tj��j�}|j|d��jj|d�|S)Nr��select)r�selector�Selectorrjrrr�)r~�remove_query�	comps_pkgr1r<r8r9�
trans_upgrade�sz1Base._finalize_comps_trans.<locals>.trans_upgradecs�jjdkrr|js"�j||d�nN|����}��|�tj�	�j
�}|jd�|j
|j�d��jj||d�n�tj�	�j
�}|jr�|jd�|j
|j�d�nV�jjr�|��r�|��j
��j|d��}n |��j
��j|jdd�d��}|j|d	��jj||d�|S)
Nrr�r�z
({} if {})r��r�Zoptional�r&Tr�r)r7�multilib_policyZrequires�_install_multiarchrr��_report_already_installedrr�r�rjrrTr�r�installr&r�r~rr)r~r�r�r�rr1r<r8r9�
trans_install�s(

�z1Base._finalize_comps_trans.<locals>.trans_installcSs|�|�}|Sr;)r�)r~r�r�r8r8r9�trans_remove�s
z0Base._finalize_comps_trans.<locals>.trans_removeTrsr�Fr�r�r�r�r��.zNo match for group package "{}")rr7r]rjr~rrr�r��install_optr�r"r�ZbasearchonlyrBr�rRrnrrTrZ
group_membersr�r�)r6r�r�r�rrr�Zattr_fn�attrr�r�Z
query_argsr,Zpackage_stringr8r<r9r?�s6 �
zBase._finalize_comps_transcs �fdd�}tj��j�j|�S)NcsR�j����j|d�}|sdSz�jj�|d�WStyLtj	j
YS0dS)Nr
r)rjr~rrr�r(r�AttributeErrorr2r3ZTransactionItemReason_UNKNOWN)Zpkgnamer,r<r8r9�	reason_fn�sz+Base._build_comps_solver.<locals>.reason_fn)rrZSolverr�r)r6rr8r<r9rA�s	zBase._build_comps_solvercCsH|��}t|t�stj�|�}|�|||p.t�||�}|s>dS|�|�S)a&Installs packages of environment group identified by env_id.
        :param types: Types of packages to install. Either an integer as a
            logical conjunction of CompsPackageType ids or a list of string
            package type ids (conditional, default, mandatory, optional).
        r)	rArVr�r2r3�listToCompsPackageTypeZ_environment_installrr�)r6�env_id�types�excluder��exclude_groupsrGr�r8r8r9�environment_install�s
zBase.environment_installcCs|��}|�|�}|�|�Sr;)rAZ_environment_remover��r6r	rGr�r8r8r9�environment_remove�s
zBase.environment_removec
s��fdd��d}|r2�fdd�|D�}tj�|�}���}t|t�sPtj�|�}|�	||||�}|shdS|rt|j
}	n|j}	t�
td�||	���|�S)anInstalls packages of selected group
        :param pkg_types: Types of packages to install. Either an integer as a
            logical conjunction of CompsPackageType ids or a list of string
            package type ids (conditional, default, mandatory, optional).
        :param exclude: list of package name glob patterns
            that will be excluded from install set
        :param strict: boolean indicating whether group packages that
            exist but are non-installable due to e.g. dependency
            issues should be skipped (False) or cause transaction to
            fail to resolve (True)
        cs6tj�|�r,�j��j|d�}tdd�|�S|fSdS)N�Z
name__globcSs|jSr;r
)rrr8r8r9rrfzABase.group_install.<locals>._pattern_to_pkgname.<locals>.<lambda>)rr��is_glob_patternrjr~rr�)r�r,r<r8r9�_pattern_to_pkgname�sz/Base.group_install.<locals>._pattern_to_pkgnameNcsg|]}�|��qSr8r8)rcrr)rr8r9rerfz&Base.group_install.<locals>.<listcomp>rz#Adding packages from group '%s': %s)�	itertools�chain�
from_iterablerArVr�r2r3rZ_group_installrrrRrSrr�)
r6�grp_idZ	pkg_typesrr�Zexclude_pkgnamesZnested_excludesrGr�Zinstlogr8)rr6r9�
group_install�s$


�zBase.group_installcCs�t|j|jtjtjBtj�}d}d}|D]�}	z|�|	�}
WnFtjj	y�}z*t
�t|��d}WYd}~q(WYd}~n
d}~00|
j
D]&}|r�||vr�||j||||d�7}q�|
jD]}
||j|
||||d�7}q�q(|s�|r�tj�td���|S)NrTF)rr�)rr�rzNothing to do.)rrr��ENVIRONMENTS�GROUPS�	AVAILABLEr�rrVr�rRr_r
�groupsr�environmentsr
rmr)r6r�r
r�rrr,�cnt�doner��res�errZgroup_idr	r8r8r9�env_group_installs,�"

�zBase.env_group_installcCs|��}|�|�}|�|�Sr;)rAZ
_group_remover��r6rrGr�r8r8r9�group_remove0s
zBase.group_removec
Cs�t|j|jtjtjBtj�}z|j|�}WnHtjj	yr}z,t
�dt|��tj�
td���WYd}~n
d}~00d}|jD]}||�|�7}q~|jD]}||�|�7}q�|S)NzWarning: %szNo groups marked for removal.r)rrr�rr�	INSTALLEDr�rrVr�rRr_r
rmrrrrr#)r6r�r,rr rrX�grpr8r8r9�env_group_remove7s

�&

zBase.env_group_removec
Csbt|j|jtjtjBtj�}d}|D�]}z|�|�}WnBtjj	yz}z&t
�t|��WYd}~q$WYd}~n
d}~00|j
D]Z}z|�|�d}Wq�tjj	y�}z&t
�t|��WYd}~q�WYd}~q�d}~00q�|jD]\}z|�|�d}Wq�tjj	�y>}z&t
�t|��WYd}~q�WYd}~q�d}~00q�q$|�s^td�}	tj�|	��dS)NFTzNo group marked for upgrade.)rrr�rrr$r�rrVr�rRr_r
r�environment_upgrader�
group_upgraderr�ZCliError)
r6r�r,Zgroup_upgradedr�rr rXr%r�r8r8r9�env_group_upgradeGs8

�
"

$

&zBase.env_group_upgradecCs|��}|�|�}|�|�Sr;)rAZ_environment_upgrader�rr8r8r9r'ds
zBase.environment_upgradecCs|��}|�|�}|�|�Sr;)rAZ_group_upgrader�r"r8r8r9r(ks
zBase.group_upgradecCs�|jjd}tj�|�rdS|jj}tjjj	|d�}|�
tjtjB�|�
dd�}t|�}~~|dkrldStj�|�}tj�|�s�t�|�t|d�}|��~dSdS)	z�Checks for the presence of GPG keys in the rpmdb.

        :return: 0 if there are no GPG keys in the rpmdb, and 1 if
           there are keys
        z/.gpgkeyschecked.yumr�)r�r�z
gpg-pubkeyr�wN)r7r�r�r�r�r^rr(r3r�r��_RPMVSF_NOSIGNATURES�_RPMVSF_NODIGESTSZdbMatchr}r�r��openr?)r6Zgpgkeyscheckedr^Zmyts�idx�keysZmydir�for8r8r9�_gpg_key_checkrs&

zBase._gpg_key_checkc	Cs�|�|�\}}|�|�|D]~}tj�|j�}|j��j|d�}|jj	rh|�
|j��j|jdd�d��}|j|d�}|dur�|j|d�}|j
j||d�qt|�S)NrTr�r�ryr�)r.r�rr�r�rjr~rr7r&r�rrrrr})	r6r~rzr��already_instr+r�r1r,r8r8r9r��s

�zBase._install_multiarchcCs,t��}t��}t||�t||�||fS)a�
        Categorize :param install and :param exclude list into two groups each (packages and groups)

        :param install: list of specs, whether packages ('foo') or groups/modules ('@bar')
        :param exclude: list of specs, whether packages ('foo') or groups/modules ('@bar')
        :return: categorized install and exclude specs (stored in argparse.Namespace class)

        To access packages use: specs.pkg_specs,
        to access groups use: specs.grp_specs
        )�argparse�	Namespacer)r6rr�
install_specs�
exclude_specsr8r8r9�_categorize_specs�s


zBase._categorize_specscsddd�|jD���fdd�|jD�}|j��j|d�}|j��j�d�}|j�|�|j�|�dS)NcSsg|]}tj�|�r|�qSr8)rr�r�rcrr8r8r9re�s�z/Base._exclude_package_specs.<locals>.<listcomp>csg|]}|�vr|�qSr8r8r8�Z
glob_excludesr8r9re�s�r
r)�	pkg_specsrjr~rr�)r6r6�excludesr�Zglob_exclude_queryr8r9r9�_exclude_package_specs�szBase._exclude_package_specsc
Cs�t�}t|j|jtjtjBtjtjB�}|D]�}z|�|�}WnDt	j
jy�}z(t�
dt|��WYd}~q,WYd}~n
d}~00|�|j�|�|j�|jD]*}|j�|�}|��D]}	|�|	j�q�q�q,t|�S)NzWarning: Module or %s)rrrr�rrrr$r�rrVr�rRr_r
rBrrZ_environment_by_idZgroups_iterr�rUr0)
r6�group_specsrr,r�rr Zenvironment_idZenvironmentrWr8r8r9�_expand_groups�s$


�"
zBase._expand_groupsc	Cs�|D]v}zL|jj}d|vr:|�d�}|d}|d�d�}|�|g|||j|j�Wqtjjyx|�	d|�Yq0qdS)Nr�rr��,�@)
r7Zgroup_package_types�splitr!r:�	grp_specsrrVrmr�)r6r=r;Zskippedr�Z
group_specr
rAr8r8r9�_install_groups�s
�zBase._install_groupscCs�|durg}g}g}g}g}	|�||�\}
}|�|�|
jD]\}z|j||||d�Wq<tjjy�}
z$t�t	|
��|�
|�WYd}
~
q<d}
~
00q<g}d}t�rF|
j�rFz tj
j�|�}|�|
j|�Wnrtjj�yB}
zT|
j�r|
jD]}|�
|�q�|
j�r(|
jD]}|�
d|��q|
j}WYd}
~
n
d}
~
00n|
j}|�rp|�|j�|_|�||||�|�s�|�s�|�s�|	�s�|�r�tjj||||	|d��dS)N)rzr��formsr8r@)�no_match_group_specs�error_group_specs�no_match_pkg_specs�error_pkg_specs�module_depsolv_errors)r7r<r:rrrV�MarkingErrorrRr_rr�r|rBrorpZ
ModuleBaseZ
MarkingErrorsrErFrIr>rC)r6rrrzr�rDrErFrGrHr5r6�specrZZno_match_module_specsrIrpZe_specr8r8r9r5�sR

"

��zBase.install_specscCs�|dd�}|r&d|d<d|d<d|d<tj�|�}|j|jfi|��}|jjdks\|�|�r�|d}|d	urx|j|d
�|s�|�	|||�|j
|||d�S|jjdkr�|j|||jj|d|d
�}	|	s�|�	|||�|	D]}
|j
j|
|d�q�dSdS)z@Mark package(s) given by pkg_spec and reponame for installation.F)rD�with_srcTrvrwrxrrr~Nry)rzr�r9)rDr&rz�reports�solutionr�r�r)rr�r��get_best_solutionrjr7r�Z_is_arch_specifiedr�_raise_package_not_found_errorr��_get_best_selectorsr&rr)r6�pkg_specrzr�rD�kwargsr�rNr,�sltrsr1r8r8r9rs8
�zBase.installcCs�|jrd}t|��|j����j|j|jdgd�}|shtd�}t	�
||j�tj�
td�|j|j��n\t|�d|kr�tj�|j�}|j|gd�|jj||d�d	Std
�}t	�
||j�dSdS)Nz-downgrade_package() for an installed package.�noarchrz.Package %s not installed, cannot downgrade it.�No match for argument: %srrr�r�zCPackage %s of lower version already installed, cannot downgrade it.)�_from_system�NotImplementedErrorrjr~rrr�r�rrRrnrrVrJr��sortedr�r�rrr)r6r
r�r�r,r1r8r8r9�package_downgrade8s  zBase.package_downgradecCs�|j���|j|j|j�}|�|�\}}||vr>|�|g�nV|tj	�
|�vrftj�
td�|j��n.tj�|j�}|j|gd�|jj||d�dS)NrVrr�r�)rjr~�_nevrar�r�r�r.r�rrrrrV�PackageNotFoundErrorrr�r�r�rrr)r6r
r�r,r2r+r1r8r8r9�package_installNszBase.package_installcCsf|j����j|j|j|jd�r0|j�|�dSt	d�}t
�|t|��t
j�t	d�|j|j��dS)N)r�r�r�r�z.Package %s not installed, cannot reinstall it.rV)rjr~rrr�r�r�rrrrRrnrrrVrJr�)r6r
r�r8r8r9�package_reinstall\s zBase.package_reinstallcCs|j�|�dSr�)rr�r�r8r8r9�package_removedszBase.package_removecCs`|jrd}t|��|jdkr6td�}t�||j�dS|j���	��
�}|jjr�|j��j
|gd�j
|d�r�tj�|j�}|j|gd�|jj|d�dS|jd	kr�|j|jd
�}n|j|j|jd	gd�}|�std�}t�||j�tj�td
�|j|j��nZt|�d|k�rBtj�|j�}|j|gd�|jj|d�dStd�}t�||j�dSdS)Nz+upgrade_package() for an installed package.r�z<File %s is a source package and cannot be updated, ignoring.rrr�r�r�rUr
rz+Package %s not installed, cannot update it.rVrzHThe same or higher version of %s is already installed, cannot update it.)rWrXr�rrRr�r�rjr~rr�r7r&rrr�r�rrr�rr�rnrVrJrY)r6r
r�rr1r,r8r8r9�package_upgradehs<
$
�zBase.package_upgradec	Cs�|j����}|�|j��jdd�|D�d��}|��}|rf|j����j|�|���d�}|�|�}|durz|j|d�|j||dd�}|r�|�|�	�j
dd�|D�d��}tj�
|j�}|j|d	�|jj|d
�dS)NcSsg|]
}|j�qSr8r
r3r8r8r9re�rfz*Base._upgrade_internal.<locals>.<listcomp>r
r�ryT)rRr�cSsg|]
}|j�qSr8r
r3r8r8r9re�rfrr�r�)rjr~rr�rr+r�r�r�r�rrr�r�rrr�)	r6r~r&rzrRZ
installed_allr,rr1r8r8r9�_upgrade_internal�s""�
 zBase._upgrade_internalc
Csvtj�|�}|�|j�}|d}|�r\tj�|�}|�s,|d�r,|dj�r,|dj}|j���	��
�}|jjr~|j
|d�n|j��jdd�}	|	�s,|j
|d��
�}
|
s�td�}t�||�tj�td�||��nV|dj�r,tj�|dj��s,|
j|djd	��s,td
�}t�|d�||dj��|jj�oJ|d�oJ|d��}|�||||�Stj�td�||��dS)Nr~�nevrar�Trsr
z(Package %s available, but not installed.rV)r�z?Package %s available, but installed for different architecture.z{}.{})rr�r�rOrjr�rr�r~rr�r7r&rrrrRrnrV�PackagesNotInstalledErrorr�rTZ
has_just_namerarJ)
r6rRrzr�rNr,Zwildcard�pkg_namerZ
obsoletersZinstalled_namer�r&r8r8r9r��s:
��� 
�zBase.upgradecCs|j|j��|jj|dd�S)N)rR)rarjr~r7r&)r6rzr8r8r9�upgrade_all�s�zBase.upgrade_allcCs�|dur|j��nttj�|�}|j|jdd�}|djtj	d�|j
|||jjdd�}|spt
�td�|�dS|D]}|jj|d	�qtd
S)NF)rLr~�Z
reponame__neqT)rNr&rMzNo package %s installed.rr�r�)rZdistupgrade_allrr�r�rOrjrrPZSYSTEM_REPO_NAMErQr7r&rRr�rZdistupgrade)r6rRr�rNrTr1r8r8r9�distro_sync�s�zBase.distro_synccCs�t|||g�r�||7}d}|rB|rB|D]}td�}t�||�q&n|rT|�|�rTd}|D]R}z|j||d�Wn6tjjy�}	zt�	t
|	��WYd}	~	qXd}	~	00d}qX|s�t�td��n0|j��j
|jj|jjd�}
|
D]}|�|�q�dS)z�Removes all 'leaf' packages from the system that were originally
        installed as dependencies of user-installed packages but which are
        no longer required by any such package.FzNot a valid form: %sT)rDNzNo packages marked for removal.r�)�anyrrRrnr&r"rrVrJr�rrjr~r�r�r�r7rlr_)r6rDr:rB�	filenamesrZgrp_specr�rRrZr�r
r8r8r9r��s.
$�zBase.autoremovec	s�d|i}|r$d|d<d|d<d|d<tj�|�j�jfi|��}��fdd�|��D�}|sj��||���jj}|D]}�j	j
||d	�qvt|�S)
z'Mark the specified package for removal.rDTrvFrwrxcs(g|] }�dus �j�|��kr|�qSr;r�r3r�r8r9re	s�zBase.remove.<locals>.<listcomp>r�)rr�r�r�rjr�"_raise_package_not_installed_errorr7r�rr�r})	r6rRrzrDrSr/rr�r
r8r�r9r"	s�zBase.removec	s0tj�|�}|��j�}��fdd�|��D�}|��}	|durL|	j|d�|dur`|	j|d�tj�	|	�}
|s�tj
�d||	����d}�j
j}�j
j}
|D]t}z|
t|�}Wn*ty�|s�Yq��jj||d�Yn.0tj��j�}|j|d��jj||
d	�|d
7}q�|dk�r,tj
�d||��|S)Ncs(g|] }�dus �j�|��kr|�qSr;r�r3��old_reponamer6r8r9re&	s�z"Base.reinstall.<locals>.<listcomp>ryrfzno package matchedrr�rr�r�)rr�r�r�rjrr+rr~Z_per_nevra_dictrVrcr8r7r�r�r
�KeyErrorrr�r�r�rrZPackagesNotAvailableError)r6rRrlZnew_reponameZnew_reponame_neqZ	remove_nar�r,r�Zavailable_qZavailable_nevra2pkgrr�r�Z
installed_pkg�available_pkgsr1r8rkr9�	reinstall"	sD�
�

�zBase.reinstallcCs
|�|�S)z�Mark a package to be downgraded.

        This is equivalent to first removing the currently installed package,
        and then installing an older version.

        )�downgrade_to)r6rRr8r8r9�	downgradeL	szBase.downgradec
Cstj�|�}|�|j�}|s6td�|}tj�||��d}|��}t	|�
����}|j���
�j|d�}	t|	�dkr�td�|}tj�|||��|	�
���D]^}
|��j|
d�}|s�td�}t�||
�q�tj�|j�}|j|d�|jj||d�d}q�|S)	z�Downgrade to specific version if specified otherwise downgrades
        to one version lower than the package installed.
        rVrr
z6Packages for argument %s available, but not installed.zDPackage %s of lowest version already installed, cannot downgrade it.rr�r�)rr�r�r�rjrrVr\r+r0�
_name_dictr/r~rrr}rcZ
downgradesrrRrnr�r�rrr)
r6rRr�r�r,r�rrnZavailable_pkg_namesZq_installedrdZdowngrade_pkgsr1r8r8r9rpV	s.zBase.downgrade_tocs�|j��j�d�}|r |�gfStj�|j��}|r>|�gfS��d�sR��d�r^d�g}n&��d�rr|�gfS�fdd�dD�}|j��j|d�|fS)	N)Z
file__glob�/bin/�/sbin/z/usrr�csg|]}|��qSr8r8)rc�prefix��
provides_specr8r9re�	s�z!Base.provides.<locals>.<listcomp>)rsrtz	/usr/bin/z
/usr/sbin/)rjr~rrZ_by_provides�
startswith)r6rwZ	providersZbinary_providesr8rvr9r�r	s




�z
Base.providesc
Cs�ddd�}||vrtd��||}|rDd|}	|j�|	t���|�|rfd|}	|j�|	t���|�|r�d|}	|j�|	t���|�|r�d|}	|j�|	t���|�|r�d	|}	|j�|	t���|�d
S)a�
        It modifies results of install, upgrade, and distrosync methods according to provided
        filters.

        :param cmp_type: only 'eq' or 'gte' allowed
        :param types: List or tuple with strings. E.g. 'bugfix', 'enhancement', 'newpackage',
        'security'
        :param advisory: List or tuple with strings. E.g.Eg. FEDORA-2201-123
        :param bugzilla: List or tuple with strings. Include packages that fix a Bugzilla ID,
        Eg. 123123.
        :param cves: List or tuple with strings. Include packages that fix a CVE
        (Common Vulnerabilities and Exposures) ID. Eg. CVE-2201-0123
        :param severity: List or tuple with strings. Includes packages that provide a fix
        for an issue of the specified severity.
        Z__eqgZ	__eqg__gt)�eqZgtez Unsupported value for `cmp_type`Z
advisory_type�advisoryZadvisory_bugZadvisory_cveZadvisory_severityN)r�r/�
setdefaultrrB)
r6Zcmp_typer
rzZbugzillaZcvesZseverityZcmp_dict�cmpr�r8r8r9�add_security_filters�	s&
zBase.add_security_filterscCs
i|_dS)z,
        Reset all security filters
        N)r/r<r8r8r9�reset_security_filters�	szBase.reset_security_filtersc
Cs4|js|jr|s|S|j��jdd�}|jrJ|jD]}|�|�}q2|g|_|jr�|j��D]2\}}|rn|d}||i}	|�|jfi|	���}qZ|�|�}|�s0|�r0|�	�}t
|�����}
|
dk�r0|dur�t
d��|
�}t
d��|
�}t�t|||
��n2t
d��||
�}t
d	��||
�}t�t|||
��|S)
z�
        Merge Queries in _update_filters and return intersection with q Query
        @param q: Query
        @return: Query
        TrsZ	__upgraderNz3No security updates needed, but {} update availablez4No security updates needed, but {} updates availablez<No security updates needed for "{}", but {} update availablez=No security updates needed for "{}", but {} updates available)r/r.rjr~rr��itemsrr�r�r}rrr/rrTrRrnr	)
r6r,rRrnr�Zmerged_queriesr~Zfilter_namer�rSr�Zmsg1Zmsg2r8r8r9r��	sF


����zBase._merge_update_filtersc
s�jrtd�}t|���|j�j��j|jv}|r:gn�j}��fdd�}d}|j��j�|D�]}	t	j
�|	��}
|
D�]�}t�
|j|j|j�dkr�td�}t�||	|j�q||jjr�t	jj�|j|j�}t	jj�|�}
t�t	j�||
��|	|_|jj�rt	j
�||
�nt	j
� |�d}|jj!�r2d}n�|jj"�r�|jj�r�|
t	jj#j$t	jj#j%fv�r|d}t�t	j�&td���nd}t�t	j�&td	���nd}n<|�r�|�|j|j|	|j'|jd
��}n|�r�|�|j|j�}|�s�d}q||j�(t)j*�}|�r|j�+�}|j�,|t)j*�|j�-t�.|j��}|�r<|j�,|�|dk�rbtd�|}t	j/�0||���t�td��d}q|qd|�s�|�r�t	j/�0td
���|�s�td��j1}t	j/�0||���|�2��\}}|dk�r|�r�td�}t�|�t3|�}t	j/�0||���dS)a�Retrieve a key for a package. If needed, use the given
        callback to prompt whether the key should be imported.

        :param po: the package object to retrieve the key of
        :param askcb: Callback function to use to ask permission to
           import a key.  The arguments *askcb* should take are the
           package object, the userid of the key, and the keyid
        :param fullaskcb: Callback function to use to ask permission to
           import a key.  This differs from *askcb* in that it gets
           passed a dictionary so that we can expand the values passed.
        :raises: :class:`dnf.exceptions.Error` if there are errors
           retrieving the keys
        z6Unable to retrieve a key for a commandline package: %scs0|td��d7}|td�d��j�7}|S)Nz. Failing package is: %sz
 zGPG Keys are configured as: %sr�)rr�r�)r��r�rXr8r9�_prov_key_data�	s

�z1Base._get_key_for_package.<locals>._prov_key_dataFrz)GPG key at %s (0x%s) is already installedTzThe key has been approved.zThe key has been rejected.)r��useridZhexkeyid�keyurl�fingerprint�	timestampzKey import failed (code %d)zKey imported successfullyzDidn't install any keysz�The GPG keys listed for the "%s" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.z+Import of key(s) didn't help, wrong key(s)?N)4r�rr�rhr�rUr1r�r�rZcryptoZretriever
ZkeyInstalledr�Zrpm_idr�rRr�Zshort_idr7r�r�ZKeyInfoZfrom_rpm_key_objectr�Zraw_keyZDNSSECKeyVerificationZverifyZ
nice_user_msg�urlZlog_dns_key_importZlog_key_importZassumenoZ	assumeyesZValidityZVALIDZPROVEN_NONEXISTENCEZany_msgr�rcr(rdZ
getTsFlagsr�ZpgpImportPubkeyZ
procgpgkeyrVrmr�r�r
)r6r��askcb�	fullaskcbr�Z
key_installedZkeyurlsr�Zuser_cb_failr�r/r�Z
dns_input_keyZ
dns_result�rcZ	test_flagZ
orig_flagsr��errmsgr8r�r9�_get_key_for_package�	s�

�




��


�

zBase._get_key_for_packagecCs|�|||�dS)a�Retrieve a key for a package. If needed, use the given
        callback to prompt whether the key should be imported.

        :param pkg: the package object to retrieve the key of
        :param askcb: Callback function to use to ask permission to
           import a key.  The arguments *askcb* should take are the
           package object, the userid of the key, and the keyid
        :param fullaskcb: Callback function to use to ask permission to
           import a key.  This differs from *askcb* in that it gets
           passed a dictionary so that we can expand the values passed.
        :raises: :class:`dnf.exceptions.Error` if there are errors
           retrieving the keys
        N)r�)r6r
r�r�r8r8r9�package_import_key`
szBase.package_import_keycCs0g}|j��|j��D]}|�t|��q|Sr;)r�r�Zproblemsr�r
)r6�resultsZprobr8r8r9r^q
s

zBase._run_rpm_check�w+bcKstjj||j||fi|��S)z�
        Open the specified absolute url, return a file object
        which respects proxy setting even for non-repo downloads
        )rr�Z_urlopenr7)r6r�rXr�rSr8r8r9�urlopen|
szBase.urlopencCs,|dur|jjtjd�}|j|jjd�}|S)Nrr�)rr~rPr#rr7r�)r6r,Zinstallonlyr8r8r9r�
szBase._get_installonly_querycCsrtjj|dd�}|j|jdddd�}|drn|drn|djrn||ddjkrnt�td��	|ddj��dS)	NTr�Frur~rbrz  * Maybe you meant: {})
rr�r�rOrjr�rRr�rrT)r6rRr�rNr8r8r9�_report_icase_hint�
s
��zBase._report_icase_hintcCs�dd�}g}g}|D].}|��r8|jtjkrB|�|�q|�|�qtd�}|||�sftj�td���|j	j
r�td�}|||�s�tj�td���g}||fS)a Check checksum of packages from local repositories and returns list packages from remote
        repositories that will be downloaded. Packages from commandline are skipped.

        :param install_pkgs: list of packages
        :return: list of remote pkgs
        cSsvd}|D]h}d}z|��}Wn2tyN}zt�t|��WYd}~n
d}~00|durt�|�||j��d}q|S)NTF)ZverifyLocalPkgrQrRr�rrTrz)Zpkg_listZ
logger_msgZall_packages_verifiedr
Zpkg_successfully_verifiedrZr8r8r9�_verification_of_packages�
s$z;Base._select_remote_pkgs.<locals>._verification_of_packagesz>Package "{}" from local repository "{}" has incorrect checksumz;Some packages from local repository have incorrect checksumz8Package "{}" from repository "{}" has incorrect checksumzVSome packages have invalid cache, but cannot be downloaded due to "--cacheonly" option)Z
_is_local_pkgrzrPZCMDLINE_REPO_NAMEr�rrrVrmr7r�)r6Zinstall_pkgsr�r�Zlocal_repository_pkgsr
r�r8r8r9r��
s*
�
�zBase._select_remote_pkgscCs|D]}t|�qdSr;)�_msg_installed)r6r�r
r8r8r9r��
szBase._report_already_installedc	Cs�|jjtjd�}tj�|�}|j|j|d|d�}|durH|dj|d�|dsdtj	�
td�|��nB|jjtjd�}|d�
|�}|r�td�}ntd�}tj	�
||��dS)	NrF�rDrLr~r~ry�No match for argument�?All matches were filtered out by exclude filtering for argumentz?All matches were filtered out by modular filtering for argument)rjr~rPr#rr�r�rOrrVr\rZIGNORE_REGULAR_EXCLUDESr�)	r6rRrDrz�	all_queryr�rNZwith_regular_queryr�r8r8r9rP�
s
�
z#Base._raise_package_not_found_errorc	s��jjtjd���}tj�|�}|j�j|d|d�}|dsNtj	�
td�|���durp��fdd�|dD�}n|d}|s�td�}ntd	�}tj	�
||��dS)
NrFr�r~r�cs g|]}�j�|��kr|�qSr8r�r3r�r8r9re�
rfz;Base._raise_package_not_installed_error.<locals>.<listcomp>zCAll matches were installed from a different repository for argumentr�)rjr~rPr#rrr�r�rOrVrcr)	r6rRrDrzr�r�rNrr�r8r�r9rj�
s
�
z'Base._raise_package_not_installed_errorcCs|jj|jdd�dS)z�
        Setup DNF file loggers based on given configuration file. The loggers are set the same
        way as if DNF was run from CLI.
        T)Zfile_loggers_onlyN)r$Z_setup_from_dnf_confr7r<r8r8r9�
setup_loggers�
szBase.setup_loggerscs�|jjtjtjBtjB@r d}nd}t|j�}|j|dd�}|jfi|��}|sn|rnt	j
�|���}t
�|�t|jdd��}t|jdd��|}	dd���fdd�|D��t��fd	d�|D��}
t��fd
d�|	D��}|
|fS)z�returns set of conflicting packages and set of packages with broken dependency that would
        be additionally installed when --best and --allowerasingTF)r6r7Zignore_weak)r+cSstj|j|j|j|j|jd�S)N)r��epoch�version�releaser�)rPZNEVRAr�r�r�r�r�)�itemr8r8r9r[s�z&Base._skipped_packages.<locals>._nevracsg|]}�|��qSr8r8r�)r[r8r9re	rfz*Base._skipped_packages.<locals>.<listcomp>csg|]}�|��vr|�qSr8r8r3�r[Ztransaction_nevrasr8r9rerfcsg|]}�|��vr|�qSr8r8r3r�r8r9re
rf)r�actionsrPZINSTALLZUPGRADEZUPGRADE_ALLrr0r8rr�rCrDrRrnr�problem_conflictsZproblem_broken_dependency)r6Zreport_problemsr3r9Zng�paramsr;r�r�Zproblem_dependencyZskipped_conflictsZskipped_dependencyr8r�r9�_skipped_packages�
s.
�
��zBase._skipped_packagescs8|js
dStd��|jj|jjB}t�fdd�|D��S)zfCheck whether a system reboot is recommended following the transaction

        :return: bool
        F)	Zkernelz	kernel-rtZglibczlinux-firmwareZsystemdZdbuszdbus-brokerzdbus-daemonZ
microcode_ctlc3s|]}|j�vVqdSr;r
r3�Zneed_rebootr8r9r4rfz%Base.reboot_needed.<locals>.<genexpr>)r3�	frozensetr}Z
remove_setrh)r6Zchanged_pkgsr8r�r9�
reboot_neededs
zBase.reboot_needed)N)F)r8r8N)F)TT)T)N)FFF)F)F)r8)N)T)NN)TN)rrNNFN)N)NTN)NT)TNN)NT)T)NNTN)NTN)F)T)N)N)N)N)NNNN)NN)NNNF)F)r8r8r8r8r8)NTF)NN)NN)Nr�)N)��__name__�
__module__�__qualname__r:r=r@rArEr[�staticmethodrrqr�r��propertyrr7rh�deleterrr�Zlazyattrr�rjrkr3�setterr�r�r�r�r�r�r�r�r�r?r�r�r�r(ZRPMTRANS_FLAG_NOSCRIPTSZRPMTRANS_FLAG_NOTRIGGERSZRPMTRANS_FLAG_NODOCSrdZRPMTRANS_FLAG_JUSTDBZRPMTRANS_FLAG_NOCONTEXTSZRPMTRANS_FLAG_NOFILEDIGESTr�rYr�r+r,r�r�r�r�r�r�r)r.r2r5r<r=rHrjrbrurer~r�r�r�r�r�r�r�r�r�r�r?rAr
rrr!r#r&r)r'r(r1r�r7r<r>rCr5rrZr]r^r_r`rar�rergr�r"rorqrpr�r}r~r�r�r�r^r�rr�r�r�rPrjr�r�r�r8r8r8r9r\s(


=











8
;
>

=�
�



+�^
;
l"^
*
C

;
�
*�
F

*



/#%&#�
*
%)-rcCs t|�}td�}t�||�dS)Nz Package %s is already installed.)r
rrRr�)r
r�r�r8r8r9r� sr�)I�__doc__Z
__future__rrrrr3rZlibdnf.transactionr2r�rZ	dnf.compsrZdnf.i18nrr	r
Zdnf.utilrZdnf.db.historyrZdnf.yumr
�collections.abcr�ImportError�collectionsr�Zdnf.callbackZdnf.confZ
dnf.conf.readZ
dnf.cryptoZ
dnf.dnssecZdnf.drpmZdnf.exceptionsZdnf.goalZdnf.historyZdnf.lockZdnf.loggingZdnf.module.module_baser|Z
dnf.persistorZ
dnf.pluginZ	dnf.queryZdnf.repoZdnf.repodictZdnf.rpm.connectionZdnf.rpm.miscutilsZdnf.rpm.transactionZdnf.sackZdnf.selectorZdnf.subjectZdnf.transactionZdnf.yum.rpmtransr�r�rPrr#rqr�r�rnr(r�r�r�Z	getLoggerrR�objectrr�r8r8r8r9�<module>s�

Y

Zerion Mini Shell 1.0