HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/debian/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/debian/__pycache__/debfile.cpython-311.pyc
�

)uyc�K��:�dZddlZddlZddlZddlZddlZddlmZ	ddl	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZddlmZn#e$r
dZesd�ZYnwxYwddlmZmZmZdd	lmZdd
lm Z dZ!dZ"gd
�Z#dZ$gd�Z%dZ&dZ'dZ(dZ)Gd�de��Z*Gd�de+��Z,Gd�de,��Z-Gd�de,��Z.Gd�de��Z/e0dkrPe/ej1d� ��Z2e2j3�4��Z4e5e4�6d����dSdS)!zX Representation of Debian binary package (.deb) files


Debfile Classes
===============
�N)�Path)�Any�BinaryIO�Dict�IO�Iterator�List�Optional�Text�TypeVar�Union�overload�
TYPE_CHECKING)�LiteralFc��dS�N�)�fs �0/usr/lib/python3/dist-packages/debian/debfile.py�<lambda>r9s��T��)�ArFile�ArError�ArMember)�	Changelog)�Deb822zdata.tarzcontrol.tar)�gz�bz2�xz�lzma�zstz
debian-binary)�preinst�postinst�prerm�postrm�config�controlzusr/share/doc/%s/changelog.gzz$usr/share/doc/%s/changelog.Debian.gz�md5sumsc��eZdZdS)�DebErrorN��__name__�
__module__�__qualname__rrrr*r*Ms�������Drr*c���eZdZdZd�Zd�Zed���Zd�Zdd�Z	e
dd	���Ze
dd
���Zdd�Ze
			dd���Ze
		dd
���Z			dd�Zd�Z
d�Zd�Zd�ZdS)�DebParta�'Part' of a .deb binary package.

    A .deb package is considered as made of 2 parts: a 'data' part
    (corresponding to the possibly compressed 'data.tar' archive embedded
    in a .deb) and a 'control' part (the 'control.tar.gz' archive). Each of
    them is represented by an instance of this class. Each archive should
    be a compressed tar archive although an uncompressed data.tar is permitted;
    supported compression formats are: .tar.gz, .tar.bz2, .tar.xz .

    When referring to file members of the underlying .tar.gz archive, file
    names can be specified in one of 3 formats "file", "./file", "/file". In
    all cases the file is considered relative to the root of the archive. For
    the control part the preferred mechanism is the first one (as in
    deb.control.get_content('control') ); for the data part the preferred
    mechanism is the third one (as in deb.data.get_file('/etc/vim/vimrc') ).
    c�"�||_d|_dSr)�_DebPart__member�
_DebPart__tgz)�self�members  r�__init__zDebPart.__init__cs����
���
�
�
rc�����fd�}�j�׉jj}tj�|��ddd�}|tvs|tks|tkrm|dkr|ddg��}n�j}	tj
|d����_nG#tjtjf$r}td	|z���d}~wwxYwtd
|z����jS)z�Return a TarFile object corresponding to this part of a .deb
        package.

        Despite the name, this method gives access to various kind of
        compressed tar archives, not only gzipped ones.
        c�����	ddl}ddl�|�||j|jd�fd����}nB#tt
f$r.}t
dd�|���d|�d����d}~wwxYw|��j	�
����d}|jdkr.t
d	d�|���d
|j�d����tj
|��S)NrFc�D�����j�j��Sr)�signal�SIGPIPE�SIG_DFL)r:s�rrz9DebPart.tgz.<locals>._custom_decompress.<locals>.<lambda>}s����M�M�&�.�&�.�A�A�r)�stdin�stdout�universal_newlines�
preexec_fnzerror while running command '� z' as subprocess: '�'z	command 'z' has failed with code ')�
subprocessr:�Popen�PIPE�OSError�
ValueErrorr*�join�communicater2�read�
returncode�io�BytesIO)�command_listrC�proc�e�datar:r4s     @�r�_custom_decompressz'DebPart.tgz.<locals>._custom_decompressqs>����
<�!�!�!�!��
�
�
�"�'�'� �$�/�*�/�',� B� B� B� B�	(�������Z�(�
<�
<�
<��h� #���� 6� 6� 6� 6���� ;�<�<�<�����
<�����#�#�D�M�$6�$6�$8�$8�9�9�!�<�D���!�#�#��h� #���� 6� 6� 6� 6����� I�J�J�J��:�d�#�#�#s�/4�A3�)A.�.A3N�r!�unzstdz--stdoutzr:*)�fileobj�modez#tarfile has returned an error: '%s'z"part '%s' has unexpected extension)r3r2�name�os�path�splitext�	PART_EXTS�	DATA_PART�	CTRL_PART�tarfile�open�	ReadError�CompressionErrorr*)r4rRrW�	extension�bufferrPs`     r�tgzzDebPart.tgzhs���	$�	$�	$�	$�	$�4�:���=�%�D���(�(��.�.�q�1�!�"�"�5�I��I�%�%���):�):�d�i�>O�>O���%�%�/�/��:�0F�G�G�F�F�!�]�F�N�!(��f�5�!I�!I�!I�D�J�J���)�7�+C�D�N�N�N�"�#H�1�#L�M�M�M�����N�����C�d�J�K�K�K��z�s�B�C�9C�Cc��t|���dd��}|�d��r|S|�d��rd|zSd|zS)zw try (not so hard) to obtain a member file name in a form that is
        stored in the .tar.gz, i.e. starting with ./ �\�/z./�.)�str�replace�
