当前位置: 首页>>代码示例>>Python>>正文


Python utils.logerror函数代码示例

本文整理汇总了Python中utils.logerror函数的典型用法代码示例。如果您正苦于以下问题:Python logerror函数的具体用法?Python logerror怎么用?Python logerror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logerror函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cleanworkspace

def cleanworkspace():
    try:
        cont = 'Y'
        rn = rominfo.rominfo.romname
        rimg = rominfo.rominfo.romimgfilename
        
        src = os.path.join('sources',rn,rimg)
        dst = rimg
        
        #retrieve original img file
        if os.path.isfile(src):
            os.system('mv ' + src + ' ' + dst)
        else:
            cont = raw_input('No ROM image found \n' + src + '\n\nContinue Y/N:')
        
        #retrieve and archive any pulled images    
        if cont in ('Y', 'y'):
            zipfolder('read','ReadImages.zip')
            zipfolder('localdeploy','localdeploy.zip')
            os.system('sudo rm -rf working')
            shutil.rmtree('localdeploy')
            shutil.rmtree('sources')
            shutil.rmtree('read')
         
        rominfo.rominfo.romname = 'un-initialised'   
    except Exception as e:
        logerror('rkmainmenu::recursive_zip ',e,1)
开发者ID:900supersport,项目名称:rkKitchen,代码行数:27,代码来源:rkmainmenu.py

示例2: parameter_menu

def parameter_menu():
    '''display parameter menu and process results'''
    
    try:
        my_menu = dict([
            ('a1', 'read parameters'), 
            ('b2', 'display parameters'), 
            ('c3', 'Edit Parameters'), 
            #('e5', 'finalise recovery'), 
            #('g=', '='), 
            #('h3', 'Custom remove'),
            #('j4', 'Custom deploy'),
            ('t=', '='), 
            ('vm', 'main menu'), 
            ('z=', '=')
            ])
        choice = mymenu(my_menu,'Enter selection :',checkvalid = True)

        if choice in ('1'):
            parse_parameter()
        elif choice in ('2'):
            display_params()
        elif choice in ('3'):
            editparameter_menu()
        elif choice in ('rR'):
            repairparams()
        else:
            pass
        
        if choice not in ('m','M'):
            parameter_menu()   

    except Exception as e:
        logerror('parameter::parameter_menu ',e,1)
开发者ID:900supersport,项目名称:rkKitchen,代码行数:34,代码来源:parameter.py

示例3: removefiles

def removefiles(removefile,root):
    '''remove files from the location
    
    iterate removefile removing files from root
    moving them to the location specified in the file
        app/cube.0.3.0_v2963.apk, removed/app
    '''
    logging.debug('remove files start (removefile:root)(' + removefile + ':' + root)
    
    path = os.path.expanduser(removefile)
    with open(path,'r') as f:
        for line in f:
            cl = line.strip();
            args = cl.split(',')
            if cl[:1] <> '#' and len(cl) > 0:
                try:
                    print 'Attempt Move ' + cl
                    source = os.path.join(root, args[0].strip())
                    dest = os.path.join('working/', args[1].strip())
                    #if os.path.exists(source):
                    if len(glob.glob(source)) > 0:
                        logging.debug('copy ' + source + ' ' + dest )
                        logging.debug('Remove ' + source)
                        CheckMakeFolders([dest])
                        os.system('sudo cp ' + source + ' ' + dest)
                        #shutil.copy(source, dest)
                        os.system('sudo rm ' + root + args[0].strip())
                    else:
                        logging.debug(source + ' does not exist')
                except IOError as e:
                    #print 'error ' + root + args[0].strip()
                    logerror('kitchen_utils::removefiles ' ,e,0)
                    
    logging.debug('remove files END')
    logging.debug('================')
开发者ID:redglory,项目名称:rkKitchen,代码行数:35,代码来源:kitchen_utils.py

示例4: Resizemtdblock

