dbrtools/dbr/dbrbaseline.py
author MattD <mattd@symbian.org>
Mon, 15 Mar 2010 16:57:00 +0000
changeset 200 12422144aae1
parent 179 eab8a264a833
child 203 e274d29c8bc9
permissions -rw-r--r--
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
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
# DBRbaseline - module for handling vanilla baselines
eab8a264a833 Pulled the DBRTools 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
eab8a264a833 Pulled the DBRTools 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
eab8a264a833 Pulled the DBRTools 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 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
    19
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
    20
import string
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: 179
diff changeset
    21
import glob
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    22
import tempfile
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    23
import shutil
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
    24
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
    25
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
    26
import dbrutils
eab8a264a833 Pulled the DBRTools 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
eab8a264a833 Pulled the DBRTools 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
def readdb(dbfile):
eab8a264a833 Pulled the DBRTools 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
    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
    32
    if(isfile(dbfile)):
eab8a264a833 Pulled the DBRTools 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
        file = open(dbfile,'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
    34
#        regex = re.compile('(\S+)\s+(\S+)\s+(\S+)\s+(.+)\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
    35
        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
    36
            #file structure 'timestamp size hash filename' avoids the problems of spaces in names, etc...
eab8a264a833 Pulled the DBRTools 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
            results = re.split(':|\n',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
    38
            if(len(results) > 3):
eab8a264a833 Pulled the DBRTools 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
              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
    40
              entry['time'] = results[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
    41
              entry['size'] = results[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
    42
              entry['md5'] = results[2]
eab8a264a833 Pulled the DBRTools 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
              if(results[4]):
eab8a264a833 Pulled the DBRTools 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
                entry['archive'] = results[4] 
eab8a264a833 Pulled the DBRTools 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
                print entry['archive'] 
eab8a264a833 Pulled the DBRTools 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
              db[results[3]] = 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
    47
#            db[results[3]] = [results[0],results[1],results[2]]
eab8a264a833 Pulled the DBRTools 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
#            bits = regex.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
    49
#            if(bits):
eab8a264a833 Pulled the DBRTools 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
#                db[bits.group(3)] = [bits.group(0), bits.group(1), bits.group(2)]
eab8a264a833 Pulled the DBRTools 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
        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
    52
    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
    53
eab8a264a833 Pulled the DBRTools 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
def writedb(db, dbfile):
eab8a264a833 Pulled the DBRTools 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
#    print 'Writing db to', dbfile
eab8a264a833 Pulled the DBRTools 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
    file = open(dbfile,'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
    57
    for filename in sorted(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
    58
        if (len(db[filename]) < 3):
eab8a264a833 Pulled the DBRTools 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
            db[filename].append('')
eab8a264a833 Pulled the DBRTools 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
        str = "%s:%s:%s:%s" %( db[filename]['time'],db[filename]['size'],db[filename]['md5'], 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
    61
        if('archive' in db[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
    62
          str = "%s:%s" %(str,db[filename]['archive'])          
eab8a264a833 Pulled the DBRTools 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
#        if(db[filename]['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
    64
#            print 'Warning: no MD5 for %s' % 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
    65
#        str = "%s:%s:%s:%s\n" %( db[filename][0],db[filename][1],db[filename][2], 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
    66
        file.write('%s\n' % 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
    67
    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
    68
eab8a264a833 Pulled the DBRTools 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
def md5test(db, md5testset):
eab8a264a833 Pulled the DBRTools 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
    changed = set()
eab8a264a833 Pulled the DBRTools 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
    md5s = dbrutils.generateMD5s(md5testset)
eab8a264a833 Pulled the DBRTools 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 file in md5testset:
eab8a264a833 Pulled the DBRTools 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
        if(db[file]['md5'] != md5s[file]['md5']):
eab8a264a833 Pulled the DBRTools 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
            changed.add(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
    75
    return changed
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    76
eab8a264a833 Pulled the DBRTools 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
def updatedb(db1, db2):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    79
  compareupdatedb(db1, db2, 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
    80
  
eab8a264a833 Pulled the DBRTools 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
def comparedb(db1, db2):
eab8a264a833 Pulled the DBRTools 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
  compareupdatedb(db1, db2, 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
    83
eab8a264a833 Pulled the DBRTools 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
def compareupdatedb(db1, db2, update):
eab8a264a833 Pulled the DBRTools 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
    print "compareupdatedb() is deprecated"
eab8a264a833 Pulled the DBRTools 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
    db1files = set(db1.keys())
eab8a264a833 Pulled the DBRTools 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
    db2files = set(db2.keys())
eab8a264a833 Pulled the DBRTools 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
    removed = db1files - db2files
eab8a264a833 Pulled the DBRTools 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
    added = db2files - db1files
eab8a264a833 Pulled the DBRTools 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
    common = db1files & db2files
eab8a264a833 Pulled the DBRTools 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
eab8a264a833 Pulled the DBRTools 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
    touched = set()
eab8a264a833 Pulled the DBRTools 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
    for file in common:
eab8a264a833 Pulled the DBRTools 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
        if(db1[file]['time'] != db2[file]['time']):
eab8a264a833 Pulled the DBRTools 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
            touched.add(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
    96
eab8a264a833 Pulled the DBRTools 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
    sizechanged = set()
eab8a264a833 Pulled the DBRTools 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 common:
eab8a264a833 Pulled the DBRTools 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
        if(db1[file]['size'] != db2[file]['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
   100
            sizechanged.add(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
   101
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   102
    #pobably won't bother with size changed... we know they're different...
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   103
#    md5testset = touched - sizechanged
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   104
    md5testset = touched
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   105
                
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   106
    changed = md5test(db1,md5testset)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   107
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   108
    #remove the ones we know are changed
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   109
    touched = touched - changed
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   110
    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   111
    print 'Comparing dbs/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
   112
    for file in sorted(added):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   113
        print 'added:', 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
   114
    for file in sorted(removed):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   115
        print 'removed:', 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
   116
    for file in sorted(touched):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
   117
        print 'touched:', 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
   118
    for file in sorted(changed):
eab8a264a833 Pulled the DBRTools 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
        print 'changed:', 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
   120
eab8a264a833 Pulled the DBRTools 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
    #update the touched...
eab8a264a833 Pulled the DBRTools 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(update):
eab8a264a833 Pulled the DBRTools 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
      for file in sorted(touched):
eab8a264a833 Pulled the DBRTools 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
          print 'Updating timestamp for: ',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
   125
          db1[file]['time'] = db2[file]['time']
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: 179
diff changeset
   126
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   127
def createdb():
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   128
    print 'creating db...Move CreateDB into dbrutils!!!'
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   129
    env = dbrutils.scanenv()
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   130
    hashes = glob.glob(os.path.join(dbrutils.patchpath(),'*.md5'))
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   131
    for file in hashes:
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   132
        print 'Reading: %s\n' % file
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   133
        dbrutils.gethashes(env, file, False)
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   134
    return env
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   135
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   136
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   137
def readzippeddb(drive):
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   138
  env = dict()
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   139
  #Note that this is really crude. I'm seeing if it'll work before cleaning things up...
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   140
  #see if we have a build_md5.zip file
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   141
  md5zip = os.path.join(drive,'build_md5.zip')
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   142
  temp_dir = tempfile.mkdtemp()
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   143
  print temp_dir 
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   144
  if(os.path.exists(md5zip)):
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   145
    files = set();
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   146
    files.add('*')
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   147
    dbrutils.extractfromzip(files,md5zip,temp_dir)
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   148
    globsearch = os.path.join(temp_dir, os.path.join(dbrutils.patch_path_internal(),'*.md5'))
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   149
    print globsearch 
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   150
    hashes = glob.glob(globsearch)
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   151
    for file in hashes:
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   152
        print 'Reading: %s\n' % file
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   153
        dbrutils.gethashes(env, file, True)
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   154
  shutil.rmtree(temp_dir)
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   155
  return env
12422144aae1 DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents: 179
diff changeset
   156