관리-도구
편집 파일: clean.cpython-39.opt-1.pyc
a �����!cn����������������������@���s����d�dl�mZ�d�dl�mZ�d�dlmZ�d�dlmZmZ�d�dlm Z �d�dlZ d�dlZ d�dlZ d�dl Z d�dlZ d�dlZd�dlZd�dlZd�dlZe�d�Zg�d�d gd gdgg�d�d �Zdd��Zdd��Zdd��Zdd��ZG�dd��dej�ZdS�)�����)�absolute_import)�unicode_literals)�commands)�_�P_)�miscN�dnf)�metadata�dbcache�expire-cache�packagesr ���r���)r ���r���r ���)r ���r���r ���r����allc�����������������c���sN���t��|��D�]>\}}}t�j�||��}|D�] }t�j�||�}t�j�|�V��q&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�_tree1���s ����r���c��������������������s�����fdd�|�D��S�)z5Yield those filenames that match any of the patterns.c�����������������3���s(���|�] }��D�]}t��||�r |V��q qd�S��N��re�match)�.0r����p��patternsr���r���� <genexpr><��������z_filter.<locals>.<genexpr>r���)r���r$���r���r#���r����_filter:���s����r'���c�����������������C���sH���d}|D�]:}t�j�|�|�}t�tjjtd�|��t � |��|d7�}q|S�)z(Remove the given filenames from dirpath.r���zRemoving file %s����)r���r���r����logger�logr����loggingZDDEBUGr���r���Zunlink_f)r���r����countr���r���r���r���r����_clean?���s���� r-���c��������������������s0���t�jjd�����fdd�|�D��}tdd��|D���S�)z:Return the repo IDs that have some cached metadata around.r ���c�����������������3���s���|�]}t����|�V��qd�S�r���r���)r!���r����Zmetapatr���r���r%���M���r&���z _cached_repos.<locals>.<genexpr>c�����������������s���s���|�]}|r|��d��V��qdS�)ZrepoidN)�group)r!����mr���r���r���r%���N���r&���)r����repo�CACHE_FILES�set)r����matchesr���r.���r���� _cached_reposJ���s����r5���c�������������������@���s0���e�Zd�ZdZdZed�Zedd���Zdd��Z dS�) �CleanCommandzSA class containing methods needed by the cli to execute the clean command. )Zcleanzremove cached datac�����������������C���s���|�j�ddt���td�d��d�S�)N�type�+zMetadata type to clean)�nargs�choices�help)�add_argument�_CACHE_TYPES�keysr���)�parserr���r���r���� set_argparserY���s�����zCleanCommand.set_argparserc�������������� ���C���s���|�j�jj}tj�|d�}tj�|d�}tj�|�j�jjd�}�z<|�� �|�����|���t dd��|�j jD���}tt |��}t�tdd�|�����d|v�r�t|�}|�j�jj�|��|�d��t�td���dd ��|D��}t|t||��} t�td d| �| ���W�d�����W�d�����W�d�����W�d�S�1��s,0����Y��W�d�����n1��sL0����Y��W�d�����n1��sl0����Y��W�q:�tjj�y��} �z@|�j�jj�s�td�| j�}t�|��t� d ��n| �W�Y�d�} ~ q:d�} ~ 0�0�q:d�S�)NTc�����������������s���s ���|�]}t�|�D�] }|V��qqd�S�r���)r=���)r!����c�tr���r���r���r%���g���r&���z#CleanCommand.run.<locals>.<genexpr>zCleaning data: � r���zCache was expiredc�����������������S���s���g�|�]}t�jj|��qS�r���)r���r1���r2���)r!���rB���r���r���r���� <listcomp>q���r&���z$CleanCommand.run.<locals>.<listcomp>z%d file removedz%d files removedz*Waiting for process with pid %d to finish.����)!r���Zconf�cachedirr����lockZbuild_metadata_lockZbuild_download_lockZbuild_rpmdb_lockZ persistdirr3���Zoptsr7����listr���r)����debugr���r���r5���Z_repo_persistorZexpired_to_add�update�remove�infor-���r'���r���� exceptionsZ LockErrorZexit_on_lock�pid�time�sleep)�selfrF���Zmd_lockZ download_lockZ rpmdb_lock�typesr���Zexpiredr$���r,����e�msgr���r���r����run_���s0���� � zCleanCommand.runN) �__name__� __module__�__qualname__�__doc__�aliasesr���Zsummary�staticmethodr@���rU���r���r���r���r���r6���Q���s��� r6���)Z __future__r���r���Zdnf.clir���Zdnf.i18nr���r���Zdnf.yumr���r���Zdnf.exceptionsZdnf.lockZdnf.loggingZdnf.repor+���r���r���rO���Z getLoggerr)���r=���r���r'���r-���r5���ZCommandr6���r���r���r���r����<module>���s2��� �