def Resizemtdblock(blocksize,tgtblock):
    '''resize tgtblock to blocksize and adjust all following offsets
'''
    try:
        ri = rominfo.rominfo
        mtdblocks = ri.mtdblocks
        found = False
        trailingblocks = []

        #populate trailingblocks with our mtdblocks from our target onwards
        for block in mtdblocks:
            if block == tgtblock:
                found = True
            if found:
                trailingblocks.append(block)

        for block in trailingblocks:
            #adjust the size of our target and the offsets of the following blocks
            if block == tgtblock:
                newoffset, pfile = subsize(ri.parameterfile,tgtblock,blocksize)
            else:
                newoffset, pfile = suboffset(pfile,block,newoffset)

        ri.writeparameter(pfile)
        
        
    except Exception as e:
        logerror('parameter::Resizemtdblock ',e,1)
开发者ID:900supersport,项目名称:rkKitchen,代码行数:28,代码来源:parameter.py

示例5: getcurrentparameterdatalines

def getcurrentparameterdatalines():
    try:
        sdata =  rominfo.rominfo.parameterfile
            
        syssizeH, syssizeI, syssizeM, syssizeG = getsizes(rominfo.rominfo.system.size)
        userdatasizeH, userdatasizeI, userdatasizeM, userdatasizeG = getsizes(rominfo.rominfo.userdata.size)
            
            
        sdata = sdata + ' \n' + 'Current system size:'
        sdata = sdata + '\n' + '    Hex as paramters :' + syssizeH
        sdata = sdata + '\n' + '    bytes            :' + str(syssizeI)
        sdata = sdata + '\n' + '    Mbytes           :' + str(syssizeM)
        sdata = sdata + '\n'   
        sdata = sdata + ' \n' + 'Current userdata (app space) size:'
        sdata = sdata + '\n' + '    Hex as paramters :' + userdatasizeH
        sdata = sdata + '\n' + '    bytes            :' + str(userdatasizeI)
        sdata = sdata + '\n' + '    Mbytes           :' + str(userdatasizeM)  
        sdata = sdata + '\n' + '    Gbytes           :' + str(userdatasizeG)
        
        rdata = sdata.replace('\n\n','\n')
        while rdata != sdata:
            sdata = rdata
            rdata = sdata.replace('\n\n','\n')
    except Exception as e:
        logerror('parameter::getcurrentparameterdatalines ',e,1)

    return rdata
开发者ID:900supersport,项目名称:rkKitchen,代码行数:27,代码来源:parameter.py

示例6: unpackboot_recovery

def unpackboot_recovery(image):
    '''unpack a boot.img or recovery.img'''
    
    try:
        loc = image.find('.')
        folder = image[:loc]
        filepath = os.path.join('working/', image)
        
        with open(filepath,'rb') as f:
            disc = f.read(4)
        
        if disc == 'KRNL':
            logging.info('kitchen_utils::unpack_recovery boot.img signed KRNL')
            os.system('dd if=working/' + image + ' of=working/' + image + '-ramdisk.gz'
                + ' skip=8 bs=1 count=20000000')
        else:
            
            unpackBootRecoveryfile(filepath)
            logging.debug('kitchen_utils::unpack_recovery :')
            
        imagefolder = os.path.join('working', folder)    
        CheckMakeFolders([imagefolder])       
        os.chdir(imagefolder)
        
        #protect against this being first sudo request
        os.system('sudo ls')
            
        os.system('sudo gunzip < ../' + image + '-ramdisk.gz '
            + '| sudo cpio -i --make-directories')
         
        os.chdir('../..')
    except Exception as e:
        logerror('kitchen_utils::unpackboot_recovery ',e,1)
开发者ID:redglory,项目名称:rkKitchen,代码行数:33,代码来源:kitchen_utils.py

示例7: makeimage

def makeimage(iname,f):
    try:
        s = getint(f.read(4))
        a = getint(f.read(4))       
        return part(iname,s,a) 
    except Exception as e:
        logerror('kitchen_utils::makeimage ',e,1)
开发者ID:redglory,项目名称:rkKitchen,代码行数:7,代码来源:kitchen_utils.py

