Ñò ÒG×Jc@shddkZddklZddklZlZlZdefd„ƒYZde fd„ƒYZ dS(iÿÿÿÿN(tUtilBase(tPopentPIPEtcallt CoreExceptioncBseZRS((t__name__t __module__(((s,/usr/lib/python2.6/site-packages/cas/core.pyRstCoreBasecBs8eZd„Zd„Zd„Zd„Zdd„ZRS(cCstƒ|_dS(N(Rtutil(tself((s,/usr/lib/python2.6/site-packages/cas/core.pyt__init__scsvhddgd6ddgd6ddgd6ddgd 6d dgd 6d d gd6}‡fd†}|ddƒp|ddƒo |dS|ddƒo |dS|ddƒo |dS|ddƒo2|idƒp|idƒo |dS|dS|ddƒp|ddƒoR|idƒp0|idƒp |idƒp|idƒo |d S|d StS(sFReturn a good default Operation, judging by the first 300 bytes or so.ttartxvftxvzfttgztgunzips-qtgztxvjfttbztbunzip2tbz2tunzips-ftzipcsˆ||t|ƒ!|jS(N(tlen(toffsettmatch(tdata(s,/usr/lib/python2.6/site-packages/cas/core.pytstring!situstarsustar isPKtPK00s‹s.tar.gzs.tgztBZhtBZs.tar.bzs.tar.bz2s.tbzs.tbz2(tendswithtFalse(R Rtfnamet suffix_mapR((Rs,/usr/lib/python2.6/site-packages/cas/core.pyt guess_formats.                c CsStiitiƒ|_||_t|idƒ}ti|iƒdƒ}|i ||iƒ}|pt dƒ‚nÃ|i |iƒt |dt dt ƒ}|iiƒ}|iiƒ}|ot d|fƒ‚nx[|ii|iƒD]D\}} } x2| D]*} |i| ƒotii|| ƒSqWqñWt d|ifƒ‚dS( s6 utility to extract archive and pull out core trbiès%Can not determine compression format.tstdouttstderrsUnable to extract file: %ss.Can not determine a corefile from tarball : %sN(tostpathtrealpathtcurdirtdsttfilepathtopentreadtfilenoR$RtappendRRR'R&Rt directoryListt isCorefiletjoin( R R-tfdRtformattpterrtouttroottdirstfilestfile((s,/usr/lib/python2.6/site-packages/cas/core.pyt extractCore6s( cCsldd|g}t|dtdtƒ}|iiƒ}dddg}x |D]}||jotSqLWtS(NR=s-iR&R'sapplication/x-coredumpsapplication/octet-streamsapplication/x-executable(RRR&R/tTrueR!(R tcorefiletcmdR7ttxttitemsti((s,/usr/lib/python2.6/site-packages/cas/core.pyR3Ts   cCs­d}ytd|ƒ}Wntj otSX|idƒ| p |djo d}nti|iƒ|ƒ}|ii||ƒ}|o|St d|fƒ‚dS(s( captures fingerprint from core s)Linux\sversion.*20\d{1,2}|#1\s.*20\d{1,2}s%siti¿/ s%Unable to retrieve timestamp from: %sN( R.tIOErrorR!tseekR(R/R0Rt regexSearchR(R R)tblksizeRR5tbR9((s,/usr/lib/python2.6/site-packages/cas/core.pyt timestamp`s  N(RRR R$R>R3tNoneRK(((s,/usr/lib/python2.6/site-packages/cas/core.pyRs     ( R(tcas.utilRtcas.cas_subprocessRRRt ExceptionRtobjectR(((s,/usr/lib/python2.6/site-packages/cas/core.pyt s