51 using namespace zypp::str;
63 result +=
"<" + tag +
">";
70 result +=
"</" + tag +
">";
75 std::string
helixXML(
const T &obj );
111 str <<
" />" << endl;
120 str <<
"<dep name='packageand("
128 detail = detail.rhs().detail();
131 && detail.
lhs().
id() == NAMESPACE_MODALIAS) {
132 str <<
"<dep name='modalias(";
133 if (!packageName.
empty())
134 str << packageName <<
":";
153 for ( ; it != caps.
end(); ++it)
165 CapabilitySet::const_iterator it = caps.begin();
167 for ( ; it != caps.end(); ++it)
179 if ( ! caps.empty() )
188 str <<
"<" <<
toLower (resolvable->kind().asString()) <<
">" << endl;
191 str <<
TAB <<
xml_tag_enclose (item->buildtime().asSeconds(),
"buildtime",
true) << endl;
192 if ( isKind<Package>(resolvable) ) {
193 str <<
TAB <<
"<history>" << endl <<
TAB <<
"<update>" << endl;
195 str <<
TAB2 <<
helixXML (resolvable->edition()) << endl;
196 str <<
TAB <<
"</update>" << endl <<
TAB <<
"</history>" << endl;
198 str <<
TAB <<
helixXML (resolvable->arch()) << endl;
199 str <<
TAB <<
helixXML (resolvable->edition()) << endl;
211 str <<
"</" <<
toLower (resolvable->kind().asString()) <<
">" << endl;
252 *
file <<
"<channel><subchannel>" << endl;
257 *
file <<
"</subchannel></channel>" << endl;
277 const Arch & systemArchitecture,
280 const std::set<std::string> & multiversionSpec,
281 const std::string & systemPath =
"solver-system.xml.gz",
282 const bool forceResolve =
false,
283 const bool onlyRequires =
false,
284 const bool ignorealreadyrecommended =
false);
308 const Arch & systemArchitecture,
311 const std::set<std::string> & multiversionSpec,
312 const std::string & systemPath,
313 const bool forceResolve,
314 const bool onlyRequires,
315 const bool ignorealreadyrecommended)
316 :dumpFile (controlPath)
318 file =
new ofstream(controlPath.c_str());
323 *
file <<
"<?xml version=\"1.0\"?>" << endl
324 <<
"<!-- testcase generated by YaST -->" << endl
326 <<
"<setup arch=\"" << systemArchitecture <<
"\">" << endl
327 <<
TAB <<
"<system file=\"" << systemPath <<
"\"/>" << endl << endl;
328 for ( RepositoryTable::const_iterator it = repoTable.begin();
329 it != repoTable.end(); ++it ) {
331 *
file <<
TAB <<
"<!-- " << endl
332 <<
TAB <<
"- alias : " << repo.
alias() << endl;
337 *
file <<
TAB <<
"- url : " << *itUrl << endl;
339 *
file <<
TAB <<
"- path : " << repo.
path() << endl;
340 *
file <<
TAB <<
"- type : " << repo.
type() << endl;
341 *
file <<
TAB <<
"- generated : " << (it->first.generatedTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
342 *
file <<
TAB <<
"- outdated : " << (it->first.suggestedExpirationTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
343 *
file <<
TAB <<
" -->" << endl;
346 <<
"-package.xml.gz\" name=\"" << repo.
alias() <<
"\""
347 <<
" priority=\"" << repo.
priority()
348 <<
"\" />" << endl << endl;
351 for (LocaleSet::const_iterator iter = languages.begin(); iter != languages.end(); iter++) {
352 *
file <<
TAB <<
"<locale name=\"" << iter->code()
356 for_( it, modaliasList.begin(), modaliasList.end() ) {
357 *
file <<
TAB <<
"<modalias name=\"" << *it
361 for_( it, multiversionSpec.begin(), multiversionSpec.end() ) {
362 *
file <<
TAB <<
"<multiversion name=\"" << *it
367 *
file <<
TAB <<
"<forceResolve/>" << endl;
369 *
file <<
TAB <<
"<onlyRequires/>" << endl;
370 if (ignorealreadyrecommended)
371 *
file <<
TAB <<
"<ignorealreadyrecommended/>" << endl;
373 *
file <<
"</setup>" << endl
374 <<
"<trial>" << endl;
378 :dumpFile (
"/var/log/YaST2/solverTestcase/solver-test.xml")
385 *
file <<
"</trial>" << endl
386 <<
"</test>" << endl;
393 *
file <<
"<install channel=\"" << resObject->repoInfo().alias() <<
"\" kind=\"" <<
toLower (resObject->kind().asString()) <<
"\""
394 <<
" name=\"" << resObject->name() <<
"\"" <<
" arch=\"" << resObject->arch().asString() <<
"\""
395 <<
" version=\"" << resObject->edition().version() <<
"\"" <<
" release=\"" << resObject->edition().release() <<
"\""
396 <<
" status=\"" << status <<
"\""
403 *
file <<
"<lock channel=\"" << resObject->repoInfo().alias() <<
"\" kind=\"" <<
toLower (resObject->kind().asString()) <<
"\""
404 <<
" name=\"" << resObject->name() <<
"\"" <<
" arch=\"" << resObject->arch().asString() <<
"\""
405 <<
" version=\"" << resObject->edition().version() <<
"\"" <<
" release=\"" << resObject->edition().release() <<
"\""
406 <<
" status=\"" << status <<
"\""
413 *
file <<
"<keep channel=\"" << resObject->repoInfo().alias() <<
"\" kind=\"" <<
toLower (resObject->kind().asString()) <<
"\""
414 <<
" name=\"" << resObject->name() <<
"\"" <<
" arch=\"" << resObject->arch().asString() <<
"\""
415 <<
" version=\"" << resObject->edition().version() <<
"\"" <<
" release=\"" << resObject->edition().release() <<
"\""
416 <<
" status=\"" << status <<
"\""
423 *
file <<
"<uninstall " <<
" kind=\"" <<
toLower (resObject->kind().asString()) <<
"\""
424 <<
" name=\"" << resObject->name() <<
"\""
425 <<
" status=\"" << status <<
"\""
431 for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
432 *
file <<
"<addRequire " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
434 for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
435 *
file <<
"<addConflict " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
441 for_( it, upgradeRepos_r.begin(), upgradeRepos_r.end() )
443 *
file <<
"<upgradeRepo name=\"" << it->alias() <<
"\"/>" << endl;
449 *
file <<
"<distupgrade/>" << endl;
454 *
file <<
"<verify/>" << endl;
459 *
file <<
"<update/>" << endl;
465 :dumpPath(
"/var/log/YaST2/solverTestcase")
479 if ( !path.isExist() ) {
481 ERR <<
"Cannot create directory " <<
dumpPath << endl;
508 HelixResolvable_Ptr system = NULL;
517 if ( system && it->status().isInstalled() ) {
519 system->addResolvable (*it);
522 Repository repo = it->resolvable()->satSolvable().repository();
524 if (repoTable.find (repo) == repoTable.end()) {
527 +
"-package.xml.gz");
529 repoTable[repo]->addResolvable (*it);
533 if ( it->status().isToBeInstalled()
534 && !(it->status().isBySolver())) {
535 items_to_install.push_back (*it);
537 if ( it->status().isKept()
538 && !(it->status().isBySolver())) {
539 items_keep.push_back (*it);
541 if ( it->status().isToBeUninstalled()
542 && !(it->status().isBySolver())) {
543 items_to_remove.push_back (*it);
545 if ( it->status().isLocked()
546 && !(it->status().isBySolver())) {
547 items_locked.push_back (*it);
558 "solver-system.xml.gz",
563 for (PoolItemList::const_iterator iter = items_to_install.begin(); iter != items_to_install.end(); iter++) {
567 for (PoolItemList::const_iterator iter = items_locked.begin(); iter != items_locked.end(); iter++) {
568 control.lockResolvable (iter->resolvable(), iter->status());
571 for (PoolItemList::const_iterator iter = items_keep.begin(); iter != items_keep.end(); iter++) {
572 control.keepResolvable (iter->resolvable(), iter->status());
575 for (PoolItemList::const_iterator iter = items_to_remove.begin(); iter != items_to_remove.end(); iter++) {
576 control.deleteResolvable (iter->resolvable(), iter->status());
585 control.distupgrade ();
589 control.verifySystem();
static const epoch_t noepoch
Value representing noepoch.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
bool isUpgradeMode() const
const std::set< Repository > & upgradeRepos() const
const_iterator begin() const
std::string alias() const
unique identifier for this source.
static const Dep RECOMMENDS
static const Dep SUPPLEMENTS
static const Dep CONFLICTS
bool ignoreAlreadyRecommended() const
Container of Capability (currently read only).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
const std::string & asString() const
IdType id() const
Expert backdoor.
Enumeration class of dependency types.
Helper providing more detailed information about a Capability.
std::string release() const
Release.
void deleteResolvable(const ResObject::constPtr &resObject, const ResStatus &status)
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
void lockResolvable(const ResObject::constPtr &resObject, const ResStatus &status)
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
What is known about a repository.
Access to the sat-pools string space.
std::list< PoolItem > PoolItemList
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Edition represents [epoch:]version[-release]
Exchange LineWriter for the lifetime of this object.
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
const_iterator end() const
TraitsType::constPtrType constPtr
std::tr1::unordered_set< Capability > CapabilitySet
unsigned priority() const
Repository priority for solver.
bool isUpdateMode() const
void logfile(const Pathname &logfile_r)
Set path for the logfile.
std::string asString() const
Conversion to std::string
static LogControl instance()
Singleton access.
static const Dep SUGGESTS
const ModaliasList & modaliasList() const
List of modaliases found on system.
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
std::string xml_tag_enclose(const std::string &text, const std::string &tag, bool escape=false)
static const Dep ENHANCES
std::map< Repository, HelixResolvable_Ptr > RepositoryTable
A mid layer class we should remove.
ResObject::constPtr resolvable() const
Returns the ResObject::constPtr.
void addDependencies(const CapabilitySet &capRequire, const CapabilitySet &capConflict)
std::string escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
CapabilitySet extraRequires() const
CapDetail detail() const
Helper providing more detailed information about a Capability.
DEFINE_PTR_TYPE(HelixResolvable)
Common template to define ifgzstream/ofgzstream reading/writing gzip files.
std::string helixXML(const T &obj)
HelixResolvable(const std::string &path)
static const Dep REQUIRES
epoch_t epoch() const
Epoch.
void addResolvable(const PoolItem item)
std::string version() const
Version.
const LocaleSet & getRequestedLocales() const
Return the requested locales.
std::tr1::unordered_set< Locale > LocaleSet
void addUpgradeRepos(const std::set< Repository > &upgradeRepos_r)
Base class for reference counted objects.
static const SystemCheck & instance()
Singleton.
Turn on excessive logging for the lifetime of this object.
static const Dep PROVIDES
std::string numstring(char n, int w=0)
bool isExpression() const
std::string toLower(const std::string &s)
Return lowercase version of s.
void keepResolvable(const ResObject::constPtr &resObject, const ResStatus &status)
bool isVerifyingMode() const
std::vector< std::string > ModaliasList
const std::string & asString() const
String representation of relational operator.
std::string form(const char *format,...)
Printf style construction of std::string.
repo::RepoType type() const
Type of repository,.
TraitsType::constPtrType constPtr
const_iterator end() const
Iterator pointing behind the last Capability.
static Modalias & instance()
Singleton access.
Base class for Exception.
const std::set< std::string > & multiversionSpec() const
const std::string & asString() const
String representation of dependency type.
bool createTestcase(Resolver &resolver, bool dumpPool=true, bool runSolver=true)
std::string xml_escape(const std::string &text)
static const Dep OBSOLETES
CapabilitySet extraConflicts() const
gzstream_detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.
IMPL_PTR_TYPE(ProblemSolutionCombi)
Creates a file in helix format which contains all controll action of a testcase ( file is known as *-...
void installResolvable(const ResObject::constPtr &resObject, const ResStatus &status)
Reference to a PoolItem connecting ResObject and ResStatus.
bool empty() const
Whether the string is empty.
pool::PoolTraits::const_iterator const_iterator
std::string asString() const
static const Dep PREREQUIRES
const_iterator begin() const
Iterator pointing to the first Capability.
bool onlyRequires() const
Creates a file in helix format which includes all available or installed packages,patches,selections....
Pathname path() const
Repository path.
sat::detail::IdType id() const
Expert backdoor.
bool forceResolve() const