HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python2.7/dist-packages/apt/debfile.pyc
�
&��cc@sZdZddlmZddlZddlZddlZddlZddlZddlZyZddl	m
Z
mZmZm
Z
mZmZmZmZe
eee
eeeWnek
r�d�ZnXddlmZddlmZdefd	��YZd
efd��YZdefd
��YZd�ZedkrVe�ndS(s;Classes for working with locally available Debian packages.i����(tprint_functionN(tDicttIterabletListtOptionaltSettTupletUniontcastcCs|S(N((ttyptobj((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR's(tgettext(tBytesIOtNoDebArchiveExceptioncBseZdZRS(s9Exception which is raised if a file is no Debian archive.(t__name__t
__module__t__doc__(((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR
/st
DebPackagecBs�eZdZed�\ZZZZdZd"d"d�Z
d�Zd�Zd�Z
ed��Zed��Zed	�Zd
�Zd�Zd�Zd
�Zed��Zed��Zed��Zed��Zd�Zd�Zd�Zed�Zed�Z d�Z!d�Z"ed��Z#ed��Z$e%d��Z&e%d��Z'eed�Z(d�Z)d�Z*d �Z+d"d!�Z,RS(#sA Debian Package (.deb file).iicCs�|dkrtj�}n||_ttjd�|_d|_d|_	i|_
g|_t|_
d|_d|_|r�|j|�ndS(Nt(tNonetapttCachet_cacheRtapt_insttDebFilet_debfiletpkgnametfilenamet	_sectionst
_need_pkgstFalset_check_was_runt_failure_stringt
_multiarchtopen(tselfRtcache((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt__init__?s								cCs�|jdd|�g|_t�|_d|_||_tj|j�|_|jj	j
d�}tj|�|_
|j
d|_t|_dS(s open given debfile is	open '%s'RtcontroltPackageN(t_dbgRtsett_installed_conflictsR RRRRR&textractdatatapt_pkgt
TagSectionRRRR(R#RR&((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR"Os			cCs|j|S(N(R(R#tkey((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt__getitem__]scCs
||jkS(N(R(R#R.((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt__contains__ascsOg�y |jjj�fd��Wn"tk
rJtd�|jgSX�S(s$return the list of files in the deb.cs�j|j�S(N(tappendtname(titemtdata(tfiles(s//usr/lib/python2.7/dist-packages/apt/debfile.pyt<lambda>kRs(List of files for '%s' could not be read(RR4tgotSystemErrort_R(R#((R5s//usr/lib/python2.7/dist-packages/apt/debfile.pytfilelistes 
	csUg�y |jjj�fd��Wn"tk
rJtd�|jgSXt��S(s, return the list of files in control.tar.gz cs�j|j�S(N(R1R2(R3R4(R&(s//usr/lib/python2.7/dist-packages/apt/debfile.pyR6xRs0List of control files for '%s' could not be read(RR&R7R8R9Rtsorted(R#((R&s//usr/lib/python2.7/dist-packages/apt/debfile.pytcontrol_filelistqs
	cCs	d|kr|S|js|S|jj|�r3|S||jkr�|j|jdk	r�ttjj|j|j�j	dkr�|Sd||jf}||jkr�|S|j|}|jdkr�|S|jj
}|j|j@r�|S|r|j|j
@r|S|S(Nt:talls%s:%s(R!Rtis_virtual_packaget	candidateRRRtpackagetVersiontarchitecturet_candt
multi_archtMULTI_ARCH_FOREIGNtMULTI_ARCH_SAME(R#Rtin_conflict_checkingtmultiarch_pkgnamet
multiarch_pkgtcand((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt_maybe_append_multiarch_suffixs0	
c	CsL|jdd|�x1|D])}|d}|d}|d}|j|�}||jkr�|jj|�r|jdd|�x*|jj|�D]}|jr�tSq�Wqqn|j|j}|d	k	r�t	j
|j||�r�tS|sxM|jj|dt�D]0}|jr
|jdd|j|f�tSq
WqqWt
S(
s�Return True if at least one dependency of the or-group is satisfied.

        This method gets an 'or_group' and analyzes if at least one dependency
        of this group is already satisfied.
        is_checkOrGroup(): %s iiis+_is_or_group_satisfied(): %s is virtual deptinclude_nonvirtuals'found installed '%s' that provides '%s'N(R(RLRR?tget_providing_packagestis_installedtTruet	installedRR,t	check_deptversionR2R(	R#tor_grouptdeptdepnametvertopertpkgtinsttppkg((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt_is_or_group_satisfied�s6



	$	c
Cs�x|D]�}|\}}}|j|�}||jkr�|jj|�sRqn|jj|�}t|�dkr|qn|dj}n|j|}|jjj|j�}|s�qnt	j
|j||�s�qn|jdd|�|j
j|�tSWd}	xn|D]f}|	|d7}	|rP|rP|	d|d|df7}	n||t|�dkr|	d7}	qqW|jtd�|	7_tS(	sTry to satisfy the or_group.iiisNeed to get: %sRs (%s %s)t|s"Dependency is not satisfiable: %s
(RLRR?RNtlenR2t	_depcachetget_candidate_vert_pkgR,RRtver_strR(RR1RPR R9R(
R#RTRURVRWRXt	providersRYRKtor_str((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt_satisfy_or_group�s:



cCs�|jdd|||f�|j|}|jrW|jdk	sHt�|jj}n1|jr�|jdk	sut�|jj}nt	St
j|||�r�|j|||�r�|j
td�|j7_
|jdd|j�tSt	S(s@Return True if a pkg conflicts with a real installed/marked pkg.is8_check_single_pkg_conflict() pkg='%s' ver='%s' oper='%s's)Conflicts with the installed package '%s's!conflicts with installed pkg '%s'N(R(RRORQRtAssertionErrorRStmarked_installR@RR,RRtreplaces_real_pkgR R9R2RP(R#RRWRXRYtpkgver((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt_check_single_pkg_conflicts$
		cCsA|jdd|�x|D]}|d}|d}|d}|j|dt�}||jkr|jj|�rx�|jj|�D]s}|jdd|j�|j|jkr�|jdd�q�n|j|j||�r�|j	j
|j�q�q�Wqqn|j|||�r|j	j
|�qqWt|j	�S(	s5Check the or-group for conflicts with installed pkgs.is _check_conflicts_or_group(): %s iiRHisconflicts virtual check: %ssconflict on self, ignoring(R(RLRPRR?RNR2RRjR*taddtbool(R#RTRURVRWRXRY((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt_check_conflicts_or_groups*



cCs:d}ytj|j|t�SWntk
r5gSXdS(s/List of packages conflicting with this package.t	ConflictsN(R,t
parse_dependsRRtKeyError(R#R.((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt	conflicts?s

cCsSg}xFdD]>}y$|jtj|j|t��Wq
tk
rJq
Xq
W|S(s2List of packages on which this package depends on.tDependssPre-Depends(RrsPre-Depends(textendR,RoRRRp(R#tdependsR.((s//usr/lib/python2.7/dist-packages/apt/debfile.pyRtIs

cCs:d}ytj|j|t�SWntk
r5gSXdS(s<List of virtual packages which are provided by this package.tProvidesN(R,RoRRRp(R#R.((s//usr/lib/python2.7/dist-packages/apt/debfile.pytprovidesWs

cCs:d}ytj|j|t�SWntk
r5gSXdS(s4List of packages which are replaced by this package.tReplacesN(R,RoRRRp(R#R.((s//usr/lib/python2.7/dist-packages/apt/debfile.pytreplacesas

cCs|jdd|||f�|j|}d}|jr]|jdk	sNt�|jj}n3|jr�|jdk	s{t�|jj}nd}xp|j	D]e}x\|D]T\}}}||kr�|dks�t
j|||�r�|jdd|�tSq�Wq�Wt
S(s�Return True if a given non-virtual package is replaced.

        Return True if the deb packages replaces a real (not virtual)
        packages named (pkgname, oper, ver).
        isreplaces_real_pkg() %s %s %ss?we have a replaces in our package for the conflict against '%s'N(R(RRRORQRfRSRgR@RxR,RRRPR(R#RRXRWRYRiRTR2((s//usr/lib/python2.7/dist-packages/apt/debfile.pyRhks$
		cCs6t}x)|jD]}|j|�rt}qqW|S(s�Check if there are conflicts with existing or selected packages.

        Check if the package conflicts with a existing or to be installed
        package. Return True if the pkg is OK.
        (RPRqRmR(R#tresRT((s//usr/lib/python2.7/dist-packages/apt/debfile.pytcheck_conflicts�s

c	CsPtt|j��}tt|d�d�}|jd}|jd}g|jD]}|dd^qR}x�t|j�D]�\}}||dkr�|jjj	t|�|d�n|j
s�q|n|jdk	s�t
�|jj}	x�|jjD]�}
x�|
jD]�}|j|jkr	tj||j|j�s�|jdd|j�|jtd	�i|jd
6|jd6|jd6|jd
67_|jjj�tSq	q	Wq�Wd|	jkr|xs|	jdD]a}xX|D]P}
|
jj|jkr�|
jj|kr�tj||
j |
j!�r�|jdd|j�|jtd�i|jd
6|
jjd6|
j d6|
j!d67_|jjj�tSn|
jj|kr�|j|jkr�|jdd|�|jtd�idj"|�d6|j#d6|
jjd6|jd
67_|jjj�tSq�Wq�Wq|q|W|jjj�t$S(s�
        check if installing the package would break exsisting
        package on the system, e.g. system has:
        smc depends on smc-data (= 1.4)
        and user tries to installs smc-data 1.6
        i2iRBtArchitectureigY@iswould break (depends) %ss]Breaks existing package '%(pkgname)s' dependency %(depname)s (%(deprelation)s %(depversion)s)RRVtdeprelationt
