403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/dnf/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/dnf/__pycache__/util.cpython-39.pyc
a

+ �g�a�@s�ddlmZddlmZddlmZddlmZmZddlmZm	Z	ddl
Z
ddlZddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZe� d�Z!e
�"�j#d	k�re
�"�j#ndZ$e$�%�Z&d
d�Z'dbdd
�Z(dcdd�Z)dd�Z*dd�Z+dd�Z,dd�Z-dd�Z.dd�Z/dd�Z0dd �Z1d!d"�Z2d#d$�Z3d%d&�Z4d'd(�Z5d)d*�Z6d+d,�Z7d-d.�Z8d/d0�Z9d1d2�Z:d3d4�Z;d5d6�Z<d7d8�Z=d9d:�Z>d;d<�Z?d=d>�Z@d?d@�ZAdAdB�ZBdCdD�ZCdddFdG�ZDdHdIejEfdJdK�ZFdLdM�ZGdNdO�ZHdPdQ�ZIdRdS�ZJGdTdU�dUeK�ZLGdVdW�dWeM�ZNGdXdY�dYeO�ZPdZd[�ZQd\d]�ZRd^d_�ZSGd`da�da�ZTdS)e�)�print_function)�absolute_import)�unicode_literals�)�PY3�
basestring)�_�ucdN�dnfZyumcCs�t|dg�t|dg�t|dg�t�}|D]�}||vr<q.|�|�tjj�|�d}|�d�rp|j�|�q.|r�|dvr�|j�|�q.|�	d�r�|j
�|dd	��q.|j�|�q.d	S)
a�
    Categorize :param values list into packages, groups and filenames

    :param namespace: argparse.Namespace, where specs will be stored
    :param values: list of specs, whether packages ('foo') or groups/modules ('@bar')
                   or filenames ('*.rmp', 'http://*', ...)

    To access packages use: specs.pkg_specs,
    to access groups use: specs.grp_specs,
    to access filenames use: specs.filenames
    �	filenames�	grp_specs�	pkg_specsrz.rpm)�http�ftp�file�https�@rN)�setattr�set�addr
�pycomp�urlparse�endswithr�append�
startswithrr
)�	namespace�valuesZtmp_set�valueZschemes�r�,/usr/lib/python3.9/site-packages/dnf/util.py�_parse_specs9s 



r c
Cs�|durtj��}tj�|||�}t|jg�}|�d|�|��g}zt	jj
�t	j�|�d�WnDt
y�}z,|jr�tt|���t�t|��WYd}~n
d}~00|jS)NrT)r
�callbackZNullDownloadProgress�repoZRemoteRPMPayload�sumZ
download_size�startZ_librepo_target�libdnfZ
PackageTargetZdownloadPackagesZVectorPPackageTarget�RuntimeError�strict�IOError�str�logger�errorZ
local_path)�url�confZprogressZploadZest_remote_size�targets�errr�_urlopen_progressYs

$r0�w+bc
Ks�trd|vr|�dd�tj|fi|��}z<|rD|j�||���n tjj	�
|rV|jnd||���Wn0ty�}zt
t|���WYd}~n
d}~00|�d�|S)z|
    Open the specified absolute url, return a file object
    which respects proxy setting even for non-repo downloads
    �b�encodingzutf-8Nr)r�
setdefault�tempfileZNamedTemporaryFileZ_repoZdownloadUrl�filenor%r"Z
DownloaderZdownloadURLZ_configr&r(r)�seek)r,r-r"�mode�kwargs�for/rrr�_urlopenhs$"
r;cCs |�|�r|dt|��}|S�N)r�len)�s�rrrr�rtrim|s
r@cCst��dkS�Nr)�os�geteuidrrrr�	am_i_root�srDcCs*t�|�D]}tj�||�}t|�q
dS)zBRemove all files and dirs under `path`

    Also see rm_rf()

    N)rB�listdir�path�join�rm_rf)rF�entryZcontained_pathrrr�	clear_dir�srJc
