Merge with default

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 11 years ago
commit 3dbde05bdf

@ -7,6 +7,7 @@ IF(WITH_NEL_TOOLS)
build_smallbank
ig_lighter
ig_elevation
lightmap_optimizer
zone_dependencies
zone_ig_lighter
zone_lighter
@ -48,7 +49,7 @@ ENDIF(WIN32)
IF(WITH_NEL_TOOLS)
IF(WIN32)
ADD_SUBDIRECTORY(lightmap_optimizer)
# ADD_SUBDIRECTORY(lightmap_optimizer)
IF(MFC_FOUND)
ADD_SUBDIRECTORY(object_viewer_exe)
ADD_SUBDIRECTORY(tile_edit)

@ -32,7 +32,17 @@
#include "nel/3d/texture_file.h"
#include "nel/3d/register_3d.h"
#include "windows.h"
#ifdef NL_OS_WINDOWS
# include <windows.h>
#else
# define strnicmp NLMISC::strnicmp
# include <dirent.h> /* for directories functions */
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h> /* getcwd, chdir -- replacement for getCurDiretory & setCurDirectory on windows */
#endif
#include <vector>
#include <string>
@ -42,20 +52,20 @@
using namespace std;
using namespace NL3D;
// ---------------------------------------------------------------------------
char sExeDir[MAX_PATH];
void outString (const string &sText)
void outString (const string &sText) ;
// ---------------------------------------------------------------------------
#ifdef NL_OS_WINDOWS // win32 code
void GetCWD (int length,char *dir)
{
char sCurDir[MAX_PATH];
GetCurrentDirectory (MAX_PATH, sCurDir);
SetCurrentDirectory (sExeDir);
NLMISC::createDebug ();
NLMISC::InfoLog->displayRaw(sText.c_str());
SetCurrentDirectory (sCurDir);
GetCurrentDirectoryA (length, dir);
}
// ---------------------------------------------------------------------------
bool ChDir(const char *path)
{
return SetCurrentDirectoryA (path);
}
void dir (const std::string &sFilter, std::vector<std::string> &sAllFiles, bool bFullPath)
{
WIN32_FIND_DATA findData;
@ -63,7 +73,8 @@ void dir (const std::string &sFilter, std::vector<std::string> &sAllFiles, bool
char sCurDir[MAX_PATH];
sAllFiles.clear ();
GetCurrentDirectory (MAX_PATH, sCurDir);
hFind = FindFirstFile (sFilter.c_str(), &findData);
std::string sFilterAsx = std::string("*") + sFilter;
hFind = FindFirstFile (sFilterAsx.c_str(), &findData);
while (hFind != INVALID_HANDLE_VALUE)
{
DWORD res = GetFileAttributes(findData.cFileName);
@ -79,16 +90,69 @@ void dir (const std::string &sFilter, std::vector<std::string> &sAllFiles, bool
}
FindClose (hFind);
}
#else // posix version of the void dir(...) function.
void GetCWD (int length, char* directory)
{
getcwd (directory,length);
}
bool ChDir(const char *path)
{
return ( chdir (path) == 0 ? true : false );
}
void dir (const string &sFilter, vector<string> &sAllFiles, bool bFullPath)
{
char sCurDir[MAX_PATH];
DIR* dp = NULL;
struct dirent *dirp= NULL;
GetCWD ( MAX_PATH,sCurDir ) ;
sAllFiles.clear ();
if ( (dp = opendir( sCurDir )) == NULL)
{
string sTmp = string("ERROR : Can't open the dir : \"")+string(sCurDir)+string("\"") ;
outString ( sTmp ) ;
return ;
}
while ( (dirp = readdir(dp)) != NULL)
{
std:string sFileName = std::string(dirp->d_name) ;
if (sFileName.substr((sFileName.length()-sFilter.length()),sFilter.length()).find(sFilter)!= std::string::npos )
{
if (bFullPath)
sAllFiles.push_back(string(sCurDir) + "/" + sFileName);
else
sAllFiles.push_back(sFileName);
}
}
closedir(dp);
}
bool DeleteFile(const char* filename){
if ( int res = unlink (filename) == -1 )
return false;
return true;
}
#endif
// ---------------------------------------------------------------------------
char sExeDir[MAX_PATH];
void outString (const string &sText)
{
char sCurDir[MAX_PATH];
GetCWD (MAX_PATH, sCurDir);
ChDir (sExeDir);
NLMISC::createDebug ();
NLMISC::InfoLog->displayRaw(sText.c_str());
ChDir (sCurDir);
}
// ---------------------------------------------------------------------------
bool fileExist (const std::string &sFileName)
{
HANDLE hFile = CreateFile (sFileName.c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return false;
CloseHandle (hFile);
return true;
return NLMISC::CFile::isExists(sFileName) ;
}
// -----------------------------------------------------------------------------------------------
@ -332,25 +396,25 @@ int main(int nNbArg, char **ppArgs)
char sSHPDir[MAX_PATH];
GetCurrentDirectory (MAX_PATH, sExeDir);
GetCWD (MAX_PATH, sExeDir);
// Get absolute directory for lightmaps
if (!SetCurrentDirectory(ppArgs[1]))
if (!ChDir(ppArgs[1]))
{
outString (string("ERROR : directory ") + ppArgs[1] + " do not exists\n");
outString (string("ERROR : directory ") + ppArgs[1] + " do not exists or access is denied\n");
return -1;
}
GetCurrentDirectory (MAX_PATH, sLMPDir);
SetCurrentDirectory (sExeDir);
GetCWD (MAX_PATH, sLMPDir);
ChDir (sExeDir);
// Get absolute directory for shapes
if (!SetCurrentDirectory(ppArgs[2]))
if (!ChDir(ppArgs[2]))
{
outString (string("ERROR : directory ") + ppArgs[2] + " do not exists\n");
outString (string("ERROR : directory ") + ppArgs[2] + " do not exists or access is denied\n");
return -1;
}
GetCurrentDirectory (MAX_PATH, sSHPDir);
dir ("*.shape", AllShapeNames, false);
GetCWD (MAX_PATH, sSHPDir);
dir (".shape", AllShapeNames, false);
registerSerial3d ();
for (uint32 nShp = 0; nShp < AllShapeNames.size(); ++nShp)
{
@ -374,13 +438,13 @@ int main(int nNbArg, char **ppArgs)
if (nNbArg > 3 && ppArgs[3] && strlen(ppArgs[3]) > 0)
{
SetCurrentDirectory (sExeDir);
if (!SetCurrentDirectory(ppArgs[3]))
ChDir (sExeDir);
if (!ChDir(ppArgs[3]))
{
outString (string("ERROR : directory ") + ppArgs[3] + " do not exists\n");
return -1;
}
dir ("*.tag", tags, false);
dir (".tag", tags, false);
for(uint k = 0; k < tags.size(); ++k)
{
std::string::size_type pos = tags[k].find('.');
@ -426,7 +490,7 @@ int main(int nNbArg, char **ppArgs)
// **** Parse all lightmaps, sorted by layer, and 8 or 16 bit mode
SetCurrentDirectory (sExeDir);
ChDir (sExeDir);
for (uint32 lmc8bitMode = 0; lmc8bitMode < 2; ++lmc8bitMode)
for (uint32 nNbLayer = 0; nNbLayer < 256; ++nNbLayer)
{
@ -440,8 +504,8 @@ int main(int nNbArg, char **ppArgs)
string sFilter;
// **** Get All Lightmaps that have this number of layer, and this mode
sFilter = "*_" + NLMISC::toString(nNbLayer) + ".tga";
SetCurrentDirectory (sLMPDir);
sFilter = "_" + NLMISC::toString(nNbLayer) + ".tga";
ChDir (sLMPDir);
dir (sFilter, AllLightmapNames, false);
// filter by layer
@ -697,7 +761,7 @@ int main(int nNbArg, char **ppArgs)
// Change shapes uvs related and names to the lightmap
// ---------------------------------------------------
SetCurrentDirectory (sSHPDir);
ChDir (sSHPDir);
for (k = 0; k < (sint32)AllShapes.size(); ++k)
{
@ -891,7 +955,7 @@ int main(int nNbArg, char **ppArgs)
}
}
SetCurrentDirectory (sLMPDir);
ChDir (sLMPDir);
// Get out of the j loop
break;
@ -923,7 +987,7 @@ int main(int nNbArg, char **ppArgs)
// **** Additionally, output or clear a "flag file" in a dir to info if a 8bit lihgtmap or not
if (nNbArg >=5 && ppArgs[4] && strlen(ppArgs[4]) > 0)
{
SetCurrentDirectory (sExeDir);
ChDir (sExeDir);
// out a text file, with list of
FILE *out= fopen(ppArgs[4], "wt");

@ -24,9 +24,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util, tarfile
import time, sys, os, shutil, subprocess, distutils.dir_util, tarfile, argparse
sys.path.append("configuration")
parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Shard Patch')
parser.add_argument('--admininstall', '-ai', action='store_true')
args = parser.parse_args()
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
@ -84,23 +88,24 @@ 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
if not args.admininstall:
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()
printLog(log, "")
log.close()
if os.path.isfile("c1_shard_patch.log"):

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save