Пример #1
0
def md5test(db, md5testset):
    changed = set()
    md5s = dbrutils.generateMD5s(md5testset)
    for file in md5testset:
        if(db[file]['md5'] != md5s[file]['md5']):
            changed.add(file)
    return changed
Пример #2
0
def newcreatepatch(name, db1, db2):
    results = newcompare(db1, db2)
    printresults(results)
    for file in results['touched']:
      db1[file]['time'] = db2[file]['time']
    
    patch = dict();
    patch['name'] = name
    patch['time'] = 'now!!!'   
    patch['removed'] = results['removed']
    added = results['added'].keys()
    md5sAdded = dbrutils.generateMD5s(added)
    for file in added:
      results['added'][file]['md5'] = md5sAdded[file]['md5']
    patch['added'] = results['added']
    print "Need to add in the untestable stuff here also!!!"
    patch['changed'] = results['changed']
    patchname = "%spatch_%s" %(dbrutils.patchpath(), name)
  
    createpatchzip(patch, patchname)

    #update the ownership 
    for file in patch['changed']:
        db1[file]['name'] = name

    return db1
Пример #3
0
def newcreatepatch(name, db1, db2):
    results = newcompare(db1, db2)
    printresults(results)
    for file in results['touched']:
        db1[file]['time'] = db2[file]['time']

    patch = dict()
    patch['name'] = name
    patch['time'] = 'now!!!'
    patch['removed'] = results['removed']
    added = results['added'].keys()
    md5sAdded = dbrutils.generateMD5s(added)
    for file in added:
        results['added'][file]['md5'] = md5sAdded[file]['md5']
    patch['added'] = results['added']
    print "Need to add in the untestable stuff here also!!!"
    patch['changed'] = results['changed']
    patchname = "%spatch_%s" % (dbrutils.patchpath(), name)

    createpatchzip(patch, patchname)

    #update the ownership
    for file in patch['changed']:
        db1[file]['name'] = name

    return db1
Пример #4
0
def md5test(db, md5testset):
    changed = set()
    md5s = dbrutils.generateMD5s(md5testset)
    for file in md5testset:
        if (db[file]['md5'] != md5s[file]['md5']):
            changed.add(file)
    return changed
Пример #5
0
def newcompare(db1, db2): 
    db1files = set(db1.keys())
    db2files = set(db2.keys())

    removed = db1files - db2files
    added = db2files - db1files
    common = db1files & db2files

    touched = set()
    for file in common:
        if(db1[file]['time'] != db2[file]['time']):
            touched.add(file)

    sizechanged = set()
    for file in common:
        if(db1[file]['size'] != db2[file]['size']):
            sizechanged.add(file)

    changed = set()

    genmd5 = 1 #I probably want to try to generate... add this as a third arg???

    if(len(touched)):
      if(genmd5):
        md5testset = set()
        for file in touched:
          if((db1[file]['md5'] != 'xxx' ) and (db2[file]['md5'] == 'xxx')): #no point geenrating an MD5 if we've nothing to compare it to...
#            print 'testing %s' % file
            md5testset.add(file)
        md5s = dbrutils.generateMD5s(md5testset)
        for file in md5testset:
          db2[file]['md5'] = md5s[file]['md5']
      for file in touched:
        if(db1[file]['md5'] != db2[file]['md5']):                    
          changed.add(file)
    touched = touched - changed

    untestable1 = set()
    untestable2 = set()
    for file in common:
        if(db1[file]['md5'] == "xxx"):
          untestable1.add(file)  
        if(db2[file]['md5'] == 'xxx'):
          untestable2.add(file)
          
    untestable = untestable1 & untestable2         
    changed = changed - untestable

    #remove the ones we know are changed
    touched = touched - changed
    touched = touched - untestable
 
    results = dict()
    results['added'] = dict()
    results['removed'] = dict()
    results['touched'] = dict()
    results['changed'] = dict()
    results['untestable'] = dict()
      
    for file in added:
      results['added'][file] = db2[file]  
    for file in removed:
      results['removed'][file] = 0
    for file in touched:
      results['touched'][file] = db2[file]  
    for file in changed:
      results['changed'][file] = db2[file]  
    for file in untestable:
      results['untestable'][file] = 0  
    return results
Пример #6
0
def newcompare(db1, db2):
    db1files = set(db1.keys())
    db2files = set(db2.keys())

    removed = db1files - db2files
    added = db2files - db1files
    common = db1files & db2files

    touched = set()
    for file in common:
        if (db1[file]['time'] != db2[file]['time']):
            touched.add(file)

    sizechanged = set()
    for file in common:
        if (db1[file]['size'] != db2[file]['size']):
            sizechanged.add(file)

    changed = set()

    genmd5 = 1  #I probably want to try to generate... add this as a third arg???

    if (len(touched)):
        if (genmd5):
            md5testset = set()
            for file in touched:
                if (
                    (db1[file]['md5'] != 'xxx') and (db2[file]['md5'] == 'xxx')
                ):  #no point geenrating an MD5 if we've nothing to compare it to...
                    #            print 'testing %s' % file
                    md5testset.add(file)
            md5s = dbrutils.generateMD5s(md5testset)
            for file in md5testset:
                db2[file]['md5'] = md5s[file]['md5']
        for file in touched:
            if (db1[file]['md5'] != db2[file]['md5']):
                changed.add(file)
    touched = touched - changed

    untestable1 = set()
    untestable2 = set()
    for file in common:
        if (db1[file]['md5'] == "xxx"):
            untestable1.add(file)
        if (db2[file]['md5'] == 'xxx'):
            untestable2.add(file)

    untestable = untestable1 & untestable2
    changed = changed - untestable

    #remove the ones we know are changed
    touched = touched - changed
    touched = touched - untestable

    results = dict()
    results['added'] = dict()
    results['removed'] = dict()
    results['touched'] = dict()
    results['changed'] = dict()
    results['untestable'] = dict()

    for file in added:
        results['added'][file] = db2[file]
    for file in removed:
        results['removed'][file] = 0
    for file in touched:
        results['touched'][file] = db2[file]
    for file in changed:
        results['changed'][file] = db2[file]
    for file in untestable:
        results['untestable'][file] = 0
    return results