CsXztj|dd�Wn@tyR}z(|jtjks:tj�|�s>|�WYd}~n
d}~00dS)Ni�)r8)rB�makedirs�OSError�errnoZEEXISTrF�isdir)Zdnamer/rrr�
ensure_dir�s
rOcCsDg}|}tj�|�\}}|s2|s$|s@|�d|�q@|�d|�q|S)z`
    Split path by path separators.
    Use os.path.join() to join the path back to string.
    r)rBrF�split�insert)rF�result�head�tailrrr�
split_path�srUcCs4zt|�}Wnty*tt|��}Yn0|dkSrA)r=�	TypeError�list)�iterable�lrrr�empty�s
rZcCs,t|�}z
t|�WSty&YdS0dS)zFReturns the first item from an iterable or None if it has no elements.N��iter�next�
StopIteration�rX�itrrr�first�s

racCs6t|�}ztdd�|D��WSty0YdS0dS)Ncss|]}|dur|VqdSr<r)�.0�itemrrr�	<genexpr>��z!first_not_none.<locals>.<genexpr>r[r_rrr�first_not_none�s
rfcCst��t|�Sr<)�time�file_timestamp��fnrrr�file_age�srkcCst�|�jSr<)rB�stat�st_mtimerirrrrh�srhcCs8zt�t���dWSty2dt��YS0dS)NrzUID: %s)�pwd�getpwuidrBrC�KeyErrorrrrr�get_effective_login�srqcCs(|D]}|�|�}|dur|Sq|S)z!Like dict.get() for nested dicts.N)�get)Zdct�keysZ	not_found�krrr�get_in�s


rucs�fdd�}t�||ggf�S)Ncs|t�|���|�|Sr<)�boolr)Zaccrcrirr�splitter�sz!group_by_filter.<locals>.splitter)�	functools�reduce)rjrXrwrrir�group_by_filter�srzccs"|D]}||�r|V|VqdS)z/Insert an item into an iterable by a condition.Nr)rcrX�	conditionZ
original_itemrrr�	insert_if�sr|cCs*zt|�Wnty YdS0dSdS)z&Test whether an iterator is exhausted.TFN)r]r^)�iteratorrrr�is_exhausted�s
r~cCs*t|�r|g}t|t�o(tdd�|D��S)Ncss|]}t|�td�@VqdS)z*[?N)r)rb�prrrrd�rez"is_glob_pattern.<locals>.<genexpr>)�is_string_type�
isinstancerW�any)�patternrrr�is_glob_pattern�sr�cCstrt|t�St|t�SdSr<)rr�r)r)�objrrrr��s
r�cs�fdd�}|S)z�Decorator to get lazy attribute initialization.

    Composes with @property. Force reinitialization by deleting the <attrname>.
    cs��fdd�}|S)Ncs<zt|��WSty6�|�}t|�|�|YS0dSr<)�getattr�AttributeErrorr)r��val)�attrnamerjrr�
cached_gettersz6lazyattr.<locals>.get_decorated.<locals>.cached_getterr)rjr��r�rir�
get_decorated�szlazyattr.<locals>.get_decoratedr)r�r�rr�r�lazyattr�s	r�cGstt|g|�R��S)z�Like functools.map(), but return a list instead of an iterator.

    This means all side effects of fn take place even without iterating the
    result.

    �rW�map)rj�seqrrr�mapallsr�cCs8t�dt�|��}tjjs4t��d}|r4|�|�}|S)z6Convert time into locale aware datetime string object.z%cr)	rg�strftime�	localtimer
rr�locale�	getlocale�decode)Z	timestamp�tZcurrent_locale_settingrrr�normalize_times
r�c	Cs�zxd}dd�t�|�D�}t|�dkrt|d}td�||���&}|��}t|�dkWd�WS1sj0YWdSttfy�YdS0dS)z�Decide whether we are on line power.

    Returns True if we are on line power, False if not, None if it can not be
    decided.

    z/sys/class/power_supplycSsg|]}|�d�r|�qS)ZAC)r)rbZnoderrr�
<listcomp>&rezon_ac_power.<locals>.<listcomp>rz{}/{}/onlinerN)	rBrEr=�open�format�read�intr(�
ValueError)Z	ps_folderZac_nodesZac_nodeZ	ac_status�datarrr�on_ac_powers,r�cCs�zddl}Wnty YdS0z0|��}|�dd�}|�|d�}|�dd�}Wn|jyhYdS0|dkrvdS|dvr�dS|d	vr�d
Std|��dS)z�Decide whether we are on metered connection.

    Returns:
      True: if on metered connection
      False: if not
      None: if it can not be decided
    rNzorg.freedesktop.NetworkManagerz/org/freedesktop/NetworkManagerzorg.freedesktop.DBus.PropertiesZMetered)r�T)��Fz&Unknown value for metered property: %r)�dbus�ImportErrorZ	SystemBusZ
get_objectZ	InterfaceZGetZ
DBusExceptionr�)r�Zbus�proxyZifaceZmeteredrrr�on_metered_connection1s(�r�cCs&t�|�\}}tj�||�t||�fS)z�Use a predicate to partition entries into false entries and true entries.

    Credit: Python library itertools' documentation.

    )�	itertools�teer
r�filterfalse�filter)ZpredrX�t1�t2rrr�	partitionNsr�cCs&zt�|�Wnty Yn0dSr<)�shutil�rmtreerL�rFrrrrHWsrHc#sBt���fdd�}t�||�}||�V||�}|s6q>|Vq(dS)z�Split an iterable into tuples by a condition.

    Inserts a separator before each item which meets the condition and then
    cuts the iterable by these separators.

    cstt��fdd�|��S)Ncs|�kSr<r)r/��	separatorrr�<lambda>grez4split_by.<locals>.next_subsequence.<locals>.<lambda>)�tupler��	takewhile)r`r�rr�next_subsequencefsz"split_by.<locals>.next_subsequenceN)�objectr|)rXr{r�ZmarkedZsubsequencerr�r�split_by]s
