3 # \file b2_shard_data.py
4 # \brief Install shard data
5 # \date 2009-02-18 16:19GMT
6 # \author Jan Boon (Kaetemi)
7 # Python port of game data build pipeline.
10 # NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
11 # Copyright (C) 2009-2014 by authors
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU Affero General Public License as
15 # published by the Free Software Foundation, either version 3 of the
16 # License, or (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU Affero General Public License for more details.
23 # You should have received a copy of the GNU Affero General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 import time
, sys
, os
, shutil
, subprocess
, distutils
.dir_util
28 sys
.path
.append("configuration")
30 if os
.path
.isfile("log.log"):
32 log
= open("log.log", "w")
34 from buildsite_local
import *
37 sys
.path
.append(WorkspaceDirectory
)
38 from projects
import *
42 printLog(log
, "-------")
43 printLog(log
, "--- Install shard data")
44 printLog(log
, "-------")
45 printLog(log
, time
.strftime("%Y-%m-%d %H:%MGMT", time
.gmtime(time
.time())))
48 for dir in InstallShardDataDirectories
:
49 printLog(log
, "SHARD PACKAGE " + dir)
50 mkPath(log
, ShardInstallDirectory
+ "/" + dir)
51 printLog(log
, "FROM " + dir)
52 mkPath(log
, InstallDirectory
+ "/" + dir)
53 copyFilesNoTreeIfNeeded(log
, InstallDirectory
+ "/" + dir, ShardInstallDirectory
+ "/" + dir)
54 for package
in InstallShardDataFiles
:
56 mkPath(log
, ShardInstallDirectory
+ "/" + dstDir
)
57 printLog(log
, "SHARD PACKAGE " + dstDir
)
58 copyFileListNoTreeIfNeeded(log
, InstallDirectory
, ShardInstallDirectory
+ "/" + dstDir
, package
[1])
59 for multiDir
in InstallShardDataMultiDirectories
:
61 mkPath(log
, ShardInstallDirectory
+ "/" + dstDir
)
62 printLog(log
, "SHARD PACKAGE " + dstDir
)
63 for srcDir
in multiDir
[1]:
64 printLog(log
, "FROM " + srcDir
)
65 mkPath(log
, InstallDirectory
+ "/" + srcDir
)
66 mkPath(log
, ShardInstallDirectory
+ "/" + dstDir
+ "/" + srcDir
)
67 copyFilesNoTreeIfNeeded(log
, InstallDirectory
+ "/" + srcDir
, ShardInstallDirectory
+ "/" + dstDir
+ "/" + srcDir
)
68 for multiDir
in InstallShardDataPrimitivesDirectories
:
70 mkPath(log
, ShardInstallDirectory
+ "/" + dstDir
)
71 printLog(log
, "SHARD PACKAGE " + dstDir
)
72 for srcDir
in multiDir
[1]:
73 printLog(log
, "FROM PRIMITIVES " + srcDir
)
74 mkPath(log
, PrimitivesDirectory
+ "/" + srcDir
)
75 mkPath(log
, ShardInstallDirectory
+ "/" + dstDir
+ "/" + srcDir
)
76 copyFilesNoTreeIfNeeded(log
, PrimitivesDirectory
+ "/" + srcDir
, ShardInstallDirectory
+ "/" + dstDir
+ "/" + srcDir
)
77 for execDir
in InstallShardDataExecutables
:
79 mkPath(log
, LinuxServiceExecutableDirectory
)
80 mkPath(log
, PatchmanCfgDefaultDirectory
)
81 mkPath(log
, InstallDirectory
)
82 mkPath(log
, ShardInstallDirectory
+ "/" + dstDir
)
83 printLog(log
, "SHARD PACKAGE " + dstDir
)
84 copyFileIfNeeded(log
, LinuxServiceExecutableDirectory
+ "/" + execDir
[1][1], ShardInstallDirectory
+ "/" + dstDir
+ "/" + execDir
[1][0])
85 copyFileListNoTreeIfNeeded(log
, PatchmanCfgDefaultDirectory
, ShardInstallDirectory
+ "/" + dstDir
, execDir
[2])
86 copyFileListNoTreeIfNeeded(log
, InstallDirectory
, ShardInstallDirectory
+ "/" + dstDir
, execDir
[3])
90 if os
.path
.isfile("b2_shard_data.log"):
91 os
.remove("b2_shard_data.log")
92 shutil
.copy("log.log", time
.strftime("%Y-%m-%d-%H-%M-GMT", time
.gmtime(time
.time())) + "_shard_data.log")
93 shutil
.move("log.log", "b2_shard_data.log")