startswith)�fnames r�__normalize_memberzDebPart.__normalize_member�sd���E�
�
�"�"�4��-�-�����D�!�!�	��L����C� � �	���;���e�|�rc��	g}|�d��dd�D]�}|�|��tj�d�|����}t�|��}|����	|��}|�
��rF|j�d��r"|j�d��}|j}��|j|d<��n#t$rYdSwxYwt�tj�|����S)z� walk the path following symlinks

        returns:
            resolved_path, info

        if the path is not found even after following symlinks within the
        archive, then None is returned.
        rgrSN���)�split�appendrXrY�normpathrHr0�_DebPart__normalize_memberrd�	getmember�issym�linknamerk�KeyError)r4rY�resolved_path_parts�pathpart�currpath�tinfos      r�__resolve_symlinkszDebPart.__resolve_symlinks�s@��	�"$�� �J�J�s�O�O�A�B�B�/�
A�
A��#�*�*�8�4�4�4��7�+�+�C�H�H�5H�,I�,I�J�J��"�5�5�h�?�?�����
�
�,�,�X�6�6���;�;�=�=�A��~�0�0��5�5�
A�.3�n�.B�.B�3�.G�.G�+�#(�>���38�.�+�B�/��%
A��(�	�	�	��4�4�	�����)�)�"�'�*:�*:�8�*D�*D�E�E�Es�DD�
D�DFc���t�|��}|������}||vrdS|r|�|��}|duS||vS)zmCheck if this part contains a given file name.

        Symlinks within the archive can be followed.
        TN)r0rsrd�getnames�_DebPart__resolve_symlinks)r4rl�follow_symlinks�names�
fname_reals     r�has_filezDebPart.has_file�sn���*�*�5�1�1�����
�
�#�#�%�%���E�>�>��4��	*��0�0��7�7�J��T�)�)���~�rNc��dSrr�r4rl�encoding�errorsr�s     r�get_filezDebPart.get_file��	��	
�rc��dSrrr�s     rr�zDebPart.get_file�r�rc�n�t�|��}|r(|�|��}|�td���|}	|����|��}n#t$rtd���wxYw|�td���|�tj|||���S|S)aReturn a file object corresponding to a given file name.

        If encoding is given, then the file object will return Unicode data;
        otherwise, it will return binary data.

        If follow_symlinks is True, then symlinks within the archive will be
        followed.
        NzFile not found inside package�r�r�)	r0rsrr*rd�extractfilerwrL�
TextIOWrapper)r4rlr�r�r�r��fobjs       rr�zDebPart.get_file�s����*�*�5�1�1���	��0�0��7�7�J��!��>�?�?�?��E�	<��8�8�:�:�)�)�%�0�0�D�D���	<�	<�	<��:�;�;�;�	<�����<��:�;�;�;����#�D�8�F�K�K�K�K��s�'A.�.Bc��dSrrr�s     r�get_contentzDebPart.get_content�	��	
�rc��dSrrr�s     rr�zDebPart.get_contentr�rc��|�t|��|||���}d}|r(|���}|���|S)a5Return the string content of a given file, or None (e.g. for
        directories).

        If encoding is given, then the content will be a Unicode object;
        otherwise, it will contain binary data.

        If follow_symlinks is True, then symlinks within the archive will be
        followed.
        )r�r�r�N)r�rirJ�close)r4rlr�r�r�r�contents       rr�zDebPart.get_content$s[�� 
�M�M���J�J��f�+�
�
�
��
���	��f�f�h�h�G�
�G�G�I�I�I��rc�h�t|��������Sr)�iterrdr~�r4s r�__iter__zDebPart.__iter__As$���D�H�H�J�J�'�'�)�)�*�*�*rc�,�|�|��Sr)r��r4rls  r�__contains__zDebPart.__contains__Es���}�}�U�#�#�#rc�,�|�|��Sr)r�r�s  r�__getitem__zDebPart.__getitem__Is������&�&�&rc�8�|j���dSr)r2r�r�s rr�z
DebPart.closeMs���
�������r)F)NNF)NF)r,r-r.�__doc__r6rd�staticmethodrsrr�rr�r�r�r�r�r�rrrr0r0Qs���������"���
4�4�4�l�
�
��\�
�$F�$F�$F�L����$�
�
�
��X�
��
�
�
��X�
�����@�"��$)�	
�
�
��X�
�� �$)�	
�
�
��X�
�"��$)�	����:+�+�+�$�$�$�'�'�'�����rr0c��eZdZdS)�DebDataNr+rrrr�r�Rs�������Drr�c�R�eZdZd�Zd�Zedd���Zedd���Zdd�ZdS)	�
DebControlc��i}tD]3}|�|��r|�|��}|�|||<�4|S)zo Return a dictionary of maintainer scripts (postinst, prerm, ...)
        mapping script names to script text. )�
