dbrtools/dbr/dbrbaseline.py
changeset 200 12422144aae1
parent 179 eab8a264a833
child 203 e274d29c8bc9
equal deleted inserted replaced
198:04b0678959bf 200:12422144aae1
    16 
    16 
    17 
    17 
    18 import re
    18 import re
    19 import os
    19 import os
    20 import string
    20 import string
       
    21 import glob
       
    22 import tempfile
       
    23 import shutil
    21 from os.path import join, isfile, stat
    24 from os.path import join, isfile, stat
    22 from stat import *
    25 from stat import *
    23 import dbrutils
    26 import dbrutils
    24                 
    27                 
    25 
    28 
   118     #update the touched...
   121     #update the touched...
   119     if(update):
   122     if(update):
   120       for file in sorted(touched):
   123       for file in sorted(touched):
   121           print 'Updating timestamp for: ',file
   124           print 'Updating timestamp for: ',file
   122           db1[file]['time'] = db2[file]['time']
   125           db1[file]['time'] = db2[file]['time']
       
   126 
       
   127 def createdb():
       
   128     print 'creating db...Move CreateDB into dbrutils!!!'
       
   129     env = dbrutils.scanenv()
       
   130     hashes = glob.glob(os.path.join(dbrutils.patchpath(),'*.md5'))
       
   131     for file in hashes:
       
   132         print 'Reading: %s\n' % file
       
   133         dbrutils.gethashes(env, file, False)
       
   134     return env
       
   135 
       
   136 
       
   137 def readzippeddb(drive):
       
   138   env = dict()
       
   139   #Note that this is really crude. I'm seeing if it'll work before cleaning things up...
       
   140   #see if we have a build_md5.zip file
       
   141   md5zip = os.path.join(drive,'build_md5.zip')
       
   142   temp_dir = tempfile.mkdtemp()
       
   143   print temp_dir 
       
   144   if(os.path.exists(md5zip)):
       
   145     files = set();
       
   146     files.add('*')
       
   147     dbrutils.extractfromzip(files,md5zip,temp_dir)
       
   148     globsearch = os.path.join(temp_dir, os.path.join(dbrutils.patch_path_internal(),'*.md5'))
       
   149     print globsearch 
       
   150     hashes = glob.glob(globsearch)
       
   151     for file in hashes:
       
   152         print 'Reading: %s\n' % file
       
   153         dbrutils.gethashes(env, file, True)
       
   154   shutil.rmtree(temp_dir)
       
   155   return env
       
   156