示例8: validatemtdblocks

    def validatemtdblocks():
        try:
            ri = rominfo

            mtdblocks = ri.mtdblocks
            rollingoffset = 0
            invalid = 0
            errors = ''
            #logging.info(mtdblocks)

            for i,v in enumerate(mtdblocks):
                offset = 0
                size = 0
                imgsize = 0
                if v == 'use':
                    v = 'user' 
                logging.info(v)
                size, offset, imgsize = ri.getmtddata(v,ri)
                if size != '-':
                    ioffset = int(offset,16)
                    isize= int(size,16)
                    if ioffset < rollingoffset:
                        invalid = 1
                        errors += 'invalid offset {}\n'.format(v)
                        rominfo.errorblocks.append([v,'offset'])
                    rollingoffset += isize
                    isize =isize * 512
                    if imgsize > isize:
                        invalid = 1
                        errors += 'invalid {}.img, image larger than allocated space\n'.format(v)     
                        rominfo.errorblocks.append([v,'size'])

        except Exception as e:
            logerror('rominfo::validatemtdblocks ' ,e ,1)
        return invalid, errors
开发者ID:900supersport,项目名称:rkKitchen,代码行数:35,代码来源:rominfo.py

示例9: parameter_menu

def parameter_menu():
    '''display parameter menu and process results'''
    
    try:
        my_menu = dict([
            ('a1', 'read parameters'), 
            ('b2', 'display parameters'), 
            #('c3', 'init.d support'), 
            #('e5', 'finalise recovery'), 
            #('g=', '='), 
            #('h3', 'Custom remove'),
            #('j4', 'Custom deploy'),
            ('t=', '='), 
            ('vm', 'main menu'), 
            ('z=', '=')
            ])
        choice = mymenu(my_menu,'Enter selection :')

        if choice in ('1'):
            parse_parameter()
        elif choice in ('2'):
            display_params()
        else:
            pass
        
        if choice not in ('m','M'):
            parameter_menu()   

    except Exception as e:
        logerror('parameter::parameter_menu ' )
        logerror(e)
        raise        
开发者ID:abazad,项目名称:rkKitchen,代码行数:32,代码来源:parameter.py

示例10: parsemtdblocks

 def parsemtdblocks(CMDLINE,parsemtdonly = 0):
     '''parse image data
 '''
     logging.debug('rominfo::parsemtdblocks CMDLINE = ' + CMDLINE)
     try:
         rominfo.mtdblocks = []
         cmdlinedata = CMDLINE.split(':')
         for i,v in enumerate(cmdlinedata):
             if v.find('(cache)') > 0 :
                 idat = v
                 break
         
         ##parse image data
         for i,v in enumerate(idat.split(',')):
             tpos = v.find('@')
             bpos = v.find('(')
             size = v[:tpos]
             offset = v[tpos+1:bpos]
             image = v[bpos+1:].strip(')')
             logging.debug('rominfo::parsemtdblocks image = ' + image)
             if parsemtdonly != 1:
                 rominfo.setimage(image,offset,size)
             rominfo.mtdblocks.append(image)
             logging.debug('rominfo::parsemtdblocks image appended')
     except Exception as e:
         logerror('rominfo::parsemtdblocks ' ,e ,1)
开发者ID:900supersport,项目名称:rkKitchen,代码行数:26,代码来源:rominfo.py

示例11: applyparameterchanges

    def applyparameterchanges():
        '''Update the persisted parameter file with the current values and regenerate system.img and parameter files

'''
        try:
            logging.info('rominfo::applyparameterchanges start current parameter')
            f = rominfo.parameterfile

            logging.info('\n\n' + f + '\n\n')

            #get all the mtdblocks here 
            kpendloc = f.find(',', f.find('(kpanic)'))+1
            sysendloc = f.find(',', f.find('(system)'))+1
            userendloc =  f.find('(user)')+6

            npf = f[:kpendloc]
            npf = npf + rominfo.submtdsize(f[kpendloc:sysendloc],rominfo.system.size)
            npf = npf + rominfo.submtdoffset(f[sysendloc:userendloc],rominfo.user.offset)
            npf = npf + f[userendloc:]

            rominfo.parameterfile = npf

            logging.info('rominfo::applyparameterchanges update parameter')
            f = rominfo.parameterfile

            logging.info('\n\n' + f + '\n\n')                    

            logging.info('rominfo::applyparameterchanges writing parameter file')
            rominfo.writeparameter(npf)

            logging.info('rominfo::applyparameterchanges storeparameterfile')
            #rominfo.storeparameterfile('working/parameter')
            logging.info('rominfo::applyparameterchanges end')
        except Exception as e:
            logerror('rominfo::applyparameterchanges ' ,e ,1)