MAINT_SCRIPTSr�r�)r4�scriptsrlrQs    rr�zDebControl.scriptsYsT��
��"�	*�	*�E��}�}�U�#�#�
*��'�'��.�.���#�%)�G�E�N���rc�P�t|�t����S)z� Return the debian/control as a Deb822 (a Debian-specific dict-like
        class) object.

        For a string representation of debian/control try
        .get_content('control') )rr��CONTROL_FILEr�s r�
debcontrolzDebControl.debcontrolgs ���d�&�&�|�4�4�5�5�5rNc��dSrr�r4r�r�s   rr(zDebControl.md5sumsqr�rc��dSrrr�s   rr(zDebControl.md5sumsvr�rc���|�t��stdtz���|�t||���}i}d}|�d}|���D]`}|�|���dd��\}}t|t��r|�	��||<�[|||<�a|�
��|S)a� Return a dictionary mapping filenames (of the data part) to
        md5sums. Fails if the control part does not contain a 'md5sum' file.

        Keys of the returned dictionary are the left-hand side values of lines
        in the md5sums member of control.tar.gz, usually file names relative to
        the file system root (without heading '/' or './').

        The returned keys are Unicode objects if an encoding is specified,
        otherwise binary. The returned values are always Unicode.z('%s' file not found, can't list MD5 sumsr�z
Ns
rS)r��MD5_FILEr*r��	readlines�rstriprp�
isinstance�bytes�decoder�)	r4r�r��md5_file�sums�newline�line�md5rls	         rr(zDebControl.md5sums{s����}�}�X�&�&�	G��:�X�E�G�G�
G��=�=��H�V�=�L�L���������G��&�&�(�(�	"�	"�D����W�-�-�3�3�D�!�<�<�J�C���#�u�%�%�
"�!�j�j�l�l��U���!��U����������r�NNr)r,r-r.r�r�rr(rrrr�r�Ws����������6�6�6��
�
�
��X�
��
�
�
��X�
������rr�c��eZdZdZdd�Zd�Zed���Zed���Zed���Z	d	�Z
d
�Zedd���Z
edd���Z
dd
�Z
d�Zd�Zd�Zd�ZdS)�DebFilea�Representation of a .deb file (a Debian binary package)

    DebFile objects have the following (read-only) properties:
        - version       debian .deb file format version (not related with the
                        contained package version), 2.0 at the time of writing
                        for all .deb packages in the Debian archive
        - data          DebPart object corresponding to the data.tar.gz (or
                        other compressed or uncompressed tar) archive contained
                        in the .deb file
        - control       DebPart object corresponding to the control.tar.gz (or
                        other compressed tar) archive contained in the .deb
                        file
    N�rc���tj||||��t|�������fd�}t�vrtdtz���i|_t|�|t������|jt<t|�|t������|jt<d|_|�t��}|�
�����|_|���dS)Nc�V����fd�tD��}�ttfvr|������t|����}|st
d|z���t|��dkrt
d|z���t|��dS)Nc���g|]	}��d|����
S)rhr)�.0�ext�basenames  �r�
<listcomp>zBDebFile.__init__.<locals>.compressed_part_name.<locals>.<listcomp>�s$���I�I�I��X�X�X�s�s�3�I�I�Irz9missing required part in given .deb (expected one of: %s)rSz>too many parts in given .deb (was looking for only one of: %s)r)	r[r\r]rq�intersection�setr*�len�list)r��
candidates�parts�actual_namess`  �r�compressed_part_namez.DebFile.__init__.<locals>.compressed_part_name�s�����I�I�I�I�y�I�I�I�J��I�y�1�1�1��!�!�(�+�+�+� �-�-�c�*�o�o�>�>�E��
;��-�/9�:�;�;�;��5�z�z�A�~�~��9�;E�F�G�G�G���;�;�q�>�!rz4missing required part in given .deb (expected: '%s'))rr6r�r~�	INFO_PARTr*�_DebFile__partsr�rtr]r�r\�_DebFile__pkgnamerJ�strip�_DebFile__versionr�)r4�filenamerVrUr�rr�s      @rr6zDebFile.__init__�s&������h��g�6�6�6��4�=�=�?�?�+�+��	"�	"�	"�	"�	"�&�L�(�(��$�&/�0�1�1�
1����",�T�^�^� � ��+�+�.-�.-�#.�#.���Y��")�$�.�.� � ��+�+�+-�+-�#.�#.���Y������N�N�9�%�%���������)�)���	���	�	�	�	�	rc�D�|���d|_dS)N�package)r�r�r�s r�__updatePkgNamezDebFile.__updatePkgName�s�����*�*�9�5����rc��|jSr)r�r�s r�versionzDebFile.version�s���~�rc�&�|jtSr)r�r\r�s rrQzDebFile.data�����|�I�&�&rc�&�|jtSr)r�r]r�s rr'zDebFile.control�r�rc�4�|j���S)z See .control.debcontrol() )r'r�r�s rr�zDebFile.debcontrol�s���|�&�&�(�(�(rc�4�|j���S)z See .control.scripts() )r'r�r�s rr�zDebFile.scripts�s���|�#�#�%�%�%rc��dSrrr�s   rr(zDebFile.md5sums�r�rc��dSrrr�s   rr(zDebFile.md5sums�r�rc�:�|j�||���S)z See .control.md5sums() r�)r'r(r�s   rr(zDebFile.md5sums�s���|�#�#�X�f�#�E�E�Erc�|�|j�|���t|jzt|jzfD]�}	|j�|d���}n#t$rY�,wxYwtj|���5}|�	��}ddd��n#1swxYwYt|��cSdS)z� Return a Changelog object for the changelog.Debian.gz of the
        present .deb package. Return None if no changelog can be found. NT)r�)rU)r��_DebFile__updatePkgName�CHANGELOG_DEBIAN�CHANGELOG_NATIVErQr�r*�gzip�GzipFilerJr)r4rl�fhr�
