dbrtools/dbr/dbrutils.py
author MattD <mattd@symbian.org>
Sun, 13 Jun 2010 18:33:42 +0100
branchDBRToolsDev
changeset 284 0792141abac7
parent 211 fc3107523c38
child 285 6a928cf9e181
permissions -rw-r--r--
DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     6
#
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     9
#
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    10
# Contributors:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    11
# mattd <mattd@symbian.org>
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    12
#
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    13
# Description:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    14
# DBRutils - Module for handling little bits of stuff to do with generating hashes and scaning directories
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    15
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    16
import re
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    17
import os
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    18
import sys
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    19
import string
203
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
    20
import shutil
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
    21
import time
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    22
from os.path import join, isfile, stat
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    23
from stat import *
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    24
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    25
import glob # temporary (I hope) used for grabbing stuf from zip files...
203
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
    26
import tempfile
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    27
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    28
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    29
def defaultdb():
203
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
    30
  return os.path.join(patch_path_internal(),'baseline.db')
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    31
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    32
def patchpath():
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    33
  return os.path.join(epocroot(),'%s/' % patch_path_internal())
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    34
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    35
def patch_path_internal():
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    36
  return 'epoc32/relinfo'
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    37
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    38
def exclude_dirs():
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    39
    fixpath = re.compile('\\\\')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    40
    leadingslash = re.compile('^%s' % fixpath.sub('/',epocroot()))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    41
    return [string.lower(leadingslash.sub('',fixpath.sub('/',os.path.join(epocroot(),'epoc32/build')))),string.lower(leadingslash.sub('',fixpath.sub('/',patch_path_internal())))]
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    42
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    43
def exclude_files():
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    44
#    return ['\.sym$','\.dll$'] # just testing...
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    45
    return ['\.sym$']
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    46
    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    47
def epocroot():
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    48
    return os.environ.get('EPOCROOT')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    49
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    50
def scanenv():
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    51
    print 'Scanning local environment'
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    52
    directory = os.path.join(epocroot(),'epoc32')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    53
    env = scandir(directory, exclude_dirs(), exclude_files())
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    54
    return env
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    55
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    56
def createzip(files, name):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    57
    tmpfilename = os.tmpnam( )
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    58
    print tmpfilename    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    59
    f = open(tmpfilename,'w')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    60
    for file in sorted(files):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    61
        str = '%s%s' % (file,'\n')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    62
        f.write(str)    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    63
    f.close()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    64
    os.chdir(epocroot())
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    65
    exestr = '7z a -Tzip -i@%s %s' %(tmpfilename,name)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    66
    print 'executing: >%s<\n' %exestr
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    67
    os.system(exestr)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    68
    os.unlink(tmpfilename)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    69
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    70
def extractfiles(files, path):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    71
    zips = glob.glob(os.path.join(path, '*.zip'))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    72
    for name in zips:
200
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
    73
      extractfromzip(files, name,'')    
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    74
        
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    75
    
200
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
    76
def extractfromzip(files, name, location):
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    77
    tmpfilename = os.tmpnam( )
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    78
    print tmpfilename
201
4e09c8ccae86 DBRTools - Need to restore the current working directory.
MattD <mattd@symbian.org>
parents: 200
diff changeset
    79
    cwd = os.getcwd();
200
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
    80
    os.chdir(os.path.join(epocroot(),location))
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    81
    f = open(tmpfilename,'w')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    82
    for file in sorted(files):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    83
        str = '%s%s' % (file,'\n')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    84
        f.write(str)    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    85
    f.close()
189
0d02b2df4cbb DBRTools - piped the unzip output to null so that cleanenv isn't as noisy.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    86
    exestr = '7z x -y -i@%s %s >nul' %(tmpfilename,name)
0d02b2df4cbb DBRTools - piped the unzip output to null so that cleanenv isn't as noisy.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    87
#    exestr = '7z x -y -i@%s %s' %(tmpfilename,name)
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    88
    print 'executing: >%s<\n' %exestr
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    89
    os.system(exestr)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    90
    os.unlink(tmpfilename)
201
4e09c8ccae86 DBRTools - Need to restore the current working directory.
MattD <mattd@symbian.org>
parents: 200
diff changeset
    91
    os.chdir(cwd)
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    92
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    93
def deletefiles(files):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    94
    os.chdir(epocroot())
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    95
    for file in files:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    96
      print 'deleting %s' %file
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    97
      os.unlink(file)
203
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
    98
            
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
    99
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
   100
def getzippedDB(location):
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
   101
    db = dict()
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   102
    md5zip = os.path.join(location,'build_md5.zip')
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   103
    print md5zip 
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   104
    temp_dir = tempfile.mkdtemp()
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   105
    print temp_dir 
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   106
    if(os.path.exists(md5zip)):
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   107
      files = set();
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   108
      files.add('*')
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   109
      extractfromzip(files,md5zip,temp_dir)
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   110
      globsearch = os.path.join(temp_dir, os.path.join(patch_path_internal(),'*.md5'))
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   111
      print globsearch 
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   112
      hashes = glob.glob(globsearch)
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   113
      for file in hashes:
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   114
#          print 'Reading: %s\n' % file
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   115
          gethashes(db, file, True)
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   116
    shutil.rmtree(temp_dir)            
203
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
   117
    return db
e274d29c8bc9 Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents: 201
diff changeset
   118
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   119
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   120
def generateMD5s(testset):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   121
    db = dict()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   122
    if(len(testset)):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   123
