46 SystemCheck::SystemCheck() {
48 _file = ZConfig::instance().solver_checkSystemFile();
52 _dir = ZConfig::instance().solver_checkSystemFileDir();
57 bool SystemCheck::setFile(
const Pathname & file)
const{
58 MIL <<
"Setting checkFile to : " << file << endl;
64 bool SystemCheck::setDir(
const Pathname & dir)
const {
65 MIL <<
"Setting checkFile directory to : " << dir << endl;
72 const Pathname & SystemCheck::file() {
76 const Pathname & SystemCheck::dir() {
88 bool SystemCheck::loadFile(Pathname & file,
bool reset_caps)
const{
89 Target_Ptr trg( getZYpp()->getTarget() );
91 file = trg->assertRootPrefix( file );
94 if ( ! pi.isFile() ) {
95 WAR <<
"Can't read " << file <<
" " << pi << endl;
104 std::ifstream infile( file.c_str() );
107 if ( ! l.empty() && l[0] !=
'#' )
111 if (capList.size() == 2 ) {
112 CapList::iterator it = capList.begin();
113 if (*it ==
"requires") {
115 }
else if (*it ==
"conflicts") {
118 ERR <<
"Wrong parameter: " << l << endl;
121 ERR <<
"Wrong line: " << l << endl;
125 MIL <<
"Read " << pi << endl;
129 bool SystemCheck::loadFiles()
const {
132 [
this](
const Pathname & dir_r,
const char *
const & name_r)->
bool
134 const std::string wanted =
".check";
135 Pathname pth = dir_r/name_r;
136 if (pth.extension() != wanted) {
137 MIL <<
"Skipping " << pth <<
" (not a *.check file)" << endl;
141 MIL <<
"Reading " << pth << endl;
142 return loadFile(pth,
false );
156 str << _file << endl;
157 str <<
"requires" << endl;
158 for (CapabilitySet::const_iterator it = _require.begin(); it != _require.end(); ++it)
159 str <<
" " << *it << endl;
161 str <<
"conflicts" << endl;
162 for (CapabilitySet::const_iterator it = _conflict.begin(); it != _conflict.end(); ++it)
163 str <<
" " << *it << endl;
bool next()
Advance to next line.
unsigned split(const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
String related utilities and Regular expression matching.
Simple lineparser: Traverse each line in a file.
std::tr1::unordered_set< Capability > CapabilitySet
std::string trim(const std::string &s, const Trim trim_r)
std::ostream & operator<<(std::ostream &str, const zypp::shared_ptr< void > &obj)
Save and restore locale set from file.
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.
Easy-to use interface to the ZYPP dependency resolver.