Go to the documentation of this file.
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 ) );
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
unsigned vendorGroupCounter
Combining sat::Solvable and ResStatus.
const StrMatcher & matchNoDots()
Convenience returning StrMatcher( "[^.]*", Match::GLOB )
A Solvable object within the sat Pool.
std::vector< IdString > VendorList
Implementation class.
bool equivalent(const Vendor &lVendor, const Vendor &rVendor) const
Return whether two vendor strings should be treated as the same vendor.
unsigned vendorMatchId(IdString vendor) const
Helper mapping vendor string to eqivalence class ID.
Solvable satSolvable() const
Return the corresponding sat::Solvable.
const char * c_str() const
Conversion to const char *
std::ostream & operator<<(std::ostream &str, const VendorAttr::Impl &obj)
void legacySetup()
bsc#1030686: The legacy default equivalence of 'suse' and 'opensuse' has been removed.
bool addVendorDirectory(const Pathname &dirname_r)
Adding new equivalent vendors described in a directory.
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d)
Definition of vendor equivalence.
Parses a INI file and offers its structure as a dictionary.
Access to the sat-pools string space.
Impl * clone() const
clone for RWCOW_pointer
Wrapper class for ::stat/::lstat.
unsigned split(std::string_view line_r, std::string_view sep_r, Trim trim_r, std::function< void(std::string_view)> fnc_r)
bool equivalent(IdString lVendor, IdString rVendor) const
Return whether two vendor strings should be treated as equivalent.
bool addVendorFile(const Pathname &filename_r)
Adding new equivalent vendors described in a file.
static ZConfig & instance()
Singleton ctor.
Easy-to use interface to the ZYPP dependency resolver.
std::string toLower(const std::string &s)
Return lowercase version of s.
std::map< std::string, unsigned > VendorMap
void vendorMatchIdReset()
Reset match cache if global VendorMap was changed.
void _addVendorList(VendorList &&list_r)
friend std::ostream & operator<<(std::ostream &str, const Impl &obj)
std::unordered_map< IdString, VendorMatchEntry > VendorMatch
std::ostream & operator<<(std::ostream &str, const Exception &obj)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
static const VendorAttr & instance()
(Pseudo)Singleton, mapped to the current Target::vendorAttr settings or to noTargetInstance.
VendorAttr implementation.
String related utilities and Regular expression matching.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
std::string trim(const std::string &s, const Trim trim_r)
void addVendorList(VendorList &&vendorList_r)
Add a new equivalent vendor set.
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.
DefaultIntegral< int, 0 > VendorMatchEntry
static VendorAttr & noTargetInstance()
Singleton, settings used if no Target is active.
IdString vendor() const
The vendor.
VendorAttr()
Ctor providing the default set.