HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/root/lib/python3/dist-packages/aptsources/__pycache__/distinfo.cpython-38.pyc
U

&��cr-�@s�ddlmZddlZddlZddlZddlmZmZddlZddl	Z	ddl	m
ZGdd�de�Z
Gdd�de�ZGd	d
�d
e�ZGdd�de�Zd
d�ZGdd�de�Zedk�r~edd�Ze�ej�ejD]�Ze�dej�e�dej�e�dej�e�dej�ejik�r6e�deej����ej D] Z!e�de!je!je!j"f��q<ej#D]Z$e�de$j��qdq�dS)�)�print_functionN)�Popen�PIPE)�gettextc@s$eZdZdd�Zdd�Zdd�ZdS)�TemplatecCsXd|_d|_g|_d|_d|_d|_d|_g|_g|_d|_	i|_
d|_d|_d|_
dS�NFT)�name�child�parents�
match_name�description�base_uri�type�
components�children�	match_uri�
mirror_set�distribution�	available�official��self�r�5/usr/lib/python3/dist-packages/aptsources/distinfo.py�__init__'szTemplate.__init__cCs|dd�|jD�kS)z8 Check if the distribution provides the given component css|]}|jVqdS�N)r)�.0�crrr�	<genexpr>9sz)Template.has_component.<locals>.<genexpr>)r)r�comprrr�
has_component7szTemplate.has_componentcCs2t|�\}}}||jkr*|j|�||�SdSdS)z8 Check if a given url of a repository is a valid mirror FN)�	split_urlr�has_repository)r�url�proto�hostname�dirrrr�	is_mirror;s
zTemplate.is_mirrorN)�__name__�
__module__�__qualname__rr r'rrrrr%src@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�	ComponentNcCs||_||_||_||_dSr)rr�description_long�parent_component)rr�descZ	long_descr-rrrrFszComponent.__init__cCs|jSr�r-rrrr�get_parent_componentLszComponent.get_parent_componentcCs
||_dSrr/)r�parentrrr�set_parent_componentOszComponent.set_parent_componentcCs(|jdk	r|jS|jdk	r |jSdSdSr)r,rrrrr�get_descriptionRs