#      print testset
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   124
      os.chdir(epocroot())
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   125
      tmpfilename = os.tmpnam( )
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   126
      print tmpfilename, '\n'
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   127
      f = open(tmpfilename,'w')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   128
      for file in testset:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   129
          entry = dict()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   130
          entry['md5'] = 'xxx'
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   131
          db[file] = entry
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   132
          str = '%s%s' % (file,'\n')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   133
          f.write(str)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   134
      f.close()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   135
      outputfile = os.tmpnam() 
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   136
      exestr = 'evalid -f %s %s %s' % (tmpfilename, epocroot(), outputfile)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   137
#      print exestr
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   138
      exeresult = os.system(exestr) 
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   139
      if(exeresult):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   140
        sys.exit('Fatal error executing: %s\nReported error: %s' % (exestr,os.strerror(exeresult)))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   141
      else:  
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   142
        db = gethashes(db, outputfile, True)
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   143
        os.unlink(outputfile)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   144
        os.unlink(tmpfilename)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   145
    return db
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   146
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   147
# Brittle and nasty!!!
200
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   148
def gethashes(db, md5filename, create):
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   149
    os.chdir(epocroot())
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   150
#    print 'trying to open %s' % md5filename
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   151
    file = open(md5filename,'r')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   152
    root = ''
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   153
    fixpath = re.compile('\\\\')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   154
    leadingslash = re.compile('^%s' % fixpath.sub('/',epocroot()))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   155
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   156
    evalidparse = re.compile('(.+)\sTYPE=(.+)\sMD5=(.+)')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   157
    dirparse = re.compile('Directory:(\S+)')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   158
    for line in file:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   159
        res = evalidparse.match(line)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   160
        if(res):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   161
            filename = "%s%s" % (root,res.group(1))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   162
            filename = string.lower(fixpath.sub('/',leadingslash.sub('',filename)))            
200
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   163
#            print "found %s" % filename
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   164
            if(create):
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   165
              entry = dict()
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   166
              entry['time'] = '0'
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   167
              entry['size'] = '0'
200
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   168
              entry['md5'] = res.group(3)
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   169
              db[filename] = entry
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   170
            else:    
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   171
              if(filename in db):
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 189
diff changeset
   172
                  db[filename]['md5'] = res.group(3)
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   173
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   174
        else:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   175
            res = dirparse.match(line)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   176
            if(res):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   177
                if(res.group(1) == '.'):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   178
                    root = ''
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   179
                else:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   180
                    root = '%s/' % res.group(1)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   181
            
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   182
    file.close()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   183
    return db
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   184
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   185
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   186
def scandir(top, exclude_dirs, exclude_files):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   187
# exclude_dirs must be in lower case...
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   188
#    print "Remember to expand the logged dir from", top, "!!!"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   189
    countdown = 0
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   190
    env = dict()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   191
    fixpath = re.compile('\\\\')
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   192
    leadingslash = re.compile('^%s' % fixpath.sub('/',epocroot()))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   193
    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   194
    ignorestr=''
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   195
    for exclude in exclude_files:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   196
      if(len(ignorestr)):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   197
        ignorestr = '%s|%s' % (ignorestr, exclude)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   198
      else:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   199
        ignorestr = exclude    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   200
    ignore = re.compile(ignorestr) 
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   201
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   202
    for root, dirs, files in os.walk(top, topdown=True):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   203
        for dirname in dirs:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   204
#            print string.lower(leadingslash.sub('',fixpath.sub('/',os.path.join(root,dirname))))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   205
            if(string.lower(leadingslash.sub('',fixpath.sub('/',os.path.join(root,dirname)))) in exclude_dirs):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   206
#              print 'removing: %s' % os.path.join(root,dirname)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   207
              dirs.remove(dirname)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   208
        for name in files:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   209
            filename = os.path.join(root, name)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   210
            statinfo = os.stat(filename)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   211
            fn = string.lower(leadingslash.sub('',fixpath.sub('/',filename)))
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   212
#            print '%s\t%s' % (filename, fn);
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   213
            if(countdown == 0):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   214
                print '.',
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   215
                countdown = 1000
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   216
            countdown = countdown-1
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   217
            if not ignore.search(fn,1):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   218
              entry = dict()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   219
              entry['time'] = '%d' % statinfo[ST_MTIME]
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   220
              entry['size'] = '%d' % statinfo[ST_SIZE]
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   221
              entry['md5'] = 'xxx'
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   222
              env[fn] = entry
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   223
  #            data = [statinfo[ST_MTIME],statinfo[ST_SIZE],'xxx']
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   224
  #            env[fn] = data
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   225
    print '\n'
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   226
    return env
208
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   227
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   228
def readfilenamesfromfile(filename):
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   229
  files = set()
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   230
  f = open(filename, 'r')
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   231
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   232
  fixpath = re.compile('\\\\')
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   233
  leadingslash = re.compile('^%s' % fixpath.sub('/',epocroot()))
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   234
  newline = re.compile('\n')
211
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   235
  epoc32 = re.compile('^epoc32');
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   236
  trailingtab = re.compile('\t\d+') #normally in rombuild files...
208
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   237
  for line in f:
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   238
    line = newline.sub('',line)
211
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   239
    name = string.lower(leadingslash.sub('',fixpath.sub('/',line)))
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   240
    if(epoc32.search(name)):
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   241
      name = trailingtab.sub('',name) 
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   242
      files.add(name)
208
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   243
  f.close()  
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   244
  return files
01c2b1268053 Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents: 203
diff changeset
   245