开发者ID:900supersport,项目名称:rkKitchen,代码行数:35,代码来源:rominfo.py

示例12: saveromdata

def saveromdata():
    '''save the rom data to the rominfo
    '''
    try: 
        parse_parameter()
    except Exception as e:
        logerror('rkmainmenu::saveromdata ',e,1)      
开发者ID:900supersport,项目名称:rkKitchen,代码行数:7,代码来源:rkmainmenu.py

示例13: unpackROM

def unpackROM():
    '''unpack the collected ROM image
    '''
    
    try:
        tcwd = os.getcwd()
        os.chdir(KitchenConfig.KitchenConfig.SourceROMUnpackedLoc())
        
        image = os.path.join('../' , rominfo.rominfo.romimgfilename)
        if image.find(' ') > 0:
            image = "'" + image + "'"
        logging.debug('rkunpack ' + image)
        rkunpack(image)
        #now fix bad parameter file if ends (use rather than (user)
        testcorrectparameter()
        
        #os.system( 'rkunpack ' + image )
        os.chdir(tcwd)
        
    except Exception as e:
        os.chdir(tcwd)
              
        logerror('rkmainmenu::getROMFile rkunpack fails ',e,0 )
        #now if this does not work try rkunpack
        try:
            os.system( 'unpack_all.sh ' 
                + os.path.join(KitchenConfig.KitchenConfig.SourceROMLoc(), rominfo.rominfo.romimgfilename) + ' ' 
                + KitchenConfig.KitchenConfig.SourceROMUnpackedLoc())
        except Exception as e:
            logerror('rkmainmenu::unpackROM unpack_all.sh',e,1)
开发者ID:900supersport,项目名称:rkKitchen,代码行数:30,代码来源:rkmainmenu.py

示例14: makeROMkits

def makeROMkits():
    '''make ROM kits based on current templates
   
    This is a run once process
'''
    try:
        src = os.path.join(KitchenConfig.KitchenConfig.KitchenPath, 'ROMtemplates/')
        dst = 'ROMKits/'
        pprint ('Copying from ' + src + ' to ' + dst)
        
        shutil.copytree(src,dst)
        pprint ('Adding images to ROM Kits')
        pcfilesrc = os.path.join(KitchenConfig.KitchenConfig.KitchenPath,'processcontrol/populateROMkits')
        copyfilesworker(pcfilesrc,'',0,verbose = 1)
        
        src = 'CWMROMKit.zip'
        tgt = os.path.join(dst,rominfo.rominfo.romname.strip() + '_' + src)
        src = os.path.join(dst,src)
        os.system('mv ' + src + ' ' + tgt)
        
        src = 'ROMKit.zip'
        tgt = os.path.join(dst,rominfo.rominfo.romname.strip() + '_' + src)
        src = os.path.join(dst,src)
        os.system('mv ' + src + ' ' + tgt)
    except Exception as e:
        logerror('rkmainmenu::makeROMkits ',e,1)
开发者ID:900supersport,项目名称:rkKitchen,代码行数:26,代码来源:rkmainmenu.py

示例15: browse_system

def browse_system():
    '''launch natilus and point at working'''
    try:  
        kc = KitchenConfig.KitchenConfig
        os.system('sudo ' + kc.browser + ' working/mntsystem')  
    except Exception as e:
        logerror('system::browse_system ' , e, 1)
开发者ID:abazad,项目名称:rkKitchen,代码行数:7,代码来源:system.py


注:本文中的utils.logerror函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。