raw_changelogs     r�	changelogzDebFile.changelogs��
�>�!�� � �"�"�"�&���7�&���7�9�		,�		,�E�
��Y�'�'��t�'�D�D�����
�
�
���
������r�*�*�*�
*�b� "���	�	�
�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*����
*�
*�
*�
*��]�+�+�+�+�+��ts#�A�
A'�&A'�?B � B$	�'B$	c�j�|j���|j���dSr)r'r�rQr�s rr�z
DebFile.closes.����������	�������rc��|Srrr�s r�	__enter__zDebFile.__enter__s���rc�.�|���dSr)r�)r4�exc_type�exc_val�exc_tbs    r�__exit__zDebFile.__exit__!s���
�
�����r)Nr�Nr�r)r,r-r.r�r6r��propertyr�rQr'r�r�rr(r�r�r�r�rrrr�r��sE��������&�&�&�&�P6�6�6�����X���'�'��X�'��'�'��X�'�)�)�)�
&�&�&�
�
�
�
��X�
��
�
�
��X�
�F�F�F�F�
���*���
�������rr��__main__rS)r�)7r�r�rLr^�sys�os.pathrX�pathlibr�typingrrrrrr	r
rrr
rr�typing_extensionsr�ImportError�
debian.arfilerrr�debian.changelogr�
debian.deb822rr\r]r[r�r�r�r�r�r�r*�objectr0r�r�r�r,�argv�debr'rd�printrtrrr�<module>rs����.����	�	�	�	�����
�
�
�
�����������"�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
����������"�"�"��M��"�"�>����"����4�3�3�3�3�3�3�3�3�3�&�&�&�&�&�&� � � � � � �
�	��	�.�.�.�	��	�D�D�D�
���2��9����	�	�	�	�	�w�	�	�	�~�~�~�~�~�f�~�~�~�B	�	�	�	�	�g�	�	�	�
C�C�C�C�C��C�C�C�LF�F�F�F�F�f�F�F�F�R�z���
�'�3�8�A�;�
'�
'�
'�C�

�+�/�/�
�
�C�	�E�#�-�-�	�
"�
"�#�#�#�#�#��s�"A�A�A