ó Âv_c@sÄdZddlZddlZdefd„ƒYZd„Zd„Zd„Zd„Zd „Z d „Z d „Z y e ƒWnek r“Z nXe d krşd dZejdƒndZdS(s- Module for the ABRT exception handling hook i˙˙˙˙Nt RPMinfoErrorcBseZdZRS(s1Exception class for RPMdb-querying related errors(t__name__t __module__t__doc__(((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pyRscCs/ddlm}y|j|ƒWnnXdS(s&Log message to system logger (journal)i˙˙˙˙(tjournalN(tsystemdRtsend(tmsgR((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pytsyslog s cCsĚtjdddkr3tjjtjdƒ}n tjd}d}|r‹yddl}t|ƒ}Wq‹tk r‡}t dƒq‹Xnyddl }|j |j |j ƒ}|j dƒy=|jddƒ|jdƒ|jd ƒ|jd tjƒƒ|jd |ƒ|jd |jƒdƒ|jd |ƒ|rd|jddj|ƒƒn|jdƒx4tjjƒD]#\}} |jd|| fƒqW|jdƒ|j|jƒd} x-trú|jdƒ} | síPn| | 7} qÎWWn*|jk r(} t dt| ƒƒnX|jƒ| jƒ} t| ƒdksŒ| djdƒ sŒ| djƒ sŒt | dƒdkrt d| ƒnWn't!k rÇ} t dt| ƒƒnXdS(Nit/i˙˙˙˙s?RPM module not available, cannot query RPM db for package namesis/var/runs/abrt/abrt.socketsPOST / HTTP/1.1 s type=Pythonspid=%ssexecutable=%ss reason=%ss backtrace=%ss dso_list=%ss senviron=s%s=%s ttis)communication with ABRT daemon failed: %sisHTTP/iis%error sending data to ABRT daemon: %ss5can't communicate with ABRT daemon, is it running? %s("tsystargvtostpathtabspathtNonetrpmt get_dso_listt ImportErrorRtsockettAF_UNIXt SOCK_STREAMt settimeouttconnecttsendalltgetpidt splitlinestjointenviront iteritemstshutdowntSHUT_WRtTruetrecvttimeouttstrtclosetsplittlent startswithtisdigittintt Exception(ttb_textttbt executabletdso_listRtimperrRtstktvtresponsetbuftextparts((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pyt write_dump1s\           cCsŠddl}|jƒ}|jd|ƒ}y|jƒ}Wn!tk r]td|ƒ‚nXdj|d|d|d|d ƒ}|S( sŰ Returns package name for a given file. @param fpath: filename @type fpath: str @return: package name for the file @rtype: str @throws RPMinfoError: if package for the file cannot be found i˙˙˙˙Nt basenamess*Cannot get package and component for file s{0}-{1}-{2}.{3}tnametversiontreleasetarch(RtTransactionSettdbMatchtnextt StopIterationRtformat(tfpathRttstmitheadertpackage((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pytget_package_for_filess   c CsÇddl}|j|ƒr-|j|ƒ}ntƒ}xP|D]H\}}}}}}y|jt|ƒƒWq=tk r„} q=q=Xq=Wy|jttj dƒƒWntk rź} nXt |ƒS(sť Get the list of names of the packages whose files appear in the traceback. @param tb: traceback @type tb: traceback @return: list of package names @rtype: list i˙˙˙˙Ni( tinspectt istracebacktgetinnerframestsettaddRIRtdiscardR R tlist( R.RJtpackagestframeRDtlinenotfunctctxtidxtrpmerr((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pyRŒs   cCsJddl}y|jdƒ}Wntk r3tSX|jddƒdkS(sR Return True if absolute path requirement is enabled in configuration i˙˙˙˙Ns python.conftRequireAbsolutePathtyes(tproblemtload_plugin_conf_filetOsErrortFalsetget(RZtconf((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pytrequire_abs_pathŞs   c Cs6|\}}}y tjt_ddl}|ttgkrOtj|||ƒS|tksg|tkr|j|jkrtj|||ƒSntj d s´tj dddkrďtj dsÇdndtj d}t d|ƒt ‚nt dtj dƒtj ddd kr0t ƒr0t ‚q0nddl }|j|||ƒ}|dkrŢ|tkrŢ|j|d dƒ}t|ƒrĄ|t|ƒd }n|j||ƒ} |rt|ƒd krg} | j|d ƒtjj|dƒ| d<| }nd} x"|D]} | t| ƒd 7} qW| } | | d7} | d7} | dj|ƒ7} |}x|jr|j}qjW|j}| d7} y>x7|jjƒD]&\}}| d|t|ƒf7} qŚWWq q Xn-t|ƒd} | d7} | dj|ƒ7} t| |ƒWnnXtj|||ƒS(s„ The exception handling function. progname - the name of the application version - the version of the application i˙˙˙˙Nit-R s (python %s ...)s;detected unhandled Python exception in 'interactive mode%s's+detected unhandled Python exception in '%s'R tlimitiit:s s% Local variables in innermost frame: s%s: %s ( R t__excepthook__t excepthookterrnotKeyboardInterruptt SystemExittIOErrortOSErrortEPIPER RR,R`t tracebacktformat_exceptionRtIndentationErrort extract_tbR(tformat_exception_onlytextendRRtbasenameR%Rttb_nextttb_frametf_localstitemstreprR9(t.0tetypetvalueR.RfteinfoRltelistttblasttextxttlltntextttttextttraceRRtkeytval((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pythandleMyExceptionşsl    %$            " cCsd„t_dS(s2 Install the exception handling function. cSst|||fƒS(N(R†(RyRzR.((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pyt!sN(R Re(((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pytinstallExceptionHandlerst__main__iis Harald Hoyer (RR RR,RRR9RIRR`R†RˆteRtdiv0texitt __author__(((s</usr/lib64/python2.7/site-packages/abrt_exception_handler.pyts$    B    c