Remove obsolete ResStatus bits.
[platform/upstream/libzypp.git] / zypp / ZConfig.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ZConfig.cc
10  *
11 */
12 extern "C"
13 {
14 #include <sys/utsname.h>
15 #include <unistd.h>
16 #include <satsolver/satversion.h>
17 }
18 #include <iostream>
19 #include <fstream>
20 #include "zypp/base/Logger.h"
21 #include "zypp/base/IOStream.h"
22 #include "zypp/base/InputStream.h"
23 #include "zypp/base/String.h"
24
25 #include "zypp/ZConfig.h"
26 #include "zypp/ZYppFactory.h"
27 #include "zypp/PathInfo.h"
28 #include "zypp/parser/IniDict.h"
29
30 using namespace std;
31 using namespace zypp::filesystem;
32 using namespace zypp::parser;
33
34 #undef ZYPP_BASE_LOGGER_LOGGROUP
35 #define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
36
37 ///////////////////////////////////////////////////////////////////
38 namespace zypp
39 { /////////////////////////////////////////////////////////////////
40
41   ///////////////////////////////////////////////////////////////////
42   namespace
43   { /////////////////////////////////////////////////////////////////
44
45     /** Determine system architecture evaluating \c uname and \c /proc/cpuinfo.
46     */
47     Arch _autodetectSystemArchitecture()
48     {
49       struct ::utsname buf;
50       if ( ::uname( &buf ) < 0 )
51       {
52         ERR << "Can't determine system architecture" << endl;
53         return Arch_noarch;
54       }
55
56       Arch architecture( buf.machine );
57       MIL << "Uname architecture is '" << buf.machine << "'" << endl;
58
59       // some CPUs report i686 but dont implement cx8 and cmov
60       // check for both flags in /proc/cpuinfo and downgrade
61       // to i586 if either is missing (cf bug #18885)
62       if ( architecture == Arch_i686 )
63       {
64         std::ifstream cpuinfo( "/proc/cpuinfo" );
65         if ( cpuinfo )
66         {
67           for( iostr::EachLine in( cpuinfo ); in; in.next() )
68           {
69             if ( str::hasPrefix( *in, "flags" ) )
70             {
71               if (    in->find( "cx8" ) == std::string::npos
72                    || in->find( "cmov" ) == std::string::npos )
73               {
74                 architecture = Arch_i586;
75                 WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
76               }
77               break;
78             }
79           }
80         }
81         else
82         {
83           ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
84         }
85       }
86       return architecture;
87     }
88
89      /** The locale to be used for texts and messages.
90      *
91      * For the encoding to be used the preference is
92      *
93      *    LC_ALL, LC_CTYPE, LANG
94      *
95      * For the language of the messages to be used, the preference is
96      *
97      *    LANGUAGE, LC_ALL, LC_MESSAGES, LANG
98      *
99      * Note that LANGUAGE can contain more than one locale name, it can be
100      * a list of locale names like for example
101      *
102      *    LANGUAGE=ja_JP.UTF-8:de_DE.UTF-8:fr_FR.UTF-8
103
104      * \todo Support dynamic fallbacklists defined by LANGUAGE
105      */
106     Locale _autodetectTextLocale()
107     {
108       Locale ret( "en" );
109       const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
110       for ( const char ** envvar = envlist; *envvar; ++envvar )
111       {
112         const char * envlang = getenv( *envvar );
113         if ( envlang )
114         {
115           std::string envstr( envlang );
116           if ( envstr != "POSIX" && envstr != "C" )
117           {
118             Locale lang( envstr );
119             if ( ! lang.code().empty() )
120             {
121               MIL << "Found " << *envvar << "=" << envstr << endl;
122               ret = lang;
123               break;
124             }
125           }
126         }
127       }
128       MIL << "Default text locale is '" << ret << "'" << endl;
129 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
130       setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
131       return ret;
132     }
133
134    /////////////////////////////////////////////////////////////////
135   } // namespace zypp
136   ///////////////////////////////////////////////////////////////////
137
138   /** Mutable option. */
139   template<class _Tp>
140       struct Option
141       {
142         typedef _Tp value_type;
143
144         /** No default ctor, explicit initialisation! */
145         Option( const value_type & initial_r )
146           : _val( initial_r )
147         {}
148
149         /** Get the value.  */
150         const value_type & get() const
151         { return _val; }
152
153         /** Autoconversion to value_type.  */
154         operator const value_type &() const
155         { return _val; }
156
157         /** Set a new value.  */
158         void set( const value_type & newval_r )
159         { _val = newval_r; }
160
161         /** Non-const reference to set a new value. */
162         value_type & ref()
163         { return _val; }
164
165         private:
166           value_type _val;
167       };
168
169   /** Mutable option with initial value also remembering a config value. */
170   template<class _Tp>
171       struct DefaultOption : public Option<_Tp>
172       {
173         typedef _Tp         value_type;
174         typedef Option<_Tp> option_type;
175
176         DefaultOption( const value_type & initial_r )
177           : Option<_Tp>( initial_r ), _default( initial_r )
178         {}
179
180         /** Reset value to the current default. */
181         void restoreToDefault()
182         { this->set( _default.get() ); }
183
184         /** Reset value to a new default. */
185         void restoreToDefault( const value_type & newval_r )
186         { setDefault( newval_r ); restoreToDefault(); }
187
188         /** Get the current default value. */
189         const value_type & getDefault() const
190         { return _default.get(); }
191
192         /** Set a new default value. */
193         void setDefault( const value_type & newval_r )
194         { _default.set( newval_r ); }
195
196         private:
197           option_type _default;
198       };
199
200   ///////////////////////////////////////////////////////////////////
201   //
202   //    CLASS NAME : ZConfig::Impl
203   //
204   /** ZConfig implementation.
205    * \todo Enrich section and entry definition by some comment
206    * (including the default setting and provide some method to
207    * write this into a sample zypp.conf.
208   */
209   class ZConfig::Impl
210   {
211     public:
212       Impl( const Pathname & override_r = Pathname() )
213         : _parsedZyppConf               ( override_r )
214         , cfg_arch                      ( defaultSystemArchitecture() )
215         , cfg_textLocale                ( defaultTextLocale() )
216         , updateMessagesNotify          ( "single | /usr/lib/zypp/notify-message -p %p" )
217         , repo_add_probe                ( false )
218         , repo_refresh_delay            ( 10 )
219         , download_use_deltarpm         ( true )
220         , download_use_deltarpm_always  ( false )
221         , download_media_prefer_download( true )
222         , download_max_concurrent_connections( 2 )
223         , download_min_download_speed   ( 0 )
224         , download_max_download_speed   ( 0 )
225         , download_max_silent_tries     ( 5 )
226         , commit_downloadMode           ( DownloadDefault )
227         , solver_onlyRequires           ( false )
228         , solver_allowVendorChange      ( false )
229         , solver_upgradeTestcasesToKeep ( 2 )
230         , solverUpgradeRemoveDropedPackages( true )
231         , apply_locks_file              ( true )
232
233       {
234         MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " <<  __TIME__ << endl;
235         // override_r has higest prio
236         // ZYPP_CONF might override /etc/zypp/zypp.conf
237         if ( _parsedZyppConf.empty() )
238         {
239           const char *env_confpath = getenv( "ZYPP_CONF" );
240           _parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
241         }
242         else
243         {
244           // Inject this into ZConfig. Be shure this is
245           // allocated via new. See: reconfigureZConfig
246           INT << "Reconfigure to " << _parsedZyppConf << endl;
247           ZConfig::instance()._pimpl.reset( this );
248         }
249         if ( PathInfo(_parsedZyppConf).isExist() )
250         {
251           parser::IniDict dict( _parsedZyppConf );
252           for ( IniDict::section_const_iterator sit = dict.sectionsBegin();
253                 sit != dict.sectionsEnd();
254                 ++sit )
255           {
256             string section(*sit);
257             //MIL << section << endl;
258             for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
259                   it != dict.entriesEnd(*sit);
260                   ++it )
261             {
262               string entry(it->first);
263               string value(it->second);
264               //DBG << (*it).first << "=" << (*it).second << endl;
265               if ( section == "main" )
266               {
267                 if ( entry == "arch" )
268                 {
269                   Arch carch( value );
270                   if ( carch != cfg_arch )
271                   {
272                     WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
273                     cfg_arch = carch;
274                   }
275                 }
276                 else if ( entry == "cachedir" )
277                 {
278                   cfg_cache_path = Pathname(value);
279                 }
280                 else if ( entry == "metadatadir" )
281                 {
282                   cfg_metadata_path = Pathname(value);
283                 }
284                 else if ( entry == "solvfilesdir" )
285                 {
286                   cfg_solvfiles_path = Pathname(value);
287                 }
288                 else if ( entry == "packagesdir" )
289                 {
290                   cfg_packages_path = Pathname(value);
291                 }
292                 else if ( entry == "configdir" )
293                 {
294                   cfg_config_path = Pathname(value);
295                 }
296                 else if ( entry == "reposdir" )
297                 {
298                   cfg_known_repos_path = Pathname(value);
299                 }
300                 else if ( entry == "servicesdir" )
301                 {
302                   cfg_known_services_path = Pathname(value);
303                 }
304                 else if ( entry == "repo.add.probe" )
305                 {
306                   repo_add_probe = str::strToBool( value, repo_add_probe );
307                 }
308                 else if ( entry == "repo.refresh.delay" )
309                 {
310                   str::strtonum(value, repo_refresh_delay);
311                 }
312                 else if ( entry == "download.use_deltarpm" )
313                 {
314                   download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
315                 }
316                 else if ( entry == "download.use_deltarpm.always" )
317                 {
318                   download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
319                 }
320                 else if ( entry == "download.media_preference" )
321                 {
322                   download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
323                 }
324                 else if ( entry == "download.max_concurrent_connections" )
325                 {
326                   str::strtonum(value, download_max_concurrent_connections);
327                 }
328                 else if ( entry == "download.min_download_speed" )
329                 {
330                   str::strtonum(value, download_min_download_speed);
331                 }
332                 else if ( entry == "download.max_download_speed" )
333                 {
334                   str::strtonum(value, download_max_download_speed);
335                 }
336                 else if ( entry == "download.max_silent_tries" )
337                 {
338                   str::strtonum(value, download_max_silent_tries);
339                 }
340                 else if ( entry == "commit.downloadMode" )
341                 {
342                   commit_downloadMode.set( deserializeDownloadMode( value ) );
343                 }
344                 else if ( entry == "vendordir" )
345                 {
346                   cfg_vendor_path = Pathname(value);
347                 }
348                 else if ( entry == "solver.onlyRequires" )
349                 {
350                   solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
351                 }
352                 else if ( entry == "solver.allowVendorChange" )
353                 {
354                   solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
355                 }
356                 else if ( entry == "solver.upgradeTestcasesToKeep" )
357                 {
358                   solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
359                 }
360                 else if ( entry == "solver.upgradeRemoveDropedPackages" )
361                 {
362                   solverUpgradeRemoveDropedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDropedPackages.getDefault() ) );
363                 }
364                 else if ( entry == "solver.checkSystemFile" )
365                 {
366                   solver_checkSystemFile = Pathname(value);
367                 }
368                 else if ( entry == "multiversion" )
369                 {
370                   std::list<std::string> multi;
371                   str::split( value, back_inserter(multi), ", \t" );
372                   for ( std::list<string>::const_iterator it = multi.begin();
373                         it != multi.end(); it++) {
374                       multiversion.insert (IdString(*it));
375                   }
376                 }
377                 else if ( entry == "locksfile.path" )
378                 {
379                   locks_file = Pathname(value);
380                 }
381                 else if ( entry == "locksfile.apply" )
382                 {
383                   apply_locks_file = str::strToBool( value, apply_locks_file );
384                 }
385                 else if ( entry == "update.datadir" )
386                 {
387                   update_data_path = Pathname(value);
388                 }
389                 else if ( entry == "update.scriptsdir" )
390                 {
391                   update_scripts_path = Pathname(value);
392                 }
393                 else if ( entry == "update.messagessdir" )
394                 {
395                   update_messages_path = Pathname(value);
396                 }
397                 else if ( entry == "update.messages.notify" )
398                 {
399                   updateMessagesNotify.set( value );
400                 }
401                 else if ( entry == "rpm.install.excludedocs" )
402                 {
403                   rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
404                                            str::strToBool( value, false ) );
405                 }
406                 else if ( entry == "history.logfile" )
407                 {
408                   history_log_path = Pathname(value);
409                 }
410                 else if ( entry == "credentials.global.dir" )
411                 {
412                   credentials_global_dir_path = Pathname(value);
413                 }
414                 else if ( entry == "credentials.global.file" )
415                 {
416                   credentials_global_file_path = Pathname(value);
417                 }
418               }
419             }
420           }
421         }
422         else
423         {
424           MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
425           _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
426         }
427
428         // legacy:
429         if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
430         {
431           Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
432           if ( carch != cfg_arch )
433           {
434             WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
435             cfg_arch = carch;
436           }
437         }
438         MIL << "ZConfig singleton created." << endl;
439       }
440
441       ~Impl()
442       {}
443
444     public:
445     /** Remember any parsed zypp.conf. */
446     Pathname _parsedZyppConf;
447
448     Arch     cfg_arch;
449     Locale   cfg_textLocale;
450
451     Pathname cfg_cache_path;
452     Pathname cfg_metadata_path;
453     Pathname cfg_solvfiles_path;
454     Pathname cfg_packages_path;
455
456     Pathname cfg_config_path;
457     Pathname cfg_known_repos_path;
458     Pathname cfg_known_services_path;
459     Pathname cfg_vendor_path;
460     Pathname locks_file;
461
462     Pathname update_data_path;
463     Pathname update_scripts_path;
464     Pathname update_messages_path;
465     DefaultOption<std::string> updateMessagesNotify;
466
467     bool repo_add_probe;
468     unsigned repo_refresh_delay;
469
470     bool download_use_deltarpm;
471     bool download_use_deltarpm_always;
472     DefaultOption<bool> download_media_prefer_download;
473
474     int download_max_concurrent_connections;
475     int download_min_download_speed;
476     int download_max_download_speed;
477     int download_max_silent_tries;
478
479     Option<DownloadMode> commit_downloadMode;
480
481     Option<bool>        solver_onlyRequires;
482     Option<bool>        solver_allowVendorChange;
483     Option<unsigned>    solver_upgradeTestcasesToKeep;
484     DefaultOption<bool> solverUpgradeRemoveDropedPackages;
485
486     Pathname solver_checkSystemFile;
487
488     std::set<IdString> multiversion;
489
490     bool apply_locks_file;
491
492     target::rpm::RpmInstFlags rpmInstallFlags;
493
494     Pathname history_log_path;
495     Pathname credentials_global_dir_path;
496     Pathname credentials_global_file_path;
497   };
498   ///////////////////////////////////////////////////////////////////
499
500   // Backdoor to redirect ZConfig from within the running
501   // TEST-application. HANDLE WITH CARE!
502   void reconfigureZConfig( const Pathname & override_r )
503   {
504     // ctor puts itself unter smart pointer control.
505     new ZConfig::Impl( override_r );
506   }
507
508   ///////////////////////////////////////////////////////////////////
509   //
510   //    METHOD NAME : ZConfig::instance
511   //    METHOD TYPE : ZConfig &
512   //
513   ZConfig & ZConfig::instance()
514   {
515     static ZConfig _instance; // The singleton
516     return _instance;
517   }
518
519   ///////////////////////////////////////////////////////////////////
520   //
521   //    METHOD NAME : ZConfig::ZConfig
522   //    METHOD TYPE : Ctor
523   //
524   ZConfig::ZConfig()
525   : _pimpl( new Impl )
526   {
527     about( MIL );
528   }
529
530   ///////////////////////////////////////////////////////////////////
531   //
532   //    METHOD NAME : ZConfig::~ZConfig
533   //    METHOD TYPE : Dtor
534   //
535   ZConfig::~ZConfig( )
536   {}
537
538   Pathname ZConfig::systemRoot() const
539   {
540     Target_Ptr target( getZYpp()->getTarget() );
541     return target ? target->root() : Pathname();
542   }
543
544   ///////////////////////////////////////////////////////////////////
545   //
546   // system architecture
547   //
548   ///////////////////////////////////////////////////////////////////
549
550   Arch ZConfig::defaultSystemArchitecture()
551   {
552     static Arch _val( _autodetectSystemArchitecture() );
553     return _val;
554   }
555
556   Arch ZConfig::systemArchitecture() const
557   { return _pimpl->cfg_arch; }
558
559   void ZConfig::setSystemArchitecture( const Arch & arch_r )
560   {
561     if ( arch_r != _pimpl->cfg_arch )
562     {
563       WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
564       _pimpl->cfg_arch = arch_r;
565     }
566   }
567
568   ///////////////////////////////////////////////////////////////////
569   //
570   // text locale
571   //
572   ///////////////////////////////////////////////////////////////////
573
574   Locale ZConfig::defaultTextLocale()
575   {
576     static Locale _val( _autodetectTextLocale() );
577     return _val;
578   }
579
580   Locale ZConfig::textLocale() const
581   { return _pimpl->cfg_textLocale; }
582
583   void ZConfig::setTextLocale( const Locale & locale_r )
584   {
585     if ( locale_r != _pimpl->cfg_textLocale )
586     {
587       WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
588       _pimpl->cfg_textLocale = locale_r;
589     }
590   }
591
592   ///////////////////////////////////////////////////////////////////
593
594   Pathname ZConfig::repoCachePath() const
595   {
596     return ( _pimpl->cfg_cache_path.empty()
597         ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
598   }
599
600   Pathname ZConfig::repoMetadataPath() const
601   {
602     return ( _pimpl->cfg_metadata_path.empty()
603         ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
604   }
605
606   Pathname ZConfig::repoSolvfilesPath() const
607   {
608     return ( _pimpl->cfg_solvfiles_path.empty()
609         ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
610   }
611
612   Pathname ZConfig::repoPackagesPath() const
613   {
614     return ( _pimpl->cfg_packages_path.empty()
615         ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
616   }
617
618   ///////////////////////////////////////////////////////////////////
619
620   Pathname ZConfig::configPath() const
621   {
622     return ( _pimpl->cfg_config_path.empty()
623         ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
624   }
625
626   Pathname ZConfig::knownReposPath() const
627   {
628     return ( _pimpl->cfg_known_repos_path.empty()
629         ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
630   }
631
632   Pathname ZConfig::knownServicesPath() const
633   {
634     return ( _pimpl->cfg_known_services_path.empty()
635         ? (configPath()/"services.d") : _pimpl->cfg_known_repos_path );
636   }
637
638   Pathname ZConfig::vendorPath() const
639   {
640     return ( _pimpl->cfg_vendor_path.empty()
641         ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
642   }
643
644   Pathname ZConfig::locksFile() const
645   {
646     return ( _pimpl->locks_file.empty()
647         ? (configPath()/"locks") : _pimpl->locks_file );
648   }
649
650   ///////////////////////////////////////////////////////////////////
651
652   bool ZConfig::repo_add_probe() const
653   {
654     return _pimpl->repo_add_probe;
655   }
656
657   unsigned ZConfig::repo_refresh_delay() const
658   {
659     return _pimpl->repo_refresh_delay;
660   }
661
662   bool ZConfig::download_use_deltarpm() const
663   { return _pimpl->download_use_deltarpm; }
664
665   bool ZConfig::download_use_deltarpm_always() const
666   { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
667
668   bool ZConfig::download_media_prefer_download() const
669   { return _pimpl->download_media_prefer_download; }
670
671   void ZConfig::set_download_media_prefer_download( bool yesno_r )
672   { _pimpl->download_media_prefer_download.set( yesno_r ); }
673
674   void ZConfig::set_default_download_media_prefer_download()
675   { _pimpl->download_media_prefer_download.restoreToDefault(); }
676
677   long ZConfig::download_max_concurrent_connections() const
678   { return _pimpl->download_max_concurrent_connections; }
679
680   long ZConfig::download_min_download_speed() const
681   { return _pimpl->download_min_download_speed; }
682
683   long ZConfig::download_max_download_speed() const
684   { return _pimpl->download_max_download_speed; }
685
686   long ZConfig::download_max_silent_tries() const
687   { return _pimpl->download_max_silent_tries; }
688
689   DownloadMode ZConfig::commit_downloadMode() const
690   { return _pimpl->commit_downloadMode; }
691
692   bool ZConfig::solver_onlyRequires() const
693   { return _pimpl->solver_onlyRequires; }
694
695   bool ZConfig::solver_allowVendorChange() const
696   { return _pimpl->solver_allowVendorChange; }
697
698   Pathname ZConfig::solver_checkSystemFile() const
699   { return ( _pimpl->solver_checkSystemFile.empty()
700       ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
701
702   unsigned ZConfig::solver_upgradeTestcasesToKeep() const
703   { return _pimpl->solver_upgradeTestcasesToKeep; }
704
705   bool ZConfig::solverUpgradeRemoveDropedPackages() const               { return _pimpl->solverUpgradeRemoveDropedPackages; }
706   void ZConfig::setSolverUpgradeRemoveDropedPackages( bool val_r )      { _pimpl->solverUpgradeRemoveDropedPackages.set( val_r ); }
707   void ZConfig::resetSolverUpgradeRemoveDropedPackages()                { _pimpl->solverUpgradeRemoveDropedPackages.restoreToDefault(); }
708
709   std::set<IdString> ZConfig::multiversion() const
710   { return _pimpl->multiversion; }
711
712   void ZConfig::addMultiversion(std::string &name)
713   { _pimpl->multiversion.insert(IdString(name)); }
714
715   bool ZConfig::removeMultiversion(std::string &name)
716   { return _pimpl->multiversion.erase(IdString(name)); }
717
718   bool ZConfig::apply_locks_file() const
719   { return _pimpl->apply_locks_file; }
720
721   Pathname ZConfig::update_dataPath() const
722   {
723     return ( _pimpl->update_data_path.empty()
724         ? Pathname("/var/adm") : _pimpl->update_data_path );
725   }
726
727   Pathname ZConfig::update_messagesPath() const
728   {
729     return ( _pimpl->update_messages_path.empty()
730              ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
731   }
732
733   Pathname ZConfig::update_scriptsPath() const
734   {
735     return ( _pimpl->update_scripts_path.empty()
736              ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
737   }
738
739   std::string ZConfig::updateMessagesNotify() const
740   { return _pimpl->updateMessagesNotify; }
741
742   void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
743   { _pimpl->updateMessagesNotify.set( val_r ); }
744
745   void ZConfig::resetUpdateMessagesNotify()
746   { _pimpl->updateMessagesNotify.restoreToDefault(); }
747
748   ///////////////////////////////////////////////////////////////////
749
750   target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
751   { return _pimpl->rpmInstallFlags; }
752
753
754   Pathname ZConfig::historyLogFile() const
755   {
756     return ( _pimpl->history_log_path.empty() ?
757         Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
758   }
759
760
761   Pathname ZConfig::credentialsGlobalDir() const
762   {
763     return ( _pimpl->credentials_global_dir_path.empty() ?
764         Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
765   }
766
767   Pathname ZConfig::credentialsGlobalFile() const
768   {
769     return ( _pimpl->credentials_global_file_path.empty() ?
770         Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
771   }
772
773   ///////////////////////////////////////////////////////////////////
774
775   std::string ZConfig::distroverpkg() const
776   { return "redhat-release"; }
777
778   ///////////////////////////////////////////////////////////////////
779
780   std::ostream & ZConfig::about( std::ostream & str ) const
781   {
782     str << "libzypp: " << VERSION << " built " << __DATE__ << " " <<  __TIME__ << endl;
783
784     str << "satsolver: " << sat_version;
785     if ( ::strcmp( sat_version, SATSOLVER_VERSION_STRING ) )
786       str << " (built against " << SATSOLVER_VERSION_STRING << ")";
787     str << endl;
788
789     str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
790     str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
791     str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
792     return str;
793   }
794
795   /////////////////////////////////////////////////////////////////
796 } // namespace zypp
797 ///////////////////////////////////////////////////////////////////