From 934f5c3f0b3f44107a0b0fc740116f3ce90b8386 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 20 Feb 2014 03:09:31 +0100 Subject: [PATCH] Add script for creating a new shard patch --- .../nel/tools/build_gamedata/b1_client_dev.py | 6 +- .../nel/tools/build_gamedata/b2_shard_data.py | 21 ++-- .../tools/build_gamedata/c1_shard_patch.py | 109 ++++++++++++++++++ .../tools/build_gamedata/d1_client_patch.py | 6 +- .../tools/build_gamedata/d2_client_install.py | 6 +- .../tools/build_gamedata/leveldesign_dev.bat | 6 +- 6 files changed, 134 insertions(+), 20 deletions(-) create mode 100644 code/nel/tools/build_gamedata/c1_shard_patch.py diff --git a/code/nel/tools/build_gamedata/b1_client_dev.py b/code/nel/tools/build_gamedata/b1_client_dev.py index cbe4b9092..9553ed6df 100644 --- a/code/nel/tools/build_gamedata/b1_client_dev.py +++ b/code/nel/tools/build_gamedata/b1_client_dev.py @@ -69,7 +69,7 @@ for category in InstallClientData: printLog(log, "") log.close() -if os.path.isfile("5_client_dev.log"): - os.remove("5_client_dev.log") +if os.path.isfile("b1_client_dev.log"): + os.remove("b1_client_dev.log") shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_client_dev.log") -shutil.move("log.log", "5_client_dev.log") +shutil.move("log.log", "b1_client_dev.log") diff --git a/code/nel/tools/build_gamedata/b2_shard_data.py b/code/nel/tools/build_gamedata/b2_shard_data.py index 28ea70f26..2843769e9 100644 --- a/code/nel/tools/build_gamedata/b2_shard_data.py +++ b/code/nel/tools/build_gamedata/b2_shard_data.py @@ -46,15 +46,20 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") for dir in InstallShardDataDirectories: - printLog(log, "SHARD DIRECTORY " + dir) + printLog(log, "SHARD PACKAGE " + dir) mkPath(log, ShardInstallDirectory + "/" + dir) printLog(log, "FROM " + dir) mkPath(log, InstallDirectory + "/" + dir) copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + dir, ShardInstallDirectory + "/" + dir) +for package in InstallShardDataFiles: + dstDir = package[0] + mkPath(log, ShardInstallDirectory + "/" + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) + copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, package[1]) for multiDir in InstallShardDataMultiDirectories: dstDir = multiDir[0] mkPath(log, ShardInstallDirectory + "/" + dstDir) - printLog(log, "SHARD DIRECTORY " + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) for srcDir in multiDir[1]: printLog(log, "FROM " + srcDir) mkPath(log, InstallDirectory + "/" + srcDir) @@ -63,7 +68,7 @@ for multiDir in InstallShardDataMultiDirectories: for multiDir in InstallShardDataPrimitivesDirectories: dstDir = multiDir[0] mkPath(log, ShardInstallDirectory + "/" + dstDir) - printLog(log, "SHARD DIRECTORY " + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) for srcDir in multiDir[1]: printLog(log, "FROM PRIMITIVES " + srcDir) mkPath(log, PrimitivesDirectory + "/" + srcDir) @@ -75,14 +80,14 @@ for execDir in InstallShardDataExecutables: mkPath(log, PatchmanCfgDefaultDirectory) mkPath(log, InstallDirectory) mkPath(log, ShardInstallDirectory + "/" + dstDir) - printLog(log, "SHARD DIRECTORY " + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) copyFileIfNeeded(log, LinuxServiceExecutableDirectory + "/" + execDir[1][1], ShardInstallDirectory + "/" + dstDir + "/" + execDir[1][0]) copyFileListNoTreeIfNeeded(log, PatchmanCfgDefaultDirectory, ShardInstallDirectory + "/" + dstDir, execDir[2]) copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, execDir[3]) printLog(log, "") log.close() -if os.path.isfile("8_shard_data.log"): - os.remove("8_shard_data.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_shard_install.log") -shutil.move("log.log", "8_shard_data.log") +if os.path.isfile("b2_shard_data.log"): + os.remove("b2_shard_data.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_shard_data.log") +shutil.move("log.log", "b2_shard_data.log") diff --git a/code/nel/tools/build_gamedata/c1_shard_patch.py b/code/nel/tools/build_gamedata/c1_shard_patch.py new file mode 100644 index 000000000..a67613f67 --- /dev/null +++ b/code/nel/tools/build_gamedata/c1_shard_patch.py @@ -0,0 +1,109 @@ +#!/usr/bin/python +# +# \file c1_shard_patch.py +# \brief Create a new patch for the patchman bridge +# \date 2014-02-20 00:27GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Create a new patch for the patchman bridge +# +# NeL - MMORPG Framework +# Copyright (C) 2014 by authors +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +import time, sys, os, shutil, subprocess, distutils.dir_util, tarfile +sys.path.append("configuration") + +if os.path.isfile("log.log"): + os.remove("log.log") +log = open("log.log", "w") +from scripts import * +from buildsite import * +from tools import * + +sys.path.append(WorkspaceDirectory) +from projects import * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Create a new patch for the patchman bridge") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# List the directories that will be used +archiveDirectories = [ ] +for dir in InstallShardDataDirectories: + if not dir in archiveDirectories: + archiveDirectories += [ dir ] +for package in InstallShardDataFiles: + dstDir = package[0] + if not dstDir in archiveDirectories: + archiveDirectories += [ dstDir ] +for multiDir in InstallShardDataMultiDirectories: + dstDir = multiDir[0] + if not dstDir in archiveDirectories: + archiveDirectories += [ dstDir ] +for multiDir in InstallShardDataPrimitivesDirectories: + dstDir = multiDir[0] + if not dstDir in archiveDirectories: + archiveDirectories += [ dstDir ] +for execDir in InstallShardDataExecutables: + dstDir = execDir[0] + if not dstDir in archiveDirectories: + archiveDirectories += [ dstDir ] + +printLog(log, ">>> Archive new admin_install.tgz <<<") +mkPath(log, PatchmanBridgeServerDirectory) +adminInstallTgz = PatchmanBridgeServerDirectory + "/admin_install.tgz" +patchmanExecutable = LinuxServiceExecutableDirectory + "/ryzom_patchman_service" +if needUpdateDirNoSubdirFile(log, PatchmanCfgAdminDirectory + "/bin", adminInstallTgz) or needUpdateDirNoSubdirFile(log, PatchmanCfgAdminDirectory + "/patchman", adminInstallTgz) or needUpdate(log, patchmanExecutable, adminInstallTgz): + printLog(log, "WRITE " + adminInstallTgz) + if os.path.isfile(adminInstallTgz): + os.remove(adminInstallTgz) + tar = tarfile.open(adminInstallTgz, "w:gz") + tar.add(PatchmanCfgAdminDirectory + "/bin", arcname = "bin") + tar.add(PatchmanCfgAdminDirectory + "/patchman", arcname = "patchman") + tar.add(patchmanExecutable, arcname = "patchman/ryzom_patchman_service") + tar.close() +else: + printLog(log, "SKIP " + adminInstallTgz) +printLog(log, "") + +printLog(log, ">>> Create new version <<<") +newVersion = 1 +vstr = str(newVersion).zfill(6) +vpath = PatchmanBridgeServerDirectory + "/" + vstr +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() +printLog(log, "") + +log.close() +if os.path.isfile("c1_shard_patch.log"): + os.remove("c1_shard_patch.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_shard_patch.log") +shutil.move("log.log", "c1_shard_patch.log") diff --git a/code/nel/tools/build_gamedata/d1_client_patch.py b/code/nel/tools/build_gamedata/d1_client_patch.py index 8af27debf..861ea8bd0 100644 --- a/code/nel/tools/build_gamedata/d1_client_patch.py +++ b/code/nel/tools/build_gamedata/d1_client_patch.py @@ -151,7 +151,7 @@ else: log.close() -if os.path.isfile("6_client_patch.log"): - os.remove("6_client_patch.log") +if os.path.isfile("d1_client_patch.log"): + os.remove("d1_client_patch.log") shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_client_patch.log") -shutil.move("log.log", "6_client_patch.log") +shutil.move("log.log", "d1_client_patch.log") diff --git a/code/nel/tools/build_gamedata/d2_client_install.py b/code/nel/tools/build_gamedata/d2_client_install.py index 2555385da..26fc4f5c5 100644 --- a/code/nel/tools/build_gamedata/d2_client_install.py +++ b/code/nel/tools/build_gamedata/d2_client_install.py @@ -77,7 +77,7 @@ for category in InstallClientData: printLog(log, "") log.close() -if os.path.isfile("7_client_install.log"): - os.remove("7_client_install.log") +if os.path.isfile("d2_client_install.log"): + os.remove("d2_client_install.log") shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_client_install.log") -shutil.move("log.log", "7_client_install.log") +shutil.move("log.log", "d2_client_install.log") diff --git a/code/nel/tools/build_gamedata/leveldesign_dev.bat b/code/nel/tools/build_gamedata/leveldesign_dev.bat index cebd81ce7..5d307fcf0 100644 --- a/code/nel/tools/build_gamedata/leveldesign_dev.bat +++ b/code/nel/tools/build_gamedata/leveldesign_dev.bat @@ -1,9 +1,9 @@ title Ryzom Core: 1_export.py (LEVELDESIGN) -1_export.py -ipj common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language +1_export.py -ipj common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language shard/data_leveldesign title Ryzom Core: 2_build.py (LEVELDESIGN) -2_build.py -ipj common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language +2_build.py -ipj common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language shard/data_leveldesign title Ryzom Core: 3_install.py (LEVELDESIGN) -3_install.py -ipj common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language +3_install.py -ipj common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language shard/data_leveldesign title Ryzom Core: b1_client_dev.py (LEVELDESIGN) b1_client_dev.py title Ryzom Core: b2_shard_data.py (LEVELDESIGN)