r�cCs|�|�r|t|�d�SdSr<)rr=)r>�prefixrrr�strip_prefixus
r�FcCsL|st�|tj�rt�|d�St|d��Wd�n1s>0YdS)z{Create an empty file if it doesn't exist or bump it's timestamps.

    If no_create is True only bumps the timestamps.
    N�a)rB�access�F_OK�utimer�)rFZ	no_createrrr�touch{sr��write�c
Cs�zh|dkr|�|�nP|dkr(|��n>|dkrD|�|�|��n"|dkrZt||d�ntd|��Wn@ty�}z(t�d�t|�j	t
|���WYd}~n
d}~00dS)Nr��flushZwrite_flush�print)rzUnsupported type: z{}: {})r�r�r�r�r(r*�criticalr��type�__name__r	)�tp�msg�outr/rrr�_terminal_messenger�s


r�cCsjd}t|�dk}t|dd�D]H\}}|rB|dtd�d|7}n|dtd�d7}|d�|�7}q|S)	z�
    Format string about problems in resolve

    :param resolve_problems: list with list of strings (output of goal.problem_rules())
    :return: string
    r�r)r$z
 ZProblemz %d: z: z
  - )r=�	enumeraterrG)Zresolve_problemsr�Zcount_problems�iZrsrrr�_format_resolve_problems�sr�cCsX|��d}|��dur4|��dkr4||��d7}||��d|��d|��S)N�-�0�:�.)�N�E�V�R�A)�teZnevrarrr�	_te_nevra�sr�c
Cs�t�d�|D]@}|��}d}|dur,|j}d�t|�|||���}t�|�q|D]2}d�t|�|j|j|j	|j
|���}t�|�qTdS)NzLogging transaction elementsz@RPM element: '{}', Key(): '{}', Key state: '{}', Failed() '{}': z^SWDB element: '{}', State: '{}', Action: '{}', From repo: '{}', Reason: '{}', Get reason: '{}')r*�debug�Key�stater�r��Failedr)�actionZ	from_repo�reasonZ
get_reason)�rpm_transaction�swdb_transaction�rpm_el�tsiZ	tsi_stater�rrr�_log_rpm_trans_with_swdb�s 
��r�c
CsHtjjtjjtjjtjjtjjh}dd�|D�}d}d}|D]�}t|�}|��}|dusbt	|d�s�|D]4}	|	j
tjjkrzqf|	j|vr�qft
|	�|krf|	}q�qf|dus�t	|d�s�t�td��|��d}q<|��r�tjj|_
d}q<tjj|_
q<|D].}|j
tjjkr�t�td��t
|���d}q�|�r4t�td��|�rDt||�dS)	NcSsg|]}|�qSrr)rbr�rrrr��rez-_sync_rpm_trans_with_swdb.<locals>.<listcomp>F�pkgz%TransactionItem not found for key: {}Tz)TransactionSWDBItem not found for key: {}z#Errors occurred during transaction.)r%�transactionZ TransactionItemAction_DOWNGRADEDZTransactionItemAction_OBSOLETED�TransactionItemAction_REMOVEZTransactionItemAction_UPGRADEDZ!TransactionItemAction_REINSTALLEDr�r��hasattrr�ZTransactionItemState_UNKNOWNr�r)r*r�rr�r��TransactionItemState_ERRORZTransactionItemState_DONEr�r�)
r�r�Zrevert_actionsZ
cached_tsiZel_not_foundr+r�Zte_nevrar�Z
tsi_candidaterrr�_sync_rpm_trans_with_swdb�sJ�

