관리-도구
편집 파일: rpm_packages_statistics.cpython-311.pyc
� |�Cgh � � � d dl Z d dlmZmZmZ d dlmZmZmZm Z d dl mZ d dlm Z e j d� � Zde eeeee f fd�Zd � ZdS ) � N)�CalledProcessError�Popen�PIPE)�Dict�AnyStr�Optional�List)� serialize_evr)� is_ubuntuz(cloudlinux-summary.get_rpm_packages_info�returnc �R � g } d}t � � }|rd}nd}d}d}d} t |t t ddd� � � 5 }|� � � \ }} |j }d d d � � n# 1 swxY w Y || v rt � |� � | S n<# t t f$ r(} t � d|| � � | cY d } ~ S d } ~ ww xY w|dk r$t � d||||| d ��� � | S |� � � � d� � }|D ]�} t ||� � \ } }}}}n0# t $ r# t � d||d|i�� � Y �Fw xY w|dk rd n|}| � | ||||t! |||g� � d�� � ��| S )z� Get full info about all of rpm packages: - name - epoch - version - release - arch - serialized_version z"Thread died in Berkeley DB libraryz9dpkg-query -f '${Package} ${Version} ${Architecture} ' -WzYrpm -qa --queryformat '%{name} %|epoch?{%{epoch}}:{None}| %{version} %{release} %{arch} 'z1Can't get information about rpm packages, becausezYServer has broken rpmdb. We can't get statistics about rpm packages and skip its getting.r Tz /bin/bash)�stdout�stderr�shell� executable�textNz%s exception "%sz)%s command "%s" return non-zero code "%s")r r )�extra� zRThe result of call "%s" has an invalid line "%s". It should contain five elements.r �None)�name�epoch�version�release�arch�serialized_version)r r r �communicate� returncode� app_logger�warningr �OSError� exception�error�strip�split�parse_package_manager_output� ValueError�appendr )�result�rpm_db_error_pattern�is_ubuntu_os�rpm_cmd� error_message�rpm_db_warn_msgr �procr r r! �lines�liner r r r r s �X/opt/cloudlinux/venv/lib64/python3.11/site-packages/clsummary/rpm_packages_statistics.py�get_rpm_packages_infor2 s� � � �F�?���;�;�L�� s�P���r��H�M�L�O��J�� �����"�� � � � )� �!�-�-�/�/�N�F�F���J� )� )� )� )� )� )� )� )� )� )� )���� )� )� )� )� �6�)�)����� � � � �M� *�� ��(� � � ������� � � � � � � � � � ����� ���� �Q������7���� � �� � � � � � � ��L�L�N�N� � ��&�&�E�� � �� �2N�t�Ua�2b�2b�/�D�%��'�4�4��� � � ����3����f�� � � � � �H� ���� ������U��� � ������"/����1� #� #� � � � � � � �MsS �B � A+�B �+A/�/B �2A/�3"B �C�(C�C�C�)E � *E-�,E-c � � |rh| � d� � \ }}}d}d|v r|� d� � \ }}|� d� � ^}}|rd� |� � nd}n| � d� � \ }}}}}|||||fS )aR rpm -qa already returns data in needed format, e.g: lve-utils None 6.2.3 2.el7.cloudlinux.1639593336.cloudlinux.1639595623 x86_64 but, dpkg-query output needed to be parsed a bit, cause version column cannot be split by util to epoch:version:release lve-utils 6.2.2.1639220776 amd64 � N�:�-)r$ �join)r0 r* r r r r r s r1 r% r% m s� � � � ?�"�j�j��.�.���g�t����'�>�>�$�]�]�3�/�/�N�E�7�#�M�M�#�.�.���'�'.�8�#�(�(�7�#�#�#�D���.2�j�j��.>�.>�+��e�W�g�t�����$�.�.� )�logging� subprocessr r r �typingr r r r �clcommon.evr_utilsr �clcommon.utilsr � getLoggerr r2 r% � r8 r1 �<module>r@ s� �� ���� 6� 6� 6� 6� 6� 6� 6� 6� 6� 6� /� /� /� /� /� /� /� /� /� /� /� /� ,� ,� ,� ,� ,� ,� $� $� $� $� $� $� �W� �I� J� J� �X�t�H�T�&�(�6�:J�2J�-K�$L�M� X� X� X� X�v/� /� /� /� /r8