HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //lib/python3.9/site-packages/dnf/cli/commands/__pycache__/clean.cpython-39.pyc
a

�!cn�@s�ddlmZddlmZddlmZddlmZmZddlm	Z	ddlZ
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZddlZddlZddlZe�d�Zgd�d	gd
gdggd�d
�Zdd�Zdd�Zdd�Zdd�ZGdd�dej�ZdS)�)�absolute_import)�unicode_literals)�commands)�_�P_)�miscN�dnf)�metadata�dbcache�expire-cache�packagesr
r)r	rr
)r	rr
r�allccsNt�|�D]>\}}}tj�||�}|D] }tj�||�}tj�|�Vq&q
dS)z:Traverse dirpath recursively and yield relative filenames.N)�os�walk�path�relpath�join�normpath)�dirpath�root�dirs�files�base�fr�r�:/usr/lib/python3.9/site-packages/dnf/cli/commands/clean.py�_tree1s
rcs�fdd�|D�S)z5Yield those filenames that match any of the patterns.c3s(|] }�D]}t�||�r
|Vq
qdS�N��re�match)�.0r�p��patternsrr�	<genexpr><�z_filter.<locals>.<genexpr>r)rr$rr#r�_filter:sr'cCsHd}|D]:}tj�||�}t�tjjtd�|�t	�
|�|d7}q|S)z(Remove the given filenames from dirpath.rzRemoving file %s�)rrr�logger�logr�loggingZDDEBUGrrZunlink_f)rr�countrrrrr�_clean?s

r-cs0tjjd��fdd�|D�}tdd�|D��S)z:Return the repo IDs that have some cached metadata around.r	c3s|]}t��|�VqdSrr)r!r�Zmetapatrrr%Mr&z _cached_repos.<locals>.<genexpr>css|]}|r|�d�VqdS)ZrepoidN)�group)r!�mrrrr%Nr&)r�repo�CACHE_FILES�set)r�matchesrr.r�
_cached_reposJsr5c@s0eZdZdZdZed�Zedd��Zdd�Z	dS)	�CleanCommandzSA class containing methods needed by the cli to execute the
    clean command.
    )Zcleanzremove cached datacCs|jddt��td�d�dS)N�type�+zMetadata type to clean)�nargs�choices�help)�add_argument�_CACHE_TYPES�keysr)�parserrrr�
set_argparserYs�zCleanCommand.set_argparserc
Cs�|jjj}tj�|d�}tj�|d�}tj�|jjjd�}�z<|�� |���|��t	dd�|j
jD��}tt
|��}t�tdd�|���d|vr�t|�}|jjj�|�|�d�t�td��dd	�|D�}t|t||��}	t�td
d|	�|	�Wd�Wd�Wd�WdS1�s,0YWd�n1�sL0YWd�n1�sl0YWq:tjj�y�}
z@|jjj�s�td�|
j}t�|�t� d
�n|
�WYd}
~
q:d}
~
00q:dS)NTcss |]}t|D]
}|VqqdSr)r=)r!�c�trrrr%gr&z#CleanCommand.run.<locals>.<genexpr>zCleaning data: � rzCache was expiredcSsg|]}tjj|�qSr)rr1r2)r!rBrrr�
<listcomp>qr&z$CleanCommand.run.<locals>.<listcomp>z%d file removedz%d files removedz*Waiting for process with pid %d to finish.�)!rZconf�cachedirr�lockZbuild_metadata_lockZbuild_download_lockZbuild_rpmdb_lockZ
persistdirr3Zoptsr7�listrr)�debugrrr5Z_repo_persistorZexpired_to_add�update�remove�infor-r'r�
exceptionsZ	LockErrorZexit_on_lock�pid�time�sleep)�selfrFZmd_lockZ
download_lockZ
rpmdb_lock�typesrZexpiredr$r,�e�msgrrr�run_s0

�
zCleanCommand.runN)
�__name__�
__module__�__qualname__�__doc__�aliasesrZsummary�staticmethodr@rUrrrrr6Qs
r6)Z
__future__rrZdnf.clirZdnf.i18nrrZdnf.yumrrZdnf.exceptionsZdnf.lockZdnf.loggingZdnf.repor+rrrOZ	getLoggerr)r=rr'r-r5ZCommandr6rrrr�<module>s2
