From 5c0c6d24178a1e63c49e72941ea7714adf7d42fc Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 11 Apr 2020 11:52:09 +0800 Subject: [PATCH] Generate 7z server patch, ref ryzom/ryzomcore#586 --- nel/tools/build_gamedata/c1_shard_patch.py | 39 ++++++++++++------- .../build_gamedata/configuration/tools.py | 1 + 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/nel/tools/build_gamedata/c1_shard_patch.py b/nel/tools/build_gamedata/c1_shard_patch.py index b67b053a8..e67314cd8 100755 --- a/nel/tools/build_gamedata/c1_shard_patch.py +++ b/nel/tools/build_gamedata/c1_shard_patch.py @@ -49,6 +49,9 @@ printLog(log, "-------") printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") +# Find tools +SevenZip = findTool(log, ToolDirectories, SevenZipTool, ToolSuffix) + # List the directories that will be used archiveDirectories = [ ] for dir in InstallShardDataDirectories: @@ -89,23 +92,29 @@ else: printLog(log, "") if not args.admininstall: - printLog(log, ">>> Create new version <<<") - newVersion = 1 - vstr = str(newVersion).zfill(6) - vpath = PatchmanBridgeServerDirectory + "/" + vstr - while os.path.exists(vpath): - newVersion = newVersion + 1 + if SevenZip == "": + toolLogFail(log, SevenZipTool, ToolSuffix) + else: + printLog(log, ">>> Create new version <<<") + newVersion = 1 vstr = str(newVersion).zfill(6) vpath = PatchmanBridgeServerDirectory + "/" + vstr - mkPath(log, vpath) - for dir in archiveDirectories: - mkPath(log, ShardInstallDirectory + "/" + dir) - tgzPath = vpath + "/" + dir + ".tgz" - printLog(log, "WRITE " + tgzPath) - tar = tarfile.open(tgzPath, "w:gz") - tar.add(ShardInstallDirectory + "/" + dir, arcname = dir) - tar.close() - printLog(log, "") + while os.path.exists(vpath): + newVersion = newVersion + 1 + vstr = str(newVersion).zfill(6) + vpath = PatchmanBridgeServerDirectory + "/" + vstr + mkPath(log, vpath) + for dir in archiveDirectories: + mkPath(log, ShardInstallDirectory + "/" + dir) + # tgzPath = vpath + "/" + dir + ".tgz" + # printLog(log, "WRITE " + tgzPath) + # tar = tarfile.open(tgzPath, "w:gz") + # tar.add(ShardInstallDirectory + "/" + dir, arcname = dir) + # tar.close() + sevenZipPath = vpath + "/" + dir + ".7z" + printLog(log, "WRITE " + sevenZipPath) + subprocess.call([ SevenZip, "a", sevenZipPath, ShardInstallDirectory + "/" + dir ]) + printLog(log, "") log.close() if os.path.isfile("c1_shard_patch.log"): diff --git a/nel/tools/build_gamedata/configuration/tools.py b/nel/tools/build_gamedata/configuration/tools.py index ebb1d07da..ee933c8e9 100755 --- a/nel/tools/build_gamedata/configuration/tools.py +++ b/nel/tools/build_gamedata/configuration/tools.py @@ -98,3 +98,4 @@ PatchGenTool = "patch_gen" TranslationToolsTool = "translation_tools" BuildWorldPackedColTool = "build_world_packed_col" R2IslandsTexturesTool = "r2_islands_textures" +SevenZipTool = "7za"