r�c@s$eZdZdd�Zdd�Zdd�ZdS)�tmpdircCsdtjj}tj|d�|_dS)Nz%s-)r�)r
�constZPREFIXr5ZmkdtemprF)�selfr�rrr�__init__�sztmpdir.__init__cCs|jSr<r��r�rrr�	__enter__�sztmpdir.__enter__cCst|j�dSr<)rHrF)r��exc_type�	exc_value�	tracebackrrr�__exit__�sztmpdir.__exit__N)r��
__module__�__qualname__r�r�r�rrrrr��sr�cs(eZdZdZ�fdd�Zdd�Z�ZS)�Bunchz�Dictionary with attribute accessing syntax.

    In DNF, prefer using this over dnf.yum.misc.GenericHolder.

    Credit: Alex Martelli, Doug Hudgeon

    cs tt|�j|i|��||_dSr<)�superr�r��__dict__)r��args�kwds��	__class__rrr��szBunch.__init__cCst|�Sr<)�idr�rrr�__hash__szBunch.__hash__)r�r�r��__doc__r�r��
__classcell__rrr�rr��sr�cs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�
MultiCallListcstt|���|�|�dSr<)r�rr��extend)r�rXr�rrr�szMultiCallList.__init__cs��fdd�}|S)Ncs���fdd�}tt|���S)Ncst|��}|�i���Sr<)r�)�v�method)r�r9�whatrr�	call_what
s
z8MultiCallList.__getattr__.<locals>.fn.<locals>.call_whatr�)r�r9r�r�r)r�r9rrjsz%MultiCallList.__getattr__.<locals>.fnr)r�rrjrrr�__getattr__szMultiCallList.__getattr__cs��fdd�}tt||��S)Ncst|���dSr<)r)rc�r�rrr�settersz)MultiCallList.__setattr__.<locals>.setterr�)r�rr�rrr
r�__setattr__szMultiCallList.__setattr__)r�r�r�r�r	rrrrr�rrsrc
Cshtgggggggggggd��}|D�]<}|jtjjkrF|j�|�q$|jtjjkrb|j	�|�q$|jtjj
kr�|jtjjkr�|j
�|�nD|jtjjkr�|j�|�n(|jtjjkr�|j�|�n|j�|�q$|jtjjkr�|j�|�q$|jtjjk�rH|jtjjk�r|j�|�n*|jtjjk�r:|j�|�n|j�|�q$|jtjjkr$|j�|�q$|S)N)�
downgraded�erased�erased_clean�
erased_dep�	installed�installed_group�
installed_dep�installed_weak�reinstalled�upgraded�failed)r�r�r%r�r�rrr�ZTransactionItemAction_DOWNGRADEr
ZTransactionItemAction_INSTALLr�ZTransactionItemReason_GROUPrZ TransactionItemReason_DEPENDENCYrZ%TransactionItemReason_WEAK_DEPENDENCYrrZTransactionItemAction_REINSTALLrr�ZTransactionItemReason_CLEANrrrZTransactionItemAction_UPGRADEr)r�r2r�rrr�_make_listssJ�
rc
s��fdd�}tj�|�}�jd|d�\}}|�|�}g}td�|jftd�|jftd�|j|j	|j
|jftd�|jftd	�|ftd
�|j
|j|jftd�|jffD]&\}	}
|�||	t|
t�|�d���q�|S)
alReturns a human-readable summary of the results of the
    transaction.

    :param action_callback: function generating output for specific action. It
       takes two parameters - action as a string and list of affected packages for
       this action
    :return: a list of lines containing a human-readable summary of the
       results of the transaction
    cs�|j|jk|j|jk}|dkr$|Stj|j|j|j|j|jd�}tj|j|j|j|j|jd�}|�|�j�}|dkrz|S|j|jk|j|jkS)z�Compares two transaction items or packages by nevra.
           Used as a fallback when tsi does not contain package object.
        r)�name�epoch�version�release�arch)	r�hawkeyZNEVRArrrrZevr_cmpZsack)Zitem1Zitem2�retZnevra1Znevra2��baserr�_tsi_or_pkg_nevra_cmpPs��z7_post_transaction_output.<locals>._tsi_or_pkg_nevra_cmpF)Zreport_problemsr�ZUpgradedZ
DowngradedZ	InstalledZReinstalledZSkippedZRemovedr�)�key)r
�utilrZ_skipped_packages�unionrrr
rrrrrrrrrr�sortedrx�
cmp_to_key)r!r�Zaction_callbackr"Z
list_bunchZskipped_conflictsZskipped_brokenZskippedr�r�Ztsisrr r�_post_transaction_outputFs:
�


