# download.use_deltarpm.always = false
##
+## Hint which media to prefer when installing packages (download vs. CD).
+##
+## Valid values: download, volatile
+## Default value: download
+##
+## Note that this just a hint. First of all the solver will choose the 'best'
+## package according to its repos proiority, version and architecture. But if
+## there is a choice, we will prefer packages from the desired media.
+##
+## Packages available loacaly are always prefered. The question is whether
+## you prefer packages being downloaded via FTP/HTTP/HTTPS (download), rather
+## than being prompted to insert a CD/DVD (volatile), in case they are available
+## on both media.
+##
+## Name | Priority | URI
+## openSUSE-11.1 99 dvd:///
+## openSUSE-11.1-Oss 99 http://download.opensuse.org/distribution/11.1/repo/oss
+##
+## In the above example 2 repositories with similar content are used. Rather
+## than raising the priority of one of them to 'prefer' a certain media, you
+## should use the same priority for both and set download.media_preference
+## instead.
+##
+## download.media_preference = download
+
+##
## Defining directory which contains vendor description files.
##
## One file in this directory reflects a group of equivalent vendors. e.G.:
} // namespace zypp
///////////////////////////////////////////////////////////////////
+ /** Mutable option with initial value. */
+ template<class _Tp, _Tp _Initial>
+ struct Option
+ {
+ typedef _Tp value_type;
+
+ Option()
+ : _val( _Initial )
+ {}
+
+ value_type get() const
+ { return _val; }
+
+ void set( const value_type & newval_r )
+ { _val = newval_r; }
+
+ private:
+ value_type _val;
+ };
+
+ /** Mutable option with initial value also remembering a config value. */
+ template<class _Tp, _Tp _Initial>
+ struct DefaultOption : public Option<_Tp,_Initial>
+ {
+ typedef _Tp value_type;
+ typedef Option<_Tp,_Initial> option_type;
+
+ void restoreDefault()
+ { this->set( _default.get() ); }
+
+ void restoreDefault( const value_type & newval_r )
+ { setDefault( newval_r ); restoreDefault(); }
+
+ value_type getDefault() const
+ { return _default.get(); }
+
+ void setDefault( const value_type & newval_r )
+ { _default.set( newval_r ); }
+
+ private:
+ option_type _default;
+ };
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ZConfig::Impl
{
download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
}
+ else if ( entry == "download.media_preference" )
+ {
+ download_media_prefer_download.restoreDefault( str::compareCI( value, "volatile" ) != 0 );
+ }
else if ( entry == "download.max_concurrent_connections" )
{
str::strtonum(value, download_max_concurrent_connections);
bool download_use_deltarpm;
bool download_use_deltarpm_always;
+ DefaultOption<bool,true> download_media_prefer_download;
int download_max_concurrent_connections;
int download_min_download_speed;
bool ZConfig::download_use_deltarpm_always() const
{ return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
+ bool ZConfig::download_media_prefer_download() const
+ { return _pimpl->download_media_prefer_download.get(); }
+
+ void ZConfig::set_download_media_prefer_download( bool yesno_r )
+ { _pimpl->download_media_prefer_download.set( yesno_r ); }
+
+ void ZConfig::set_default_download_media_prefer_download()
+ { _pimpl->download_media_prefer_download.restoreDefault(); }
+
long ZConfig::download_max_concurrent_connections() const
{ return _pimpl->download_max_concurrent_connections; }
-
+
long ZConfig::download_min_download_speed() const
{ return _pimpl->download_min_download_speed; }
-
+
long ZConfig::download_max_download_speed() const
{ return _pimpl->download_max_download_speed; }
bool download_use_deltarpm_always() const;
/**
+ * Hint which media to prefer when installing packages (download vs. CD).
+ * \see class \ref media::MediaPriority
+ */
+ bool download_media_prefer_download() const;
+ /** \overload */
+ bool download_media_prefer_volatile() const
+ { return ! download_media_prefer_download(); }
+ /**
+ * Set \ref download_media_prefer_download to a specific value.
+ */
+ void set_download_media_prefer_download( bool yesno_r );
+ /**
+ * Set \ref download_media_prefer_download to the configfiles default.
+ */
+ void set_default_download_media_prefer_download();
+
+ /**
* Directory for equivalent vendor definitions (configPath()/vendors.d)
* \ingroup g_ZC_CONFIGFILES
*/