From: Mikko Rasa Date: Tue, 7 May 2013 18:43:11 +0000 (+0300) Subject: Add a convenience function for saving caches in PackageManager X-Git-Url: http://git.tdb.fi/?p=builder.git;a=commitdiff_plain;h=d6d1d6ef8f589747b996f223c6c65dd293fedd93 Add a convenience function for saving caches in PackageManager --- diff --git a/source/buildercli.cpp b/source/buildercli.cpp index c470f04..6292318 100644 --- a/source/buildercli.cpp +++ b/source/buildercli.cpp @@ -315,11 +315,7 @@ bool BuilderCLI::prepare_build() build_graph.force_full_rebuild(); if(!dry_run) - { - const PackageManager::PackageMap &packages = package_manager.get_packages(); - for(PackageManager::PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i) - i->second->save_caches(); - } + package_manager.save_all_caches(); return true; } diff --git a/source/packagemanager.cpp b/source/packagemanager.cpp index f840ea2..0e2d8a0 100644 --- a/source/packagemanager.cpp +++ b/source/packagemanager.cpp @@ -244,3 +244,9 @@ FS::Path PackageManager::get_binary_package_file(const string &name) return FS::Path(); } + +void PackageManager::save_all_caches() const +{ + for(PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i) + i->second->save_caches(); +} diff --git a/source/packagemanager.h b/source/packagemanager.h index 9b4f347..b168d72 100644 --- a/source/packagemanager.h +++ b/source/packagemanager.h @@ -71,6 +71,9 @@ private: /** Determines the file containing a binary package. The file is expected to be named after the package. */ Msp::FS::Path get_binary_package_file(const std::string &); + +public: + void save_all_caches() const; }; #endif