관리-도구
편집 파일: rpmUtils.cpython-36.pyc
3 e�$g� � @ s| d dl Z d dlZd dlmZ d dlmZ d dlZejddd�Ze ed�sPeje_ ej Zdd � Zd d� Z ddd �Zdd� ZdS )� N)�sstr)�transactionzrhn-client-toolsT)Zfallback�ugettextc K sV t j� }|j� }x$| j� D ]}|j|tj| | � qW g }x|D ]}|j|� q@W |S )z@ just cause this is such a potentially useful looking method... )r �initReadOnlyTransaction�dbMatch�keys�pattern�rpmZRPMMIRE_GLOB�append)�kwargs�_tsZmi�keywordZ headerList�h� r �/usr/lib/python3.6/rpmUtils.py�installedHeaderByKeyword s r c C s~ i }g }g }�xf| D �]\}|d |d |d |d d�}x.|j � D ]"}|| dks^|| dkrB||= qBW tf |�}t|�dkr�|j|� x�|D ]�}|d } | dkr�d} |d } | dkr�d} |d |d |d | | f}|d dkr�d |d |d |d f }n d|d |d |d |d f }d| } tj| �}|j� }|j� g }x|D ]}|j|j� � �qHW |j||g� q�W qW ||fS )zf given a list of package labels, run rpm -V on them and return a dict keyed off that data r � � � )�name�version�release�archN� �epochr r r r z%s-%s-%sz%s-%s-%s.%sz/usr/bin/rpmverify -V %s) r r �lenr �os�popen� readlines�close�strip)Zpackages�dataZmissing_packagesZretlist�package�keywords�keyZheaders�headerr r ZpkgZpackageLabelZverifystring�fd�resZreslist�liner r r �verifyPackages* sH r) c C s~ g }| dkr| t d�� tj� }d}d}x"|j� D ]}|dkr@P |d }q2W |}d}�x|j� D �]}|dkrpP t|d �|d t|d �t|d �|d d �} | d dkr�d| d<