VULN_CHECK_I913V6 jBddlmZddlmZmZddlmZddlmZddl m Z ddl Z ddl Z ddl Z ddlZddlZddlZ ddlZ Gddej$Zy) )print_function)commandsCliError)_)NoModuleException)loggerNc eZdZGddejZGddeZGddeZGddeZGd d eZ Gd d eZ Gd deZ GddeZ GddeZ GddeZGddeZGddeZeeee e e e e eeeh ZehZdZedZfdZdZdZdZdZxZS) ModuleCommandc*eZdZfdZdZdZxZS)ModuleCommand.SubCommandcttj||tj j j|j|_yN) superr SubCommand__init__dnfmodule module_base ModuleBasebase)selfcli __class__s &,kkv{{r*0--RNNv~~';KK#T!UU[U[#V%&'-kkv{{r))44::4RQUV"))'2 5& %rct}t}|D]L}||vs|jjj|s.|j |j N|D]e}t j|}|jt jgD]*}|js|j|j,g||fS)N)forms) rrr*isModuleActiver, getArtifactshawkeySubjectget_nevra_possibilities FORM_NEVRAr#add) r use_modules skip_modules artifacts pkg_namesrartifactsubj nevra_objs r_get_module_artifact_namesz3ModuleCommand.SubCommand._get_module_artifact_names>sII%-yy11@@H!(()<)<)>?&&~~h/!%!=!=%001">"3I ~~! inn5"3& i' 'r)__name__ __module__ __qualname__rr1rB __classcell__rs@rrr &s L &$ (rrc,eZdZdZedZdZdZy)ModuleCommand.ListSubCommand)listz,list all module streams, profiles and statescL|jj}d|_d|_yNTrdemandsavailable_repossack_activationrrNs r configurez&ModuleCommand.ListSubCommand.configureR!hh&&G&*G #&*G #rc|j}|jjrJ|j|jjt j jj}n|jjrI|j|jjt j jj}n|jjrI|j|jjt j jj}nH|j|jjt j jj}|r t|y|jjr*td}t j"j%|yNzNo matching Modules to list)rr enabled_get_brief_descriptionr!libdnfrModulePackageContainerModuleState_ENABLEDdisabledModuleState_DISABLED installedModuleState_INSTALLEDModuleState_UNKNOWNprintrr exceptionsError)rmodsoutputmsgs r run_on_modulez*ModuleCommand.ListSubCommand.run_on_moduleWs9##Dyy  44II))6==+O+O+c+ce##44II))MM88MMO$$44II))MM88NNP44II))6==+O+O+c+cef yy$$56nn**3//%rNrCrDrEaliasesrsummaryrRrfrrListSubCommandrIMsBC +  0rrkc,eZdZdZedZdZdZy)ModuleCommand.InfoSubCommand)r'z)print detailed information about a modulecL|jj}d|_d|_yrLrMrQs rrRz&ModuleCommand.InfoSubCommand.configuretrSrc|jjr0|jj|jj}nu|jj r0|jj |jj}n/|jj|jj}|r t|ytjjtdrU) r verboser_get_full_infor!profile_get_info_profiles _get_infor`rrarbrrrds rrfz*ModuleCommand.InfoSubCommand.run_on_moduleysyy  ))889N9NO""))<>>// %99>>((--1D1D..13J3J13M"MM@@bb4c SV$$ %/2C3BC..C3NrgrjrrEnableSubCommandrxs,- % %rrc,eZdZdZedZdZdZy)ModuleCommand.DisableSubCommand)disablez%disable a module with all its streamsch|jj}d|_d|_d|_d|_yrLr{rQs rrRz)ModuleCommand.DisableSubCommand.configurer~rc |jj|jjy#tj j $r}|jjjr\|js |jr||jr6|jdtjjj k7r|t#j$t'|Yd}~yd}~wwxYwr)rrr r!rrarrrrrrrrXrrYrrrrrs rrfz-ModuleCommand.DisableSubCommand.run_on_modules %  (()>)>?>>// %99>>((--1D1D..13J3J13M"MM@@bb4c SV$$ %rNrgrjrrDisableSubCommandrs;< % %rrc,eZdZdZedZdZdZy)ModuleCommand.ResetSubCommand)resetzreset a modulech|jj}d|_d|_d|_d|_yrLr{rQs rrRz'ModuleCommand.ResetSubCommand.configurer~rcP |jj|jjy#tj j $rV}|jjjr|jr|tjt|Yd}~yd}~wwxYwr)rrr r!rrarrrrrrrrrs rrfz+ModuleCommand.ResetSubCommand.run_on_modulesq %  &&tyy'<'<=>>// %99>>((-- SV$$  %s/2B%A B  B%NrgrjrrResetSubCommandrs$% % %rrc,eZdZdZedZdZdZy)ModuleCommand.InstallSubCommand)installz/install a module profile including its packagesch|jj}d|_d|_d|_d|_yrLr{rQs rrRz)ModuleCommand.InstallSubCommand.configurer~rc |jj|jj|jj j y#tjj$rb}|jj j r|js |jr|tjt|Yd}~yd}~wwxYwr)rrr r!rrrrrarrrrrrrs rrfz-ModuleCommand.InstallSubCommand.run_on_modules %  (()>)> @U@UV>>// %99>>((--1D1D SV$$  %sAAC.AC  CNrgrjrrInstallSubCommandrsEF % %rrc,eZdZdZedZdZdZy)ModuleCommand.UpdateSubCommand)r,z0update packages associated with an active streamch|jj}d|_d|_d|_d|_yrLr{rQs rrRz(ModuleCommand.UpdateSubCommand.configurer~rc|jj|jj}|rt dj |y)Nz, )rupgrader r!rjoin)r module_specss rrfz,ModuleCommand.UpdateSubCommand.run_on_modules>++33DII4I4IJL' ,(?@@rNrgrjrrUpdateSubCommandrsFG % Arrc,eZdZdZedZdZdZy)ModuleCommand.RemoveSubCommand)removeerasez3remove installed module profiles and their packagesc|jj}d|_d|_d|_d|_d|_d|_y)NTF)rrN allow_erasingrOfresh_metadatar|r}rPrQs rrRz(ModuleCommand.RemoveSubCommand.configuresAhh&&G$(G !&*G #%*G " $G  $G &*G #rc|jj|jj}|jjrh|j }|j |t\}}|j |jjj|\}}|jjjjj|}|jjjjj|}|D]{}||vr0tdj!|} t#j$| 7|jj&j)||jj*j,}|syt#j.t0j2j5|y)Nr#z0Package {} belongs to multiple modules, skipping) clean_deps)r)rrr r!allr1rBrrr*getModulePackagessackr+r]filtermrr(rr'goalrrclean_requirements_on_removerrrar) rskipped_groupsr-remove_names_from_specr. keep_names remove_query keep_querypkgres rrfz,ModuleCommand.RemoveSubCommand.run_on_modulesq!--44TYY5J5JKNyy}}%)%M%M%O"-1-L-L&./*&!%!@!@II..@@BDV"X B#yy~~335??AII/ J 1 !YY^^113==?GGZGX 'Cj( RSZZ[^_ C( ,,DIINN,W,W-Y (" LL55>5Z [rNrgrjrrRemoveSubCommandrs&IJ + \rrc,eZdZdZedZdZdZy) ModuleCommand.SwitchToSubCommand)z switch-toz7switch a module to a stream and distrosync rpm packagesc|jj}d|_d|_d|_d|_d|j j_yrL) rrNrOrPr|r}rrmodule_stream_switchrQs rrRz*ModuleCommand.SwitchToSubCommand.configuresAhh&&G&*G #&*G # $G  $G 26DIINN /rc |jj|jj|jj j y#tjj$rb}|jj j r|js |jr|tjt|Yd}~yd}~wwxYw)N)r)r switch_tor r!rrrrrarrrrrrrs rrfz.ModuleCommand.SwitchToSubCommand.run_on_module"s %  **499+@+@I^I^*_>>// %99>>((--1D1D SV$$  %sAAC/AC  CNrgrjrrSwitchToSubCommandrs MN 7 %rrc,eZdZdZedZdZdZy) ModuleCommand.ProvidesSubCommand)providesz.locate a module the modular packages belong tocL|jj}d|_d|_yrLrMrQs rrRz*ModuleCommand.ProvidesSubCommand.configure0rSrc~|jj|jj}|r t |yyr)r_what_providesr r!r`rus rrfz.ModuleCommand.ProvidesSubCommand.run_on_module5s1%%44TYY5J5JKFf rNrgrjrrProvidesSubCommandr+s DE +  rrc,eZdZdZedZdZdZy)!ModuleCommand.RepoquerySubCommand) repoqueryz#list packages belonging to a modulecL|jj}d|_d|_yrLrMrQs rrRz+ModuleCommand.RepoquerySubCommand.configure?rSrcTt}|jjD]1}|jj |\}}|j |3|j |t\}}t}|jjs|jjsc|jjjjj|}|D]} |jt| |jjrc|jjjjj|}|D]} |jt| djt!|} t#| y)N) nevra_strictr )rr r!rr"r,rB availabler]rrr+rr:rrsortedr`) rr-r!r0r.names_from_specspec_artifactspackage_stringsr+rrds rrfz/ModuleCommand.RepoquerySubCommand.run_on_moduleDs@!$ #yy44 "..;;KH "))'2 5/3.M.M"CE/+ +O^!eOyy""$))*=*= ,,.88:BBP^B_ C#''C1!yy"" ,,.88:BBBX C#''C1!YYvo67F &MrNrgrjrrRepoquerySubCommandr:s!9: +  rr)rzxInteract with Modules. WARNING: modularity is deprecated, and functionality will be removed in a future release of DNF5.ctt| fd|jD}d|_|Dcic]}|j D]}||c}}|_ycc}}w)Nc3.K|] }|ywrrj).0subcmdrs r z)ModuleCommand.__init__..ds>vvc{s)rr rSUBCMDSrrh_subcmd_name2obj)rr subcmd_objsraliasrs ` rrzModuleCommand.__init__bs[ mT+C0>>  (3!Q(3fE6ME !Q!QsAc |j}|jdddtd|jdddtd|jd d dtd |jd d dtd|jdddtd|jdddtdg}g}t|jdD]\}|j |j d|j dj|j d|jxsd^|jdd|ddj||jdd d!td"#y)$Nz --enabledrV store_truezshow only enabled modules)destactionhelpz --disabledr[zshow only disabled modulesz --installedr]z'show only installed modules or packagesz --profilerrzshow profile contentz --availablerzshow only available packagesz--allrzremove all modular packagesc |jdS)Nr)rh)xs rz-ModuleCommand.set_argparser..~s 1r)keyrz{}: {}rrrzr)nargschoicesmetavarrr!z module-spec*zModule specification)rrr) add_mutually_exclusive_group add_argumentrrrappendrhr(rir)rparsernarrowssubcommand_choicessubcommand_helprs r set_argparserzModuleCommand.set_argparseris557[y$0"#$?"@  B \ $0"#$@"A  C ]$0"#$M"N  P [y$0"#$:";  = M L!"#A!B  DW5$0"#$A"B  D T\\/EFF  % %fnnQ&7 8  " "8??6>>!3DfnnFZXZ#[ \G HA7I$7!%?!;  = M=!"#9!:  /LV.4nnU"'.<"'/L !> 99  A &; ;99((34;;CHHsC)rCrDrErCommandrrkrvrrrrrrrrrrrrhrrirrrRrrrFrGs@rr r %s%(X%%%(N 0 0DMM,%:%0%J%0%*%*%J%*A:A"#\:#\J%Z%, Z j>~/? /3DFV!35GI\^G!//GKLGQ<< $ Rrr ) __future__rdnf.clirrdnf.i18nrdnf.module.exceptionsrdnf.utilrrsysosr6rXdnf.module.module_basednf.exceptionsrr rjrrrsA(&&3 yRH$$yRr