���

����r(cCs|r|Std�S)Nz<name-unset>)r)Z
input_namerrr�_name_unset_wrapperysr)c@sdeZdZdZdZdd�Zedd��Zedd��Z	d	d
�Z
dd�Zed
d��Zedd��Z
dd�ZdS)�_BootcSystemz/usricCs||��sttd���ddl}||_|�dd�ddlm}||_|jj	�
�|_|j�d�s^J�|j�
�|_|jdusxJ�dS)NzNot running on a bootc system.r�OSTreez1.0)r+)�is_bootc_systemr&r�giZ_giZrequire_versionZ
gi.repositoryr+�_OSTreeZSysrootZnew_defaultZ_sysroot�loadZrequire_booted_deployment�_booted_deployment)r�r-r+rrrr��sz_BootcSystem.__init__cCsd}tj�|�S)zYReturns true is the system is managed as an immutable container, false
        otherwise.z/run/ostree-booted)rBrF�isfile)Z
ostree_bootedrrrr,�sz_BootcSystem.is_bootc_systemcCst�|jtj�S)z-Returns true if and only if /usr is writable.)rBr��usr�W_OK)�clsrrr�is_writable�sz_BootcSystem.is_writablecCs
|j��Sr<)r0Zget_unlockedr�rrr�_get_unlocked_state�sz _BootcSystem._get_unlocked_statecCs|��|jjjkS)z�Returns true if and only if the bootc system is unlocked in a
        transient state, i.e. a overlayfs is mounted as read-only on /usr.
        Changes can be made to the overlayfs by remounting /usr as
        read/write in a private mount namespace.)r6r.�DeploymentUnlockedState�	TRANSIENTr�rrr�is_unlocked_transient�sz"_BootcSystem.is_unlocked_transientc	Cs�t�d�}|�|j�dkr"td��dddd|jg}ztj|dd�}|��WnTt	yvt
j�t
d	�|d��Yn,tjy�t
j�t
d
|j|j���Yn0dS)Nrz!Failed to unshare mount namespaceZmountz--options-source=disablez-oz
remount,rwT��textz%s: command not found.z$Failed to mount %s as read/write: %s)�ctypesZCDLLZunshare�CLONE_NEWNSrLr2�
subprocess�run�check_returncode�FileNotFoundErrorr
�
exceptions�Errorr�CalledProcessError�stderr)r4ZlibcZ
mount_command�completed_processrrr�_set_up_mountns�s
z_BootcSystem._set_up_mountnscCsxgd�}ztj|dd�}|��WnPtyLtj�td�|d��Yn(tjyrtj�td|j	���Yn0dS)N)ZostreeZadminZunlockz--transientTr:z.%s: command not found. Is this a bootc system?rzFailed to unlock system: %s)
r>r?r@rAr
rBrCrrDrE)Zunlock_commandrFrrr�_unlock�sz_BootcSystem._unlockcCs�|��}|jjj|jjj|jjj|jjjf}||vrFttd�|j	��|jjj|jjjf}||vrdn6||jjjkr�|�
�|��n||jjjkr�|��t�
|jtj�s�J�dS)z+Set up a writable overlay on bootc systems.z"Unhandled bootc unlocked state: %sN)r6r.r7ZNONEZDEVELOPMENTr8ZHOTFIXr�rZ
value_nickrHrGrBr�r2r3)r�Zbootc_unlocked_stateZvalid_bootc_unlocked_statesZwritable_unlocked_statesrrr�
make_writable�s&��
z_BootcSystem.make_writableN)r�r�r�r2r=r��staticmethodr,�classmethodr5r6r9rGrHrIrrrrr*~s




r*)N)NNr1)F)UZ
__future__rrrrrrZdnf.i18nrr	�argparser<r
Zdnf.callbackZ	dnf.constZ
dnf.pycomprMrxrr�r�ZloggingrBrnr�r>�sysr5rgZlibdnf.repor%Zlibdnf.transactionZ	getLoggerr*�ArgumentParser�progZ	MAIN_PROG�upperZMAIN_PROG_UPPERr r0r;r@rDrJrOrUrZrarfrkrhrqrurzr|r~r�r�r�r�r�r�r�r�rHr�r�r��stdoutr�r�r�r�r�r�r��dictr�rWrrr(r)r*rrrr�<module>s�
 


						
(-3

Youez - 2016 - github.com/yon3zu
LinuXploit