def _initBase(self): ''' 初始化一些基本配置 ''' if getattr(self.options, 'texasTeamConfInited', False): return _datas = redisdata._getLastOkDefines(self.options) projects_path = _datas['pokerdict']['projects_path'] # 源码目录。一般为: /home/tyhall/hall37/source pokerpath = self.options.pokerpath # 也就是配置目录。一般为 /home/tyhall/hall37/source/config teamRoot = os.path.join(projects_path, 'texas-team') runningDir = os.path.join(pokerpath, 'game/8/room/') ftlog.debug('TexasActionHandler._initBase >>|', 'projects_path, teamRoot, runningDir:', projects_path, teamRoot, runningDir) if not os.path.exists(teamRoot): ftlog.debug('create teamRoot:', teamRoot) fsutils.makePath(teamRoot) self._svnCmd(teamRoot, 'checkout', teamConfUrl, 'team') self._svnCmd(teamRoot, 'checkout', roomConfTestingUrl, 'testing') self._svnCmd(teamRoot, 'checkout', roomConfReleaseUrl, 'release') initDirs(teamRoot, runningDir) self.options.texasTeamConfInited = True
def _initBase(self): ''' 初始化一些基本配置 ''' if getattr(self.options, 't3flushTeamConfInited', False): return _datas = redisdata._getLastOkDefines(self.options) projects_path = _datas['pokerdict'][ 'projects_path'] # 源码目录。一般为: /home/tyhall/hall37/source pokerpath = self.options.pokerpath # 也就是配置目录。一般为 /home/tyhall/hall37/source/config teamRoot = os.path.join(projects_path, 't3flush-team') runningDir = os.path.join(pokerpath, 'game/39/room/') ftlog.debug('T3flushActionHandler._initBase >>|', 'projects_path, teamRoot, runningDir:', projects_path, teamRoot, runningDir) if not os.path.exists(teamRoot): ftlog.debug('create teamRoot:', teamRoot) fsutils.makePath(teamRoot) self._svnCmd(teamRoot, 'checkout', teamConfUrl, 'team') self._svnCmd(teamRoot, 'checkout', roomConfTestingUrl, 'testing') self._svnCmd(teamRoot, 'checkout', roomConfReleaseUrl, 'release') initDirs(teamRoot, runningDir) self.options.t3flushTeamConfInited = True
def initDirs(self): if getattr(self.options, 'teamConfInited', False): return _datas = redisdata._getLastOkDefines(self.options) # 源码目录。一般为: /home/tyhall/hall37/source projects_path = _datas['pokerdict']['projects_path'] # 也就是配置目录。一般为 /home/tyhall/hall37/source/config pokerpath = self.options.pokerpath teamRoot = os.path.join(projects_path, 'team') if not os.path.exists(teamRoot): tylog.debug('create teamRoot:', teamRoot) fsutils.makePath(teamRoot) svn.svnCmd(teamRoot, 'checkout', self.svnTestingUrl, 'testing') svn.svnCmd(teamRoot, 'checkout', self.svnReleaseUrl, 'release') self.teamRoot = teamRoot self.testingDir = os.path.join(teamRoot, 'testing') self.releaseDir = os.path.join(teamRoot, 'release') self.runningDir = pokerpath
def action(options): ''' 拷贝源代码工程的webroot到编译输出目录,按照配置文件的工程列表进行顺序覆盖拷贝 ''' actlog.log('copy webroot to bin/webroot') if os.environ.get('RUN_IN_DOCKER', 0): # 在开发docker模式下,webroot为link模式,无需拷贝 actlog.log('docker mode skip this step !') return 1 allpaths = [ options.env['webroot_path'], options.env['backup_path'], ] for mp in allpaths: fsutils.makePath(mp, False) paths = [] for proj in options.projectlist: src = fsutils.appendPath(proj['path'], 'webroot') if fsutils.dirExists(src): paths.append({ 'path': src, 'include': [], 'exclude': [".*\\.svn\\.*", ".*pyc"] }) if options.pokerdict['mode'] in (1, 2): fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log) return 1 # MODE 3, 4: 只链接, 并且只链接 tygame-webroot/webroot dstpath = options.env['webroot_path'] for pathconf in paths: if 'tygame-webroot' in pathconf['path']: srcpath = pathconf['path'] if os.path.islink(dstpath): if os.readlink(dstpath) == srcpath: # 已经链接好了 actlog.log('already linked.', dstpath, '->', srcpath) return 1 fsutils.deletePath(dstpath) os.symlink(srcpath, dstpath) actlog.log('symlink created.', dstpath, '->', srcpath) return 1 else: fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log) return 1
def action(options): ''' 拷贝源代码工程的webroot到编译输出目录,按照配置文件的工程列表进行顺序覆盖拷贝 ''' actlog.log('copy webroot to bin/webroot') if os.environ.get('RUN_IN_DOCKER', 0) : # 在开发docker模式下,webroot为link模式,无需拷贝 actlog.log('docker mode skip this step !') return 1 allpaths = [ options.env['webroot_path'], options.env['backup_path'], ] for mp in allpaths: fsutils.makePath(mp, False) paths = [] for proj in options.projectlist : src = fsutils.appendPath(proj['path'], 'webroot') if fsutils.dirExists(src) : paths.append({'path':src, 'include' : [], 'exclude' : [".*\\.svn\\.*", ".*pyc"]}) if options.pokerdict['mode'] in (1, 2): fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log) return 1 # MODE 3, 4: 只链接, 并且只链接 tygame-webroot/webroot dstpath = options.env['webroot_path'] for pathconf in paths: if 'tygame-webroot' in pathconf['path']: srcpath = pathconf['path'] if os.path.islink(dstpath): if os.readlink(dstpath) == srcpath: # 已经链接好了 actlog.log('already linked.', dstpath, '->', srcpath) return 1 fsutils.deletePath(dstpath) os.symlink(srcpath, dstpath) actlog.log('symlink created.', dstpath, '->', srcpath) return 1 else: fsutils.copyTree(paths, options.env['webroot_path'], logfun=actlog.log) return 1
def action(options): """ 拷贝源代码工程的etc、src、src-robot、webroot到编译输出目录,按照配置文件的工程列表进行顺序覆盖拷贝 """ # 创建所有的路径 allpaths = [ options.env['log_path'], options.env['webroot_path'], options.env['backup_path'], ] for mp in allpaths: fsutils.makePath(mp, False) allpaths = [ options.env['bin_path'] ] for mp in allpaths: fsutils.makePath(mp, True) if os.environ.get('RUN_IN_DOCKER', 0): # 在开发docker模式下,webroot为link模式,无需拷贝 copySourceInDocker(options) actlog.log('docker mode use original project src path !') return 1 paths = [] for proj in options.projectlist: src = fsutils.appendPath(proj['path'], 'src') if fsutils.dirExists(src): paths.append({'path': src, 'include': [], 'exclude': [".*\\.svn\\.*", ".*pyc"]}) else: # freetime project paths.append({'path': proj['path'], "include": ["^/freetime/.*"], "exclude": [".*\\.svn\\.*", ".*pyc", ".*\\logserver\\.*", ".*\\cold-data-server\\.*"]}) if ide_debug(): _, copy_files = fsutils.linkTree(paths, options.env['bin_path'], logfun=actlog.log) else: _, copy_files = fsutils.copyTree(paths, options.env['bin_path'], logfun=actlog.log) setattr(options, '_pyfiles', copy_files) return 1