HEX
Server: Apache/2.4.6 () OpenSSL/1.0.2k-fips PHP/8.3.8
System: Linux gateway.rmc-logistics.net 4.1.12-124.48.6.el7uek.x86_64 #2 SMP Tue Mar 16 14:57:50 PDT 2021 x86_64
User: apache (48)
PHP: 8.3.8
Disabled: NONE
Upload Files
File: //lib/yum-plugins/copr.pyo
�
x޺^c@s&dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
dZe
fZeed�ed�g�Zeed	�ed
�dg�ZejjZejjZd�Zd
dd��YZdefd��YZdS(s(YUM plugin supplying the 'copr' command.i����(tgrabberN(t_(tTYPE_INTERACTIVEs2.5tyestytnotntcCs$|jt��|jt��dS(N(tregisterCommandtCoprCommandtPlaygroundCommand(tconduit((s/usr/lib/yum-plugins/copr.pytconfig_hook,sR	cBs�eZdZd�Zd�Zd�Zd�ZdZdZe	d�Z
e	d�Zd	�Zd
�Z
d�Zed��Zed
��Zedd��Zed��Zed��ZRS(s Copr plugin for DNF cCs|jdgS(Ni(taliases(tself((s/usr/lib/yum-plugins/copr.pytgetNames3scCs|jS(N(tusage(R((s/usr/lib/yum-plugins/copr.pytgetUsage6scCs|jdS(Ni(tsummary(R((s/usr/lib/yum-plugins/copr.pyt
getSummary9scCs
||_dS(N(tbase(RRtbasecmdtextcmds((s/usr/lib/yum-plugins/copr.pytdoCheck<sshttps://copr.fedoraproject.orgtcoprs Interact with Copr repositories.s
  enable name/project [chroot]
  disable name/project
  list name
  search project

  Examples:
  copr enable rhscl/perl516 epel-6-x86_64
  copr enable ignatenkobrain/ocltoys
  copr disable rhscl/perl516
  copr list ignatenkobrain
  copr search tests
    cCs�y|d}|d}WnIttfk
rc|jjtd�td��ttd���nXy|d}Wntk
r�|j�}nXdj|jdd��}|d	kr�|j	�|j
d
�|j|||�|jjtd��n�|dkr8|j	�|j
|�|jjtd
��n�|dkrwdj|�}tji�}	|	j|j|�}
ytj|
j��}Wn,tk
r�ttd�j|���nXtd�j|�}|j|�d}
x�|
t|d�krsdj||d|
d�}|d|
d}|sFtd�}n|jjt|�|�}|GH|
d7}
q�Wnf|dkr�dj|�}tji�}	|	j|j|�}
ytj|
j��}Wn,tk
r�ttd�j|���nXtd�j|�}|j|�d}
x�|
t|d�kr�dj|d|
d|d|
d�}|d|
d}|s�td�}n|jjt|�|�}|GH|
d7}
q*Wnttd�j|���d|dgfS( NiisError: s>exactly two additional parameters to copr command are requiredis/etc/yum.repos.d/_copr_{}.repot/t-tenables5
You are about to enable a Copr repository. Please note that this
repository is not part of the main Fedora 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
<https://fedorahosted.org/copr/wiki/UserDocs#WhatIcanbuildinCopr>, and
packages are not held to any quality or securty level.

Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.

Do you want to continue? [y/N]: s Repository successfully enabled.tdisables!Repository successfully disabled.tlists/api/coprs/{}/s+Can't parse repositories for username '{}'.sList of {} coprstreposs
{0}/{1} : tnametdescriptionsNo description giventsearchs/api/coprs/search/{}/sCan't parse search for '{}'.sMatched: {}tusernametcoprnamesNo description given.sUnknown subcommand {}.s done(t
ValueErrort
IndexErrortloggertcriticalRt	YCliErrort
_guess_chroottformattreplacet
_need_roott	_ask_usert_download_repotinfot_remove_repoturllibtFancyURLopenertopentcopr_urltjsontloadstreadtYErrort_print_match_sectiontlenRt
fmtKeyValFilltunicode(RRRRt
subcommandtproject_nametchroott
repo_filenametapi_pathtopenertrest
json_parsetsection_texttitmsgtdesc((s/usr/lib/yum-plugins/copr.pyt	doCommandPs�
		






	

*cCs|jj|�}|GHdS(N(Rt
fmtSection(Rttextt	formatted((s/usr/lib/yum-plugins/copr.pyR9�scCs�|jjjr#|jjjr#dS|jjjrW|jjjrWttd���nt|�j�}t|�}x:|tkp�|t	ks�t|�j�}t|�}qxW|tkr�dSttd���dS(NsSafe and good answer. Exiting.(
Rtconft	assumeyestassumenoR8Rt	raw_inputtlowerRR(Rtquestiontanswer((s/usr/lib/yum-plugins/copr.pyR-�scCs+tj�dkr'ttd���ndS(Nis/This command has to be run under the root user.(tostgeteuidR8R(tcls((s/usr/lib/yum-plugins/copr.pyR,�scCsetj�}d|krCd|kr-d}qadj|d�}nd|djdd�d}|S(	s1 Guess which choot is equivalent to this machine tFedoratRawhidesfedora-rawhide-x86_64sfedora-{}-x86_64isepel-%s-x86_64t.i(tplatformtlinux_distributionR*tsplit(RVtdistR?((s/usr/lib/yum-plugins/copr.pyR)�s	cCs�|dkr|j�}ndj||�}tj�}y|j|j|d|�Wn5tjk
r�}|j|�t	t
|���nXdS(Ns/coprs/{0}/repo/{1}/tfilename(tNoneR)R*Rt
URLGrabberturlgrabR4tURLGrabErrorR0R8tstr(RVR>R@R?RAtugte((s/usr/lib/yum-plugins/copr.pyR.�s
cCs=ytj|�Wn%tk
r8}tt|���nXdS(N(RTtremovetOSErrorR8Rc(RVR@Re((s/usr/lib/yum-plugins/copr.pyR0�scCsoytj|j�}Wn"tk
r:ttd��dSX|jdkrkttdj|d���dS|S(s� Wrapper around response from server

        check data and print nice error in case of some error (and return None)
        otherwise return json object.
        sUnknown response from server.Ni�sSomething went wrong:
 {0}
terror(R5R6RKR$R(Rtstatus_codeR*(RVtreqtoutput((s/usr/lib/yum-plugins/copr.pyt	_get_data�s
(RN(t__name__t
__module__t__doc__RRRRR4R
RRRRIR9R-tclassmethodR,R)R_R.R0Rl(((s/usr/lib/yum-plugins/copr.pyR	0s&						]		
R
cBsAeZdZdZed�ZdZd�Zd�Zd�Z	RS(s Playground plugin for DNF t
playgrounds$Interact with Playground repository.s [enable|disable|upgrade]c	Cs@|j�|jd�dj|j�}tj|�}|j|�}|ddkrlttd���nx�|dD]�}dj|d|d	�}d
j|j	dd��}yrd
j|j||�}tj|�}|j|�}|r#d|kr#|ddkr#|j
|||�nWqwtk
r7qwXqwWdS(NsS
You are about to enable a Playground repository.

Do you want to continue? [y/N]: s{0}/api/playground/list/RktoksUnknown response from server.Rs{0}/{1}R"R#s$/etc/yum.repos.d/_playground_{}.repoRRs{0}/api/coprs/{1}/detail/{2}/(R,R-R*R4trequeststgetRlR(RR+R.R8(	RR?tapi_urlRjRktrepoR>R@toutput2((s/usr/lib/yum-plugins/copr.pyt_cmd_enables.


"
cCs5|j�x$tjd�D]}|j|�qWdS(Ns#/etc/yum.repos.d/_playground_*.repo(R,tglobR0(RR@((s/usr/lib/yum-plugins/copr.pyt_cmd_disable&s
cCs/y|d}WnIttfk
rY|jjtd�td��ttd���nX|j�}|dkr�|j|�|jjtd��n�|dkr�|j	�|jjtd��nW|dkr|j	�|j|�|jjtd	��nt
td
�j|���d|dgfS(NisError: s8exactly one parameter to playground command are requiredRs-Playground repositories successfully enabled.Rs.Playground repositories successfully disabled.tupgrades-Playground repositories successfully updated.sUnknown subcommand {}.s done(R$R%R&R'RR(R)RxR/RzR8R*(RRRRR=R?((s/usr/lib/yum-plugins/copr.pyRI+s,		



(Rq(
RmRnRoR
RRRRxRzRI(((s/usr/lib/yum-plugins/copr.pyR
s		((Rot
urlgrabberRtyumRyR5RTRZRsR1tyum.i18nRtyum.pluginsRtrequires_api_versiontplugin_typetsetRRtErrorstYumBaseErrorR8t	MiscErrorR(RR	R
(((s/usr/lib/yum-plugins/copr.pyt<module>s&	!	