libzypp 17.34.1
ZConfig.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12extern "C"
13{
14#include <features.h>
15#include <sys/utsname.h>
16#if __GLIBC_PREREQ (2,16)
17#include <sys/auxv.h> // getauxval for PPC64P7 detection
18#endif
19#include <unistd.h>
20#include <solv/solvversion.h>
21}
22#include <iostream>
23#include <fstream>
24#include <optional>
25#include <zypp/base/LogTools.h>
26#include <zypp/base/IOStream.h>
27#include <zypp-core/base/InputStream>
28#include <zypp/base/String.h>
29#include <zypp/base/Regex.h>
30
31#include <zypp/ZConfig.h>
32#include <zypp/ZYppFactory.h>
33#include <zypp/PathInfo.h>
34#include <zypp-core/parser/IniDict>
35
36#include <zypp/sat/Pool.h>
38
39#include <zypp-media/MediaConfig>
40
41using std::endl;
42using namespace zypp::filesystem;
43using namespace zypp::parser;
44
45#undef ZYPP_BASE_LOGGER_LOGGROUP
46#define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
47
49namespace zypp
50{
61 namespace
62 {
63
65 // From rpm's lib/rpmrc.c
66# if defined(__linux__) && defined(__x86_64__)
67 static inline void cpuid(uint32_t op, uint32_t op2, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
68 {
69 asm volatile (
70 "cpuid\n"
71 : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
72 : "a" (op), "c" (op2));
73 }
74
75 /* From gcc's gcc/config/i386/cpuid.h */
76 /* Features (%eax == 1) */
77 /* %ecx */
78 #define bit_SSE3 (1 << 0)
79 #define bit_SSSE3 (1 << 9)
80 #define bit_FMA (1 << 12)
81 #define bit_CMPXCHG16B (1 << 13)
82 #define bit_SSE4_1 (1 << 19)
83 #define bit_SSE4_2 (1 << 20)
84 #define bit_MOVBE (1 << 22)
85 #define bit_POPCNT (1 << 23)
86 #define bit_OSXSAVE (1 << 27)
87 #define bit_AVX (1 << 28)
88 #define bit_F16C (1 << 29)
89
90 /* Extended Features (%eax == 0x80000001) */
91 /* %ecx */
92 #define bit_LAHF_LM (1 << 0)
93 #define bit_LZCNT (1 << 5)
94
95 /* Extended Features (%eax == 7) */
96 /* %ebx */
97 #define bit_BMI (1 << 3)
98 #define bit_AVX2 (1 << 5)
99 #define bit_BMI2 (1 << 8)
100 #define bit_AVX512F (1 << 16)
101 #define bit_AVX512DQ (1 << 17)
102 #define bit_AVX512CD (1 << 28)
103 #define bit_AVX512BW (1 << 30)
104 #define bit_AVX512VL (1u << 31)
105
106 static int get_x86_64_level(void)
107 {
108 int level = 1;
109
110 unsigned int op_1_ecx = 0, op_80000001_ecx = 0, op_7_ebx = 0, unused = 0;
111 cpuid(1, 0, &unused, &unused, &op_1_ecx, &unused);
112 cpuid(0x80000001, 0, &unused, &unused, &op_80000001_ecx, &unused);
113 cpuid(7, 0, &unused, &op_7_ebx, &unused, &unused);
114
115 const unsigned int op_1_ecx_lv2 = bit_SSE3 | bit_SSSE3 | bit_CMPXCHG16B | bit_SSE4_1 | bit_SSE4_2 | bit_POPCNT;
116 if ((op_1_ecx & op_1_ecx_lv2) == op_1_ecx_lv2 && (op_80000001_ecx & bit_LAHF_LM))
117 level = 2;
118
119 const unsigned int op_1_ecx_lv3 = bit_FMA | bit_MOVBE | bit_OSXSAVE | bit_AVX | bit_F16C;
120 const unsigned int op_7_ebx_lv3 = bit_BMI | bit_AVX2 | bit_BMI2;
121 if (level == 2 && (op_1_ecx & op_1_ecx_lv3) == op_1_ecx_lv3 && (op_7_ebx & op_7_ebx_lv3) == op_7_ebx_lv3
122 && (op_80000001_ecx & bit_LZCNT))
123 level = 3;
124
125 const unsigned int op_7_ebx_lv4 = bit_AVX512F | bit_AVX512DQ | bit_AVX512CD | bit_AVX512BW | bit_AVX512VL;
126 if (level == 3 && (op_7_ebx & op_7_ebx_lv4) == op_7_ebx_lv4)
127 level = 4;
128
129 return level;
130 }
131# endif
133
136 Arch _autodetectSystemArchitecture()
137 {
138 struct ::utsname buf;
139 if ( ::uname( &buf ) < 0 )
140 {
141 ERR << "Can't determine system architecture" << endl;
142 return Arch_noarch;
143 }
144
145 Arch architecture( buf.machine );
146 MIL << "Uname architecture is '" << buf.machine << "'" << endl;
147
148 if ( architecture == Arch_x86_64 )
149 {
150#if defined(__linux__) && defined(__x86_64__)
151 switch ( get_x86_64_level() )
152 {
153 case 2:
154 architecture = Arch_x86_64_v2;
155 WAR << "CPU has 'x86_64': architecture upgraded to '" << architecture << "'" << endl;
156 break;
157 case 3:
158 architecture = Arch_x86_64_v3;
159 WAR << "CPU has 'x86_64': architecture upgraded to '" << architecture << "'" << endl;
160 break;
161 case 4:
162 architecture = Arch_x86_64_v4;
163 WAR << "CPU has 'x86_64': architecture upgraded to '" << architecture << "'" << endl;
164 break;
165 }
166# endif
167 }
168 else if ( architecture == Arch_i686 )
169 {
170 // some CPUs report i686 but dont implement cx8 and cmov
171 // check for both flags in /proc/cpuinfo and downgrade
172 // to i586 if either is missing (cf bug #18885)
173 std::ifstream cpuinfo( "/proc/cpuinfo" );
174 if ( cpuinfo )
175 {
176 for( iostr::EachLine in( cpuinfo ); in; in.next() )
177 {
178 if ( str::hasPrefix( *in, "flags" ) )
179 {
180 if ( in->find( "cx8" ) == std::string::npos
181 || in->find( "cmov" ) == std::string::npos )
182 {
183 architecture = Arch_i586;
184 WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
185 }
186 break;
187 }
188 }
189 }
190 else
191 {
192 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
193 }
194 }
195 else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
196 {
197 // Check for sun4[vum] to get the real arch. (bug #566291)
198 std::ifstream cpuinfo( "/proc/cpuinfo" );
199 if ( cpuinfo )
200 {
201 for( iostr::EachLine in( cpuinfo ); in; in.next() )
202 {
203 if ( str::hasPrefix( *in, "type" ) )
204 {
205 if ( in->find( "sun4v" ) != std::string::npos )
206 {
207 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
208 WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
209 }
210 else if ( in->find( "sun4u" ) != std::string::npos )
211 {
212 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
213 WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
214 }
215 else if ( in->find( "sun4m" ) != std::string::npos )
216 {
217 architecture = Arch_sparcv8;
218 WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
219 }
220 break;
221 }
222 }
223 }
224 else
225 {
226 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
227 }
228 }
229 else if ( architecture == Arch_armv8l || architecture == Arch_armv7l || architecture == Arch_armv6l )
230 {
231 std::ifstream platform( "/etc/rpm/platform" );
232 if (platform)
233 {
234 for( iostr::EachLine in( platform ); in; in.next() )
235 {
236 if ( str::hasPrefix( *in, "armv8hl-" ) )
237 {
238 architecture = Arch_armv8hl;
239 WAR << "/etc/rpm/platform contains armv8hl-: architecture upgraded to '" << architecture << "'" << endl;
240 break;
241 }
242 if ( str::hasPrefix( *in, "armv7hl-" ) )
243 {
244 architecture = Arch_armv7hl;
245 WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture << "'" << endl;
246 break;
247 }
248 if ( str::hasPrefix( *in, "armv6hl-" ) )
249 {
250 architecture = Arch_armv6hl;
251 WAR << "/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture << "'" << endl;
252 break;
253 }
254 }
255 }
256 }
257#if __GLIBC_PREREQ (2,16)
258 else if ( architecture == Arch_ppc64 )
259 {
260 const char * platform = (const char *)getauxval( AT_PLATFORM );
261 int powerlvl = 0;
262 if ( platform && sscanf( platform, "power%d", &powerlvl ) == 1 && powerlvl > 6 )
263 architecture = Arch_ppc64p7;
264 }
265#endif
266 return architecture;
267 }
268
286 Locale _autodetectTextLocale()
287 {
288 Locale ret( Locale::enCode );
289 const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
290 for ( const char ** envvar = envlist; *envvar; ++envvar )
291 {
292 const char * envlang = getenv( *envvar );
293 if ( envlang )
294 {
295 std::string envstr( envlang );
296 if ( envstr != "POSIX" && envstr != "C" )
297 {
298 Locale lang( envstr );
299 if ( lang )
300 {
301 MIL << "Found " << *envvar << "=" << envstr << endl;
302 ret = lang;
303 break;
304 }
305 }
306 }
307 }
308 MIL << "Default text locale is '" << ret << "'" << endl;
309#warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
310 setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
311 return ret;
312 }
313
314
315 inline Pathname _autodetectSystemRoot()
316 {
317 Target_Ptr target( getZYpp()->getTarget() );
318 return target ? target->root() : Pathname();
319 }
320
321 inline Pathname _autodetectZyppConfPath()
322 {
323 const char *env_confpath = getenv( "ZYPP_CONF" );
324 return env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
325 }
326
328 } // namespace zypp
330
332 template<class Tp>
333 struct Option
334 {
335 using value_type = Tp;
336
338 Option( value_type initial_r )
339 : _val( std::move(initial_r) )
340 {}
341
343 { set( std::move(newval_r) ); return *this; }
344
346 const value_type & get() const
347 { return _val; }
348
350 operator const value_type &() const
351 { return _val; }
352
354 void set( value_type newval_r )
355 { _val = std::move(newval_r); }
356
357 private:
359 };
360
362 template<class Tp>
363 struct DefaultOption : public Option<Tp>
364 {
365 using value_type = Tp;
367
368 explicit DefaultOption( value_type initial_r )
369 : Option<Tp>( initial_r )
370 , _default( std::move(initial_r) )
371 {}
372
374 { this->set( std::move(newval_r) ); return *this; }
375
378 { this->set( _default.get() ); }
379
382 { setDefault( std::move(newval_r) ); restoreToDefault(); }
383
385 const value_type & getDefault() const
386 { return _default.get(); }
387
389 void setDefault( value_type newval_r )
390 { _default.set( std::move(newval_r) ); }
391
392 private:
394 };
395
397 //
398 // CLASS NAME : ZConfig::Impl
399 //
406 {
407 using MultiversionSpec = std::set<std::string>;
408
411 {
424
425 bool consume( const std::string & entry, const std::string & value )
426 {
427 if ( entry == "solver.focus" )
428 {
429 fromString( value, solver_focus );
430 }
431 else if ( entry == "solver.onlyRequires" )
432 {
434 }
435 else if ( entry == "solver.allowVendorChange" )
436 {
438 }
439 else if ( entry == "solver.dupAllowDowngrade" )
440 {
442 }
443 else if ( entry == "solver.dupAllowNameChange" )
444 {
446 }
447 else if ( entry == "solver.dupAllowArchChange" )
448 {
450 }
451 else if ( entry == "solver.dupAllowVendorChange" )
452 {
454 }
455 else if ( entry == "solver.cleandepsOnRemove" )
456 {
458 }
459 else if ( entry == "solver.upgradeTestcasesToKeep" )
460 {
462 }
463 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
464 {
466 }
467 else
468 return false;
469
470 return true;
471 }
472
483 };
484
485 public:
487 : _parsedZyppConf ( _autodetectZyppConfPath() )
490 , cfg_cache_path { "/var/cache/zypp" }
491 , cfg_metadata_path { "" } // empty - follows cfg_cache_path
492 , cfg_solvfiles_path { "" } // empty - follows cfg_cache_path
493 , cfg_packages_path { "" } // empty - follows cfg_cache_path
494 , updateMessagesNotify ( "" )
495 , repo_add_probe ( false )
496 , repo_refresh_delay ( 10 )
497 , repoLabelIsAlias ( false )
498 , download_use_deltarpm ( true )
501 , download_mediaMountdir ( "/var/adm/mount" )
503 , gpgCheck ( true )
504 , repoGpgCheck ( indeterminate )
505 , pkgGpgCheck ( indeterminate )
506 , apply_locks_file ( true )
507 , pluginsPath ( "/usr/lib/zypp/plugins" )
508 , geoipEnabled ( true )
509 , geoipHosts { "download.opensuse.org" }
510 {
511 MIL << "libzypp: " LIBZYPP_VERSION_STRING << endl;
512 if ( PathInfo(_parsedZyppConf).isExist() )
513 {
516 sit != dict.sectionsEnd();
517 ++sit )
518 {
519 const std::string& section(*sit);
520 //MIL << section << endl;
521 for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
522 it != dict.entriesEnd(*sit);
523 ++it )
524 {
525 std::string entry(it->first);
526 std::string value(it->second);
527
528 if ( _mediaConf.setConfigValue( section, entry, value ) )
529 continue;
530
531 //DBG << (*it).first << "=" << (*it).second << endl;
532 if ( section == "main" )
533 {
534 if ( _initialTargetDefaults.consume( entry, value ) )
535 continue;
536
537 if ( entry == "arch" )
538 {
539 Arch carch( value );
540 if ( carch != cfg_arch )
541 {
542 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
543 cfg_arch = carch;
544 }
545 }
546 else if ( entry == "cachedir" )
547 {
548 cfg_cache_path.restoreToDefault( value );
549 }
550 else if ( entry == "metadatadir" )
551 {
552 cfg_metadata_path.restoreToDefault( value );
553 }
554 else if ( entry == "solvfilesdir" )
555 {
556 cfg_solvfiles_path.restoreToDefault( value );
557 }
558 else if ( entry == "packagesdir" )
559 {
560 cfg_packages_path.restoreToDefault( value );
561 }
562 else if ( entry == "configdir" )
563 {
564 cfg_config_path = Pathname(value);
565 }
566 else if ( entry == "reposdir" )
567 {
569 }
570 else if ( entry == "servicesdir" )
571 {
573 }
574 else if ( entry == "varsdir" )
575 {
576 cfg_vars_path = Pathname(value);
577 }
578 else if ( entry == "repo.add.probe" )
579 {
581 }
582 else if ( entry == "repo.refresh.delay" )
583 {
585 }
586 else if ( entry == "repo.refresh.locales" )
587 {
588 std::vector<std::string> tmp;
589 str::split( value, back_inserter( tmp ), ", \t" );
590
591 boost::function<Locale(const std::string &)> transform(
592 [](const std::string & str_r)->Locale{ return Locale(str_r); }
593 );
594 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
595 make_transform_iterator( tmp.end(), transform ) );
596 }
597 else if ( entry == "download.use_deltarpm" )
598 {
600 }
601 else if ( entry == "download.use_deltarpm.always" )
602 {
604 }
605 else if ( entry == "download.media_preference" )
606 {
608 }
609 else if ( entry == "download.media_mountdir" )
610 {
611 download_mediaMountdir.restoreToDefault( Pathname(value) );
612 }
613 else if ( entry == "download.use_geoip_mirror") {
615 }
616 else if ( entry == "commit.downloadMode" )
617 {
618 commit_downloadMode.set( deserializeDownloadMode( value ) );
619 }
620 else if ( entry == "gpgcheck" )
621 {
623 }
624 else if ( entry == "repo_gpgcheck" )
625 {
627 }
628 else if ( entry == "pkg_gpgcheck" )
629 {
631 }
632 else if ( entry == "vendordir" )
633 {
634 cfg_vendor_path = Pathname(value);
635 }
636 else if ( entry == "multiversiondir" )
637 {
639 }
640 else if ( entry == "multiversion.kernels" )
641 {
642 cfg_kernel_keep_spec = value;
643 }
644 else if ( entry == "solver.checkSystemFile" )
645 {
647 }
648 else if ( entry == "solver.checkSystemFileDir" )
649 {
651 }
652 else if ( entry == "multiversion" )
653 {
655 str::splitEscaped( value, std::inserter( defSpec, defSpec.end() ), ", \t" );
656 }
657 else if ( entry == "locksfile.path" )
658 {
659 locks_file = Pathname(value);
660 }
661 else if ( entry == "locksfile.apply" )
662 {
664 }
665 else if ( entry == "update.datadir" )
666 {
667 update_data_path = Pathname(value);
668 }
669 else if ( entry == "update.scriptsdir" )
670 {
672 }
673 else if ( entry == "update.messagessdir" )
674 {
676 }
677 else if ( entry == "update.messages.notify" )
678 {
679 updateMessagesNotify.set( value );
680 }
681 else if ( entry == "rpm.install.excludedocs" )
682 {
684 str::strToBool( value, false ) );
685 }
686 else if ( entry == "history.logfile" )
687 {
688 history_log_path = Pathname(value);
689 }
690 else if ( entry == "techpreview.ZYPP_SINGLE_RPMTRANS" )
691 {
692 DBG << "techpreview.ZYPP_SINGLE_RPMTRANS=" << value << endl;
693 ::setenv( "ZYPP_SINGLE_RPMTRANS", value.c_str(), 1 );
694 }
695 else if ( entry == "techpreview.ZYPP_MEDIANETWORK" )
696 {
697 DBG << "techpreview.ZYPP_MEDIANETWORK=" << value << endl;
698 ::setenv( "ZYPP_MEDIANETWORK", value.c_str(), 1 );
699 }
700 }
701 }
702 }
703 }
704 else
705 {
706 MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
707 _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
708 }
709
710 // legacy:
711 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
712 {
713 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
714 if ( carch != cfg_arch )
715 {
716 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
717 cfg_arch = carch;
718 }
719 }
720 MIL << "ZConfig singleton created." << endl;
721 }
722
723 Impl(const Impl &) = delete;
724 Impl(Impl &&) = delete;
725 Impl &operator=(const Impl &) = delete;
726 Impl &operator=(Impl &&) = delete;
727 ~Impl() {}
728
730 {
731 Pathname newRoot { _autodetectSystemRoot() };
732 MIL << "notifyTargetChanged (" << newRoot << ")" << endl;
733
734 if ( newRoot.emptyOrRoot() ) {
735 _currentTargetDefaults.reset(); // to initial settigns from /
736 }
737 else {
739
740 Pathname newConf { newRoot/_autodetectZyppConfPath() };
741 if ( PathInfo(newConf).isExist() ) {
742 parser::IniDict dict( newConf );
743 for ( const auto & [entry,value] : dict.entries( "main" ) ) {
744 (*_currentTargetDefaults).consume( entry, value );
745 }
746 }
747 else {
748 MIL << _parsedZyppConf << " not found, using defaults." << endl;
749 }
750 }
751 }
752
753 public:
756
759
760 DefaultOption<Pathname> cfg_cache_path; // Settings from the config file are also remembered
761 DefaultOption<Pathname> cfg_metadata_path; // 'default'. Cleanup in RepoManager e.g needs to tell
762 DefaultOption<Pathname> cfg_solvfiles_path; // whether settings in effect are config values or
763 DefaultOption<Pathname> cfg_packages_path; // custom settings applied vie set...Path().
764
770
775
780
785
790
792
796
799
801 const MultiversionSpec & multiversion() const { return getMultiversion(); }
802
804
805 target::rpm::RpmInstFlags rpmInstallFlags;
806
808
809 std::string userData;
810
812
814
815 std::vector<std::string> geoipHosts;
816
817 /* Other config singleton instances */
819
820
821 public:
824 private:
826 std::optional<TargetDefaults> _currentTargetDefaults;
827
828 private:
829 // HACK for bnc#906096: let pool re-evaluate multiversion spec
830 // if target root changes. ZConfig returns data sensitive to
831 // current target root.
832 // TODO Actually we'd need to scan the target systems zypp.conf and
833 // overlay all system specific values.
835 {
836 using SpecMap = std::map<Pathname, MultiversionSpec>;
837
838 MultiversionSpec & getSpec( Pathname root_r, const Impl & zConfImpl_r ) // from system at root
839 {
840 // _specMap[] - the plain zypp.conf value
841 // _specMap[/] - combine [] and multiversion.d scan
842 // _specMap[root] - scan root/zypp.conf and root/multiversion.d
843
844 if ( root_r.empty() )
845 root_r = "/";
846 bool cacheHit = _specMap.count( root_r );
847 MultiversionSpec & ret( _specMap[root_r] ); // creates new entry on the fly
848
849 if ( ! cacheHit )
850 {
851 // bsc#1193488: If no (/root)/.../zypp.conf exists use the default zypp.conf
852 // multiversion settings. It is a legacy that the packaged multiversion setting
853 // in zypp.conf (the kernel) may differ from the builtin default (empty).
854 // But we want a missing config to behave similar to the default one, otherwise
855 // a bare metal install easily runs into trouble.
856 if ( root_r == "/" || scanConfAt( root_r, ret, zConfImpl_r ) == 0 )
857 ret = _specMap[Pathname()];
858 scanDirAt( root_r, ret, zConfImpl_r ); // add multiversion.d at root_r
859 using zypp::operator<<;
860 MIL << "MultiversionSpec '" << root_r << "' = " << ret << endl;
861 }
862 return ret;
863 }
864
865 MultiversionSpec & getDefaultSpec() // Spec from zypp.conf parsing; called before any getSpec
866 { return _specMap[Pathname()]; }
867
868 private:
869 int scanConfAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
870 {
871 static const str::regex rx( "^multiversion *= *(.*)" );
872 str::smatch what;
873 return iostr::simpleParseFile( InputStream( Pathname::assertprefix( root_r, _autodetectZyppConfPath() ) ),
874 [&]( int num_r, std::string line_r )->bool
875 {
876 if ( line_r[0] == 'm' && str::regex_match( line_r, what, rx ) )
877 {
878 str::splitEscaped( what[1], std::inserter( spec_r, spec_r.end() ), ", \t" );
879 return false; // stop after match
880 }
881 return true;
882 } );
883 }
884
885 void scanDirAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
886 {
887 // NOTE: Actually we'd need to scan and use the root_r! zypp.conf values.
888 Pathname multiversionDir( zConfImpl_r.cfg_multiversion_path );
889 if ( multiversionDir.empty() )
890 multiversionDir = ( zConfImpl_r.cfg_config_path.empty()
891 ? Pathname("/etc/zypp")
892 : zConfImpl_r.cfg_config_path ) / "multiversion.d";
893
894 filesystem::dirForEach( Pathname::assertprefix( root_r, multiversionDir ),
895 [&spec_r]( const Pathname & dir_r, const char *const & name_r )->bool
896 {
897 MIL << "Parsing " << dir_r/name_r << endl;
898 iostr::simpleParseFile( InputStream( dir_r/name_r ),
899 [&spec_r]( int num_r, std::string line_r )->bool
900 {
901 DBG << " found " << line_r << endl;
902 spec_r.insert( std::move(line_r) );
903 return true;
904 } );
905 return true;
906 } );
907 }
908
909 private:
911 };
912
914 { return _multiversionMap.getSpec( _autodetectSystemRoot(), *this ); }
915
917 };
919
921 //
922 // METHOD NAME : ZConfig::instance
923 // METHOD TYPE : ZConfig &
924 //
926 {
927 static ZConfig _instance; // The singleton
928 return _instance;
929 }
930
932 //
933 // METHOD NAME : ZConfig::ZConfig
934 // METHOD TYPE : Ctor
935 //
937 : _pimpl( new Impl )
938 {
939 about( MIL );
940 }
941
943 //
944 // METHOD NAME : ZConfig::~ZConfig
945 // METHOD TYPE : Dtor
946 //
949
951 { return _pimpl->notifyTargetChanged(); }
952
954 { return _autodetectSystemRoot(); }
955
957 {
958 return ( _pimpl->cfg_repo_mgr_root_path.empty()
959 ? systemRoot() : _pimpl->cfg_repo_mgr_root_path );
960 }
961
963 { _pimpl->cfg_repo_mgr_root_path = root; }
964
966 //
967 // system architecture
968 //
970
972 {
973 static Arch _val( _autodetectSystemArchitecture() );
974 return _val;
975 }
976
978 { return _pimpl->cfg_arch; }
979
981 {
982 if ( arch_r != _pimpl->cfg_arch )
983 {
984 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
985 _pimpl->cfg_arch = arch_r;
986 }
987 }
988
990 //
991 // text locale
992 //
994
996 {
997 static Locale _val( _autodetectTextLocale() );
998 return _val;
999 }
1000
1002 { return _pimpl->cfg_textLocale; }
1003
1004 void ZConfig::setTextLocale( const Locale & locale_r )
1005 {
1006 if ( locale_r != _pimpl->cfg_textLocale )
1007 {
1008 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
1009 _pimpl->cfg_textLocale = locale_r;
1010 // Propagate changes
1011 sat::Pool::instance().setTextLocale( locale_r );
1012 }
1013 }
1014
1016 // user data
1018
1020 { return !_pimpl->userData.empty(); }
1021
1022 std::string ZConfig::userData() const
1023 { return _pimpl->userData; }
1024
1025 bool ZConfig::setUserData( const std::string & str_r )
1026 {
1027 for_( ch, str_r.begin(), str_r.end() )
1028 {
1029 if ( *ch < ' ' && *ch != '\t' )
1030 {
1031 ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl;
1032 return false;
1033 }
1034 }
1035 MIL << "Set user data string to '" << str_r << "'" << endl;
1036 _pimpl->userData = str_r;
1037 return true;
1038 }
1039
1041
1043 {
1044 return ( _pimpl->cfg_cache_path.get().empty()
1045 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.get() );
1046 }
1047
1049 {
1050 return repoCachePath()/"pubkeys";
1051 }
1052
1054 {
1055 _pimpl->cfg_cache_path = path_r;
1056 }
1057
1059 {
1060 return ( _pimpl->cfg_metadata_path.get().empty()
1061 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path.get() );
1062 }
1063
1065 {
1066 _pimpl->cfg_metadata_path = path_r;
1067 }
1068
1070 {
1071 return ( _pimpl->cfg_solvfiles_path.get().empty()
1072 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.get() );
1073 }
1074
1076 {
1077 _pimpl->cfg_solvfiles_path = path_r;
1078 }
1079
1081 {
1082 return ( _pimpl->cfg_packages_path.get().empty()
1083 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path.get() );
1084 }
1085
1087 {
1088 _pimpl->cfg_packages_path = path_r;
1089 }
1090
1092 { return _pimpl->cfg_cache_path.getDefault().empty() ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.getDefault(); }
1093
1095 { return _pimpl->cfg_metadata_path.getDefault().empty() ? (builtinRepoCachePath()/"raw") : _pimpl->cfg_metadata_path.getDefault(); }
1096
1098 { return _pimpl->cfg_solvfiles_path.getDefault().empty() ? (builtinRepoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.getDefault(); }
1099
1101 { return _pimpl->cfg_packages_path.getDefault().empty() ? (builtinRepoCachePath()/"packages") : _pimpl->cfg_packages_path.getDefault(); }
1102
1104
1106 {
1107 return ( _pimpl->cfg_config_path.empty()
1108 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
1109 }
1110
1112 {
1113 return ( _pimpl->cfg_known_repos_path.empty()
1114 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
1115 }
1116
1118 {
1119 return ( _pimpl->cfg_known_services_path.empty()
1120 ? (configPath()/"services.d") : _pimpl->cfg_known_services_path );
1121 }
1122
1124 { return configPath()/"needreboot"; }
1125
1127 { return configPath()/"needreboot.d"; }
1128
1129 void ZConfig::setGeoipEnabled( bool enable )
1130 { _pimpl->geoipEnabled = enable; }
1131
1133 { return _pimpl->geoipEnabled; }
1134
1136 { return builtinRepoCachePath()/"geoip.d"; }
1137
1138 const std::vector<std::string> ZConfig::geoipHostnames () const
1139 { return _pimpl->geoipHosts; }
1140
1142 {
1143 return ( _pimpl->cfg_vars_path.empty()
1144 ? (configPath()/"vars.d") : _pimpl->cfg_vars_path );
1145 }
1146
1148 {
1149 return ( _pimpl->cfg_vendor_path.empty()
1150 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
1151 }
1152
1154 {
1155 return ( _pimpl->locks_file.empty()
1156 ? (configPath()/"locks") : _pimpl->locks_file );
1157 }
1158
1160
1162 { return _pimpl->repo_add_probe; }
1163
1165 { return _pimpl->repo_refresh_delay; }
1166
1168 { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
1169
1171 { return _pimpl->repoLabelIsAlias; }
1172
1173 void ZConfig::repoLabelIsAlias( bool yesno_r )
1174 { _pimpl->repoLabelIsAlias = yesno_r; }
1175
1177 { return _pimpl->download_use_deltarpm; }
1178
1180 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
1181
1183 { return _pimpl->download_media_prefer_download; }
1184
1186 { _pimpl->download_media_prefer_download.set( yesno_r ); }
1187
1189 { _pimpl->download_media_prefer_download.restoreToDefault(); }
1190
1192 { return _pimpl->_mediaConf.download_max_concurrent_connections(); }
1193
1195 { return _pimpl->_mediaConf.download_min_download_speed(); }
1196
1198 { return _pimpl->_mediaConf.download_max_download_speed(); }
1199
1201 { return _pimpl->_mediaConf.download_max_silent_tries(); }
1202
1204 { return _pimpl->_mediaConf.download_transfer_timeout(); }
1205
1206 Pathname ZConfig::download_mediaMountdir() const { return _pimpl->download_mediaMountdir; }
1207 void ZConfig::set_download_mediaMountdir( Pathname newval_r ) { _pimpl->download_mediaMountdir.set( std::move(newval_r) ); }
1208 void ZConfig::set_default_download_mediaMountdir() { _pimpl->download_mediaMountdir.restoreToDefault(); }
1209
1211 { return _pimpl->commit_downloadMode; }
1212
1213
1214 bool ZConfig::gpgCheck() const { return _pimpl->gpgCheck; }
1215 TriBool ZConfig::repoGpgCheck() const { return _pimpl->repoGpgCheck; }
1216 TriBool ZConfig::pkgGpgCheck() const { return _pimpl->pkgGpgCheck; }
1217
1218 void ZConfig::setGpgCheck( bool val_r ) { _pimpl->gpgCheck.set( val_r ); }
1219 void ZConfig::setRepoGpgCheck( TriBool val_r ) { _pimpl->repoGpgCheck.set( val_r ); }
1220 void ZConfig::setPkgGpgCheck( TriBool val_r ) { _pimpl->pkgGpgCheck.set( val_r ); }
1221
1222 void ZConfig::resetGpgCheck() { _pimpl->gpgCheck.restoreToDefault(); }
1223 void ZConfig::resetRepoGpgCheck() { _pimpl->repoGpgCheck.restoreToDefault(); }
1224 void ZConfig::resetPkgGpgCheck() { _pimpl->pkgGpgCheck.restoreToDefault(); }
1225
1226
1227 ResolverFocus ZConfig::solver_focus() const { return _pimpl->targetDefaults().solver_focus; }
1228 bool ZConfig::solver_onlyRequires() const { return _pimpl->targetDefaults().solver_onlyRequires; }
1229 bool ZConfig::solver_allowVendorChange() const { return _pimpl->targetDefaults().solver_allowVendorChange; }
1230 bool ZConfig::solver_dupAllowDowngrade() const { return _pimpl->targetDefaults().solver_dupAllowDowngrade; }
1231 bool ZConfig::solver_dupAllowNameChange() const { return _pimpl->targetDefaults().solver_dupAllowNameChange; }
1232 bool ZConfig::solver_dupAllowArchChange() const { return _pimpl->targetDefaults().solver_dupAllowArchChange; }
1233 bool ZConfig::solver_dupAllowVendorChange() const { return _pimpl->targetDefaults().solver_dupAllowVendorChange; }
1234 bool ZConfig::solver_cleandepsOnRemove() const { return _pimpl->targetDefaults().solver_cleandepsOnRemove; }
1235 unsigned ZConfig::solver_upgradeTestcasesToKeep() const { return _pimpl->targetDefaults().solver_upgradeTestcasesToKeep; }
1236
1237 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages; }
1238 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.set( val_r ); }
1239 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
1240
1241
1243 { return ( _pimpl->solver_checkSystemFile.empty()
1244 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
1245
1247 { return ( _pimpl->solver_checkSystemFileDir.empty()
1248 ? (configPath()/"systemCheck.d") : _pimpl->solver_checkSystemFileDir ); }
1249
1250
1251 namespace
1252 {
1253 inline void sigMultiversionSpecChanged()
1254 {
1256 }
1257 }
1258
1259 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); }
1260 void ZConfig::multiversionSpec( std::set<std::string> new_r ) { _pimpl->multiversion().swap( new_r ); sigMultiversionSpecChanged(); }
1261 void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); sigMultiversionSpecChanged(); }
1262 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); sigMultiversionSpecChanged(); }
1263 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); sigMultiversionSpecChanged(); }
1264
1266 { return _pimpl->apply_locks_file; }
1267
1269 {
1270 return ( _pimpl->update_data_path.empty()
1271 ? Pathname("/var/adm") : _pimpl->update_data_path );
1272 }
1273
1275 {
1276 return ( _pimpl->update_messages_path.empty()
1277 ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
1278 }
1279
1281 {
1282 return ( _pimpl->update_scripts_path.empty()
1283 ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
1284 }
1285
1287 { return _pimpl->updateMessagesNotify; }
1288
1289 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
1290 { _pimpl->updateMessagesNotify.set( val_r ); }
1291
1293 { _pimpl->updateMessagesNotify.restoreToDefault(); }
1294
1296
1297 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
1298 { return _pimpl->rpmInstallFlags; }
1299
1300
1302 {
1303 return ( _pimpl->history_log_path.empty() ?
1304 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
1305 }
1306
1308 {
1309 return _pimpl->_mediaConf.credentialsGlobalDir();
1310 }
1311
1313 {
1314 return _pimpl->_mediaConf.credentialsGlobalFile();
1315 }
1316
1318
1319 std::string ZConfig::distroverpkg() const
1320 { return "system-release"; }
1321
1323
1325 { return _pimpl->pluginsPath.get(); }
1326
1328 {
1329 return _pimpl->cfg_kernel_keep_spec;
1330 }
1331
1333
1334 std::ostream & ZConfig::about( std::ostream & str ) const
1335 {
1336 str << "libzypp: " LIBZYPP_VERSION_STRING << endl;
1337
1338 str << "libsolv: " << solv_version;
1339 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
1340 str << " (built against " << LIBSOLV_VERSION_STRING << ")";
1341 str << endl;
1342
1343 str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
1344 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
1345 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
1346 return str;
1347 }
1348
1350} // namespace zypp
Architecture.
Definition Arch.h:37
Helper to create and pass std::istream.
Definition inputstream.h:57
'Language[_Country]' codes.
Definition Locale.h:51
static const Locale enCode
Last resort "en".
Definition Locale.h:78
bool setConfigValue(const std::string &section, const std::string &entry, const std::string &value)
static MediaConfig & instance()
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition Target.cc:94
ZConfig implementation.
Definition ZConfig.cc:406
Pathname cfg_multiversion_path
Definition ZConfig.cc:772
DefaultOption< Pathname > download_mediaMountdir
Definition ZConfig.cc:789
MediaConfig & _mediaConf
Definition ZConfig.cc:818
DefaultOption< Pathname > cfg_metadata_path
Definition ZConfig.cc:761
Pathname cfg_known_repos_path
Definition ZConfig.cc:766
Pathname cfg_known_services_path
Definition ZConfig.cc:767
Pathname cfg_vars_path
Definition ZConfig.cc:768
Impl & operator=(const Impl &)=delete
Impl & operator=(Impl &&)=delete
DefaultOption< Pathname > cfg_packages_path
Definition ZConfig.cc:763
bool download_use_deltarpm_always
Definition ZConfig.cc:787
Pathname _parsedZyppConf
Remember any parsed zypp.conf.
Definition ZConfig.cc:755
void notifyTargetChanged()
Definition ZConfig.cc:729
Pathname solver_checkSystemFile
Definition ZConfig.cc:797
Impl(const Impl &)=delete
MultiversionMap _multiversionMap
Definition ZConfig.cc:916
Pathname update_data_path
Definition ZConfig.cc:776
Pathname history_log_path
Definition ZConfig.cc:807
Pathname locks_file
Definition ZConfig.cc:774
const TargetDefaults & targetDefaults() const
Definition ZConfig.cc:822
MultiversionSpec & getMultiversion() const
Definition ZConfig.cc:913
Impl(Impl &&)=delete
LocaleSet repoRefreshLocales
Definition ZConfig.cc:783
DefaultOption< Pathname > cfg_cache_path
Definition ZConfig.cc:760
std::vector< std::string > geoipHosts
Definition ZConfig.cc:815
TargetDefaults & targetDefaults()
Definition ZConfig.cc:823
Pathname update_scripts_path
Definition ZConfig.cc:777
Option< Pathname > pluginsPath
Definition ZConfig.cc:811
std::string userData
Definition ZConfig.cc:809
std::string cfg_kernel_keep_spec
Definition ZConfig.cc:773
DefaultOption< TriBool > repoGpgCheck
Definition ZConfig.cc:794
unsigned repo_refresh_delay
Definition ZConfig.cc:782
Option< DownloadMode > commit_downloadMode
Definition ZConfig.cc:791
std::optional< TargetDefaults > _currentTargetDefaults
TargetDefaults while –root.
Definition ZConfig.cc:826
MultiversionSpec & multiversion()
Definition ZConfig.cc:800
DefaultOption< bool > download_media_prefer_download
Definition ZConfig.cc:788
std::set< std::string > MultiversionSpec
Definition ZConfig.cc:407
Pathname solver_checkSystemFileDir
Definition ZConfig.cc:798
Pathname cfg_config_path
Definition ZConfig.cc:765
TargetDefaults _initialTargetDefaults
Initial TargetDefaults from /.
Definition ZConfig.cc:825
target::rpm::RpmInstFlags rpmInstallFlags
Definition ZConfig.cc:805
Pathname update_messages_path
Definition ZConfig.cc:778
const MultiversionSpec & multiversion() const
Definition ZConfig.cc:801
Pathname cfg_repo_mgr_root_path
Definition ZConfig.cc:769
DefaultOption< TriBool > pkgGpgCheck
Definition ZConfig.cc:795
DefaultOption< std::string > updateMessagesNotify
Definition ZConfig.cc:779
Pathname cfg_vendor_path
Definition ZConfig.cc:771
DefaultOption< Pathname > cfg_solvfiles_path
Definition ZConfig.cc:762
DefaultOption< bool > gpgCheck
Definition ZConfig.cc:793
Interim helper class to collect global options and settings.
Definition ZConfig.h:64
bool hasUserData() const
Whether a (non empty) user data sting is defined.
Definition ZConfig.cc:1019
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Definition ZConfig.cc:1234
std::string userData() const
User defined string value to be passed to log, history, plugins...
Definition ZConfig.cc:1022
Pathname knownServicesPath() const
Path where the known services .service files are kept (configPath()/services.d).
Definition ZConfig.cc:1117
void removeMultiversionSpec(const std::string &name_r)
Definition ZConfig.cc:1263
Pathname repoPackagesPath() const
Path where the repo packages are downloaded and kept (repoCachePath()/packages).
Definition ZConfig.cc:1080
unsigned repo_refresh_delay() const
Amount of time in minutes that must pass before another refresh.
Definition ZConfig.cc:1164
Arch systemArchitecture() const
The system architecture zypp uses.
Definition ZConfig.cc:977
Locale textLocale() const
The locale for translated texts zypp uses.
Definition ZConfig.cc:1001
const std::vector< std::string > geoipHostnames() const
All hostnames we want to rewrite using the geoip feature.
Definition ZConfig.cc:1138
Pathname update_dataPath() const
Path where the update items are kept (/var/adm)
Definition ZConfig.cc:1268
ResolverFocus solver_focus() const
The resolver's general attitude when resolving jobs.
Definition ZConfig.cc:1227
Pathname update_messagesPath() const
Path where the repo solv files are created and kept (update_dataPath()/solv).
Definition ZConfig.cc:1274
Pathname builtinRepoSolvfilesPath() const
The builtin config file value.
Definition ZConfig.cc:1097
Pathname pluginsPath() const
Defaults to /usr/lib/zypp/plugins.
Definition ZConfig.cc:1324
Pathname repoManagerRoot() const
The RepoManager root directory.
Definition ZConfig.cc:956
void resetRepoGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1223
bool gpgCheck() const
Turn signature checking on/off (on)
Definition ZConfig.cc:1214
Pathname knownReposPath() const
Path where the known repositories .repo files are kept (configPath()/repos.d).
Definition ZConfig.cc:1111
Pathname update_scriptsPath() const
Path where the repo metadata is downloaded and kept (update_dataPath()/).
Definition ZConfig.cc:1280
long download_transfer_timeout() const
Maximum time in seconds that you allow a transfer operation to take.
Definition ZConfig.cc:1203
void setRepoManagerRoot(const Pathname &root)
Sets the RepoManager root directory.
Definition ZConfig.cc:962
bool solver_dupAllowArchChange() const
DUP tune: Whether to allow package arch changes upon DUP.
Definition ZConfig.cc:1232
void setTextLocale(const Locale &locale_r)
Set the preferred locale for translated texts.
Definition ZConfig.cc:1004
bool solverUpgradeRemoveDroppedPackages() const
Whether dist upgrade should remove a products dropped packages (true).
Definition ZConfig.cc:1237
void notifyTargetChanged()
internal
Definition ZConfig.cc:950
static Locale defaultTextLocale()
The autodetected preferred locale for translated texts.
Definition ZConfig.cc:995
Pathname download_mediaMountdir() const
Path where media are preferably mounted or downloaded.
Definition ZConfig.cc:1206
void resetSolverUpgradeRemoveDroppedPackages()
Reset solverUpgradeRemoveDroppedPackages to the zypp.conf default.
Definition ZConfig.cc:1239
bool apply_locks_file() const
Whether locks file should be read and applied after start (true)
Definition ZConfig.cc:1265
bool solver_allowVendorChange() const
Whether vendor check is by default enabled.
Definition ZConfig.cc:1229
void set_default_download_mediaMountdir()
Reset to zypp.cong default.
Definition ZConfig.cc:1208
Pathname repoCachePath() const
Path where the caches are kept (/var/cache/zypp)
Definition ZConfig.cc:1042
void setPkgGpgCheck(TriBool val_r)
Change the value.
Definition ZConfig.cc:1220
Pathname needrebootPath() const
Path where the custom needreboot config files are kept (configPath()/needreboot.d).
Definition ZConfig.cc:1126
bool setUserData(const std::string &str_r)
Set a new userData string.
Definition ZConfig.cc:1025
Pathname systemRoot() const
The target root directory.
Definition ZConfig.cc:953
long download_max_silent_tries() const
Maximum silent tries.
Definition ZConfig.cc:1200
bool repo_add_probe() const
Whether repository urls should be probed.
Definition ZConfig.cc:1161
target::rpm::RpmInstFlags rpmInstallFlags() const
The default target::rpm::RpmInstFlags for ZYppCommitPolicy.
Definition ZConfig.cc:1297
void setUpdateMessagesNotify(const std::string &val_r)
Set a new command definition (see update.messages.notify in zypp.conf).
Definition ZConfig.cc:1289
unsigned solver_upgradeTestcasesToKeep() const
When committing a dist upgrade (e.g.
Definition ZConfig.cc:1235
Pathname repoMetadataPath() const
Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
Definition ZConfig.cc:1058
Pathname geoipCachePath() const
Path where the geoip caches are kept (/var/cache/zypp/geoip)
Definition ZConfig.cc:1135
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d)
Definition ZConfig.cc:1147
long download_min_download_speed() const
Minimum download speed (bytes per second) until the connection is dropped.
Definition ZConfig.cc:1194
DownloadMode commit_downloadMode() const
Commit download policy to use as default.
Definition ZConfig.cc:1210
Pathname needrebootFile() const
Path of the default needreboot config file (configPath()/needreboot).
Definition ZConfig.cc:1123
void setGpgCheck(bool val_r)
Change the value.
Definition ZConfig.cc:1218
bool solver_dupAllowVendorChange() const
DUP tune: Whether to allow package vendor changes upon DUP.
Definition ZConfig.cc:1233
~ZConfig()
Dtor.
Definition ZConfig.cc:947
void setGeoipEnabled(bool enable=true)
Enables or disables the use of the geoip feature of download.opensuse.org.
Definition ZConfig.cc:1129
Pathname locksFile() const
Path where zypp can find or create lock file (configPath()/locks)
Definition ZConfig.cc:1153
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Pointer to implementation.
Definition ZConfig.h:600
Pathname repoSolvfilesPath() const
Path where the repo solv files are created and kept (repoCachePath()/solv).
Definition ZConfig.cc:1069
bool geoipEnabled() const
Returns true if zypp should use the geoip feature of download.opensuse.org.
Definition ZConfig.cc:1132
Pathname historyLogFile() const
Path where ZYpp install history is logged.
Definition ZConfig.cc:1301
void setSystemArchitecture(const Arch &arch_r)
Override the zypp system architecture.
Definition ZConfig.cc:980
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck)
Definition ZConfig.cc:1216
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:925
void setRepoPackagesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:1086
void setRepoSolvfilesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:1075
void resetUpdateMessagesNotify()
Reset to the zypp.conf default.
Definition ZConfig.cc:1292
std::ostream & about(std::ostream &str) const
Print some detail about the current libzypp version.
Definition ZConfig.cc:1334
const std::set< std::string > & multiversionSpec() const
Definition ZConfig.cc:1259
void set_download_mediaMountdir(Pathname newval_r)
Set alternate value.
Definition ZConfig.cc:1207
bool download_use_deltarpm() const
Whether to consider using a deltarpm when downloading a package.
Definition ZConfig.cc:1176
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck)
Definition ZConfig.cc:1215
void set_download_media_prefer_download(bool yesno_r)
Set download_media_prefer_download to a specific value.
Definition ZConfig.cc:1185
std::string updateMessagesNotify() const
Command definition for sending update messages.
Definition ZConfig.cc:1286
void addMultiversionSpec(const std::string &name_r)
Definition ZConfig.cc:1262
Pathname builtinRepoCachePath() const
The builtin config file value.
Definition ZConfig.cc:1091
Pathname builtinRepoPackagesPath() const
The builtin config file value.
Definition ZConfig.cc:1100
Pathname solver_checkSystemFile() const
File in which dependencies described which has to be fulfilled for a running system.
Definition ZConfig.cc:1242
Pathname builtinRepoMetadataPath() const
The builtin config file value.
Definition ZConfig.cc:1094
void set_default_download_media_prefer_download()
Set download_media_prefer_download to the configfiles default.
Definition ZConfig.cc:1188
Pathname solver_checkSystemFileDir() const
Directory, which may or may not contain files in which dependencies described which has to be fulfill...
Definition ZConfig.cc:1246
void resetGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1222
void setSolverUpgradeRemoveDroppedPackages(bool val_r)
Set solverUpgradeRemoveDroppedPackages to val_r.
Definition ZConfig.cc:1238
Pathname configPath() const
Path where the configfiles are kept (/etc/zypp).
Definition ZConfig.cc:1105
static Arch defaultSystemArchitecture()
The autodetected system architecture.
Definition ZConfig.cc:971
ZConfig()
Default ctor.
Definition ZConfig.cc:936
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Definition ZConfig.cc:1048
long download_max_concurrent_connections() const
Maximum number of concurrent connections for a single transfer.
Definition ZConfig.cc:1191
void resetPkgGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1224
bool solver_onlyRequires() const
Solver regards required packages,patterns,... only.
Definition ZConfig.cc:1228
Pathname varsPath() const
Path containing custom repo variable definitions (configPath()/vars.d).
Definition ZConfig.cc:1141
bool solver_dupAllowNameChange() const
DUP tune: Whether to follow package renames upon DUP.
Definition ZConfig.cc:1231
bool repoLabelIsAlias() const
Whether to use repository alias or name in user messages (progress, exceptions, .....
Definition ZConfig.cc:1170
void clearMultiversionSpec()
Definition ZConfig.cc:1261
LocaleSet repoRefreshLocales() const
List of locales for which translated package descriptions should be downloaded.
Definition ZConfig.cc:1167
long download_max_download_speed() const
Maximum download speed (bytes per second)
Definition ZConfig.cc:1197
void setRepoMetadataPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:1064
bool solver_dupAllowDowngrade() const
DUP tune: Whether to allow version downgrades upon DUP.
Definition ZConfig.cc:1230
std::string multiversionKernels() const
Definition ZConfig.cc:1327
std::string distroverpkg() const
Package telling the "product version" on systems not using /etc/product.d/baseproduct.
Definition ZConfig.cc:1319
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Definition ZConfig.cc:1179
void setRepoCachePath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:1053
void setRepoGpgCheck(TriBool val_r)
Change the value.
Definition ZConfig.cc:1219
Pathname credentialsGlobalDir() const
Defaults to /etc/zypp/credentials.d.
Definition ZConfig.cc:1307
bool download_media_prefer_download() const
Hint which media to prefer when installing packages (download vs.
Definition ZConfig.cc:1182
Pathname credentialsGlobalFile() const
Defaults to /etc/zypp/credentials.cat.
Definition ZConfig.cc:1312
Wrapper class for stat/lstat.
Definition PathInfo.h:222
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
Definition Pathname.h:175
bool empty() const
Test for an empty path.
Definition Pathname.h:116
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Definition Pathname.cc:272
Simple lineparser: Traverse each line in a file.
Definition IOStream.h:113
bool next()
Advance to next line.
Definition IOStream.cc:72
Parses a INI file and offers its structure as a dictionary.
Definition inidict.h:42
section_const_iterator sectionsEnd() const
Definition inidict.cc:113
entry_const_iterator entriesBegin(const std::string &section) const
Definition inidict.cc:75
Iterable< entry_const_iterator > entries(const std::string &section) const
Definition inidict.cc:97
section_const_iterator sectionsBegin() const
Definition inidict.cc:108
MapKVIteratorTraits< SectionSet >::Key_const_iterator section_const_iterator
Definition inidict.h:47
EntrySet::const_iterator entry_const_iterator
Definition inidict.h:48
entry_const_iterator entriesEnd(const std::string &section) const
Definition inidict.cc:86
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition Pool.cc:233
static Pool instance()
Singleton ctor.
Definition Pool.h:55
Regular expression.
Definition Regex.h:95
Regular expression match result.
Definition Regex.h:168
Definition Arch.h:364
String related utilities and Regular expression matching.
Types and functions for filesystem operations.
Definition Glob.cc:24
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
Definition PathInfo.cc:32
int simpleParseFile(std::istream &str_r, ParseFlags flags_r, function< bool(int, std::string)> consume_r)
Simple lineparser optionally trimming and skipping comments.
Definition IOStream.cc:124
TriBool strToTriBool(const C_Str &str)
Parse str into a bool if it's a legal true or false string; else indeterminate.
Definition String.cc:94
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition String.h:1026
bool regex_match(const std::string &s, smatch &matches, const regex &regex)
\relates regex \ingroup ZYPP_STR_REGEX \relates regex \ingroup ZYPP_STR_REGEX
Definition Regex.h:70
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
Definition String.h:429
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", const Trim trim_r=NO_TRIM)
Split line_r into words.
Definition String.h:531
TInt strtonum(const C_Str &str)
Parsing numbers from string.
unsigned splitEscaped(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false)
Split line_r into words with respect to escape delimeters.
Definition String.h:594
int compareCI(const C_Str &lhs, const C_Str &rhs)
Definition String.h:983
Easy-to use interface to the ZYPP dependency resolver.
bool fromString(const std::string &val_r, ResolverFocus &ret_r)
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
ResolverFocus
The resolver's general attitude.
@ Default
Request the standard behavior (as defined in zypp.conf or 'Job')
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:30
DownloadMode
Supported commit download policies.
@ DownloadDefault
libzypp will decide what to do.
Mutable option with initial value also remembering a config value.
Definition ZConfig.cc:364
DefaultOption(value_type initial_r)
Definition ZConfig.cc:368
option_type _default
Definition ZConfig.cc:393
void setDefault(value_type newval_r)
Set a new default value.
Definition ZConfig.cc:389
void restoreToDefault(value_type newval_r)
Reset value to a new default.
Definition ZConfig.cc:381
DefaultOption & operator=(value_type newval_r)
Definition ZConfig.cc:373
void restoreToDefault()
Reset value to the current default.
Definition ZConfig.cc:377
Option< Tp > option_type
Definition ZConfig.cc:366
const value_type & getDefault() const
Get the current default value.
Definition ZConfig.cc:385
Mutable option.
Definition ZConfig.cc:334
const value_type & get() const
Get the value.
Definition ZConfig.cc:346
Option & operator=(value_type newval_r)
Definition ZConfig.cc:342
void set(value_type newval_r)
Set a new value.
Definition ZConfig.cc:354
Option(value_type initial_r)
No default ctor, explicit initialisation!
Definition ZConfig.cc:338
value_type _val
Definition ZConfig.cc:358
int scanConfAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:869
MultiversionSpec & getSpec(Pathname root_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:838
MultiversionSpec & getDefaultSpec()
Definition ZConfig.cc:865
void scanDirAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:885
std::map< Pathname, MultiversionSpec > SpecMap
Definition ZConfig.cc:836
Settings that follow a changed Target.
Definition ZConfig.cc:411
Option< bool > solver_dupAllowVendorChange
Definition ZConfig.cc:479
DefaultOption< bool > solverUpgradeRemoveDroppedPackages
Definition ZConfig.cc:482
Option< unsigned > solver_upgradeTestcasesToKeep
Definition ZConfig.cc:481
Option< bool > solver_dupAllowDowngrade
Definition ZConfig.cc:476
Option< bool > solver_dupAllowArchChange
Definition ZConfig.cc:478
bool consume(const std::string &entry, const std::string &value)
Definition ZConfig.cc:425
Option< bool > solver_cleandepsOnRemove
Definition ZConfig.cc:480
Option< bool > solver_allowVendorChange
Definition ZConfig.cc:475
Option< bool > solver_dupAllowNameChange
Definition ZConfig.cc:477
static PoolImpl & myPool()
Definition PoolImpl.cc:184
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:28
#define DBG
Definition Logger.h:97
#define MIL
Definition Logger.h:98
#define ERR
Definition Logger.h:100
#define WAR
Definition Logger.h:99