VULN_CHECK_I913V6 ?(fylddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddl m Z m Z ddlZddlmZddlmZddlZ ddlmZmZmZmZdZd Zee d e d gZee de ddgZerddl m!Z!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'nddl!m!Z!m"Z"m#Z#ddl(m%Z%m&Z&m'Z'ejRjTGddejVjXZ-ejRjTGdde-Z.y#e$rdZ dd lmZn#e$rd ZYnwxYwYwxYw))print_functionN)_logger)PY3)ucd)nameversioncodenameos_release_attrc<tttfSN)rr r 5/usr/lib/python3.12/site-packages/dnf-plugins/copr.pylinux_distributionr.s 8:..rcy)Nr)rs rr r 1sr)rctd5}i}|D]9} |jjd\}}|jd||<;|d|ddfcdddS#t$rY[wxYw#1swYyxYw)Nz/etc/os-release="NAME VERSION_ID)openrstripsplitstrip ValueError)os_release_fileos_release_datalineos_release_keyos_release_values rrr7s'(O"$+D;?;;=;N;Ns;S8(8:J:P:PQT:U7,(/1NPTU)( & )(s.A06A! A0! A-*A0,A--A00A9copryesynonr) ConfigParser NoOptionErrorNoSectionError)urlopen HTTPErrorURLErrorceZdZdZdZdZdZdZdZedzezZ dZ e d Z d Z e d Zed Zd ZdZdZdZdZdZdZdZdZdZdZdZedZdZdZ dZ!dZ"dZ#dZ$ed Z%ed!Z&ed"Z'y)# CoprCommandz Copr plugin for DNF Nzcopr.fedorainfracloud.orgfedorahttpsi://)r#z Interact with Copr repositories.Ta enable name/project [chroot] disable name/project remove name/project list --installed/enabled/disabled list --available-by-user=NAME search project Examples: copr enable rhscl/perl516 epel-6-x86_64 copr enable ignatenkobrain/ocltoys copr disable rhscl/perl516 copr remove rhscl/perl516 copr list --enabled copr list --available-by-user=ignatenkobrain copr search tests c|jddgd|j}|jddtd|jd dtd |jd dtd |jd dtd|jdtd|jddy)N subcommand)helpenabledisableremovelistsearchnargschoicesz --installed store_truez.List all installed Copr repositories (default))actionr6z --enabledzList enabled Copr repositoriesz --disabledzList disabled Copr repositoriesz--available-by-userrz-List available Copr repositories by user NAME)metavarr6z--hubz(Specify an instance of Copr to work with)r6arg*)r=) add_argumentadd_mutually_exclusive_groupr)parser list_options r set_argparserzCoprCommand.set_argparserpsL%A  B99;   |&'(X&Y ! [  \&'(H&I ! K  l&'(I&J ! L  !6&'(W&X ! Z G!,V*WXE-rc|jjjjdk7ryd}t}g}|jj j d}tjj|tdz}tjjdtdz}tjj|r|j|tjj|r|j|n|j|tjtjj|tdzD]M}|jdstjj|tdz|}|j|Og} t!|jj"r(|jj"dj%d} t!| dk(rh|jj&rRt)j*t-d t-d zt.jj1t-d |jj&s1t!| dk7r#|j2|_|j6|_n*t!| dk(r| d}n|jj&}|r|rd|_|j;t=|d |j?||dd} | r|j?||d|j@} |j?||d|jB} | |_| dz| z|_tE| |jBk7r0|xj8d| zz c_|xj4d| zz c_|j8sEd|vr||_|j@dz|z|_y|j%ddd|_||_yy)Nr#rz.confz/usr/share/dnf/plugins/z .vendor.confz.d/Error: z^specify Copr hub either with `--hub` or using `copr_hub/copr_username/copr_projectname` formatzmultiple hubs specifiedT)reversehostnameprotocolportr2:r5)#clicommandoptsr(baseconfpluginconfpathospathjoin PLUGIN_CONFisfileappend_get_copr_chrootlistdirendswithlenrBrhubrcriticalrdnfCliErrordefault_hostname copr_hostname default_urlcopr_urlreadsorted_read_config_itemdefault_protocol default_portint) selfcopr_hubcopr_plugin_config config_files config_pathdefault_config_filevendor_config_filefilename config_fileprojectrNrOrPs r configurezCoprCommand.configures@ 88   ( (F 2 )^ iinn33A6  ggll; g8MNWW\\*C[SaEab 77>>- .    3 4 77>>, -  ! !"4 5  ! !"5 6 277<< [4=O#PQH  ) ggll; d8JHU ##K0R  tyy}} iimmA&,,S1G w<1  OO) EFF  ''""1%>#?@ @3w<1#4!%!6!6D  ,,DM\Q qzHyy}}H H DM  # #F<$F G--.@(JX\]H112DhPZ262G2GI--.@(F.2.?.?A&." (5 08 ; t9 1 11MMS4Z/M&&#*4&}}H$%-" $ 5 5 = H %-^^E1%=a%@" ( rcV |j||S#ttf$r|cYSwxYwr )getr)r*)rpconfigrbsectiondefaults rrlzCoprCommand._read_config_items1 ::c7+ +~. N s ((cJtjj|syt}|j ||j ddr@|j ddr.|j dd}|j dd}||g|_y|js ddg|_yy)z} Sets the Copr root from a config file This is refactored from configure() to avoid code duplication Nmain distribution releaseverF)rXrYr\r(rj has_optionr| chroot_config)rpr}rrrrs rr^zCoprCommand._get_copr_chroots ww~~f% )^'  ( ( @"--flC-11&.IL+// EJ". !;D %%&+U^"&rc|tjjdj|j y)N{0} )sysstderrwriteformatr)rptexts r_user_warning_before_promptz'CoprCommand._user_warning_before_prompts#  56rc |jjd}|dk(r&|jjj |y|dk(r|jj r&|j |jj y|j|jjjd|jj|jjy |jjd} |jjd}t+|jjdkDr(t&j,j/t%d|j1d |_t+|j2d kr(t&j,j/t%d  |d k(r|j7|y|j1d }t+|dvrRt!j"t%dt%dzt&jj)t%dt+|dk(r |d}|d}n|d}|d}|d z|z}dj9|jjj:|j<|j?||}|dk(r|jAt%d}d jC|j<||g}dj9|} |jE|| |jG||t!jHt%d|jK||y|dk(rA|jA|jM||t!jHt%dy|dk(rA|jA|jO||t!jHt%dyt&j,j/t%dj9|#ttf$rxt!j"t%dt%dz|jjj |t&jj)t%dwxYw#t$r*|j5}|j1d |_Y wxYw)Nrr6r:rLz>exactly two additional parameters to copr command are requiredr5zToo many arguments.-rKzOBad format of optional chroot. The format is distribution-version-architecture.r;rJ)rrKzEuse format `copr_username/copr_projectname` to reference copr projectzbad copr project formatz{0}/_copr:{1}:{2}:{3}.repor7a Enabling a Copr repository. Please note that this repository is not part of the main distribution, and quality may vary. The Fedora Project does not exercise any power over the contents of this repository beyond the rules outlined in the Copr FAQ at , and packages are not held to any quality or security level. Please do not file bug reports about these packages in Fedora Bugzilla. In case of problems, contact the owner of this repository. z!Do you really want to enable {0}?z Repository successfully enabled.r8z!Repository successfully disabled.r9z Repository successfully removed.zUnknown subcommand {}.)(rTr4rR optparser print_helpavailable_by_user_list_user_projects_list_installed_repositoriesrUrVreposdirenableddisabledrBr IndexErrorrrcrrdrera exceptionsErrorr chroot_parts _guess_chroot_searchr get_reposdirrg_sanitize_username _need_rootrZ _ask_user_download_repoinfo_runtime_deps_warning _disable_repo _remove_repo) rpr4 project_namechrootry copr_usernamecopr_projectname repo_filenamermsgs rrunzCoprCommand.runs#YY))!,   HH   ) )$ /  yy**(()D)DE11$))..2I2I!2L26))2C2CTYYEWEWY 099==+L 2YY]]1%F499==!A%nn**1-B+CDD & S 1D 4$$%)nn**1.R,STT*  ! LL & $$S) w#?@ @ \Q #AJM&qz #AJM&qz (3.1AAL4;; IINN ' '););  # #M 24DF   ! OO   Dhh 2 2M 0 23G5<  & &}6F G 9 $ OO    }.> ? KK=> ? 8 # OO    m-= > KK<= >..&&*+22:>@ @WJ' 0 OO) .// 0 HH   ) )$ /''""./0 0  0" 2'')F & S 1D  2s $P>B9R&BR#&/SSc|jjdd}tjd|jz|}|j |j k(xrtjd|}tjd|}|jjr|s|sy|sytjd|rytjd|ry|j} | r|s| s|ryd} tjd |r&|jd d \} } } }| dz| zdz|z}ntjd|rO|jd d }|jd ddjd d d } | dz|dzdz|d z}n2|jd d }|jdz|dzdz|d z}d} | s|dz }| r|dz }t|| S)NrJ_copr:_copr_z_copr:|^_copr_zcopr:.*:.*:.*:mlz coprdep:.*Fcopr:rQrKrr5rrTz (disabled)z *) repofilerrematchrgrirhrTrbrrsplitrfprint)rprepo_idrepo enabled_only disabled_only file_name match_new match_old match_anyrold_reporrg copr_ownercopr_dirr copr_names r_list_repo_filezCoprCommand._list_repo_fileJsMM'',R0 HHX(:(::IF MMT%5%55W"((8Y:W HH-y9 99==Y  88& 0  88L' * ,,  w<  88GW %5<]]35J 2A}j(#% 2S88CC XXh * c1-I%,,S!4Q7==c1EaHM#% ! 4s:Yq\IC c1-I''#- !   !!,/w'D%%if>C &C!,B*CD))""00S4@C #J ( $..&&?@ "$ $ $s #D AE cdj|}|j|z}|jj|d} t j |j }|j|tdj|}|j||dD]b}dj|d}|d xs td } |jjjt!|| }t#|dy#t$r8tjjtdj|wxYw) Nz/api_3/project/search?query={}rrzCan't parse search for '{}'.z Matched: {}rz{0} : full_namerzNo description given.r) rpqueryrrrrrrrrs rrzCoprCommand._searchs3::5Ammh&ii$/ :CHHJ/J  +'..u5  !!,/w'D//${"34C &D!,C*DD))""00S4@C #J ( :..&&q)G(++16%=: : :s #D AE cd|jjj|}t|yr )rUr fmtSectionr)rpr formatteds rrz CoprCommand._print_match_sections$II$$//5  irc|jstjjdd|_tjjdj |j |j jrf|j jjsE|j jjdj |dj |syy)N Frz {} [y/N]: z {} [Y/n]: )rdefaultyes_msgT) first_warningrrrrrrU _promptWantedrVassumenor userconfirmrprrs r_ask_user_no_raisezCoprCommand._ask_user_no_raises!! JJ  T ""  56 99 " " $yy~~&&dii.>.>.J.J&--c2>CXCXY\C]/K/_rcx|j||s(tjjt dy)NzSafe and good answer. Exiting.)rrdrrrrs rrzCoprCommand._ask_users2&&tS1..&&q)I'JK K2rctjdk7r(tjj t dy)Nrz/This command has to be run under the root user.)rXgeteuidrdrrr)clss rrzCoprCommand._need_roots9 ::<1 ..&&CDF F rc|j}||ddus|ddur t}|jjjd}d|dvr6d|vrd|z}|Sdt d vrd|z}|Sd j |d|}|Sd |vrCtjd }d |vrdj |}|Sdj |d|}|Sd|vrCtjd}d|vrdj |}|Sdj |d|}|Sdj |djddd|r|nd}|S)z2 Guess which chroot is equivalent to this machine rFr5basearchFedoraRawhidezfedora-rawhide-rawhideredhat_support_product_versionzfedora-{0}-{1}Mageiaz%{distro_arch}Cauldronzmageia-cauldron-{}zmageia-{0}-{1}openSUSEz%{_target_cpu} Tumbleweedzopensuse-tumbleweed-{}zopensuse-leap-{0}-{1}z epel-{}-{}.x86_64) rrrUrV substitutionsr rrpm expandMacror)rpdistdistarchrs rrzCoprCommand._guess_chroots!! >// ; tAw D +h62 -o.NOO+h6* '+11$q'8D& % '78HT!.55h? +11$q'8D 4 '78Ht#299(C  288a(K #))$q'--Q*?*BPXH^fgF rc. dj|jdd}|jd}dj|||} t|j|z}t j j|rt j||j5} | j)d} t7j8d| rGt j j|j:j<j>d| ddzdz}|j|j@k(r|jCdddjC|jDdjCdddjCddjCdd} t j j| rt j| tG|d5}|jI| |jKD]} |jI|  dddt jL|tNjPtNjRztNjTztNjVzy#t$r}|jdk7r[tdj|j|z|jt|}tjj|td}|j j#d} | rt%j&| j)d} t+j,| } |td jdj|j|z }| j#d rG|td d jd | d Dzz }|tdj|z }tjj||tdj|z }tjj|d}~wt.$r`}tdj|j|z|j0j2}tjj|d}~wwxYw#1swYxYw)Nrrz%/coprs/{0}/repo/{1}/dnf.repo?arch={2}iz Request to {0} failed: {1} - {2}z+It wasn't possible to enable this project. zCopr-Error-Datazutf-8z1Repository '{0}' does not exist in project '{1}'.zavailable chrootsz Available repositories: z, c3>K|]}dj|yw)z'{}'Nr).0xs r z-CoprCommand._download_repo..s M[2YQ a(2Ysz If you want to enable a non-default repository, use the following command: 'dnf copr enable {0} ' But note that the installed repo file will likely need a manual modification.zProject {0} does not exist.zFailed to connect to {0}: {1}z\[copr:rr5z.repor_coprrrQgroup_@wb),rZrrr+rirXrYexistsr9r,coderstrrdrrheadersr|base64 b64decodedecoderrr-reasonstrerrorreadlinerrrUrVrrhreplacergrr readlineschmodstatS_IRUSRS_IWUSRS_IRGRPS_IROTH)rprr short_chrootarchrresponsee error_msg error_dataerror_data_decoded first_liner old_repo_filenamefs rrzCoprCommand._download_reposxx 1 1#2 67   $:AA,P\^bc 2t}}x78Hww~~m, -(8&&(   ) 88J %GGLL)D)DcDQRSUJFVY`F`aM ==D,, , - 5 5h K++R0c11EggcSVFW3' ww~~/0 +, - &! GGJ  **, -'  t|| ;dll JT\\ YZ[ 6vv}@AHHYaIacdciciknopkqr nn**955HII'89J%+%5%5j%A%H%H%Q"%)ZZ0B%C"QRSZZHHT../?? %))*=>#?!@499M[2DEX2YM[D["[[I$3"45;F<4HIInn**955Q<=DD\RR nn**955 29:AA$--RZBZ\]\d\d\m\mnI..&&y1 1 2&' &s3A I8R  R&F5P R'ARR Rc:|jjd|jj|j|j ||}g}|j j D]%}|jdr|j|'|sytd}tjd}|jdj|Dcgc]9}djt|||j j|d  ;c}}|j!|td sZ|D]T} |jj"j%|j&| |jj"j(d d iVyycc}w)a, In addition to the main copr repo (that has repo ID prefixed with `copr:`), the repofile might contain additional repositories that serve as runtime dependencies. This method informs the user about the additional repos and provides an option to disable them. T)rrNaMaintainer of the enabled Copr repository decided to make it dependent on other repositories. Such repositories are usually necessary for successful installation of RPMs from the main Copr repository (they provide runtime dependencies). Be aware that the note about quality and bug-reporting above applies here too, Fedora Project doesn't control the content. Please review the list: {0} These repositories have been enabled automatically.r5z z){num:2}. [{repoid}] baseurl={baseurl}baseurl)numrepoidr*z!Do you want to keep them enabled?r0)rUresetread_all_repos_get_copr_reporcfgsections startswithr]r itertoolscountrrZnextgetValuerrVwrite_raw_configfilerr) rprrr runtime_depsrrcounterr,deps rrz!CoprCommand._runtime_deps_warning&su d#   """4#:#:=#IK[\ xx((*G!!'*    (+   B  //!${{6;; ' ( ' 9 ? ?M))&)< @ >' (   &&tQ/R-ST# 33DMM348IINN4P4P5>4DF$U( s>F cdj|jjddd|j||}||jj vrdj|j||x}}||jj vrd|jj |j vro|jj |j jdd} |jdd djddd}||jk7ryny|jj |S#t$rY$wxYw) Nzcopr:{0}:{1}:{2}rQr5rz{0}-{1}r rJrr) rrgrrrUrrrr)rprrrrrgs rr0zCoprCommand._get_copr_repoXs:$++D,>,>,E,Ec1,Ma,P,0,C,CM,R,<> $))// ) ) 0 01H1H1W1A!C CGg$))//)g9Q9Z9Z.Z IIOOG4==CCCHL $-$4$4S!$? @  s#'1AAcnd|vr1tjjdj|dy)Nerrorz{})rdrrr)rjson_objs rrzCoprCommand._check_json_outputs2 h ..&&t{{8G3D'EF F rc>|ddk(rdj|ddS|S)Nrr zgroup_{}r5r)rrs rrzCoprCommand._sanitize_usernames-  s "$$]12%67 7 r)(__name__ __module__ __qualname____doc__rrf default_hubrmrnrhaliasesrsummaryrusage staticmethodrHrzrlr^rrrrrrrrr classmethodrrrrr0rrrBrrrrrr/r/Ps#M2KL"U*-==KG23GM  E$..&I)V 4&7]@~/b;*( LFF #J6[p0Fd(, / `  GG!!rr/cJeZdZdZdZedZdZdZdZ e dZ dZ y ) PlaygroundCommandz Playground plugin for DNF ) playgroundz$Interact with Playground repository.z [enable|disable|upgrade]c|j|jtdtddj|j}|j j |d}|j|}|j|ddk7r(tjjtd|d D]}d j|d |d }d j|j jj|jdd} ||dvrddj|j||}|j j |d}|j|}|j|rd|vr|ddk(r|j||y#tj j"$rYwxYw)Nz!Enabling a Playground repository.zDo you want to continue?z{0}/api/playground/list/rrrokrArz{0}/{1}usernamecoprnamez{}/_playground_{}.reporJrchrootsz{0}/api/coprs/{1}/detail/{2}/)rrrrrirUr+rBcloserdrRrerVrrrrr) rprapi_urlr(rrrroutput2s r _cmd_enablezPlaygroundCommand._cmd_enables   1 2 ( ) -33 MM II  gD  1"  ( t #''""1%D#EF F7OD$++D,<,0,<>L4;;DIINN>''  sF%'A;F%%GGc|jtjdj|jjj D]}|j |y)Nz{}/_playground_*.repo)rglobrrUrVrr)rprs r _cmd_disablezPlaygroundCommand._cmd_disablesH !YY'>'E'EdiinnFaFa'bcM   m ,drc0|jddgdy)Nr4r5)r7r8upgrader<)rD)rFs rrHzPlaygroundCommand.set_argparsersL$D  Frc@tjjd)Nz%Playground is temporarily unsupported) rdrrrTr4rr\rrrr_r)rpr4rs rrzPlaygroundCommand.runsnn""#JKKrN) rGrHrIrJrLrrMrNr\r_rOrHrrrrrRrRsA%G67G 'E@- FF@rrR)/ __future__rr^r4rrXrshutilrrrdnfpluginscorerrrd dnf.pycomprdnf.i18nrrdistrorr r r r ImportErrorplatformr[setYESNO configparserr(r)r*urllib.requestr+r,r-urllib2pluginregister_commandrRCommandr/rRrrrrts-(&  $  V??/,  1U8QsV !D'1S62 HH;;HH44M !#''//M !M !`A@ A@A@eVV/  V V V Vs6 DD3D"!D3"D-*D3,D--D32D3