Added: #1093 Added command line argument for client_patch script to only generate updated bnp files without creating a patch.
This commit is contained in:
parent
9f726fff73
commit
2ca6207037
1 changed files with 56 additions and 50 deletions
|
@ -24,9 +24,13 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
|
||||||
sys.path.append("configuration")
|
sys.path.append("configuration")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Client Patch')
|
||||||
|
parser.add_argument('--bnponly', '-bo', action='store_true')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
log = open("log.log", "w")
|
||||||
|
@ -59,56 +63,57 @@ printLog(log, "")
|
||||||
|
|
||||||
if BnpMake == "":
|
if BnpMake == "":
|
||||||
toolLogFail(log, BnpMakeTool, ToolSuffix)
|
toolLogFail(log, BnpMakeTool, ToolSuffix)
|
||||||
elif PatchGen == "":
|
elif PatchGen == "" and not args.bnponly:
|
||||||
toolLogFail(log, PatchGenTool, ToolSuffix)
|
toolLogFail(log, PatchGenTool, ToolSuffix)
|
||||||
elif Lzma == "":
|
elif Lzma == "" and not args.bnponly:
|
||||||
toolLogFail(log, "LZMA", ToolSuffix)
|
toolLogFail(log, "LZMA", ToolSuffix)
|
||||||
elif XDelta == "":
|
elif XDelta == "" and not args.bnponly:
|
||||||
toolLogFail(log, "XDELTA", ToolSuffix)
|
toolLogFail(log, "XDELTA", ToolSuffix)
|
||||||
elif os.path.dirname(Lzma) != os.path.dirname(XDelta):
|
elif os.path.dirname(Lzma) != os.path.dirname(XDelta):
|
||||||
printLog(log, "FAIL lzma.exe and xdelta.exe must be in the same directory")
|
printLog(log, "FAIL lzma.exe and xdelta.exe must be in the same directory")
|
||||||
else:
|
else:
|
||||||
mkPath(log, ClientPatchDirectory)
|
mkPath(log, ClientPatchDirectory)
|
||||||
productXml = ClientPatchDirectory + "/" + ProductName + ".xml"
|
if not args.bnponly:
|
||||||
if not os.path.isfile(productXml):
|
productXml = ClientPatchDirectory + "/" + ProductName + ".xml"
|
||||||
printLog(log, ">>> Create new product <<<")
|
if not os.path.isfile(productXml):
|
||||||
subprocess.call([ PatchGen, "createNewProduct", productXml ])
|
printLog(log, ">>> Create new product <<<")
|
||||||
printLog(log, "")
|
subprocess.call([ PatchGen, "createNewProduct", productXml ])
|
||||||
printLog(log, ">>> Rewrite " + ProductName + ".xml <<<") # because we know better.
|
printLog(log, "")
|
||||||
shutil.move(productXml, productXml + ".old")
|
printLog(log, ">>> Rewrite " + ProductName + ".xml <<<") # because we know better.
|
||||||
oldCfg = open(productXml + ".old", "r")
|
shutil.move(productXml, productXml + ".old")
|
||||||
cfg = open(productXml, "w")
|
oldCfg = open(productXml + ".old", "r")
|
||||||
inCategories = 0
|
cfg = open(productXml, "w")
|
||||||
for line in oldCfg:
|
inCategories = 0
|
||||||
if not inCategories:
|
for line in oldCfg:
|
||||||
if line.strip() == "<_Categories>":
|
if not inCategories:
|
||||||
inCategories = 1
|
if line.strip() == "<_Categories>":
|
||||||
cfg.write("\t<_Categories>\n")
|
inCategories = 1
|
||||||
for category in InstallClientData:
|
cfg.write("\t<_Categories>\n")
|
||||||
cfg.write("\t\t<_Category>\n")
|
for category in InstallClientData:
|
||||||
cfg.write("\t\t\t<_Name type=\"STRING\" value=\"" + category["Name"] + "\"/>\n")
|
cfg.write("\t\t<_Category>\n")
|
||||||
if category["UnpackTo"] != None:
|
cfg.write("\t\t\t<_Name type=\"STRING\" value=\"" + category["Name"] + "\"/>\n")
|
||||||
if category["UnpackTo"] != "":
|
if category["UnpackTo"] != None:
|
||||||
cfg.write("\t\t\t<_UnpackTo type=\"STRING\" value=\"./" + category["UnpackTo"] + "/\"/>\n")
|
if category["UnpackTo"] != "":
|
||||||
else:
|
cfg.write("\t\t\t<_UnpackTo type=\"STRING\" value=\"./" + category["UnpackTo"] + "/\"/>\n")
|
||||||
cfg.write("\t\t\t<_UnpackTo type=\"SINT32\" value=\"./\"/>\n")
|
else:
|
||||||
cfg.write("\t\t\t<_IsOptional type=\"SINT32\" value=\"" + str(category["IsOptional"]) + "\"/>\n")
|
cfg.write("\t\t\t<_UnpackTo type=\"SINT32\" value=\"./\"/>\n")
|
||||||
cfg.write("\t\t\t<_IsIncremental type=\"SINT32\" value=\"" + str(category["IsIncremental"]) + "\"/>\n")
|
cfg.write("\t\t\t<_IsOptional type=\"SINT32\" value=\"" + str(category["IsOptional"]) + "\"/>\n")
|
||||||
for package in category["Packages"]:
|
cfg.write("\t\t\t<_IsIncremental type=\"SINT32\" value=\"" + str(category["IsIncremental"]) + "\"/>\n")
|
||||||
if (len(package[1]) > 0):
|
for package in category["Packages"]:
|
||||||
cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[1][0] + "\"/>\n")
|
if (len(package[1]) > 0):
|
||||||
else:
|
cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[1][0] + "\"/>\n")
|
||||||
cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[0] + ".bnp\"/>\n")
|
else:
|
||||||
cfg.write("\t\t</_Category>\n")
|
cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[0] + ".bnp\"/>\n")
|
||||||
cfg.write("\t</_Categories>\n")
|
cfg.write("\t\t</_Category>\n")
|
||||||
|
cfg.write("\t</_Categories>\n")
|
||||||
|
else:
|
||||||
|
cfg.write(line)
|
||||||
else:
|
else:
|
||||||
cfg.write(line)
|
if line.strip() == "</_Categories>":
|
||||||
else:
|
inCategories = 0
|
||||||
if line.strip() == "</_Categories>":
|
oldCfg.close()
|
||||||
inCategories = 0
|
cfg.close()
|
||||||
oldCfg.close()
|
os.remove(productXml + ".old")
|
||||||
cfg.close()
|
|
||||||
os.remove(productXml + ".old")
|
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
printLog(log, ">>> Make bnp <<<")
|
printLog(log, ">>> Make bnp <<<")
|
||||||
targetPath = ClientPatchDirectory + "/bnp"
|
targetPath = ClientPatchDirectory + "/bnp"
|
||||||
|
@ -133,13 +138,14 @@ else:
|
||||||
else:
|
else:
|
||||||
printLog(log, "SKIP " + targetBnp)
|
printLog(log, "SKIP " + targetBnp)
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
printLog(log, ">>> Update product <<<")
|
if not args.bnponly:
|
||||||
cwDir = os.getcwd().replace("\\", "/")
|
printLog(log, ">>> Update product <<<")
|
||||||
toolDir = os.path.dirname(Lzma).replace("\\", "/")
|
cwDir = os.getcwd().replace("\\", "/")
|
||||||
os.chdir(toolDir)
|
toolDir = os.path.dirname(Lzma).replace("\\", "/")
|
||||||
subprocess.call([ PatchGen, "updateProduct", productXml ])
|
os.chdir(toolDir)
|
||||||
os.chdir(cwDir)
|
subprocess.call([ PatchGen, "updateProduct", productXml ])
|
||||||
printLog(log, "")
|
os.chdir(cwDir)
|
||||||
|
printLog(log, "")
|
||||||
|
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
Loading…
Reference in a new issue