Example #1
0
 def GET(self):
     PuzzleBackGroundCommands.sayHello()
     pass
Example #2
0
 def GET(self):
     print "gearman workers"
     print PuzzleBackGroundCommands.getWorkers()
     pass
Example #3
0
def buildPackage(packageInfo):
    print "buildPackage is here"
    print packageInfo
    PuzzleBackGroundCommands.doWork_packageByPackageInfo(packageInfo)
    return True
Example #4
0
 def GET(self):
     print "gearman status"
     print PuzzleBackGroundCommands.getStatus()
     pass
Example #5
0
def getPackageInfoForBuild(projectId, category, type=1):
    """
        the result of this function is used for user to choose which version need to be build

        type's definition is:
        0   common node
        1   initial node
        2   offline node
    """

    data = {}

    projectInfo = (db.select('projectList', where="id=" + projectId))[0]

    appId = "%d" % projectInfo['appId']
    appInfo = (db.select('appList', where="id=" + appId))[0]

    data['projectPath'] = projectInfo['projectPath']
    data['appName'] = appInfo['identifier']
    data['version'] = projectInfo['version']
    data['projectId'] = projectId
    data['category'] = category

    params = {
        'projectId':projectId,
        'projectPath':projectInfo['projectPath'],
        'appName':data['appName'],
        'dependencyType':1,
    }

    result = PuzzleBackGroundCommands.doWork_fetchDependencyInfo(params)

    print "\n this is the result from background"
    print result

    data['dependencyArray'] = json.loads(result)

    lastPackageInfo = ConfigHelper().initWithProjectPath(params["projectPath"]).getConfigData()

    #非DailyBuild的时候才使用上一次打包的sha1
    if category != "7":
        if lastPackageInfo['category'] != '0':
            for dependencyInfo in lastPackageInfo['dependencyArray']:
                depRepoName = dependencyInfo['repoName']
                depSha1 = dependencyInfo['sha1']
                for depInfo in data['dependencyArray']:
                    if depInfo['name'] == depRepoName:
                        for sha1 in depInfo["SHA1Array"]:
                            if sha1['hash'] == depSha1:
                                sha1["isCurrent"] = 1
                            else:
                                sha1["isCurrent"] = 0

    #data['dependencyArray'] = [{
    #        'name':'RTApiProxy',
    #        'dependencyId':'2',
    #        'SHA1Array':[
    #            {'hash':'12345', 'type':'0', 'isCurrent':'0', 'versionName':'1.0', 'isInit':'0', 'isOffLine':'0'},
    #            {'hash':'23456', 'type':'0', 'isCurrent':'0', 'versionName':'1.1', 'isInit':'0', 'isOffLine':'0'},
    #            {'hash':'45678', 'type':'0', 'isCurrent':'0', 'versionName':'1.2', 'isInit':'0', 'isOffLine':'0'},
    #            {'hash':'56789', 'type':'1', 'isCurrent':'0', 'versionName':'2.0', 'isInit':'1', 'isOffLine':'0'},
    #            {'hash':'67890', 'type':'0', 'isCurrent':'0', 'versionName':'2.1', 'isInit':'0', 'isOffLine':'0'},
    #            {'hash':'78901', 'type':'0', 'isCurrent':'0', 'versionName':'2.2', 'isInit':'0', 'isOffLine':'0'},
    #            {'hash':'289cc82d48e8e32e841c8f533af7747d8095f325', 'type':'2', 'isCurrent':'1', 'versionName':'2.3', 'isInit':'0', 'isOffLine':'1'},
    #            {'hash':'90123', 'type':'0', 'isCurrent':'0', 'versionName':'3.0', 'isInit':'0', 'isOffLine':'0'},
    #            {'hash':'01234', 'type':'0', 'isCurrent':'0', 'versionName':'4.0', 'isInit':'0', 'isOffLine':'0'}
    #        ]
    #    }]

    return data