zComponent.get_descriptioncCs
||_dSr)r�rr.rrr�set_descriptionZszComponent.set_descriptioncCs
||_dSr�r,r4rrr�set_description_long]szComponent.set_description_longcCs|jSrr6rrrr�get_description_long`szComponent.get_description_long)NNN)
r(r)r*rr0r2r3r5r7r8rrrrr+Ds
r+c@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�Mirrorz( Storage for mirror related information NcCs"||_g|_|�||�||_dSr)r%�repositories�add_repository�location)rr$r%r&r<rrrrgszMirror.__init__cCs|j�t||��dSr)r:�append�
Repository�rr$r&rrrr;mszMirror.add_repositorycs�fdd�|jD�S)Ncsg|]}|j�kr|�qSr�r$�r�rr@rr�
<listcomp>qs
z5Mirror.get_repositories_for_proto.<locals>.<listcomp>�r:)rr$rr@r�get_repositories_for_protopsz!Mirror.get_repositories_for_protocCs6|dkrdS|jD]}|j|kr||jkrdSqdSr)r:r$r&)rr$r&rBrrrr"ss
zMirror.has_repositorycs�fdd��jD�S)Ncsg|]}|��j��qSr)�get_urlr%rArrrrC|sz(Mirror.get_repo_urls.<locals>.<listcomp>rDrrrr�
get_repo_urls{szMirror.get_repo_urlscCs|jSr�r<rrrr�get_location~szMirror.get_locationcCs
||_dSrrH)rr<rrr�set_location�szMirror.set_location)N)r(r)r*�__doc__rr;rEr"rGrIrJrrrrr9ds
r9c@s$eZdZdd�Zdd�Zdd�ZdS)r>cCs||_||_dSr�r$r&r?rrrr�szRepository.__init__cCs|j|jfSrrLrrrr�get_info�szRepository.get_infocCsd|j||jfS)Nz
%s://%s/%srL)rr%rrrrF�szRepository.get_urlN)r(r)r*rrMrFrrrrr>�sr>cCs,tjd|dd�}t|�dkr(|�d�q|S)zE split a given URL into the protocoll, the hostname and the dir part z:*\/+�)�maxsplit�N)�re�split�lenr=)r#rRrrrr!�sr!c@seZdZddd�Zdd�ZdS)�DistInfoN�/usr/share/python-apt/templatescCs6d|_g|_tj�d�|_d}t�d�}t�d�}|s�z$tdddgdt	d	��
�d
��}WnDtt
fk
r�}z"|jtjkr�t�d|�d}W5d}~XYnX||_i}d
||f}t|���l}	d}
d}|	D�]B}|�dd�}
t|
�dkr�q�|
d
��}|
d��}|dk�rt|�|_q�|dk�r.||_q�|dk�rf|�|
|�d}t�}
||
_||
_d||
_q�|dk�rx||
_q�|dk�r�d|
_|jD]*}|j|k�r�|
j�|�|j �|
��q�q�|dk�r�t�!|�|
_"q�|dk�r�t�!|�|
_#q�|dk�r�||
_$q�|dk�r|
j%�s||
_%q�|d|jk�r0||
_%q�|dk�rJ|
j&�sJ||
_&q�|d|jk�rb||
_&q�|dk�s||d|jk�r�t'j(�)|��r�|�p�t'j(�*t'j(�+||��}||k�rvi}z2t|�� }t,t-|j.d d!�|D���}W5QRXWn"t/k
�rt0d"�g}YnX|D]^}|�1d#��r.|�2d$|�}�qt3|�\}}}||k�rX||�4||�nt5||||�||<�q|||<|||
_6q�|d%k�r�t|�|
_7q�|d&k�r�|�r�|
�8|j��s�|
j9�|�t:|�}q�|d'k�r�|�;t|��q�|d(k�r|�<t|��q�|d)kr�|�=|�q�|�|
|�d}
d}W5QRXdS)*N�zAPT::Architecturez^#LOC:(.+)$zS^(#LOC:.+)|(((http)|(ftp)|(rsync)|(file)|(mirror)|(https))://[A-Za-z0-9/\.:\-_@]+)$Zlsb_releasez-iz-sT)Zuniversal_newlines�stdoutrz#lsb_release failed, using defaults:ZDebianz
%s/%s.info�:�rNZChangelogURIZMetaReleaseURIZSuitez^%s$Z	MatchNameZParentSuiteZ	AvailableZOfficialZRepositoryTypeZBaseURIz
BaseURI-%sZMatchURIzMatchURI-%sZMirrorsFilezMirrorsFile-%scSsg|]}|���qSr)�strip)r�xrrrrC�sz%DistInfo.__init__.<locals>.<listcomp>z#WARNING: Failed to read mirror filez#LOC:z\1ZDescriptionr+ZCompDescriptionZCompDescriptionLongZParentComponent)>Zmetarelease_uri�	templates�apt_pkgZconfig�findZarchrQ�compilerrZcommunicaterZ�OSError�IOError�errnoZENOENT�loggingZwarning�dist�openrRrS�_�changelogs_uri�finish_templaterrrrr	r
r=rZstring_to_boolrrrr
r�os�path�isabs�abspath�join�list�filter�match�	Exception�print�
startswith�subr!r;r9rrr rr+r5r7r2)rrdZbase_dirr<Z	match_locZmatch_mirror_line�excZmap_mirror_setsZ
dist_fnameZ	dist_file�template�	component�line�tokensZfield�valueZnannyrZvalue_fZmirror_datar$r%r&rrrr�s�
�
���










��

�

�


�


zDistInfo.__init__cCs�|sdS|jdkr6|jr6|jD]}|jr|j|_q6q|jikrd|jrd|jD]}|jrL|j|_qdqL|r�|�|j�s�|j�|�d}|jD]}|j|_q�|j	�|�dS)z finish the current tempalte N)
rr	r
rr rrr=rr\)rrvrw�trrrrhs$



zDistInfo.finish_template)NrU)r(r)r*rrhrrrrrT�s
srT�__main__ZUbunturUz

Suite: %szDesc: %szBaseURI: %szMatchURI: %szMirrors: %sz %s -%s -%sz  %s)%Z
__future__rrbrcri�
subprocessrrrQr]rrf�objectrr+r9r>r!rTr(�d�inforgr\rvrrr
rrrn�keysrrr,rr	rrrr�<module>s> !





