AlkantarClanX12

Your IP : 18.190.160.6


Current Path : /usr/lib/python3.6/site-packages/dnf/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/__pycache__/drpm.cpython-36.pyc

3

�ft`��@s�ddlmZddlmZddlmZddlmZddlmZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZddlZddlZdZejd�ZGd	d
�d
e
jj�ZGdd�de�ZdS)
�)�absolute_import)�unicode_literals)�hexlify)�unlink_f)�_Nz/usr/bin/applydeltarpm�dnfcsXeZdZ�fdd�Zdd�Z�fdd�Zdd�Zed	d
��Zedd��Z	d
d�Z
�ZS)�DeltaPayloadcs"tt|�j||�||_||_dS)N)�superr�__init__�
delta_info�delta)�selfrr�pkg�progress)�	__class__��/usr/lib/python3.6/drpm.pyr
)szDeltaPayload.__init__cCstjj|jj�S)N)�os�path�basenamer�location)r
rrr�__str__.szDeltaPayload.__str__cs2tt|�j|||�|tjjjkr.|jj|�dS)N)	r	r�_end_cb�libdnf�repoZPackageTargetCBZTransferStatus_ERRORr�enqueue)r
ZcbdataZ	lr_status�msg)rrrr1szDeltaPayload._end_cbcCsh|j}|j\}}tj|�}t|�j�}tjjj	|�}|tjjj
krRtjt
d�|�|j|||j|jd�S)Nzunsupported checksum type: %s)Zrelative_urlZ
checksum_typeZchecksumZexpectedsizeZbase_url)r�chksum�hawkeyZchksum_namer�decoderrZ
PackageTargetZchecksumTypeZChecksumType_UNKNOWN�loggerZwarningrr�downloadsizeZbaseurl)r
rZctypeZcsumrZ
ctype_coderrr�_target_params6s

zDeltaPayload._target_paramscCs|jjS)N)rr!)r
rrr�
download_sizeHszDeltaPayload.download_sizecCs|jjS)N)rr!)r
rrr�
_full_sizeLszDeltaPayload._full_sizecCs$|jj}tjj|jjjtjj|��S)N)	rrrr�joinrrZpkgdirr)r
rrrr�localPkgPszDeltaPayload.localPkg)�__name__�
__module__�__qualname__r
rrr"�propertyr#r$r&�
__classcell__rr)rrr(src@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�	DeltaInfoNcCs�d|_tjttj�rd|_ytjd�|_Wnttfk
rHd|_YnX|dkrbt	j
j�j|_n||_||_
||_g|_i|_i|_dS)z�A delta lookup and rebuild context
           query -- installed packages to use when looking up deltas
           progress -- progress obj to display finished delta rebuilds
        FT�SC_NPROCESSORS_ONLN�N)�deltarpm_installedr�access�
APPLYDELTA�X_OK�sysconf�
deltarpm_jobs�	TypeError�
ValueErrorrZconfZConf�deltarpm_percentage�queryr�queue�jobs�err)r
r8rr7rrrr
VszDeltaInfo.__init__cCs�|js
dS|jjs|jr dS|j�r,dStjj|j��r@dS|j	|jd}d}x@|j
j|j|j
d�D](}|j|j�}|rj|j|krj|j}|}qjW|r�t||||�SdS)z&Turn a po to Delta RPM po, if possibleN�d)�name�arch)r/rZdeltarpmr7Z
_is_local_pkgrr�existsr&Z_sizer8�filterr=r>Zget_delta_from_evrZevrr!r)r
ZporZbestZ
best_deltaZiporrrr�
delta_factoryms$zDeltaInfo.delta_factorycCs�tjtjjd||d?|d@�|jj|�}|j}|dkrXt|jj	��t
d�g|j|<nB|jj�stt
d�g|j|<n&t
j|j	��|jj|tjjt
d��dS)Nzdrpm: %d: return code: %d, %d��rzDelta RPM rebuild failedz(Checksum of the delta-rebuilt RPM failed�done)r �logr�logging�SUBDEBUGr:�poprrr&rr;ZverifyLocalPkgr�unlinkr�end�callbackZSTATUS_DRPM)r
�pid�code�ploadrrrr�job_done�s
zDeltaInfo.job_donecCs`ttd|jj|j�|jj�g}tjtjf|��}tjt	j
jd|dj|dd���||j
|<dS)Nz-azdrpm: spawned %d: %s� �)r1rr>r&r�spawnl�P_NOWAITr rErrFrGr%r:)r
rNZ
spawn_argsrLrrr�	start_job�szDeltaInfo.start_jobcCspx.|jr.tjdtj�\}}|s P|j||�qW|jj|�x.t|j�|jkrj|j	|jj
d��|js>Pq>WdS)NrQr���)r:r�waitpid�WNOHANGrOr9�append�lenr4rTrH)r
rNrLrMrrrr�szDeltaInfo.enqueuecCs@x:|jr:tj�\}}|j||�|jr|j|jjd��qWdS)z!Wait until all jobs have finishedrN)r:r�waitrOr9rTrH)r
rLrMrrrrZ�s
zDeltaInfo.wait)N)	r'r(r)r
rArOrTrrZrrrrr,Us


r,)Z
__future__rrZbinasciirZdnf.yum.miscrZdnf.i18nrZdnf.callbackrZdnf.loggingZdnf.reporrFZlibdnf.reporrr1Z	getLoggerr rZPackagePayloadr�objectr,rrrr�<module>s
-