Your IP : 18.227.46.54
3
��f � @ sv d dl mZmZmZ d dlZd dlZd dlZd dlmZ d dl m
Z
ejd�Zda
dd� Zdd � Zd
d� Zdd
� ZdS )� )�print_function�absolute_import�unicode_literalsN)�which)�_Zdnfc C s$ t d kr td�a tjtd�t � t S )N�rpmkeysz3Using rpmkeys executable at %s to verify signatures)�_rpmkeys_binaryr �_logger�debugr � r r �/usr/lib/python3.6/miscutils.py�_find_rpmkeys_binary s
r
c C s� t | �dk s | d dks | d r$dS d\}}}}x^| dd� D ]N}d|krNdS |jd�r^d }q>|jd
�rnd }q>|jd�r~d }q>|jd�s>dS q>W |r�dS |r�dS |r�d
S dS )N� r s -:� � Fs : BADs : NOKEYTs : NOTTRUSTEDs
: NOTFOUNDs : OK� ���)FFFFr )�len�endswith)�dataZseen_sigZmissing_keyZnot_trustedZ
not_signed�ir r r �_process_rpm_output$ s*
r c
C s� t � }|d kstjj|� r.tjtd�� dS ddd|dddd f}tj||d
ditj d| d
��}|j
� d }W d Q R X |j}t|�t
k r�td��|dks�|dk r�dS t|jd��}|r�|S |r�dS dS )Nz4Cannot find rpmkeys executable to verify signatures.r r z
--checksigz--rootz --verbosez#--define=_pkgverify_level signaturez--define=_pkgverify_flags 0x0�-�LC_ALL�C�/)�args�
executable�env�stdout�cwd�stdinr z Popen set return code to non-int�
)r
�os�path�isfiler Zcriticalr �
subprocess�Popen�PIPEZcommunicate�
returncode�type�int�AssertionErrorr �split)�packageZinstallrootZrpmkeys_binaryr �pr r) �retr r r �_verifyPackageUsingRpmkeys? s0
r1 c C s>