dbrtools/dbr/dbrutils.py
author MattD <mattd@symbian.org>
Sun, 13 Jun 2010 20:39:03 +0100
branchDBRToolsDev
changeset 285 6a928cf9e181
parent 284 0792141abac7
permissions -rw-r--r--
diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
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
285
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
    22
import urllib
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
    23
from urlparse import urljoin
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
    24
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
    25
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
    26
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
    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
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
    29
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
    30
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 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
    33
  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
    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 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
    36
  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
    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 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
    39
  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
    40
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
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
    42
    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
    43
    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
    44
    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
    45
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
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
    47
#    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
    48
    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
    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 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
    51
    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
    52
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
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
    54
    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
    55
    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
    56
    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
    57
    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
    58
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
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
    60
    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
    61
    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
    62
    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
    63
    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
    64
        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
    65
        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
    66
    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
    67
    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
    68
    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
    69
    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
    70
    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
    71
    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
    72
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
    73
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
    74
    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
    75
    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
    76
      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
    77
        
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
    
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
    79
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
    80
    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
    81
    print tmpfilename
201
4e09c8ccae86 DBRTools - Need to restore the current working directory.
MattD <mattd@symbian.org>
parents: 200
diff changeset
    82
    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
    83
    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
    84
    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
    85
    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
    86
        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
    87
        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
    88
    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
    89
    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
    90
#    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
    91
    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
    92
    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
    93
    os.unlink(tmpfilename)
201
4e09c8ccae86 DBRTools - Need to restore the current working directory.
MattD <mattd@symbian.org>
parents: 200
diff changeset
    94
    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
    95
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
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
    97
    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
    98
    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
    99
      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
   100
      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
   101
            
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
   102
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
   103
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
   104
    db = dict()
285
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
   105
    temp_dir = tempfile.mkdtemp()
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   106
    md5zip = os.path.join(location,'build_md5.zip')
285
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
   107
    if(re.match('^http',location, re.IGNORECASE)):
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
   108
      md5zip = os.path.join(temp_dir,'build_md5.zip')
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
   109
      url = '%s%s' % (location,'build_md5.zip')
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
   110
      res = urllib.urlretrieve(url,md5zip) 
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   111
    print md5zip 
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   112
    print temp_dir 
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   113
    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
   114
      files = set();
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   115
      files.add('*')
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   116
      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
   117
      globsearch = os.path.join(temp_dir, os.path.join(patch_path_internal(),'*.md5'))
285
6a928cf9e181 diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
MattD <mattd@symbian.org>
parents: 284
diff changeset
   118
#      print globsearch 
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   119
      hashes = glob.glob(globsearch)
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   120
      for file in hashes:
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   121
#          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
   122
          gethashes(db, file, True)
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   123
    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
   124
    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
   125
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
   126
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
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
   128
    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
   129
    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
   130
#      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
   131
      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
   132
      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
   133
      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
   134
      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
   135
      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
   136
          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
   137
          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
   138
          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
   139
          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
   140
          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
   141
      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
   142
      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
   143
      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
   144
#      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
   145
      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
   146
      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
   147
        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
   148
      else:  
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   149
        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
   150
        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
   151
        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
   152
    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
   153
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
# 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
   155
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
   156
    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
   157
#    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
   158
    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
   159
    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
   160
    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
   161
    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
   162
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
   163
    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
   164
    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
   165
    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
   166
        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
   167
        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
   168
            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
   169
            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
   170
#            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
   171
            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
   172
              entry = dict()
284
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   173
              entry['time'] = '0'
0792141abac7 DBRUtils - zipped baseline comparisons: Fixed so we only need the md5s.
MattD <mattd@symbian.org>
parents: 211
diff changeset
   174
              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
   175
              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
   176
              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
   177
            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
   178
              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
   179
                  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
   180
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
        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
   182
            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
   183
            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
   184
                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
   185
                    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
   186
                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
   187
                    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
   188
            
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
    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
   190
    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
   191
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
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
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
   194
# 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
   195
#    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
   196
    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
   197
    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
   198
    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
   199
    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
   200
    
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
    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
   202
    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
   203
      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
   204
        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
   205
      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
   206
        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
   207
    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
   208
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
    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
   210
        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
   211
#            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
   212
            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
   213
#              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
   214
              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
   215
        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
   216
            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
   217
            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
   218
            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
   219
#            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
   220
            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
   221
                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
   222
                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
   223
            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
   224
            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
   225
              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
   226
              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
   227
              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
   228
              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
   229
              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
   230
  #            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
   231
  #            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
   232
    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
   233
    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
   234
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
   235
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
   236
  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
   237
  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
   238
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
   239
  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
   240
  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
   241
  newline = re.compile('\n')
211
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   242
  epoc32 = re.compile('^epoc32');
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   243
  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
   244
  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
   245
    line = newline.sub('',line)
211
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   246
    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
   247
    if(epoc32.search(name)):
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   248
      name = trailingtab.sub('',name) 
fc3107523c38 DBRTools - added support for filtering using raw rombuild log
MattD <mattd@symbian.org>
parents: 208
diff changeset
   249
      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
   250
  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
   251
  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
   252