Add script for creating a new shard patch

This commit is contained in:
kaetemi 2014-02-20 03:09:31 +01:00
parent 0934e84757
commit 4433139a8e
6 changed files with 134 additions and 20 deletions

View file

@ -69,7 +69,7 @@ for category in InstallClientData:
printLog(log, "") printLog(log, "")
log.close() log.close()
if os.path.isfile("5_client_dev.log"): if os.path.isfile("b1_client_dev.log"):
os.remove("5_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.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")

View file

@ -46,15 +46,20 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "") printLog(log, "")
for dir in InstallShardDataDirectories: for dir in InstallShardDataDirectories:
printLog(log, "SHARD DIRECTORY " + dir) printLog(log, "SHARD PACKAGE " + dir)
mkPath(log, ShardInstallDirectory + "/" + dir) mkPath(log, ShardInstallDirectory + "/" + dir)
printLog(log, "FROM " + dir) printLog(log, "FROM " + dir)
mkPath(log, InstallDirectory + "/" + dir) mkPath(log, InstallDirectory + "/" + dir)
copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + dir, ShardInstallDirectory + "/" + 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: for multiDir in InstallShardDataMultiDirectories:
dstDir = multiDir[0] dstDir = multiDir[0]
mkPath(log, ShardInstallDirectory + "/" + dstDir) mkPath(log, ShardInstallDirectory + "/" + dstDir)
printLog(log, "SHARD DIRECTORY " + dstDir) printLog(log, "SHARD PACKAGE " + dstDir)
for srcDir in multiDir[1]: for srcDir in multiDir[1]:
printLog(log, "FROM " + srcDir) printLog(log, "FROM " + srcDir)
mkPath(log, InstallDirectory + "/" + srcDir) mkPath(log, InstallDirectory + "/" + srcDir)
@ -63,7 +68,7 @@ for multiDir in InstallShardDataMultiDirectories:
for multiDir in InstallShardDataPrimitivesDirectories: for multiDir in InstallShardDataPrimitivesDirectories:
dstDir = multiDir[0] dstDir = multiDir[0]
mkPath(log, ShardInstallDirectory + "/" + dstDir) mkPath(log, ShardInstallDirectory + "/" + dstDir)
printLog(log, "SHARD DIRECTORY " + dstDir) printLog(log, "SHARD PACKAGE " + dstDir)
for srcDir in multiDir[1]: for srcDir in multiDir[1]:
printLog(log, "FROM PRIMITIVES " + srcDir) printLog(log, "FROM PRIMITIVES " + srcDir)
mkPath(log, PrimitivesDirectory + "/" + srcDir) mkPath(log, PrimitivesDirectory + "/" + srcDir)
@ -75,14 +80,14 @@ for execDir in InstallShardDataExecutables:
mkPath(log, PatchmanCfgDefaultDirectory) mkPath(log, PatchmanCfgDefaultDirectory)
mkPath(log, InstallDirectory) mkPath(log, InstallDirectory)
mkPath(log, ShardInstallDirectory + "/" + dstDir) 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]) copyFileIfNeeded(log, LinuxServiceExecutableDirectory + "/" + execDir[1][1], ShardInstallDirectory + "/" + dstDir + "/" + execDir[1][0])
copyFileListNoTreeIfNeeded(log, PatchmanCfgDefaultDirectory, ShardInstallDirectory + "/" + dstDir, execDir[2]) copyFileListNoTreeIfNeeded(log, PatchmanCfgDefaultDirectory, ShardInstallDirectory + "/" + dstDir, execDir[2])
copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, execDir[3]) copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, execDir[3])
printLog(log, "") printLog(log, "")
log.close() log.close()
if os.path.isfile("8_shard_data.log"): if os.path.isfile("b2_shard_data.log"):
os.remove("8_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_install.log") shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_shard_data.log")
shutil.move("log.log", "8_shard_data.log") shutil.move("log.log", "b2_shard_data.log")

View file

@ -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 <http://www.ryzomcore.org/>
# 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 <http://www.gnu.org/licenses/>.
#
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")

View file

@ -151,7 +151,7 @@ else:
log.close() log.close()
if os.path.isfile("6_client_patch.log"): if os.path.isfile("d1_client_patch.log"):
os.remove("6_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.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")

View file

@ -77,7 +77,7 @@ for category in InstallClientData:
printLog(log, "") printLog(log, "")
log.close() log.close()
if os.path.isfile("7_client_install.log"): if os.path.isfile("d2_client_install.log"):
os.remove("7_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.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")

View file

@ -1,9 +1,9 @@
title Ryzom Core: 1_export.py (LEVELDESIGN) 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) 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) 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) title Ryzom Core: b1_client_dev.py (LEVELDESIGN)
b1_client_dev.py b1_client_dev.py
title Ryzom Core: b2_shard_data.py (LEVELDESIGN) title Ryzom Core: b2_shard_data.py (LEVELDESIGN)