id HddlmZmZddlZddlZddlmZGddeeZy))Plugin RedHatPluginN)PathceZdZdZdZdZy) UnpackagedzDCollects a list of files that are not handled by the package manager unpackagedc d}d fd }fd}jdsyjd5}| g}t fdjj jj j D} D] }|||z }|D cgc] \}} | |vs |} }} || } |jdj| dddycc} }w#1swYyxYw) NcFtjdjdS)z3Return a list of directories in $PATH. PATH:)osenvironsplit?/usr/lib/python3/dist-packages/sos/report/plugins/unpackaged.pyget_env_path_listz-Unpackaged.collect..get_env_path_lists::f%++C0 0rcg}tj|dD]\}}}|r|D]}|Dcgc] }||vs| c}|dd|D]} j||} tjtj |j rt|j}|j j||tjj|g|D]D} j||}|j|tjj|gF|Scc}w#t$rYwxYw)zReturn 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)topdownN) r walk path_joinstatS_ISLNKlstatst_moderresolve Exceptionappendpathrealpath) rexclude file_listrootdirsfilesednameselfs rall_files_systemz,Unpackaged.collect..all_files_systemsDI%'WWT4%@ E!dE$B.2"Aaqj1"AQB! D>>$5D!<<(>(>?#':#5#5#7D$$d3RWW5E5Ed5KL !ED>>$5D$$dBGG,<,|dkr9tj|}|d|z }|dz }j|r|dkr9|j |dz}|S)z4Format the unpackaged list as a string. r z ->  )r path_islinkr readlinkr)r%expandedffpoutlinksr)s r format_outputz)Unpackaged.collect..format_output:sH ,^^A& &&r*urzRBT";&CQJE&&r*urzd + ,OrT)cmdrc 3K|]K}tDcgc]}|j|c}r!tjj |Mycc}wwN)any startswithr rr ).0xppathss r z%Unpackaged.collect..TsH()59a!,,q/9:  #:sAA 0Ar9) test_predicatecollection_filesetpolicymangle_package_pathpackage_manager all_fileswritejoin) r)rr*r6ufile all_fsystemall_frpmr'r=rp not_packagednot_packaged_expandedr?s ` @rcollectzUnpackaged.collects 1  : (""t",   ! !, / 85%'EK-1[[-L-LKK//99;.H  3/22  3-8O'1bBhrYs#4 O8O8r