Ejemplo n.º 1
0
def update_diff_file(v1, valid, v2):
    fl1 = FileList()
    fl1.ParseFromString(
        open('%s_%s.files%s' % (v1, platform, '' if valid else '.invalid'),
             'rb').read())
    fl2 = FileList()
    fl2.ParseFromString(open('%s_%s.files' % (v2, platform), 'rb').read())

    fileset1 = {f.url: (f.md5, f.size) for f in fl1.files}
    fileset2 = {f.url: (f.md5, f.size) for f in fl2.files}
    fileset_all = copy(fileset1)
    fileset_all.update(fileset2)

    bigupgrade = v2 / 100000 > v1 / 100000
    print 'bigupgrade', bigupgrade

    rsp = CheckUpgradeResponse(isbigupgrade=False)
    rsp.isbigupgrade = bigupgrade
    rsp.versionId = fl2.version
    rsp.versionName = fl2.version_name
    rsp.config_version = fl2.config_version

    for f in fileset_all:
        if f not in fileset2:
            # deleted
            info = rsp.files.add()
            info.url = f
            info.md5 = fileset1[f][0]
            info.size = 0
            info.new = False
        else:
            if fileset2[f] != fileset1.get(f, ('', 0)):
                info = rsp.files.add()
                info.url = f
                info.md5, info.size = fileset2[f]
                info.new = f not in fileset1

    difffile = '%s_%s.list' % (fl1.version, platform)
    print 'write diff file', difffile
    open(difffile, 'wb').write(rsp.SerializeToString())
Ejemplo n.º 2
0
def update_diff_file(v1, valid, v2):
    fl1 = FileList()
    fl1.ParseFromString(open('%s_%s.files%s' % (v1, platform, '' if valid else '.invalid'), 'rb').read())
    fl2 = FileList()
    fl2.ParseFromString(open('%s_%s.files' % (v2, platform), 'rb').read())

    fileset1 = { f.url:(f.md5,f.size) for f in fl1.files }
    fileset2 = { f.url:(f.md5,f.size) for f in fl2.files }
    fileset_all = copy(fileset1)
    fileset_all.update(fileset2)

    bigupgrade = v2/100000 > v1/100000
    print 'bigupgrade', bigupgrade

    rsp = CheckUpgradeResponse(isbigupgrade=False)
    rsp.isbigupgrade = bigupgrade
    rsp.versionId = fl2.version
    rsp.versionName = fl2.version_name
    rsp.config_version = fl2.config_version

    for f in fileset_all:
        if f not in fileset2:
            # deleted
            info = rsp.files.add()
            info.url = f
            info.md5 = fileset1[f][0]
            info.size = 0
            info.new = False
        else:
            if fileset2[f] != fileset1.get(f, ('', 0)):
                info = rsp.files.add()
                info.url = f
                info.md5, info.size = fileset2[f]
                info.new = f not in fileset1

    difffile = '%s_%s.list'%(fl1.version, platform)
    print 'write diff file', difffile
    open(difffile, 'wb').write(rsp.SerializeToString())
Ejemplo n.º 3
0
#!/usr/bin/env python
import sys, files_pb2
from session_pb2 import CheckUpgradeResponse


def version_name(ver):
    return str(ver / 100000.0)


version, platform = int(sys.argv[1]), sys.argv[2]

#flist = files_pb2.FileList()
#flist.version = version
#flist.platform = platform
#flist.version_name = version_name(version)
#open('%s_%s.list' % (version, platform), 'wb').write(flist.SerializeToString())

flist = CheckUpgradeResponse()
flist.isbigupgrade = False
flist.versionId = version
flist.versionName = version_name(version)
output = '%s_%s.list' % (version, platform)
print 'write to', output
open(output, 'wb').write(flist.SerializeToString())
Ejemplo n.º 4
0
#!/usr/bin/env python
import sys, files_pb2
from session_pb2 import CheckUpgradeResponse

def version_name(ver):
    return str(ver/100000.0)

version, platform = int(sys.argv[1]), sys.argv[2]

#flist = files_pb2.FileList()
#flist.version = version
#flist.platform = platform
#flist.version_name = version_name(version)
#open('%s_%s.list' % (version, platform), 'wb').write(flist.SerializeToString())

flist = CheckUpgradeResponse()
flist.isbigupgrade = False
flist.versionId = version
flist.versionName = version_name(version)
output = '%s_%s.list' % (version, platform)
print 'write to', output
open(output, 'wb').write(flist.SerializeToString())