|
@@ -15,7 +15,7 @@ if len(sys.argv) == 2:
|
|
JSONFILE = sys.argv[1] # 表示Json参数文件路径;
|
|
JSONFILE = sys.argv[1] # 表示Json参数文件路径;
|
|
if len(sys.argv) == 3:
|
|
if len(sys.argv) == 3:
|
|
SHELLFILE = sys.argv[2] # 表示Shell脚本文件路径;
|
|
SHELLFILE = sys.argv[2] # 表示Shell脚本文件路径;
|
|
-# 输入开始时间;
|
|
|
|
|
|
+# 输入开始时间;
|
|
print("Start",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
|
|
print("Start",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
|
|
|
|
|
|
# 源码路径
|
|
# 源码路径
|
|
@@ -71,14 +71,14 @@ def loadJson():
|
|
|
|
|
|
return True
|
|
return True
|
|
|
|
|
|
-
|
|
|
|
# 不使用重定向;
|
|
# 不使用重定向;
|
|
def cmdExecute2(cmd, dir=None):
|
|
def cmdExecute2(cmd, dir=None):
|
|
print(str.format("cmd start:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
print(str.format("cmd start:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
proc = subprocess.Popen(cmd, shell=True, cwd=dir)
|
|
proc = subprocess.Popen(cmd, shell=True, cwd=dir)
|
|
|
|
+ # 等待完成;
|
|
|
|
+ proc.wait()
|
|
print(str.format("cmd end:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
print(str.format("cmd end:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
|
|
|
|
-
|
|
|
|
def cmdExecute(cmd, dir=None):
|
|
def cmdExecute(cmd, dir=None):
|
|
print(str.format("cmd start:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
print(str.format("cmd start:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, cwd=dir)
|
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, cwd=dir)
|
|
@@ -87,7 +87,8 @@ def cmdExecute(cmd, dir=None):
|
|
if proc.returncode == 0:
|
|
if proc.returncode == 0:
|
|
print(u'cmd finished')
|
|
print(u'cmd finished')
|
|
# 返回执行结果;
|
|
# 返回执行结果;
|
|
- print(stdout)
|
|
|
|
|
|
+ print("stdout=",stdout)
|
|
|
|
+ print("stderr=",stderr)
|
|
print(str.format("cmd end:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
print(str.format("cmd end:%s, %s") % (cmd, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))
|
|
return stdout
|
|
return stdout
|
|
|
|
|
|
@@ -114,13 +115,14 @@ def prev_compile():
|
|
commands=None
|
|
commands=None
|
|
if 'sync' in PREV_ARG and PREV_ARG['sync']:
|
|
if 'sync' in PREV_ARG and PREV_ARG['sync']:
|
|
print("start sync")
|
|
print("start sync")
|
|
- commands = str.format("cd %s;repo sync") % CODE_DIR
|
|
|
|
|
|
+ commands = str.format("export PATH=$PATH:/bin/git-repo/;cd %s;repo sync") % CODE_DIR
|
|
cmdExecute(commands, CODE_DIR)
|
|
cmdExecute(commands, CODE_DIR)
|
|
|
|
|
|
# 重新下载;
|
|
# 重新下载;
|
|
commands=[]
|
|
commands=[]
|
|
if PREV_ARG['redownload']:
|
|
if PREV_ARG['redownload']:
|
|
print("start redownload")
|
|
print("start redownload")
|
|
|
|
+ commands.append("export PATH=$PATH:/bin/git-repo/")
|
|
commands.append(str.format("cd %s") % CODE_DIR)
|
|
commands.append(str.format("cd %s") % CODE_DIR)
|
|
commands.append(str.format("rm -rf !(%s|%s|%s|%s)") % ("builder.py", "arg.json", "51M-CompileScript.sh", "ftp.py"))
|
|
commands.append(str.format("rm -rf !(%s|%s|%s|%s)") % ("builder.py", "arg.json", "51M-CompileScript.sh", "ftp.py"))
|
|
# 已在编译路径中,无须处理;
|
|
# 已在编译路径中,无须处理;
|