Esempio n. 1
0
def exceptQuit(lock_file, conf, build_log = ''):
    os.remove(lock_file)
    traceback.print_exc()
    mail = Mail.BuildMail()
    mail.sendBuildFailMail(conf.product_name_cn, build_log, conf.fail_dst_addr)
    print ''
    os.system('pause')
    exit()
Esempio n. 2
0
def mainProc(config_file_name):
    
    print '正在读取配置……'
    conf = Config.Config(config_file_name)
    conf.parseConfig()

    print '正在复制文件……'
    util = Util.Util()
    version = conf.getVersion(conf.rc_conf.ver_major, conf.rc_conf.ver_minor, conf.rc_conf.ver_revision, conf.rc_conf.ver_build - 1)
    out_file = conf.outputFile(version)
    print '文件 ' + out_file + ' 从 ' + conf.output_dir + ' 到 ' + conf.publish_dir
    util.copyFile(conf.output_dir, conf.publish_dir, out_file)

    print '正在发送发布成功邮件……'
    mail = Mail.BuildMail()
    mail.sendBuildSuccessMail(conf.publish_download_url + out_file, conf.product_name_cn, '', conf.publish_dst_addr)

    print '\n\n发布流程成功。\n--------------------------------------------------'
    os.system('pause')
Esempio n. 3
0
 def __exceptQuit(self, lock_file, conf, build_log = ''):
     os.remove(lock_file)
     traceback.print_exc()
     mail = Mail.BuildMail()
     #mail.sendBuildFailMail(conf.product_name_cn, build_log, conf.fail_dst_addr)
     return False
Esempio n. 4
0
def mainProc(config_file_name, lock_file_name):
    
    # 验证打包锁
    lock_file = checkLock(lock_file_name)

    # 读取配置
    conf = Config.Config(config_file_name)
    conf.parseConfig()

    total_timer = Timer.Timer(1, conf.product_name_cn + '打包整个流程')
    
    try:
        total_timer.start()

        # 读取和各编译模块相关的配置
        module_center = BuildModule.BuildModuleCenter(conf.product_name_cn, conf.conf_parser, conf.version, conf.pdb_dir + '\\' + conf.region, conf.root_dir)
        
        print conf.product_name_cn + ' ' + conf.version + ' 准备编译……'
        
        # 更新svn
        module_center.updateSVN()

        # 更新rc文件版本号
        module_center.versionRC(conf.rc_conf)

    except:
        total_timer.stop()
        exceptQuit(lock_file, conf)

    # 编译各工程
    build_timer = Timer.Timer(1, conf.product_name_cn + '所有编译', True)
    build_timer.start()
    
    threads = module_center.genSolutionThreads()
    build_configuration = 'Deploy_Release'

    '''
    if xtCommon.CV_STANDALONE == conf.client_version:
        build_configuration = 'Standalone_Release'
    if xtCommon.CV_STANDALONE == conf.client_version:
        threads.append(SolutionThread(conf, 'Broker', conf.broker_dir, 'broker.sln', ['sfit', 'hsfutures', 'invs', 'CJStock', 'rzrk_futures', 'rzrk_stock', 'CiticStock', 'qiluSecurities', 'broker'], build_configuration))
        threads.append(SolutionThread(conf, 'TTService', conf.ttservice_dir, 'XtService.full.sln', [''], build_configuration))
    threads.append(SolutionThread(conf, 'Updater', conf.updater_dir, 'Updater.sln', ['']))
    threads.append(SolutionThread(conf, 'Daemon', conf.daemon_dir, 'daemon.sln', ['daemon'], build_configuration))
    threads.append(SolutionThread(conf, 'Quoter', conf.quoter_dir, 'quoter.sln', ['XtQuoter'], build_configuration))
    threads.append(SolutionThread(conf, conf.product_name_en, conf.root_dir, 'XtTradeClient.full.sln', ['XtTradeClient'], build_configuration))
    '''

    for t in threads:
        t.start()

    res = waitThreads(threads, lock_file, conf)

    if res[0]:
        build_timer.stop()
        try:
            print (conf.product_name_cn + ' ' + conf.version + ' 正在生成……')

            # 复制文件
            print '复制文件到指定目录'
            packer = Packer.Packer(conf, build_configuration)
            bin_dir, conf_dir = packer.iniBinDir()
            module_center.copyFiles(bin_dir, conf_dir)
            
            # 数字签名
            print '数字签名'
            module_center.signBins(bin_dir)

            # 调用NSIS生成安装包
            print '生成安装文件'
            packer.packInstaller()
            
            # svn更新日志
            print '提取svn更新日志'
            svn_log = 'SVN版本信息: <br/><br/>' + module_center.getRevisionInfo() + '<br/>SVN更新日志:<br/><br/>' + module_center.getLog()

            # 备份PDB
            print '备份pdb文件'
            module_center.backupPdb()

            # 更新版本号
            print '更新软件版本'
            conf.incVersion()

            # 更新新的svn revision到配置文件中
            print '更新svn revision到配置文件'
            module_center.updateRevisions(conf.conf_file)

            # 发送打包成功邮件
            print '正在发送打包成功邮件……'
            mail = Mail.BuildMail()
            mail.sendBuildSuccessMail(conf.output_download_url + conf.out_file, conf.product_name_cn, svn_log, conf.success_dst_addr)
            
            # 结束
            total_timer.stop()
            print (conf.product_name_cn + ' ' + conf.version + ' 打包完成')
            print '\n\n编译打包流程成功。\n--------------------------------------------------'
            for t in threads:
                showBuildTime(t.timer())
            showTime(build_timer)
            showTime(total_timer)
            os.remove(lock_file)
        except:
            total_timer.stop()
            exceptQuit(lock_file, conf)
    else:
        build_timer.stop()
        total_timer.stop()
        log_file = res[1]
        if os.path.isfile(log_file):
            f = open(log_file)
            all_log = f.read()
            f.close()
            os.startfile(log_file)
        exceptQuit(lock_file, conf, all_log)