|
|
|
@ -78,7 +78,7 @@ void GenerateLZMA(const std::string sourceFile, const std::string &outputFile)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// old syntax incompatible with new versions
|
|
|
|
|
std::string cmd = "lzma e ";
|
|
|
|
|
std::string cmd = "lzma e";
|
|
|
|
|
cmd += " " + sourceFile + " " + outputFile;
|
|
|
|
|
nlinfo("Executing system command: %s", cmd.c_str());
|
|
|
|
|
}
|
|
|
|
@ -187,38 +187,38 @@ void CPackageDescription::setup(const std::string& packageName)
|
|
|
|
|
clear();
|
|
|
|
|
|
|
|
|
|
// read new contents from input file
|
|
|
|
|
static CPersistentDataRecord pdr;
|
|
|
|
|
static CPersistentDataRecord pdr;
|
|
|
|
|
pdr.clear();
|
|
|
|
|
pdr.readFromTxtFile(packageName);
|
|
|
|
|
apply(pdr);
|
|
|
|
|
|
|
|
|
|
// root directory
|
|
|
|
|
if (_RootDirectory.empty())
|
|
|
|
|
_RootDirectory= NLMISC::CFile::getPath(packageName);
|
|
|
|
|
_RootDirectory= NLMISC::CPath::standardizePath(_RootDirectory,true);
|
|
|
|
|
_RootDirectory = NLMISC::CFile::getPath(packageName);
|
|
|
|
|
_RootDirectory = NLMISC::CPath::standardizePath(_RootDirectory, true);
|
|
|
|
|
|
|
|
|
|
// patch directory
|
|
|
|
|
if (_PatchDirectory.empty())
|
|
|
|
|
_PatchDirectory= _RootDirectory+"patch";
|
|
|
|
|
_PatchDirectory= NLMISC::CPath::standardizePath(_PatchDirectory,true);
|
|
|
|
|
_PatchDirectory = _RootDirectory + "patch";
|
|
|
|
|
_PatchDirectory = NLMISC::CPath::standardizePath(_PatchDirectory, true);
|
|
|
|
|
|
|
|
|
|
// BNP directory
|
|
|
|
|
if (_BnpDirectory.empty())
|
|
|
|
|
_BnpDirectory= _RootDirectory+"bnp";
|
|
|
|
|
_BnpDirectory= NLMISC::CPath::standardizePath(_BnpDirectory,true);
|
|
|
|
|
_BnpDirectory = _RootDirectory+"bnp";
|
|
|
|
|
_BnpDirectory = NLMISC::CPath::standardizePath(_BnpDirectory, true);
|
|
|
|
|
|
|
|
|
|
// ref directory
|
|
|
|
|
if (_RefDirectory.empty())
|
|
|
|
|
_RefDirectory= _RootDirectory+"ref";
|
|
|
|
|
_RefDirectory= NLMISC::CPath::standardizePath(_RefDirectory,true);
|
|
|
|
|
_RefDirectory = _RootDirectory+"ref";
|
|
|
|
|
_RefDirectory = NLMISC::CPath::standardizePath(_RefDirectory, true);
|
|
|
|
|
|
|
|
|
|
// client index file
|
|
|
|
|
if (_ClientIndexFileName.empty())
|
|
|
|
|
_ClientIndexFileName= NLMISC::CFile::getFilenameWithoutExtension(packageName)+".idx";
|
|
|
|
|
_ClientIndexFileName = NLMISC::CFile::getFilenameWithoutExtension(packageName)+".idx";
|
|
|
|
|
|
|
|
|
|
// index file
|
|
|
|
|
if (_IndexFileName.empty())
|
|
|
|
|
_IndexFileName= NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName)+".hist";
|
|
|
|
|
_IndexFileName = NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName)+".hist";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CPackageDescription::storeToPdr(CPersistentDataRecord& pdr) const
|
|
|
|
@ -239,7 +239,7 @@ void CPackageDescription::readIndex(CBNPFileSet& packageIndex) const
|
|
|
|
|
// read new contents from input file
|
|
|
|
|
if (NLMISC::CFile::fileExists(indexPath))
|
|
|
|
|
{
|
|
|
|
|
static CPersistentDataRecord pdr;
|
|
|
|
|
static CPersistentDataRecord pdr;
|
|
|
|
|
pdr.clear();
|
|
|
|
|
pdr.readFromTxtFile(indexPath);
|
|
|
|
|
packageIndex.apply(pdr);
|
|
|
|
@ -253,7 +253,7 @@ void CPackageDescription::writeIndex(const CBNPFileSet& packageIndex) const
|
|
|
|
|
nlinfo("Writing history file: %s ...", indexPath.c_str());
|
|
|
|
|
|
|
|
|
|
// write contents to output file
|
|
|
|
|
static CPersistentDataRecordRyzomStore pdr;
|
|
|
|
|
static CPersistentDataRecordRyzomStore pdr;
|
|
|
|
|
pdr.clear();
|
|
|
|
|
packageIndex.store(pdr);
|
|
|
|
|
pdr.writeToTxtFile(indexPath);
|
|
|
|
@ -304,7 +304,7 @@ void CPackageDescription::generateClientIndex(CProductDescriptionForClient& theC
|
|
|
|
|
theClientPackage.clear();
|
|
|
|
|
|
|
|
|
|
// copy the categories using a pdr record
|
|
|
|
|
static CPersistentDataRecordRyzomStore pdr;
|
|
|
|
|
static CPersistentDataRecordRyzomStore pdr;
|
|
|
|
|
pdr.clear();
|
|
|
|
|
_Categories.store(pdr);
|
|
|
|
|
theClientPackage.setCategories(pdr);
|
|
|
|
@ -348,14 +348,14 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
|
|
|
|
{
|
|
|
|
|
nlinfo("Generating patches ...");
|
|
|
|
|
|
|
|
|
|
for (uint32 i=packageIndex.fileCount();i--;)
|
|
|
|
|
for (uint32 i = packageIndex.fileCount(); i--;)
|
|
|
|
|
{
|
|
|
|
|
bool deleteRefAfterDelta= true;
|
|
|
|
|
bool deleteRefAfterDelta = true;
|
|
|
|
|
bool usingTemporaryFile = false;
|
|
|
|
|
// generate file name root
|
|
|
|
|
std::string bnpFileName= _BnpDirectory+packageIndex.getFile(i).getFileName();
|
|
|
|
|
std::string refNameRoot= _RefDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
std::string patchNameRoot= _PatchDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
std::string bnpFileName = _BnpDirectory + packageIndex.getFile(i).getFileName();
|
|
|
|
|
std::string refNameRoot = _RefDirectory + NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
std::string patchNameRoot = _PatchDirectory + NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
|
|
|
|
|
// if the file has no versions then skip on to the next file
|
|
|
|
|
if (packageIndex.getFile(i).versionCount()==0)
|
|
|
|
@ -365,7 +365,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
|
|
|
|
const CBNPFileVersion& curVersion= packageIndex.getFile(i).getVersion(packageIndex.getFile(i).versionCount()-1);
|
|
|
|
|
std::string curVersionFileName= refNameRoot+NLMISC::toString("_%05u.%s",curVersion.getVersionNumber(),NLMISC::CFile::getExtension(bnpFileName).c_str());
|
|
|
|
|
// std::string patchFileName= patchNameRoot+NLMISC::toString("_%05d.patch",curVersion.getVersionNumber());
|
|
|
|
|
std::string patchFileName= _PatchDirectory+toString("%05u/",curVersion.getVersionNumber())+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+toString("_%05u",curVersion.getVersionNumber())+".patch";
|
|
|
|
|
std::string patchFileName= _PatchDirectory + toString("%05u/",curVersion.getVersionNumber())+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+toString("_%05u",curVersion.getVersionNumber())+".patch";
|
|
|
|
|
|
|
|
|
|
// get the second last version number and the related file name
|
|
|
|
|
std::string prevVersionFileName;
|
|
|
|
@ -413,7 +413,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
|
|
|
|
refVersionFileName= _BnpDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+"_.ref";
|
|
|
|
|
|
|
|
|
|
// delete the previous patch - because we only need the latest patch for non-incremental files
|
|
|
|
|
std::string lastPatch= _PatchDirectory+NLMISC::CFile::getFilenameWithoutExtension(prevVersionFileName)+".patch";
|
|
|
|
|
std::string lastPatch= _PatchDirectory + NLMISC::CFile::getFilenameWithoutExtension(prevVersionFileName)+".patch";
|
|
|
|
|
if (NLMISC::CFile::fileExists(lastPatch.c_str()))
|
|
|
|
|
NLMISC::CFile::deleteFile(lastPatch.c_str());
|
|
|
|
|
}
|
|
|
|
@ -552,7 +552,7 @@ static bool createNewProduct(std::string fileName)
|
|
|
|
|
|
|
|
|
|
// create a new package, store it to a persistent data record and write the latter to a file
|
|
|
|
|
CPackageDescription package;
|
|
|
|
|
static CPersistentDataRecordRyzomStore pdr;
|
|
|
|
|
static CPersistentDataRecordRyzomStore pdr;
|
|
|
|
|
pdr.clear();
|
|
|
|
|
package.storeToPdr(pdr);
|
|
|
|
|
pdr.writeToTxtFile(fileName);
|
|
|
|
@ -563,7 +563,7 @@ static bool createNewProduct(std::string fileName)
|
|
|
|
|
pdr.writeToTxtFile(fileName);
|
|
|
|
|
|
|
|
|
|
BOMB_IF(!NLMISC::CFile::fileExists(fileName),("Failed to create new package file: "+fileName).c_str(),return false);
|
|
|
|
|
nlinfo("New package description file created successfully: %s",fileName.c_str());
|
|
|
|
|
nlinfo("New package description file created successfully: %s", fileName.c_str());
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|