From fb3e97db1d6593390040ed5d4930ce9a6481bd94 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 11 Apr 2020 12:20:24 +0800 Subject: [PATCH] Request for 7z instead of tgz, ref ryzom/ryzomcore#586 --- .../spa_server_patch_applier.cpp | 2 +- .../src/patchman_service/file_receiver.cpp | 29 +++++++++++++------ .../src/patchman_service/file_receiver.h | 3 +- .../spa_server_patch_applier.cpp | 10 +++++-- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp b/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp index bac02ae51..fdece27c6 100644 --- a/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp +++ b/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp @@ -120,7 +120,7 @@ bool untar(const NLMISC::CSString& destFile) bool untarIfNeeded(const NLMISC::CSString& destFile) { - if (destFile.right(4)==".tgz" || destFile.right(7)==".tar.gz") + if (destFile.right(4)==".tgz" || destFile.right(7)==".tar.gz" || destFile.right(3)==".7z") { return untar(destFile); } diff --git a/ryzom/server/src/patchman_service/file_receiver.cpp b/ryzom/server/src/patchman_service/file_receiver.cpp index f84d29713..9520e2da2 100644 --- a/ryzom/server/src/patchman_service/file_receiver.cpp +++ b/ryzom/server/src/patchman_service/file_receiver.cpp @@ -64,13 +64,22 @@ namespace PATCHMAN _Parent=NULL; } - void CFileReceiver::init(NLNET::IModule* parent,const std::string& fileSpec) - { - CFileReceiverSkel::init(parent); - _Parent= parent; - _FileSpec= fileSpec; - _AdministeredModuleWrapper.init(dynamic_cast(parent)); - } + void CFileReceiver::init(NLNET::IModule *parent, const std::string &fileSpec) + { + std::vector fileSpecs; + fileSpecs.push_back(fileSpec); + init(parent, fileSpecs); + } + + void CFileReceiver::init(NLNET::IModule *parent, const std::vector &fileSpecs) + { + CFileReceiverSkel::init(parent); + _Parent = parent; + _FileSpecs.clear(); + for (std::vector::const_iterator it(fileSpecs.begin()), end(fileSpecs.end()); it != end; ++it) + _FileSpecs.push_back(*it); + _AdministeredModuleWrapper.init(dynamic_cast(parent)); + } bool CFileReceiver::haveIdleProxies() const { @@ -144,7 +153,8 @@ namespace PATCHMAN if (NLMISC::CSString(module->getModuleManifest()).contains(ManifestEntryIsFileRepository)) { CFileRepositoryProxy spr(module); - spr.subscribe(_Parent,_FileSpec); + for (std::vector::const_iterator it(_FileSpecs.begin()), end(_FileSpecs.end()); it != end; ++it) + spr.subscribe(_Parent, *it); _log("Repository up: "+module->getModuleName()); _Proxies[module].Proxy= module; } @@ -281,7 +291,8 @@ namespace PATCHMAN // send the subscription request CFileRepositoryProxy spr(sender); - spr.subscribe(_Parent,_FileSpec); + for (std::vector::const_iterator it(_FileSpecs.begin()), end(_FileSpecs.end()); it != end; ++it) + spr.subscribe(_Parent, *it); _log(NLMISC::toString("setupSubscriptions from: %s",sender->getModuleName().c_str())); } diff --git a/ryzom/server/src/patchman_service/file_receiver.h b/ryzom/server/src/patchman_service/file_receiver.h index ebe4d8b7a..abd7c21c5 100644 --- a/ryzom/server/src/patchman_service/file_receiver.h +++ b/ryzom/server/src/patchman_service/file_receiver.h @@ -50,6 +50,7 @@ namespace PATCHMAN // ctor & init CFileReceiver(); void init(NLNET::IModule* parent,const std::string& fileSpec="*/*"); + void init(NLNET::IModule* parent,const std::vector &fileSpecs); // CModuleBase specialisation implementation void onModuleUp(NLNET::IModuleProxy *module); @@ -120,7 +121,7 @@ namespace PATCHMAN private: // private data ----------------------------------------------------------- NLNET::IModule* _Parent; - NLMISC::CSString _FileSpec; + std::vector _FileSpecs; CAdministeredModuleWrapper _AdministeredModuleWrapper; // some handy data types diff --git a/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp b/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp index a5583aabc..672ce0f38 100644 --- a/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp +++ b/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp @@ -392,7 +392,10 @@ bool CServerPatchApplier::initModule(const TParsedCommandLine &initInfo) // initialise the module base classes... logMsg+= CAdministeredModuleBase::init(initInfo); - CFileReceiver::init(this,"*/*.tgz"); + std::vector fileSpecs; + fileSpecs.push_back("*/*.tgz"); + fileSpecs.push_back("*/*.7z"); + CFileReceiver::init(this, fileSpecs); CDeploymentConfigurationSynchroniser::init(this); // now that the base classes have been initialised, we can cumulate the module manifests @@ -403,7 +406,7 @@ bool CServerPatchApplier::initModule(const TParsedCommandLine &initInfo) registerProgress(string("SPA Initialised: ")+logMsg+" "+_Manifest); setStateVariable("State","Initialised"); broadcastStateInfo(); - + return true; } @@ -865,7 +868,8 @@ bool CServerPatchApplier::_patchNextFile(const NLMISC::CSString& domainName,uint NLMISC::CSString buildNumber= NLMISC::toString("%06u",nextVersion); NLMISC::CSString baseFileName= *rit; NLMISC::CSString tagFileName= baseFileName+".tag"; - NLMISC::CSString tgzFileName= baseFileName+".tgz"; + // NLMISC::CSString tgzFileName= baseFileName+".tgz"; + NLMISC::CSString tgzFileName= baseFileName+".7z"; // if the archive file is missing then dispatch a request for it and give up if (!NLMISC::CFile::fileExists(_Directories.getNextPatchDirectory(domainName)+tgzFileName))