usr/lib/python3.6/site-packages/dnf/__pycache__/drpm.cpython-36.pyc000064400000012244147205376570021005 0ustar003 ft`@sddlmZddlmZddlmZddlmZddlmZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZdZejdZGd d d e jjZGd d d eZdS) )absolute_import)unicode_literals)hexlify)unlink_f)_Nz/usr/bin/applydeltarpmdnfcsXeZdZfddZddZfddZddZed d Zed d Z d dZ Z S) DeltaPayloadcs"tt|j||||_||_dS)N)superr__init__ delta_infodelta)selfr r pkgprogress) __class__/usr/lib/python3.6/drpm.pyr )szDeltaPayload.__init__cCstjj|jjS)N)ospathbasenamer location)r rrr__str__.szDeltaPayload.__str__cs2tt|j||||tjjjkr.|jj|dS)N) r r_end_cblibdnfrepoZPackageTargetCBZTransferStatus_ERRORr enqueue)r ZcbdataZ lr_statusmsg)rrrr1szDeltaPayload._end_cbcCsh|j}|j\}}tj|}t|j}tjjj |}|tjjj krRt j t d||j|||j|jdS)Nzunsupported checksum type: %s)Z relative_urlZ checksum_typeZchecksumZ expectedsizeZbase_url)r chksumhawkeyZ chksum_namerdecoderrZ PackageTargetZ checksumTypeZChecksumType_UNKNOWNloggerZwarningrr 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 rrrjoinrrZpkgdirr)r rrrrlocalPkgPszDeltaPayload.localPkg) __name__ __module__ __qualname__r rrr"propertyr#r$r& __classcell__rr)rrr(s    rc@s>eZdZdddZddZddZdd Zd d Zd d ZdS) DeltaInfoNc Csd|_tjttjrd|_ytjd|_Wnttfk rHd|_YnX|dkrbt j j j |_ n||_ ||_ ||_g|_i|_i|_dS)zA delta lookup and rebuild context query -- installed packages to use when looking up deltas progress -- progress obj to display finished delta rebuilds FTSC_NPROCESSORS_ONLNN)deltarpm_installedraccess APPLYDELTAX_OKsysconf deltarpm_jobs TypeError ValueErrorrZconfZConfdeltarpm_percentagequeryrqueuejobserr)r r8rr7rrrr Vs zDeltaInfo.__init__cCs|js dS|jj s|j r dS|jr,dStjj|jr@dS|j |jd}d}x@|j j |j |j dD](}|j|j}|rj|j|krj|j}|}qjW|rt||||SdS)z&Turn a po to Delta RPM po, if possibleNd)namearch)r/rZdeltarpmr7Z _is_local_pkgrrexistsr&Z_sizer8filterr=r>Zget_delta_from_evrZevrr!r)r ZporZbestZ best_deltaZipor rrr delta_factoryms$ zDeltaInfo.delta_factorycCstjtjjd||d?|d@|jj|}|j}|dkrXt|jj t dg|j |<nB|jj stt dg|j |<n&t j|j |jj|tjjt ddS)Nzdrpm: %d: return code: %d, %drzDelta RPM rebuild failedz(Checksum of the delta-rebuilt RPM faileddone)r logrloggingSUBDEBUGr:poprrr&rr;ZverifyLocalPkgrunlinkrendcallbackZ STATUS_DRPM)r pidcodeploadrrrrjob_dones  zDeltaInfo.job_donecCs`ttd|jj|j|jjg}tjtjf|}tjt j j d|dj |dd||j |<dS)Nz-azdrpm: spawned %d: %s )r1rr>r&rspawnlP_NOWAITr rErrFrGr%r:)r rNZ spawn_argsrLrrr start_jobszDeltaInfo.start_jobcCspx.|jr.tjdtj\}}|s P|j||qW|jj|x.t|j|jkrj|j |jj d|js>Pq>WdS)NrQr) r:rwaitpidWNOHANGrOr9appendlenr4rTrH)r rNrLrMrrrrs zDeltaInfo.enqueuecCs@x:|jr:tj\}}|j|||jr|j|jjdqWdS)z!Wait until all jobs have finishedrN)r:rwaitrOr9rTrH)r rLrMrrrrZs   zDeltaInfo.wait)N) r'r(r)r rArOrTrrZrrrrr,Us    r,)Z __future__rrZbinasciirZ dnf.yum.miscrZdnf.i18nrZ dnf.callbackrZ dnf.loggingZdnf.reporrFZ libdnf.reporrr1Z getLoggerr rZPackagePayloadrobjectr,rrrrs      -