[zypp-commit] r7068 - in /trunk/libzypp: devel/devel.ma/Parse.cc zypp/ZConfig.cc zypp/ZConfig.h
Author: mlandres Date: Fri Aug 31 21:41:15 2007 New Revision: 7068 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7068&view=rev Log: Added "bool ZConfig::download_use_patchrpm()" and "bool ZConfig::download_use_deltarpm()" and corresponding zypp.conf entries: [main] download.use_patchrpm = true download.use_deltarpm = true Modified: trunk/libzypp/devel/devel.ma/Parse.cc trunk/libzypp/zypp/ZConfig.cc trunk/libzypp/zypp/ZConfig.h Modified: trunk/libzypp/devel/devel.ma/Parse.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Parse.cc?rev=7068&r1=7067&r2=7068&view=diff ============================================================================== --- trunk/libzypp/devel/devel.ma/Parse.cc (original) +++ trunk/libzypp/devel/devel.ma/Parse.cc Fri Aug 31 21:41:15 2007 @@ -345,6 +345,12 @@ { //zypp::base::LogControl::instance().logfile( "log.restrict" ); INT << "===[START]==========================================" << endl; + setenv( "ZYPP_CONF", "/Local/ROOT/zypp.conf", 1 ); + + + INT << ZConfig::instance().download_use_patchrpm() << endl; + INT << ZConfig::instance().download_use_deltarpm() << endl; + return 0; DigestReceive foo; KeyRingSignalsReceive baa; Modified: trunk/libzypp/zypp/ZConfig.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.cc?rev=7068&r1=7067&r2=7068&view=diff ============================================================================== --- trunk/libzypp/zypp/ZConfig.cc (original) +++ trunk/libzypp/zypp/ZConfig.cc Fri Aug 31 21:41:15 2007 @@ -12,6 +12,7 @@ #include <iostream> #include "zypp/base/Logger.h" #include "zypp/base/InputStream.h" +#include "zypp/base/String.h" #include "zypp/ZConfig.h" #include "zypp/ZYppFactory.h" @@ -31,14 +32,20 @@ // CLASS NAME : ZConfig::Impl // /** ZConfig implementation. + * \todo Enrich section and entry definition by some comment + * (including the default setting and provide some method to + * write this into a sample zypp.conf. */ class ZConfig::Impl { public: Impl() - : repo_add_probe(false), - repo_refresh_delay(10), - autolock_untrustedvendor(false) + : repo_add_probe ( false ) + , repo_refresh_delay ( 10 ) + , download_use_patchrpm ( true ) + , download_use_deltarpm ( true ) + , autolock_untrustedvendor( false ) + { MIL << "ZConfig singleton created." << endl; @@ -54,21 +61,22 @@ else { MIL << confpath << " not found, using defaults instead." << endl; + return; } - - for ( IniDict::section_const_iterator sit = dict.sectionsBegin(); + + for ( IniDict::section_const_iterator sit = dict.sectionsBegin(); sit != dict.sectionsEnd(); ++sit ) { string section(*sit); //MIL << section << endl; - for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit); + for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit); it != dict.entriesEnd(*sit); ++it ) { string entry(it->first); string value(it->second); - // DBG << (*it).first << "=" << (*it).second << endl; + //DBG << (*it).first << "=" << (*it).second << endl; if ( section == "main" ) { if ( entry == "arch" ) @@ -89,41 +97,52 @@ } else if ( entry == "repo.add.probe" ) { - repo_add_probe = (value == "1"); + repo_add_probe = str::strToBool( value, repo_add_probe ); } else if ( entry == "repo.refresh.delay" ) { str::strtonum(value, repo_refresh_delay); } + else if ( entry == "download.use_patchrpm" ) + { + download_use_patchrpm = str::strToBool( value, download_use_patchrpm ); + } + else if ( entry == "download.use_deltarpm" ) + { + download_use_deltarpm = str::strToBool( value, download_use_deltarpm ); + } } else if ( section == "locking" ) { - autolock_untrustedvendor = ( value == "1" ); + autolock_untrustedvendor = str::strToBool( value, autolock_untrustedvendor ); } - + } } - + } ~Impl() {} - + public: parser::IniDict dict; - + Arch cfg_arch; - + Pathname cfg_metadata_path; Pathname cfg_cache_path; Pathname cfg_known_repos_path; - + bool repo_add_probe; unsigned repo_refresh_delay; - + + bool download_use_patchrpm; + bool download_use_deltarpm; + // [locking] bool autolock_untrustedvendor; - + }; /////////////////////////////////////////////////////////////////// @@ -146,7 +165,7 @@ ZConfig::ZConfig() : _pimpl( new Impl ) { - + } /////////////////////////////////////////////////////////////////// @@ -197,19 +216,19 @@ Pathname ZConfig::repoMetadataPath() const { - return ( _pimpl->cfg_metadata_path.empty() + return ( _pimpl->cfg_metadata_path.empty() ? Pathname("/var/cache/zypp/raw") : _pimpl->cfg_metadata_path ); } Pathname ZConfig::repoCachePath() const { - return ( _pimpl->cfg_cache_path.empty() + return ( _pimpl->cfg_cache_path.empty() ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path ); } Pathname ZConfig::knownReposPath() const { - return ( _pimpl->cfg_known_repos_path.empty() + return ( _pimpl->cfg_known_repos_path.empty() ? Pathname("/etc/zypp/repos.d") : _pimpl->cfg_known_repos_path ); } @@ -229,11 +248,17 @@ return _pimpl->repo_refresh_delay; } + bool ZConfig::download_use_patchrpm() const + { return _pimpl->download_use_patchrpm; } + + bool ZConfig::download_use_deltarpm() const + { return _pimpl->download_use_deltarpm; } + bool ZConfig::autolock_untrustedvendor() const { return _pimpl->autolock_untrustedvendor; } - + ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/ZConfig.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.h?rev=7068&r1=7067&r2=7068&view=diff ============================================================================== --- trunk/libzypp/zypp/ZConfig.h (original) +++ trunk/libzypp/zypp/ZConfig.h Fri Aug 31 21:41:15 2007 @@ -94,13 +94,23 @@ */ unsigned repo_refresh_delay() const; + /** Whether to consider using a patchrpm when downloading a package. + * Config option <tt>download.use_patchrpm (true)</tt> + */ + bool download_use_patchrpm() const; + + /** Whether to consider using a deltarpm when downloading a package. + * Config option <tt>download.use_deltarpm (true)</tt> + */ + bool download_use_deltarpm() const; + /** * Whether untrusted vendor should be autolocked / config option * repo.add.probe */ bool autolock_untrustedvendor() const; - + public: class Impl; /** Dtor */ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
mlandres@svn.opensuse.org