1
/*---------------------------------------------------------------------\
3
| |__ / \ / / . \ . \ |
8
\---------------------------------------------------------------------*/
9
/** \file zypp/ZConfig.cc
15
#include <sys/utsname.h>
16
#if __GLIBC_PREREQ (2,16)
17
#include <sys/auxv.h> // getauxval for PPC64P7 detection
20
#include <solv/solvversion.h>
24
#include "zypp/base/Logger.h"
25
#include "zypp/base/IOStream.h"
26
#include "zypp/base/InputStream.h"
27
#include "zypp/base/String.h"
29
#include "zypp/ZConfig.h"
30
#include "zypp/ZYppFactory.h"
31
#include "zypp/PathInfo.h"
32
#include "zypp/parser/IniDict.h"
34
#include "zypp/sat/Pool.h"
37
using namespace zypp::filesystem;
38
using namespace zypp::parser;
40
#undef ZYPP_BASE_LOGGER_LOGGROUP
41
#define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
43
///////////////////////////////////////////////////////////////////
45
{ /////////////////////////////////////////////////////////////////
46
/** \addtogroup ZyppConfig Zypp Configuration Options
48
* The global \c zypp.conf configuration file is per default located in \c /etc/zypp/.
49
* An alternate config file can be set using the environment varaible \c ZYPP_CONF=<PATH>
50
* (see \ref zypp-envars).
52
* \section ZyppConfig_ZyppConfSample Sample zypp.conf
53
* \include ../zypp.conf
55
///////////////////////////////////////////////////////////////////
57
{ /////////////////////////////////////////////////////////////////
59
/** Determine system architecture evaluating \c uname and \c /proc/cpuinfo.
61
Arch _autodetectSystemArchitecture()
64
if ( ::uname( &buf ) < 0 )
66
ERR << "Can't determine system architecture" << endl;
70
Arch architecture( buf.machine );
71
MIL << "Uname architecture is '" << buf.machine << "'" << endl;
73
if ( architecture == Arch_i686 )
75
// some CPUs report i686 but dont implement cx8 and cmov
76
// check for both flags in /proc/cpuinfo and downgrade
77
// to i586 if either is missing (cf bug #18885)
78
std::ifstream cpuinfo( "/proc/cpuinfo" );
81
for( iostr::EachLine in( cpuinfo ); in; in.next() )
83
if ( str::hasPrefix( *in, "flags" ) )
85
if ( in->find( "cx8" ) == std::string::npos
86
|| in->find( "cmov" ) == std::string::npos )
88
architecture = Arch_i586;
89
WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
97
ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
100
else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
102
// Check for sun4[vum] to get the real arch. (bug #566291)
103
std::ifstream cpuinfo( "/proc/cpuinfo" );
106
for( iostr::EachLine in( cpuinfo ); in; in.next() )
108
if ( str::hasPrefix( *in, "type" ) )
110
if ( in->find( "sun4v" ) != std::string::npos )
112
architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
113
WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
115
else if ( in->find( "sun4u" ) != std::string::npos )
117
architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
118
WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
120
else if ( in->find( "sun4m" ) != std::string::npos )
122
architecture = Arch_sparcv8;
123
WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
131
ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
134
else if ( architecture == Arch_armv7l || architecture == Arch_armv6l )
136
std::ifstream platform( "/etc/rpm/platform" );
139
for( iostr::EachLine in( platform ); in; in.next() )
141
if ( str::hasPrefix( *in, "armv7hl-" ) )
143
architecture = Arch_armv7hl;
144
WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture << "'" << endl;
147
if ( str::hasPrefix( *in, "armv6hl-" ) )
149
architecture = Arch_armv6hl;
150
WAR << "/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture << "'" << endl;
156
#if __GLIBC_PREREQ (2,16)
157
else if ( architecture == Arch_ppc64 )
159
const char * platform = (const char *)getauxval( AT_PLATFORM );
161
if ( platform && sscanf( platform, "power%d", &powerlvl ) == 1 && powerlvl > 6 )
162
architecture = Arch_ppc64p7;
168
/** The locale to be used for texts and messages.
170
* For the encoding to be used the preference is
172
* LC_ALL, LC_CTYPE, LANG
174
* For the language of the messages to be used, the preference is
176
* LANGUAGE, LC_ALL, LC_MESSAGES, LANG
178
* Note that LANGUAGE can contain more than one locale name, it can be
179
* a list of locale names like for example
181
* LANGUAGE=ja_JP.UTF-8:de_DE.UTF-8:fr_FR.UTF-8
183
* \todo Support dynamic fallbacklists defined by LANGUAGE
185
Locale _autodetectTextLocale()
188
const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
189
for ( const char ** envvar = envlist; *envvar; ++envvar )
191
const char * envlang = getenv( *envvar );
194
std::string envstr( envlang );
195
if ( envstr != "POSIX" && envstr != "C" )
197
Locale lang( envstr );
198
if ( ! lang.code().empty() )
200
MIL << "Found " << *envvar << "=" << envstr << endl;
207
MIL << "Default text locale is '" << ret << "'" << endl;
208
#warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
209
setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
213
/////////////////////////////////////////////////////////////////
215
///////////////////////////////////////////////////////////////////
217
/** Mutable option. */
221
typedef _Tp value_type;
223
/** No default ctor, explicit initialisation! */
224
Option( const value_type & initial_r )
228
/** Get the value. */
229
const value_type & get() const
232
/** Autoconversion to value_type. */
233
operator const value_type &() const
236
/** Set a new value. */
237
void set( const value_type & newval_r )
240
/** Non-const reference to set a new value. */
248
/** Mutable option with initial value also remembering a config value. */
250
struct DefaultOption : public Option<_Tp>
252
typedef _Tp value_type;
253
typedef Option<_Tp> option_type;
255
DefaultOption( const value_type & initial_r )
256
: Option<_Tp>( initial_r ), _default( initial_r )
259
/** Reset value to the current default. */
260
void restoreToDefault()
261
{ this->set( _default.get() ); }
263
/** Reset value to a new default. */
264
void restoreToDefault( const value_type & newval_r )
265
{ setDefault( newval_r ); restoreToDefault(); }
267
/** Get the current default value. */
268
const value_type & getDefault() const
269
{ return _default.get(); }
271
/** Set a new default value. */
272
void setDefault( const value_type & newval_r )
273
{ _default.set( newval_r ); }
276
option_type _default;
279
///////////////////////////////////////////////////////////////////
281
// CLASS NAME : ZConfig::Impl
283
/** ZConfig implementation.
284
* \todo Enrich section and entry definition by some comment
285
* (including the default setting and provide some method to
286
* write this into a sample zypp.conf.
291
Impl( const Pathname & override_r = Pathname() )
292
: _parsedZyppConf ( override_r )
293
, cfg_arch ( defaultSystemArchitecture() )
294
, cfg_textLocale ( defaultTextLocale() )
295
, updateMessagesNotify ( "single | /usr/lib/zypp/notify-message -p %p" )
296
, repo_add_probe ( false )
297
, repo_refresh_delay ( 10 )
298
, repoLabelIsAlias ( false )
299
, download_use_deltarpm ( true )
300
, download_use_deltarpm_always ( false )
301
, download_media_prefer_download( true )
302
, download_max_concurrent_connections( 5 )
303
, download_min_download_speed ( 0 )
304
, download_max_download_speed ( 0 )
305
, download_max_silent_tries ( 5 )
306
, download_transfer_timeout ( 180 )
307
, commit_downloadMode ( DownloadDefault )
308
, solver_onlyRequires ( false )
309
, solver_allowVendorChange ( false )
310
, solver_cleandepsOnRemove ( false )
311
, solver_upgradeTestcasesToKeep ( 2 )
312
, solverUpgradeRemoveDroppedPackages( true )
313
, apply_locks_file ( true )
314
, pluginsPath ( "/usr/lib/zypp/plugins" )
316
MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
317
// override_r has higest prio
318
// ZYPP_CONF might override /etc/zypp/zypp.conf
319
if ( _parsedZyppConf.empty() )
321
const char *env_confpath = getenv( "ZYPP_CONF" );
322
_parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
326
// Inject this into ZConfig. Be shure this is
327
// allocated via new. See: reconfigureZConfig
328
INT << "Reconfigure to " << _parsedZyppConf << endl;
329
ZConfig::instance()._pimpl.reset( this );
331
if ( PathInfo(_parsedZyppConf).isExist() )
333
parser::IniDict dict( _parsedZyppConf );
334
for ( IniDict::section_const_iterator sit = dict.sectionsBegin();
335
sit != dict.sectionsEnd();
338
string section(*sit);
339
//MIL << section << endl;
340
for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
341
it != dict.entriesEnd(*sit);
344
string entry(it->first);
345
string value(it->second);
346
//DBG << (*it).first << "=" << (*it).second << endl;
347
if ( section == "main" )
349
if ( entry == "arch" )
352
if ( carch != cfg_arch )
354
WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
358
else if ( entry == "cachedir" )
360
cfg_cache_path = Pathname(value);
362
else if ( entry == "metadatadir" )
364
cfg_metadata_path = Pathname(value);
366
else if ( entry == "solvfilesdir" )
368
cfg_solvfiles_path = Pathname(value);
370
else if ( entry == "packagesdir" )
372
cfg_packages_path = Pathname(value);
374
else if ( entry == "configdir" )
376
cfg_config_path = Pathname(value);
378
else if ( entry == "reposdir" )
380
cfg_known_repos_path = Pathname(value);
382
else if ( entry == "servicesdir" )
384
cfg_known_services_path = Pathname(value);
386
else if ( entry == "repo.add.probe" )
388
repo_add_probe = str::strToBool( value, repo_add_probe );
390
else if ( entry == "repo.refresh.delay" )
392
str::strtonum(value, repo_refresh_delay);
394
else if ( entry == "repo.refresh.locales" )
396
std::vector<std::string> tmp;
397
str::split( value, back_inserter( tmp ), ", \t" );
399
boost::function<Locale(const std::string &)> transform(
400
[](const std::string & str_r)->Locale{ return Locale(str_r); }
402
repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
403
make_transform_iterator( tmp.end(), transform ) );
405
else if ( entry == "download.use_deltarpm" )
407
download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
409
else if ( entry == "download.use_deltarpm.always" )
411
download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
413
else if ( entry == "download.media_preference" )
415
download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
417
else if ( entry == "download.max_concurrent_connections" )
419
str::strtonum(value, download_max_concurrent_connections);
421
else if ( entry == "download.min_download_speed" )
423
str::strtonum(value, download_min_download_speed);
425
else if ( entry == "download.max_download_speed" )
427
str::strtonum(value, download_max_download_speed);
429
else if ( entry == "download.max_silent_tries" )
431
str::strtonum(value, download_max_silent_tries);
433
else if ( entry == "download.transfer_timeout" )
435
str::strtonum(value, download_transfer_timeout);
436
if ( download_transfer_timeout < 0 ) download_transfer_timeout = 0;
437
else if ( download_transfer_timeout > 3600 ) download_transfer_timeout = 3600;
439
else if ( entry == "commit.downloadMode" )
441
commit_downloadMode.set( deserializeDownloadMode( value ) );
443
else if ( entry == "vendordir" )
445
cfg_vendor_path = Pathname(value);
447
else if ( entry == "multiversiondir" )
449
cfg_multiversion_path = Pathname(value);
451
else if ( entry == "solver.onlyRequires" )
453
solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
455
else if ( entry == "solver.allowVendorChange" )
457
solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
459
else if ( entry == "solver.cleandepsOnRemove" )
461
solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
463
else if ( entry == "solver.upgradeTestcasesToKeep" )
465
solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
467
else if ( entry == "solver.upgradeRemoveDroppedPackages" )
469
solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
471
else if ( entry == "solver.checkSystemFile" )
473
solver_checkSystemFile = Pathname(value);
475
else if ( entry == "multiversion" )
477
str::split( value, inserter( _multiversion, _multiversion.end() ), ", \t" );
479
else if ( entry == "locksfile.path" )
481
locks_file = Pathname(value);
483
else if ( entry == "locksfile.apply" )
485
apply_locks_file = str::strToBool( value, apply_locks_file );
487
else if ( entry == "update.datadir" )
489
update_data_path = Pathname(value);
491
else if ( entry == "update.scriptsdir" )
493
update_scripts_path = Pathname(value);
495
else if ( entry == "update.messagessdir" )
497
update_messages_path = Pathname(value);
499
else if ( entry == "update.messages.notify" )
501
updateMessagesNotify.set( value );
503
else if ( entry == "rpm.install.excludedocs" )
505
rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
506
str::strToBool( value, false ) );
508
else if ( entry == "history.logfile" )
510
history_log_path = Pathname(value);
512
else if ( entry == "credentials.global.dir" )
514
credentials_global_dir_path = Pathname(value);
516
else if ( entry == "credentials.global.file" )
518
credentials_global_file_path = Pathname(value);
526
MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
527
_parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
531
if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
533
Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
534
if ( carch != cfg_arch )
536
WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
540
MIL << "ZConfig singleton created." << endl;
547
/** Remember any parsed zypp.conf. */
548
Pathname _parsedZyppConf;
551
Locale cfg_textLocale;
553
Pathname cfg_cache_path;
554
Pathname cfg_metadata_path;
555
Pathname cfg_solvfiles_path;
556
Pathname cfg_packages_path;
558
Pathname cfg_config_path;
559
Pathname cfg_known_repos_path;
560
Pathname cfg_known_services_path;
562
Pathname cfg_vendor_path;
563
Pathname cfg_multiversion_path;
566
Pathname update_data_path;
567
Pathname update_scripts_path;
568
Pathname update_messages_path;
569
DefaultOption<std::string> updateMessagesNotify;
572
unsigned repo_refresh_delay;
573
LocaleSet repoRefreshLocales;
574
bool repoLabelIsAlias;
576
bool download_use_deltarpm;
577
bool download_use_deltarpm_always;
578
DefaultOption<bool> download_media_prefer_download;
580
int download_max_concurrent_connections;
581
int download_min_download_speed;
582
int download_max_download_speed;
583
int download_max_silent_tries;
584
int download_transfer_timeout;
586
Option<DownloadMode> commit_downloadMode;
588
Option<bool> solver_onlyRequires;
589
Option<bool> solver_allowVendorChange;
590
Option<bool> solver_cleandepsOnRemove;
591
Option<unsigned> solver_upgradeTestcasesToKeep;
592
DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
594
Pathname solver_checkSystemFile;
596
std::set<std::string> & multiversion() { return getMultiversion(); }
597
const std::set<std::string> & multiversion() const { return getMultiversion(); }
599
bool apply_locks_file;
601
target::rpm::RpmInstFlags rpmInstallFlags;
603
Pathname history_log_path;
604
Pathname credentials_global_dir_path;
605
Pathname credentials_global_file_path;
607
std::string userData;
609
Option<Pathname> pluginsPath;
612
std::set<std::string> & getMultiversion() const
614
if ( ! _multiversionInitialized )
616
Pathname multiversionDir( cfg_multiversion_path );
617
if ( multiversionDir.empty() )
618
multiversionDir = ( cfg_config_path.empty() ? Pathname("/etc/zypp") : cfg_config_path ) / "multiversion.d";
620
filesystem::dirForEach( multiversionDir,
621
[this]( const Pathname & dir_r, const char *const & name_r )->bool
623
MIL << "Parsing " << dir_r/name_r << endl;
624
iostr::simpleParseFile( InputStream( dir_r/name_r ),
625
[this]( int num_r, std::string line_r )->bool
627
DBG << " found " << line_r << endl;
628
_multiversion.insert( line_r );
633
_multiversionInitialized = true;
635
return _multiversion;
637
mutable std::set<std::string> _multiversion;
638
mutable DefaultIntegral<bool,false> _multiversionInitialized;
640
///////////////////////////////////////////////////////////////////
642
// Backdoor to redirect ZConfig from within the running
643
// TEST-application. HANDLE WITH CARE!
644
void reconfigureZConfig( const Pathname & override_r )
646
// ctor puts itself unter smart pointer control.
647
new ZConfig::Impl( override_r );
650
///////////////////////////////////////////////////////////////////
652
// METHOD NAME : ZConfig::instance
653
// METHOD TYPE : ZConfig &
655
ZConfig & ZConfig::instance()
657
static ZConfig _instance; // The singleton
661
///////////////////////////////////////////////////////////////////
663
// METHOD NAME : ZConfig::ZConfig
664
// METHOD TYPE : Ctor
672
///////////////////////////////////////////////////////////////////
674
// METHOD NAME : ZConfig::~ZConfig
675
// METHOD TYPE : Dtor
680
Pathname ZConfig::systemRoot() const
682
Target_Ptr target( getZYpp()->getTarget() );
683
return target ? target->root() : Pathname();
686
///////////////////////////////////////////////////////////////////
688
// system architecture
690
///////////////////////////////////////////////////////////////////
692
Arch ZConfig::defaultSystemArchitecture()
694
static Arch _val( _autodetectSystemArchitecture() );
698
Arch ZConfig::systemArchitecture() const
699
{ return _pimpl->cfg_arch; }
701
void ZConfig::setSystemArchitecture( const Arch & arch_r )
703
if ( arch_r != _pimpl->cfg_arch )
705
WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
706
_pimpl->cfg_arch = arch_r;
710
///////////////////////////////////////////////////////////////////
714
///////////////////////////////////////////////////////////////////
716
Locale ZConfig::defaultTextLocale()
718
static Locale _val( _autodetectTextLocale() );
722
Locale ZConfig::textLocale() const
723
{ return _pimpl->cfg_textLocale; }
725
void ZConfig::setTextLocale( const Locale & locale_r )
727
if ( locale_r != _pimpl->cfg_textLocale )
729
WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
730
_pimpl->cfg_textLocale = locale_r;
731
#warning prefer signal
732
sat::Pool::instance().setTextLocale( locale_r );
736
///////////////////////////////////////////////////////////////////
738
///////////////////////////////////////////////////////////////////
740
bool ZConfig::hasUserData() const
741
{ return !_pimpl->userData.empty(); }
743
std::string ZConfig::userData() const
744
{ return _pimpl->userData; }
746
bool ZConfig::setUserData( const std::string & str_r )
748
for_( ch, str_r.begin(), str_r.end() )
750
if ( *ch < ' ' && *ch != '\t' )
752
ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl;
756
MIL << "Set user data string to '" << str_r << "'" << endl;
757
_pimpl->userData = str_r;
761
///////////////////////////////////////////////////////////////////
763
Pathname ZConfig::repoCachePath() const
765
return ( _pimpl->cfg_cache_path.empty()
766
? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
769
Pathname ZConfig::repoMetadataPath() const
771
return ( _pimpl->cfg_metadata_path.empty()
772
? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
775
Pathname ZConfig::repoSolvfilesPath() const
777
return ( _pimpl->cfg_solvfiles_path.empty()
778
? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
781
Pathname ZConfig::repoPackagesPath() const
783
return ( _pimpl->cfg_packages_path.empty()
784
? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
787
///////////////////////////////////////////////////////////////////
789
Pathname ZConfig::configPath() const
791
return ( _pimpl->cfg_config_path.empty()
792
? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
795
Pathname ZConfig::knownReposPath() const
797
return ( _pimpl->cfg_known_repos_path.empty()
798
? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
801
Pathname ZConfig::knownServicesPath() const
803
return ( _pimpl->cfg_known_services_path.empty()
804
? (configPath()/"services.d") : _pimpl->cfg_known_services_path );
807
Pathname ZConfig::vendorPath() const
809
return ( _pimpl->cfg_vendor_path.empty()
810
? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
813
Pathname ZConfig::locksFile() const
815
return ( _pimpl->locks_file.empty()
816
? (configPath()/"locks") : _pimpl->locks_file );
819
///////////////////////////////////////////////////////////////////
821
bool ZConfig::repo_add_probe() const
822
{ return _pimpl->repo_add_probe; }
824
unsigned ZConfig::repo_refresh_delay() const
825
{ return _pimpl->repo_refresh_delay; }
827
LocaleSet ZConfig::repoRefreshLocales() const
828
{ return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
830
bool ZConfig::repoLabelIsAlias() const
831
{ return _pimpl->repoLabelIsAlias; }
833
void ZConfig::repoLabelIsAlias( bool yesno_r )
834
{ _pimpl->repoLabelIsAlias = yesno_r; }
836
bool ZConfig::download_use_deltarpm() const
837
{ return _pimpl->download_use_deltarpm; }
839
bool ZConfig::download_use_deltarpm_always() const
840
{ return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
842
bool ZConfig::download_media_prefer_download() const
843
{ return _pimpl->download_media_prefer_download; }
845
void ZConfig::set_download_media_prefer_download( bool yesno_r )
846
{ _pimpl->download_media_prefer_download.set( yesno_r ); }
848
void ZConfig::set_default_download_media_prefer_download()
849
{ _pimpl->download_media_prefer_download.restoreToDefault(); }
851
long ZConfig::download_max_concurrent_connections() const
852
{ return _pimpl->download_max_concurrent_connections; }
854
long ZConfig::download_min_download_speed() const
855
{ return _pimpl->download_min_download_speed; }
857
long ZConfig::download_max_download_speed() const
858
{ return _pimpl->download_max_download_speed; }
860
long ZConfig::download_max_silent_tries() const
861
{ return _pimpl->download_max_silent_tries; }
863
long ZConfig::download_transfer_timeout() const
864
{ return _pimpl->download_transfer_timeout; }
866
DownloadMode ZConfig::commit_downloadMode() const
867
{ return _pimpl->commit_downloadMode; }
869
bool ZConfig::solver_onlyRequires() const
870
{ return _pimpl->solver_onlyRequires; }
872
bool ZConfig::solver_allowVendorChange() const
873
{ return _pimpl->solver_allowVendorChange; }
875
bool ZConfig::solver_cleandepsOnRemove() const
876
{ return _pimpl->solver_cleandepsOnRemove; }
878
Pathname ZConfig::solver_checkSystemFile() const
879
{ return ( _pimpl->solver_checkSystemFile.empty()
880
? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
882
unsigned ZConfig::solver_upgradeTestcasesToKeep() const
883
{ return _pimpl->solver_upgradeTestcasesToKeep; }
885
bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->solverUpgradeRemoveDroppedPackages; }
886
void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
887
void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
889
const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); }
890
void ZConfig::multiversionSpec( std::set<std::string> new_r ) { _pimpl->multiversion().swap( new_r ); }
891
void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); }
892
void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); }
893
void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); }
895
bool ZConfig::apply_locks_file() const
896
{ return _pimpl->apply_locks_file; }
898
Pathname ZConfig::update_dataPath() const
900
return ( _pimpl->update_data_path.empty()
901
? Pathname("/var/adm") : _pimpl->update_data_path );
904
Pathname ZConfig::update_messagesPath() const
906
return ( _pimpl->update_messages_path.empty()
907
? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
910
Pathname ZConfig::update_scriptsPath() const
912
return ( _pimpl->update_scripts_path.empty()
913
? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
916
std::string ZConfig::updateMessagesNotify() const
917
{ return _pimpl->updateMessagesNotify; }
919
void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
920
{ _pimpl->updateMessagesNotify.set( val_r ); }
922
void ZConfig::resetUpdateMessagesNotify()
923
{ _pimpl->updateMessagesNotify.restoreToDefault(); }
925
///////////////////////////////////////////////////////////////////
927
target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
928
{ return _pimpl->rpmInstallFlags; }
931
Pathname ZConfig::historyLogFile() const
933
return ( _pimpl->history_log_path.empty() ?
934
Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
937
Pathname ZConfig::credentialsGlobalDir() const
939
return ( _pimpl->credentials_global_dir_path.empty() ?
940
Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
943
Pathname ZConfig::credentialsGlobalFile() const
945
return ( _pimpl->credentials_global_file_path.empty() ?
946
Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
949
///////////////////////////////////////////////////////////////////
951
std::string ZConfig::distroverpkg() const
952
{ return "redhat-release"; }
954
///////////////////////////////////////////////////////////////////
956
Pathname ZConfig::pluginsPath() const
957
{ return _pimpl->pluginsPath.get(); }
959
///////////////////////////////////////////////////////////////////
961
std::ostream & ZConfig::about( std::ostream & str ) const
963
str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
965
str << "libsolv: " << solv_version;
966
if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
967
str << " (built against " << LIBSOLV_VERSION_STRING << ")";
970
str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
971
str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
972
str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
976
/////////////////////////////////////////////////////////////////
978
///////////////////////////////////////////////////////////////////