Пример #1
0
def prePackage():
	# extra other files
	for item in gv.EXTRA_FILES:
		file = os.path.basename(item)
		if not os.path.exists(gv.EXTRA_PATH + '/' + file):
			func.errorReport(gv.EXTRA_PATH + '/' + file + ' not exists')
	
	# build number check
	cfg = ConfigParser.ConfigParser();
	cfg.read(gv.BUILD_INI_FILE)
	currentNum = cfg.get(gv.BUILD_INI_SEC, gv.CURRENT_BUILDNUM)
	revision = cfg.get(gv.BUILD_INI_SEC, gv.CURRENT_REVISION)
	
	lastRevision = cfg.get(gv.BUILD_INI_SEC, 'build' + currentNum)
	if int(lastRevision) > int(revision):
		func.errorReport('No need to package\nNow Revison: ' + revision + ', Last:' +lastRevision + '(Build' + currentNum + ')')
	
	# conf / files / package
	outputs = [gv.PACK_CONF_PATH, gv.PACK_FILE_PATH, gv.PACK_PACK_PATH]
	for item in outputs:
		if os.path.exists(item):
			shutil.rmtree(item)
		os.makedirs(item)
	
	# delete old package
	if os.path.exists(gv.ITM_PACKAGE_NAME):
		os.remove(gv.ITM_PACKAGE_NAME)
	
	func.tip('Prepare for Package Finish.', '32');
	func.tip('-------------------------------------');
Пример #2
0
def generateCfgIni():
	for branch in gv.SVN_EACH_BRANCH:
		if os.path.exists(gv.FILE_INI_PATH + '/' + branch + '.ini'):
			_getSvnList(branch);
			_updateCfgIni(branch);
			func.tip('++++ update ini ' + branch + ' \t++++');
		else:
			func.errorReport(item + " origin ini miss")
	func.tip('Generate Latest Ini Config', '32');
Пример #3
0
def checkUninited():
	for branch in gv.SVN_EACH_BRANCH:
		_checkByAct(branch, 'add');
		func.tip('++++ check uninited ' + branch + ' \t++++');
	
	if uninit_items > 0:
		func.tip('\033[40;32mUninitialied Files: ' + str(uninit_items));
		func.tip('Go to ' + gv.FILE_INI_PATH + ' REWRITE INI Files', '32');
		func.tip('Run\'./make_patch.py uninited\' to check after rewrite', '32');
		func.errorReport();
	
	func.tip('No-Uninited Sections Exists', '32');
Пример #4
0
def updateBranch(branch = ''):
	# code update
	cmd = 'svn update ' + gv.LOCAL_CODE_PATH + '/' + branch
	os.system(cmd)
	
	# new revision update
	cmd = 'svn info ' + gv.LOCAL_CODE_PATH + '/' + branch + ' | awk \'{if($1=="Revision:")print $NF}\''
	revision = commands.getoutput(cmd).strip();
	
	cfg = ConfigParser.ConfigParser();
	cfg.read(gv.BUILD_INI_FILE)
	if cfg.has_section(gv.BUILD_INI_SEC):
		last = cfg.get(gv.BUILD_INI_SEC, gv.CURRENT_REVISION);
		if (not last.isdigit()) or (not revision.isdigit()):
			func.errorReport(gv.CURRENT_BUILDNUM + ' or Revision Not Number')
		
		_int_last = int(last)
		_int_revi = int(revision)
		
		if _int_last > _int_revi:
			func.errorReport('Last Build revision after Current Revision, Check ' + gv.BUILD_INI_FILE)
		else:
			cfg.set(gv.BUILD_INI_SEC, gv.CURRENT_REVISION, revision)
			cfg.write(open(gv.BUILD_INI_FILE, 'w'))
		
		_curbuild = cfg.get(gv.BUILD_INI_SEC, gv.CURRENT_BUILDNUM);
		_curbuild = 'build' + _curbuild;
		_curRevi = cfg.get(gv.BUILD_INI_SEC, _curbuild);
		
		if not _curRevi < revision:
			func.errorReport('No Update against Last Build, Not Need to Package')
	else:
		func.errorReport(gv.BUILD_INI_FILE + ' miss section:' + gv.BUILD_INI_SEC)
