a º&cL+ã@sNddlmZmZddlZddlmZGdd„dejƒZGdd„dejj ƒZ dS)é)Ú_ÚloggerN)ÚPackagecs,eZdZdZdZ‡fdd„Zdd„Z‡ZS)ÚDebuginfoInstallz5DNF plugin supplying the 'debuginfo-install' command.údebuginfo-installcs4tt|ƒ ||¡||_||_|dur0| t¡dS)zInitialize the plugin instance.N)ÚsuperrÚ__init__ÚbaseÚcliZregister_commandÚDebuginfoInstallCommand)Úselfr r ©Ú __class__©úA/usr/lib/python3.9/site-packages/dnf-plugins/debuginfo-install.pyr s zDebuginfoInstall.__init__cCsf| |jj¡}| d¡o.| dd¡o.| dd¡}|rbtj |j¡  ¡j dd}t |ƒrb|jj   ¡dS)NÚmainÚ autoupdatez *-debuginfo)Z name__glob)Z read_configr ÚconfZ has_sectionZ has_optionZ getbooleanÚdnfÚsackZ _rpmdb_sackÚqueryÚfiltermÚlenÚreposÚenable_debug_repos)r ZcprZdbginforrrÚconfig(s  ÿ þzDebuginfoInstall.config)Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚnamerrÚ __classcell__rrr rrs rcsheZdZdZdZedƒZ‡fdd„Zedd„ƒZ dd „Z d d „Z d d „Z dd„Z dd„Zdd„Z‡ZS)r z! DebuginfoInstall plugin for DNF )rzinstall debuginfo packagescs4tt|ƒ |¡tƒ|_tƒ|_tƒ|_tƒ|_dS)N)rr rÚsetÚavailable_debuginfo_missingÚavailable_debugsource_missingÚinstalled_debuginfo_missingÚinstalled_debugsource_missing)r r r rrr:s z DebuginfoInstallCommand.__init__cCs|jddddS)NÚpackageú+)Únargs)Ú add_argument)ÚparserrrrÚ set_argparserBsz%DebuginfoInstallCommand.set_argparsercCs0|jj}d|_d|_d|_d|_|jj ¡dS)NT) r ÚdemandsZ resolvingZ root_userZsack_activationZavailable_reposr rr)r r-rrrÚ configureFs z!DebuginfoInstallCommand.configurecCshg}ttjƒ}ttjƒ}|jjD]„}tj |¡j |j j dd}|d}|stt   tdƒ|j jj |¡¡| |¡q | ¡ ¡}| | ¡ ¡¡t| ¡ƒD]T}| tj¡rÊ|d| …|vrÊ| |¡| tj¡rž|d| …|vrž| |¡qž| ¡D]¦} | d} | jr i} | D]} |  | jg¡ | ¡q|  ¡D]^} | d} | | j | ¡sz| | j!| ¡sz|j" #t$| ƒ¡| | j%| ¡s>|j& #t$| ƒ¡q>qü| j' tj¡sÀ| j' tj¡rÌ| (| ¡qü|ddurF| )| j |d¡s| )| j!|d¡s|j* #d +| j'| j,¡¡| )| j%|d¡sü|j- #d +| j'| j,¡¡qü| .| j | ¡s~| .| j!| ¡s~|j* #d +| j'| j,¡¡| .| j%| ¡sü|j- #d +| j'| j,¡¡qüq |j*rÌt   tdƒd  /t0|j*ƒ¡¡|j-rðt   td ƒd  /t0|j-ƒ¡¡|j"rt   td ƒd  /t0|j"ƒ¡¡|j&r8t   td ƒd  /t0|j&ƒ¡¡|rd|j j1j2rdtj3j4td ƒd /|¡d‚dS)NF)Zwith_srcrzNo match for argument: %srZnevraz{}-{}zICould not find debuginfo package for the following available packages: %sz, zKCould not find debugsource package for the following available packages: %szICould not find debuginfo package for the following installed packages: %szKCould not find debugsource package for the following installed packages: %szUnable to find a matchú )Zpkg_spec)5rrZDEBUGINFO_SUFFIXZDEBUGSOURCE_SUFFIXZoptsr'rZsubjectZSubjectZget_best_solutionr rrÚinforÚoutputZtermZboldÚappendZ availableZ _name_dictÚupdateZ installedÚlistÚkeysÚendswithÚpopÚvaluesZ _from_systemÚ setdefaultÚarchÚ_install_debug_from_systemÚ debug_nameZsource_debug_namer%ÚaddÚstrZdebugsource_namer&r Ú_installÚ_install_debugr#ÚformatÚevrr$Ú_install_debug_no_nevraÚjoinÚsortedrÚstrictÚ exceptionsZPackagesNotAvailableError)r Z errors_specZdebuginfo_suffix_lenZdebugsource_suffix_lenZpkgspecZsolutionrZ package_dictr ÚpkgsZ first_pkgZ arch_dictÚpkgZpackage_arch_listrrrÚrunNs¨  ÿ         ÿ ÿÿÿÿþþþþ ÿzDebuginfoInstallCommand.runcCs:|jj ¡j||j|j|j|jd}|r6| |¡dSdS)N)r ÚepochÚversionÚreleaser:TF) r rrÚfilterrKrLrMr:r?)r r<rIrrrrr;Êsü z2DebuginfoInstallCommand._install_debug_from_systemcCs†i}|jdur|j|d<|jdur,|j|d<|jdur@|j|d<|jdurT|j|d<|jj ¡jfd|i|¤Ž}|r‚| |¡dSdS)NZ epoch__globZ version__globZ release__globZ arch__globr TF) rKrLrMr:r rrrNr?)r r<Z base_nevraÚkwargsrrrrr@×s         z&DebuginfoInstallCommand._install_debugcs8|jj ¡j‡fdd„|Dƒd}|r4| |¡dSdS)Ncsg|]}d ˆ|j|j¡‘qS)z{}-{}.{})rArBr:)Ú.0Úp©r<rrÚ îózCDebuginfoInstallCommand._install_debug_no_nevra..)Z nevra_strictTF)r rrrr?)r r<rHrrrRrrCìs ÿ z/DebuginfoInstallCommand._install_debug_no_nevracCs:tj |jj¡}|j|d|jjj||jjj ddS)N)rI)ZselectZoptional) rÚselectorZSelectorr rr"ZgoalÚinstallrrF)r rHrUrrrr?õs z DebuginfoInstallCommand._install)rrrrÚaliasesrZsummaryrÚ staticmethodr,r.rJr;r@rCr?r!rrr rr 4s  |  r ) ZdnfpluginscorerrrZ dnf.packagerZPluginrr ZCommandr rrrrÚs