3 ܓi @s`ddlZddlZddlmZGdddeZGdddeZGdddeZGd d d eZdS) N)SoSObfuscationArchivec@s$eZdZdZdZdZeddZdS)SoSReportArchivezThis is the class representing an sos report, or in other words the type the archive the SoS project natively generates Zreportzsos report archivec Cs,ytj|od|kStk r&dSXdS)Nz sosreport-F)tarfile is_tarfile Exception)clsarc_pathr /usr/lib/python3.6/sos.py check_is_typeszSoSReportArchive.check_is_typeN)__name__ __module__ __qualname____doc__ type_name description classmethodr r r r r rsrc@s$eZdZdZdZdZeddZdS)SoSReportDirectoryzThis is the archive class representing a build directory, or in other words what `sos report --clean` will end up using for in-line obfuscation Z report_dirzsos report directorycCstjj|rdtj|kSdS)NZsos_logsF)ospathisdirlistdir)rrr r r r )s z SoSReportDirectory.check_is_typeN)r r rrrrrr r r r r r!src@s0eZdZdZdZdZdZeddZddZ d S) SoSCollectorArchivezArchive class representing the tarball created by ``sos collect``. It will not provide prep files on its own, however it will provide a list of SoSReportArchive's which will then be used to prep the parsers Zcollectzsos collect tarballTc Cs,ytj|od|kStk r&dSXdS)Nz sos-collectF)rrr)rrr r r r :sz!SoSCollectorArchive.check_is_typecCsh|jdd|j}g}xLtj|D]>}tjj||}d|kr"tj|r"|jt ||j |j |j q"W|S)NT)quietz sosreport-) extractZextracted_pathrrrjoinrrappendrZtmpdirZkeep_binary_filesZtreat_certificates)self_pathZarchivesfnameZarc_namer r r get_nested_archivesAs  z'SoSCollectorArchive.get_nested_archivesN) r r rrrrZ is_nestedrr r r r r r r0s  rc@s$eZdZdZdZdZeddZdS)SoSCollectorDirectoryz{The archive class representing the temp directory used by ``sos collect`` when ``--clean`` is used during runtime. Z collect_dirzsos collect directorycCs0tjj|r,xtj|D]}d|krdSqWdS)Nzsos-collector-TF)rrrr)rrrr r r r Vs  z#SoSCollectorDirectory.check_is_typeN)r r rrrrrr r r r r r!Nsr!)rrZsos.cleaner.archivesrrrrr!r r r r  s