Пример #5
0
def checkCfgIni():
	illegals = 0;
	if os.path.exists(gv.CHECK_CONF_PATH):
		os.system('rm -rf ' + gv.CHECK_CONF_PATH)
	os.makedirs(gv.CHECK_CONF_PATH)
	
	for branch in gv.SVN_EACH_BRANCH:
		# diff list
		file_diff = gv.DIFF_LIST_PATH + '/' + branch + '.txt'
		file_inis = gv.FILE_INI_PATH + '/' + branch + '.ini'
		
		cfgPsr = ConfigParser.ConfigParser()
		cfgPsr.read(file_inis)
		
		_cfgStr = ''
		_errStr = ''
		# read each line Of diff.txt
		file_reader = open(file_diff)
		for line in file_reader:
			line = line.strip();
			# comment line & null line, skip;
			if line.find('#') == 0 or line.strip() == '':
				continue;
			(act, codepath) = line.split(' ');
			if _checkInSkipDirs(codepath) == 1:
				_cfgStr += codepath + '\n  [action]: IGNORE  [reason]: belong to SVN_SKIP_DIRS\n';
				continue;
			
			
			# errorReport
			if not cfgPsr.has_section(codepath):
				if cfgPsr.has_section(codepath + '/'):
					codepath += '/';
				else:
					_errStr += codepath + '\n  [reason]: NOT EXSITS\n'
					continue;
			
			dictIni = _parserInfo(cfgPsr.items(codepath));
			if dictIni['typ'] == '' and dictIni['act'] == '' and dictIni['src'] == '' and dictIni['dst'] == '' and dictIni['mod'] == '' and dictIni['own'] == '' and dictIni['grp'] == '':
				_errStr += codepath + '\n  [reason]: PROPERTIES UNDEFINED\n';
				continue;
			
			# Dirs, src & dst not allow multi
			if dictIni['typ'] == 'd':
				if (len(dictIni['src'].strip()) > 1) or (len(dictIni['dst'].strip()) > 1):
					_errStr += codepath + '\n  [reason]: Dirs src/dst UnALLOWED MULTI';
					continue;
			
			if dictIni['act'] == 'i':
				_cfgStr += codepath + '\n  [act]: IGNORE\n  [reason]: defined by '+ branch +'.ini\n';
				continue;
			elif dictIni['act'] == 'z':
				_errStr += codepath + '\n  [reason]: UNINITIALIEZED\n'
				continue;
			
			# check srcNums & dstNums
			_srcNums = str.count(dictIni['src'], '|')
			_dstNums = str.count(dictIni['dst'], '|')
			if not _srcNums == _dstNums:
				_errStr += codepath + '\n  [reason]: SRC & DST NUMBERS NOT EQUAL\n'
				continue;
			
			# check src whether exist or not
			# exist 1 at least!!
			_srcCount = 0;
			_srcS = dictIni['src'].split('|');
			for each in _srcS:
				if os.path.exists(gv.LOCAL_CODE_PATH + '/' + each):
					_srcCount += 1;
			if _srcCount == 0:
				if not act == 'D':
					_errStr += codepath + '\n  [reason]: NOT FOUND SRC, BUT CHANGED\n'
					continue;
			
			# check dst, if not start with '/', error
			_dstCount = 0;
			_dstS = dictIni['dst'].split('|');
			for each in _dstS:
				if not each.find('/') == 0:
					_errStr += codepath + '\n  [reason]: DST PATH NOT START WITH \'/\'\n'
			
			# check finish
			_cfgStr += codepath + '\n  [act]: ' + dictIni['act'] + '  \t[type]:  ' + dictIni['typ'] + '\n'
			_cfgStr += '  [src]: ' + dictIni['src'] + '\n  [dst]: ' + dictIni['dst'] + '\n'
			_cfgStr += '  [mod]: ' + dictIni['mod'] + '  \t[own]: ' + dictIni['own'] + '  \t[grp]: ' + dictIni['grp'] + '\n'
		
		func.writeFile(gv.CHECK_CONF_PATH + '/' + branch + '-cfg.txt', _cfgStr, 'w');
		func.writeFile(gv.CHECK_CONF_PATH + '/' + branch + '-err.txt', _errStr, 'w');
		
		if not len(_errStr) == 0:
			illegals += 1;
			func.tip(branch + '.ini EXISTS ERRORS', '31')
		
		if gv.DEBUG_SWITCH == 1:
			if not len(_errStr) == 0:
				func.tip(_errStr, '31');
		
		func.tip('++++ check ini ' + branch + ' \t++++');
	
	if not illegals == 0:
		func.errorReport('INI Config Illegal, Go "' + gv.CHECK_CONF_PATH + '" to check')
	
	func.tip('INI Config Check Finished.', '32')