29 #undef ZYPP_BASE_LOGGER_LOGGROUP 30 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::VendorAttr" 72 typedef std::unordered_map<IdString, VendorMatchEntry>
VendorMatch;
94 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
97 {
return new Impl( *
this ); }
111 static const IdString openSUSE(
"opensuse" );
142 std::vector<std::string> vendorList_r;
143 for (
const auto & el : vendorList_rr ) {
144 vendorList_r.push_back( el.asString() );
147 unsigned int nextId = vendorGroupCounter + 1;
151 for_( it, vendorList_r.begin(), vendorList_r.end() )
154 if (_vendorMap.find(*it) != _vendorMap.end())
156 if (nextId != vendorGroupCounter + 1 &&
157 nextId != _vendorMap[*it])
160 unsigned int moveID = _vendorMap[*it];
161 for_( itMap, _vendorMap.begin(), _vendorMap.end() )
163 if (itMap->second == moveID)
164 itMap->second = nextId;
169 nextId = _vendorMap[*it];
170 WAR <<
"Vendor " << *it <<
" is already used in another vendor group. --> mixing these groups" << endl;
175 for_( it, vendorList_r.begin(), vendorList_r.end() )
177 _vendorMap[*it] = nextId;
180 if (nextId == vendorGroupCounter + 1)
181 ++vendorGroupCounter;
184 vendorMatchIdReset();
190 str <<
"Equivalent vendors:";
192 str << endl <<
" [" << p.second <<
"] " << p.first;
219 MIL <<
"Initial: " << *
this << endl;
227 MIL <<
"Initial " << initial_r <<
": " << *
this << endl;
235 if (
PathInfo pi { dirname_r }; ! pi.isDir() ) {
236 MIL <<
"Not a directory " << pi << endl;
241 [
this](
const Pathname & dir_r,
const std::string & str_r )->
bool 252 if (
PathInfo pi { filename_r }; ! pi.isFile() ) {
253 MIL <<
"Not a file " << pi << endl;
258 for (
const auto & el : dict.entries(
"main") )
260 if ( el.first ==
"vendors" )
264 [&tmp]( std::string_view word ) {
265 if ( ! word.empty() )
266 tmp.push_back( IdString( word ) );
A Solvable object within the sat Pool.
IdString vendor() const
The vendor.
std::ostream & operator<<(std::ostream &str, const VendorAttr::Impl &obj)
c++17: std::string_view tools
static ZConfig & instance()
Singleton ctor.
bool equivalent(const Vendor &lVendor, const Vendor &rVendor) const
Return whether two vendor strings should be treated as the same vendor.
VendorAttr()
Ctor providing the default set.
void addVendorList(VendorList &&vendorList_r)
Add a new equivalent vendor set.
DefaultIntegral< int, 0 > VendorMatchEntry
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
String related utilities and Regular expression matching.
bool addVendorDirectory(const Pathname &dirname_r)
Adding new equivalent vendors described in a directory.
unsigned vendorGroupCounter
std::vector< IdString > VendorList
Implementation class.
Access to the sat-pools string space.
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
void _addVendorList(VendorList &&list_r)
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
Impl * clone() const
clone for RWCOW_pointer
void legacySetup()
bsc#1030686: The legacy default equivalence of 'suse' and 'opensuse' has been removed.
VendorAttr implementation.
const StrMatcher & matchNoDots()
Convenience returning StrMatcher( "[^.]*", Match::GLOB )
std::ostream & operator<<(std::ostream &str, const Exception &obj)
std::string trim(const std::string &s, const Trim trim_r)
static VendorAttr & noTargetInstance()
Singleton, settings used if no Target is active.
void vendorMatchIdReset()
Reset match cache if global VendorMap was changed.
Definition of vendor equivalence.
bool equivalent(IdString lVendor, IdString rVendor) const
Return whether two vendor strings should be treated as equivalent.
const char * c_str() const
Conversion to const char *
std::string toLower(const std::string &s)
Return lowercase version of s.
Parses a INI file and offers its structure as a dictionary.
friend std::ostream & operator<<(std::ostream &str, const Impl &obj)
std::unordered_map< IdString, VendorMatchEntry > VendorMatch
std::map< std::string, unsigned > VendorMap
Wrapper class for ::stat/::lstat.
int dirForEach(const Pathname &dir_r, function< bool(const Pathname &, const char *const)> fnc_r)
Invoke callback function fnc_r for each entry in directory dir_r.
Combining sat::Solvable and ResStatus.
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
unsigned vendorMatchId(IdString vendor) const
Helper mapping vendor string to eqivalence class ID.
Easy-to use interface to the ZYPP dependency resolver.
Solvable satSolvable() const
Return the corresponding sat::Solvable.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
unsigned split(std::string_view line_r, std::string_view sep_r, Trim trim_r, std::function< void(std::string_view)> fnc_r)