HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/sos/report/plugins/__pycache__/unpackaged.cpython-38.pyc
U

i��d�
�@sBddlmZmZddlZddlZddlmZGdd�dee�ZdS)�)�Plugin�RedHatPluginN)�Pathc@seZdZdZdZdd�ZdS)�
UnpackagedzDCollects a list of files that are not handled by the package manager�
unpackagedc		s�dd�}d�fdd�	}�fdd�}�jdd�s2dS��d	��v}|��g}t�fd
d��j��jj���D����D]}|||�7}qr�fdd
�|D�}||�}|�d�|��W5QRXdS)NcSstjd�d�S)z3Return a list of directories in $PATH.
            �PATH�:)�os�environ�split�rr�?/usr/lib/python3/dist-packages/sos/report/plugins/unpackaged.py�get_env_path_listsz-Unpackaged.collect.<locals>.get_env_path_listc
s�g}tj|dd�D]�\}}}|rD|D]��fdd�|D�|dd�<q$|D]j}��||�}z"t�t�|�j�rxt|���}Wnt	k
r�YqHYnX|�
��||�tj�|�g�qH|D]&}��||�}|�
|tj�|�g�q�q|S)z�Return a list of all files present on the system, excluding
                any directories listed in `exclude`.

            :param path: the starting path
            :param exclude: list of paths to exclude
            T)�topdowncsg|]}|�kr|�qSrr)�.0�d��err
�
<listcomp>)sz@Unpackaged.collect.<locals>.all_files_system.<locals>.<listcomp>N)
r	�walk�	path_join�stat�S_ISLNK�lstat�st_moderZresolve�	Exception�append�path�realpath)rZexcludeZ	file_list�root�dirs�files�name��selfrr
�all_files_systems&
�z,Unpackaged.collect.<locals>.all_files_systemcshg}|D]Z}��|�}|�}d}��|�rT|dkrTt�|�}|d|��7}|d7}q |�|d�q|S)z4Format the unpackaged list as a string.
            r�
z -> ��
)rZpath_islinkr	�readlinkr)r!Zexpanded�f�fp�outZlinksr#rr
�
format_output:s


z)Unpackaged.collect.<locals>.format_outputT)�cmdrc3s0|](�t�fdd��D��rtj���VqdS)csg|]}��|��qSr)�
startswith)r�p��xrr
rWsz0Unpackaged.collect.<locals>.<genexpr>.<listcomp>N)�anyr	rr)r)�pathsr1r
�	<genexpr>Ts�z%Unpackaged.collect.<locals>.<genexpr>csg|]\}}|�kr|�qSrr)rr2Zrp)�all_frpmrr
r\sz&Unpackaged.collect.<locals>.<listcomp>�)N)	Ztest_predicateZcollection_file�setZpolicyZmangle_package_pathZpackage_managerZ	all_files�write�join)	r$rr%r-ZufileZall_fsystemrZnot_packagedZnot_packaged_expandedr)r6r4r$r
�collects$
��zUnpackaged.collectN)�__name__�
__module__�__qualname__Z
short_descZplugin_namer;rrrr
rsr)Zsos.report.pluginsrrr	r�pathlibrrrrrr
�<module>	s