AlkantarClanX12

Your IP : 3.129.211.116


Current Path : /proc/self/root/usr/lib/python3.6/site-packages/dnf/rpm/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3.6/site-packages/dnf/rpm/__pycache__/miscutils.cpython-36.pyc

3

��f�@svddlmZmZmZddlZddlZddlZddlmZddl	m
Z
ejd�Zda
dd�Zdd	�Zd
d�Zdd
�ZdS)�)�print_function�absolute_import�unicode_literalsN)�which)�_ZdnfcCs$tdkr td�atjtd�t�tS)N�rpmkeysz3Using rpmkeys executable at %s to verify signatures)�_rpmkeys_binaryr�_logger�debugr�rr�/usr/lib/python3.6/miscutils.py�_find_rpmkeys_binarys

r
cCs�t|�dks |ddks |dr$dSd\}}}}x^|dd�D]N}d|krNdS|jd�r^d	}q>|jd
�rnd	}q>|jd�r~d	}q>|jd�s>dSq>W|r�dS|r�dS|r�d
SdS)N�rs-:��Fs: BADs: NOKEYTs: NOTTRUSTEDs
: NOTFOUNDs: OK����)FFFFr)�len�endswith)�dataZseen_sigZmissing_keyZnot_trustedZ
not_signed�irrr�_process_rpm_output$s* 



rc
Cs�t�}|dkstjj|�r.tjtd��dSddd|dddd	f}tj||d
ditj	d|d
��}|j
�d}WdQRX|j}t|�t
k	r�td��|dks�|dkr�dSt|jd��}|r�|S|r�dSdS)Nz4Cannot find rpmkeys executable to verify signatures.rrz
--checksigz--rootz	--verbosez#--define=_pkgverify_level signaturez--define=_pkgverify_flags 0x0�-�LC_ALL�C�/)�args�
executable�env�stdout�cwd�stdinrz Popen set return code to non-int�
)r
�os�path�isfiler	Zcriticalr�
subprocess�Popen�PIPEZcommunicate�
returncode�type�int�AssertionErrorr�split)�packageZinstallrootZrpmkeys_binaryr�prr)�retrrr�_verifyPackageUsingRpmkeys?s0

r1cCs>tj|tjtjBtjB�}zt||jj�}Wdtj|�X|S)a
Takes a transaction set and a package, check it's sigs,
    return 0 if they are all fine
    return 1 if the gpg key can't be found
    return 2 if the header is in someway damaged
    return 3 if the key is not trusted
    return 4 if the pkg is not gpg or pgp signedN)	r#�open�O_RDONLY�O_NOCTTY�	O_CLOEXECr1�tsZrootDir�close)r6r.Zfdno�valuerrr�checkSig^s
r9)Z
__future__rrrr#r&ZloggingZshutilrZdnf.i18nrZ	getLoggerr	rr
rr1r9rrrr�<module>s