depversionRnswould break (conflicts) %ssZBreaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s %(targetver)s)t	targetpkgtcomptypet	targetvers{Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But the '%(debfile)s' provides it via: '%(provides)s't,RvtdebfileN(%tfloatR^RtmaxtintRRvt	enumeratetop_progresstupdateRORQRRfRatcurrent_vertdependenciestor_dependenciesR2RR,RRtrelationRSR(R R9tdoneRtdepends_listt
target_pkgRCt	comp_typet
target_vertjoinRRP(R#tsizetstepstdebvertdebarchtxRvtiRYRWtdep_orRUtconflicts_ver_listtc_or((s//usr/lib/python2.7/dist-packages/apt/debfile.pytcheck_breaks_existing_packages�sx	

$$	











cCsD|jdd�|jd}|jd}dj||g�}|jd}|jdd|�||jkr=|j|}|r�|jdk	r�|jj}n,|r�|jdk	r�|jj}n|jS|dk	r=t	j
||�}|jdd	|�|d
kr|jS|d
kr$|jS|d
kr:|j
Sq=n|jS(s	Compare the package to the version available in the cache.

        Checks if the package is already installed or availabe in the cache
        and if so in what version, returns one of (VERSION_NONE,
        VERSION_OUTDATED, VERSION_SAME, VERSION_NEWER).
        itcompare_to_version_in_cacheR'R{R=RBis
debver: %ss"CompareVersion(debver,instver): %siN(R(RR�RRQRRSR@tVERSION_NONER,tversion_comparetVERSION_SAMEt
VERSION_NEWERtVERSION_OUTDATED(R#t
use_installedRRCR�RYtcachevertcmp((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR��s.




cCs�|jdd�t|_d|jkrK|jdd�td�|_tS|jd}|dkr�|tjj	d�kr�|tj
�kr�||_d	|j|jf|_|jdd
|�q�|jdd�td�||_tSn|r6|j
�|jkr6|j|jjr6td
�|_tSnd|_|j�sOtS|j�s_tS|j|j�sutS|j�s�tS|jjjdkr�td�|_|jj�tStS(s$Check if the package is installable.itcheckR{isERROR: no architecture fields$No Architecture field in the packageR>sAPT::Architectures%s:%ssFound multiarch arch: '%s'sERROR: Wrong architecture dude!sVWrong architecture '%s' -- Run dpkg --add-architecture to add it and update afterwardss$A later version is already installedRis1Failed to satisfy all dependencies (broken cache)(R(RPRRR9R RR,tconfigtfindtget_architecturesR!RR�R�RRQRzR�t_satisfy_dependsRtR_tbroken_counttclear(R#tallow_downgradetarch((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR�sH	
$		
	
cCs|jtj|t��S(s-Satisfy the dependencies in the given string.(R�R,RoR(R#t
dependsstr((s//usr/lib/python2.7/dist-packages/apt/debfile.pytsatisfy_depends_strQscCs�ytj|jj�}|Wntk
r0nXx3|D]+}|j|�s8|j|�sctSq8q8Wxa|jD]V}y|j|j	dt�Wqqt
k
r�td�||_|jj
�tSXqqWtS(sSatisfy the dependencies.t	from_usersCannot install '%s'(R,tActionGroupRR_tAttributeErrorR\ReRRtmark_installR8R9R R�RP(R#Rtt_actiongroupRTRY((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR�Vs"



	cCs6|jdd|j�|js/td��n|jS(sReturn missing dependencies.isInstalling: %ss-property only available after check() was run(R(RRR�(R#((s//usr/lib/python2.7/dist-packages/apt/debfile.pytmissing_depsns
	cCs�g}g}g}|js*td��nx�|jD]�}|jsL|jr�|jdk	sat�|j|j	�t
}x!|jjD]}||jO}q�W|s�|j|j	�q�n|j
r4|j|j	�q4q4W|||fS(s�Get the changes required to satisfy the dependencies.

        Returns: a tuple with (install, remove, unauthenticated)
        s-property only available after check() was runN(RR�RRgtmarked_upgradeR@RRfR1R2Rtoriginsttrustedt
marked_delete(R#tinstalltremovetunauthenticatedRYt
authenticatedtorigin((s//usr/lib/python2.7/dist-packages/apt/debfile.pytrequired_changesxs$		cCsXd}xKt|�D]=\}}|ddkr<|d7}n|dt|�7}qW|S(NRiPis
s%2.2x (R�tord(tin_datathexR�tc((s//usr/lib/python2.7/dist-packages/apt/debfile.pytto_hex�s
cCs�d}t|t�rdx�|D]A}t|�dksFt|�dkrS|d7}q||7}qWnFxC|D];}|dks�|dkr�|d7}qk|t|�7}qkW|S(NRi
it (t
isinstancetstrR�tchr(R�tsR�tb((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt	to_strish�s
$


c	Cs�|jd�r|d}n|j|�}|jd�r�|r�t|�}tjd|�}td�jd�}||j�7}ny|j	d�SWn1t
k
r�td�}||j|�7}|SXdS(Ns./is.gztfileobjsAutomatically decompressed:

sutf-8s,Automatically converted to printable ascii:
(t
startswithR+tendswithRtgziptGzipFileR9tencodetreadtdecodet	ExceptionR�(	R#tpartR2tauto_decompresstauto_hexR4tiotgztnew_data((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt_get_content�s

cCs3y|j|jj|�SWntk
r.dSXdS(s6 return the content of a specific control.tar.gz file RN(R�RR&tLookupError(R#R2((s//usr/lib/python2.7/dist-packages/apt/debfile.pytcontrol_content�s
cCs3y|j|jj|�SWntk
r.dSXdS(s6 return the content of a specific control.tar.gz file RN(R�RR4R�(R#R2((s//usr/lib/python2.7/dist-packages/apt/debfile.pytdata_content�s
cCs)||jkr%t|dtj�ndS(s%Write debugging output to sys.stderr.tfileN(tdebugtprinttsyststderr(R#tleveltmsg((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR(�scCs�|jdkr!tjd��n|dkrLtjtjddd|j�Sy|j�Wntk
rw|j	�nX|j
|j�}y|j�Wntk
r�|j�nX|SdS(sInstall the package.sNo filename specifiedtdpkgs-iN(
RRR,tErrortostspawnlptP_WAITtstart_updateR�tstartUpdatetrunt
finish_updatetfinishUpdate(R#tinstall_progressRy((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR��s

N(-RRRtrangeR�R�R�R�R�RR%R"R/R0tpropertyR:R<RRLR\ReRjRmRqRtRvRxRhRzR�RPR�R�R�R�R�R�tstaticmethodR�R�R�R�R�R(R�(((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR3sD			$	/	.		!


			Y$?		

			t
DscSrcPackagecBs_eZdZddd�Zed��Zed��Zed��Zd�Z	e
d�ZRS(s#A locally available source package.cCs{tj|d|�||_g|_g|_t�|_d|_g|_	i|_
|jdk	rw|j|j�ndS(NR(RR%RRt_dependst
_conflictsR)R*RtbinariesRR"(R#RR$((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR%�s						cCs|jS(s&Return the dependencies of the package(R�(R#((s//usr/lib/python2.7/dist-packages/apt/debfile.pyRt�scCs|jS(s&Return the dependencies of the package(R�(R#((s//usr/lib/python2.7/dist-packages/apt/debfile.pyRqscCs|jdj�ddd�S(s6Return the list of files associated with this dsc filetFilesiNi(Rtsplit(R#((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR:scCs�ddg}ddg}tj|�}tj|�}tj|�}z&x|D]}x=|D]5}||krtq\n|jjtj||��q\Wx=|D]5}||kr�q�n|jjtj||��q�Wd|kr�|d|_	nd|kr/g|dj
d�D]}	|	j�^q|_nx4|j
�D]&}||kr<|||j|<q<q<WqOWWd~|j�Xtd	�|j	d
j|j�f}
|
|jd<t|_dS(sOpen the package.s
Build-DependssBuild-Depends-IndepsBuild-ConflictssBuild-Conflicts-IndeptSourcetBinaryR�NsBInstall Build-Dependencies for source package '%s' that builds %s
R�tDescription(R,topen_maybe_clear_signed_fileR�tfdopentTagFileR�Rstparse_src_dependsR�RR�tstripR�tkeysRtcloseR9R�RR(R#R�tdepends_tagstconflicts_tagstfdtfobjttagfiletsecttagR�R�((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR"s<

!
!/ 	
cCsu|j�s\xM|jD]?}|j|jjrDttd���n|j|j�qWnt|_	|j
|j�S(s�Check if the package is installable.

        The second parameter is ignored and only exists for compatibility
        with parent type.s%An essential package would be removed(RzR*RRat	essentialR�R9tmark_deleteRPRR�Rt(R#R�R((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR�6s	N(RRRRR%R�RtRqR:R"RR�(((s//usr/lib/python2.7/dist-packages/apt/debfile.pyR��s
	$c
Csaddlm}ddlm}|�}d}td||j|�f�|j|�}td|�x|D]}td|j�qpWtt	j
d|�}td	|j�|j�s�td
�t|j
�ntd|j�t|j�t|j�td�|j|��}t|�td
|�}d}	t|jtj|	t���dS(s
Test functioni����(R(tInstallProgressswww-browsers%s virtual: %ssProviders for %s :s %sisDeb: %sscan't be satifiedsmissing deps: %ssInstalling ...R$s:libc6 (>= 2.3.2), libaio (>= 0.3.96) | libaio1 (>= 0.3.96)N(t	apt.cacheRtapt.progress.baseRR�R?RNR2RR�targvRR�R R�R�R:R�R�R�R,RoR(
RRR$tvpRcRYtdtretR�tds((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt_testHs.	





t__main__(Rt
__future__RRRR,R�R�R�ttypingRRRRRRRRtImportErrorRR9R�RtIOErrorR
tobjectRR�RR(((s//usr/lib/python2.7/dist-packages/apt/debfile.pyt<module>s::
	���Y	'