17 #define ZYPP_USE_RESOLVER_INTERNALS 67 result +=
"<" + tag +
">";
74 result +=
"</" + tag +
">";
79 std::string
helixXML(
const T &obj );
84 std::stringstream
str;
96 std::stringstream
str;
104 std::stringstream
str;
115 str <<
" />" << endl;
124 str <<
"<dep name='packageand(" 128 && detail.
lhs().
id() == NAMESPACE_OTHERPROVIDERS) {
129 str <<
"<dep name='otherproviders(" 136 detail = detail.rhs().detail();
139 && detail.
lhs().
id() == NAMESPACE_MODALIAS) {
140 str <<
"<dep name='modalias(";
141 if (!packageName.
empty())
142 str << packageName <<
":";
158 std::stringstream
str;
161 for ( ; it != caps.
end(); ++it)
172 std::stringstream
str;
173 CapabilitySet::const_iterator it = caps.begin();
175 for ( ; it != caps.end(); ++it)
185 std::stringstream out;
187 if ( ! caps.
empty() )
194 std::stringstream
str;
195 str <<
"<" << item.
kind() <<
">" << endl;
199 if ( isKind<Package>( item ) ) {
200 str <<
TAB <<
"<history>" << endl <<
TAB <<
"<update>" << endl;
203 str <<
TAB <<
"</update>" << endl <<
TAB <<
"</history>" << endl;
218 str <<
"</" << item.
kind() <<
">" << endl;
259 *
file <<
"<channel><subchannel>" << endl;
264 *
file <<
"</subchannel></channel>" << endl;
285 const Arch & systemArchitecture,
287 const std::set<std::string> & multiversionSpec,
288 const std::string & systemPath);
295 *
file <<
"</setup>" << endl <<
"<trial>" << endl;
303 void addTagIf(
const std::string & tag_r,
bool yesno_r =
true )
306 writeTag() <<
"<" << tag_r <<
"/>" << endl;
321 const Arch & systemArchitecture,
323 const std::set<std::string> & multiversionSpec,
324 const std::string & systemPath)
325 :dumpFile (controlPath)
328 file =
new std::ofstream(controlPath.c_str());
333 *
file <<
"<?xml version=\"1.0\"?>" << endl
334 <<
"<!-- libzypp resolver testcase -->" << endl
336 <<
"<setup arch=\"" << systemArchitecture <<
"\">" << endl
337 <<
TAB <<
"<system file=\"" << systemPath <<
"\"/>" << endl << endl;
338 for ( RepositoryTable::const_iterator it = repoTable.begin();
339 it != repoTable.end(); ++it ) {
341 *
file <<
TAB <<
"<!-- " << endl
342 <<
TAB <<
"- alias : " << repo.
alias() << endl;
347 *
file <<
TAB <<
"- url : " << *itUrl << endl;
349 *
file <<
TAB <<
"- path : " << repo.
path() << endl;
350 *
file <<
TAB <<
"- type : " << repo.
type() << endl;
351 *
file <<
TAB <<
"- generated : " << (it->first.generatedTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
352 *
file <<
TAB <<
"- outdated : " << (it->first.suggestedExpirationTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
353 *
file <<
TAB <<
" -->" << endl;
356 <<
"-package.xml.gz\" name=\"" << repo.
alias() <<
"\"" 357 <<
" priority=\"" << repo.
priority()
358 <<
"\" />" << endl << endl;
369 for (
Locale l : requestedLocales )
371 const char * fate = ( addedLocales.count(l) ?
"\" fate=\"added" :
"" );
372 *
file <<
TAB <<
"<locale name=\"" << l << fate <<
"\" />" << endl;
374 for (
Locale l : removedLocales )
376 *
file <<
TAB <<
"<locale name=\"" << l <<
"\" fate=\"removed\" />" << endl;
387 for_( it, modaliasList.begin(), modaliasList.end() ) {
392 for_( it, multiversionSpec.begin(), multiversionSpec.end() ) {
393 *
file <<
TAB <<
"<multiversion name=\"" << *it
403 *
file <<
"</trial>" << endl
404 <<
"</test>" << endl;
411 <<
" kind=\"" << pi_r.
kind() <<
"\"" 412 <<
" name=\"" << pi_r.
name() <<
"\"" 413 <<
" arch=\"" << pi_r.
arch() <<
"\"" 416 <<
" status=\"" << pi_r.
status() <<
"\"" 423 <<
" kind=\"" << pi_r.
kind() <<
"\"" 424 <<
" name=\"" << pi_r.
name() <<
"\"" 425 <<
" arch=\"" << pi_r.
arch() <<
"\"" 428 <<
" status=\"" << pi_r.
status() <<
"\"" 435 <<
" kind=\"" << pi_r.
kind() <<
"\"" 436 <<
" name=\"" << pi_r.
name() <<
"\"" 437 <<
" arch=\"" << pi_r.
arch() <<
"\"" 440 <<
" status=\"" << pi_r.
status() <<
"\"" 446 *
file <<
"<uninstall kind=\"" << pi_r.
kind() <<
"\"" 447 <<
" name=\"" << pi_r.
name() <<
"\"" 448 <<
" status=\"" << pi_r.
status() <<
"\"" 454 for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
455 *
file <<
"<addRequire " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
457 for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
458 *
file <<
"<addConflict " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
464 for_( it, upgradeRepos_r.begin(), upgradeRepos_r.end() )
466 *
file <<
"<upgradeRepo name=\"" << it->alias() <<
"\"/>" << endl;
473 :dumpPath(
"/var/log/YaST2/solverTestcase")
476 Testcase::Testcase(
const std::string & path)
480 Testcase::~Testcase()
483 bool Testcase::createTestcase(Resolver & resolver,
bool dumpPool,
bool runSolver)
485 PathInfo path (dumpPath);
487 if ( !path.isExist() ) {
489 ERR <<
"Cannot create directory " << dumpPath << endl;
494 ERR << dumpPath <<
" is not a directory." << endl;
507 resolver.resolvePool();
510 ResPool pool = resolver.pool();
512 PoolItemList items_to_install;
513 PoolItemList items_to_remove;
514 PoolItemList items_locked;
515 PoolItemList items_keep;
516 HelixResolvable_Ptr system = NULL;
519 system =
new HelixResolvable(dumpPath +
"/solver-system.xml.gz");
521 for (
const PoolItem & pi : pool )
523 if ( system && pi.status().isInstalled() ) {
525 system->addResolvable( pi );
528 Repository repo = pi.repository();
530 if (repoTable.find (repo) == repoTable.end()) {
531 repoTable[repo] =
new HelixResolvable(dumpPath +
"/" 533 +
"-package.xml.gz");
535 repoTable[repo]->addResolvable( pi );
539 if ( pi.status().isToBeInstalled()
540 && !(pi.status().isBySolver())) {
541 items_to_install.push_back( pi );
543 if ( pi.status().isKept()
544 && !(pi.status().isBySolver())) {
545 items_keep.push_back( pi );
547 if ( pi.status().isToBeUninstalled()
548 && !(pi.status().isBySolver())) {
549 items_to_remove.push_back( pi );
551 if ( pi.status().isLocked()
552 && !(pi.status().isBySolver())) {
553 items_locked.push_back( pi );
558 HelixControl control (dumpPath +
"/solver-test.xml",
563 "solver-system.xml.gz");
566 control.writeTag() <<
"<focus value=\"" << resolver.focus() <<
"\"/>" << endl;
568 control.addTagIf(
"ignorealreadyrecommended", resolver.ignoreAlreadyRecommended() );
569 control.addTagIf(
"onlyRequires", resolver.onlyRequires() );
570 control.addTagIf(
"forceResolve", resolver.forceResolve() );
572 control.addTagIf(
"cleandepsOnRemove", resolver.cleandepsOnRemove() );
574 control.addTagIf(
"allowDowngrade", resolver.allowDowngrade() );
575 control.addTagIf(
"allowNameChange", resolver.allowNameChange() );
576 control.addTagIf(
"allowArchChange", resolver.allowArchChange() );
577 control.addTagIf(
"allowVendorChange", resolver.allowVendorChange() );
579 control.addTagIf(
"dupAllowDowngrade", resolver.dupAllowDowngrade() );
580 control.addTagIf(
"dupAllowNameChange", resolver.dupAllowNameChange() );
581 control.addTagIf(
"dupAllowArchChange", resolver.dupAllowArchChange() );
582 control.addTagIf(
"dupAllowVendorChange", resolver.dupAllowVendorChange() );
584 control.closeSetup();
587 for (
const PoolItem & pi : items_to_install )
588 { control.installResolvable( pi ); }
590 for (
const PoolItem & pi : items_locked )
591 { control.lockResolvable( pi ); }
593 for (
const PoolItem & pi : items_keep )
594 { control.keepResolvable( pi ); }
596 for (
const PoolItem & pi : items_to_remove )
597 { control.deleteResolvable( pi ); }
599 control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
600 control.addDependencies (SystemCheck::instance().requiredSystemCap(),
601 SystemCheck::instance().conflictSystemCap());
602 control.addUpgradeRepos( resolver.upgradeRepos() );
604 control.addTagIf(
"distupgrade", resolver.isUpgradeMode() );
605 control.addTagIf(
"update", resolver.isUpdateMode() );
606 control.addTagIf(
"verify", resolver.isVerifyingMode() );
static const epoch_t noepoch
Value representing noepoch.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
Pathname path() const
Repository path.
unsigned priority() const
Repository priority for solver.
std::ostream & writeTag()
static const Dep RECOMMENDS
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
static const Dep SUPPLEMENTS
static const Dep CONFLICTS
Container of Capability (currently read only).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
Enumeration class of dependency types.
Helper providing more detailed information about a Capability.
const std::string & asString() const
String representation of relational operator.
const_iterator end() const
Iterator pointing behind the last Capability.
detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.
ResStatus & status() const
Returns the current status.
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
String related utilities and Regular expression matching.
What is known about a repository.
Access to the sat-pools string space.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Edition represents [epoch:]version[-release]
Exchange LineWriter for the lifetime of this object.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string asSeconds() const
Convert to string representation of calendar time in numeric form (like "1029255142").
void deleteResolvable(const PoolItem &pi_r)
void lockResolvable(const PoolItem &pi_r)
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
bool isExpression() const
void logfile(const Pathname &logfile_r)
Set path for the logfile.
static LogControl instance()
Singleton access.
static const Dep SUGGESTS
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
sat::detail::IdType id() const
Expert backdoor.
std::map< Repository, HelixResolvable_Ptr > RepositoryTable
void addDependencies(const CapabilitySet &capRequire, const CapabilitySet &capConflict)
void keepResolvable(const PoolItem &pi_r)
const_iterator begin() const
Iterator pointing to the first Capability.
Common template to define ifgzstream/ofgzstream reading/writing compressed files. ...
constexpr bool empty() const
Whether the string is empty.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
static Pool instance()
Singleton ctor.
std::string version() const
Version.
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
String related utilities and Regular expression matching.
DEFINE_PTR_TYPE(HelixResolvable)
sat::detail::IdType IdType
std::string alias() const
unique identifier for this source.
RepoInfo repoInfo() const
std::string release() const
Release.
std::string helixXML(const T &obj)
HelixResolvable(const std::string &path)
static const Dep REQUIRES
void addResolvable(const PoolItem item)
void addUpgradeRepos(const std::set< Repository > &upgradeRepos_r)
Base class for reference counted objects.
const LocaleSet & getRequestedLocales() const
Return the requested locales.
Turn on excessive logging for the lifetime of this object.
static const Dep PROVIDES
std::string numstring(char n, int w=0)
HelixControl(const std::string &controlPath, const RepositoryTable &sourceTable, const Arch &systemArchitecture, const target::Modalias::ModaliasList &modaliasList, const std::set< std::string > &multiversionSpec, const std::string &systemPath)
std::vector< std::string > ModaliasList
'Language[_Country]' codes.
std::unordered_set< Capability > CapabilitySet
static Modalias & instance()
Singleton access.
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
Base class for Exception.
std::string xml_escape(const std::string &text)
static const Dep OBSOLETES
epoch_t epoch() const
Epoch.
Creates a file in helix format which contains all controll action of a testcase ( file is known as *-...
IMPL_PTR_TYPE(SATResolver)
Combining sat::Solvable and ResStatus.
void installResolvable(const PoolItem &pi_r)
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
std::string asString() const
Conversion to std::string
const std::string & asString() const
void addTagIf(const std::string &tag_r, bool yesno_r=true)
CapDetail detail() const
Helper providing more detailed information about a Capability.
std::string asString() const
Easy-to use interface to the ZYPP dependency resolver.
static const Dep PREREQUIRES
repo::RepoType type() const
Type of repository,.
bool empty() const
Whether the container is empty.
std::unordered_set< Locale > LocaleSet
Creates a file in helix format which includes all available or installed packages,patches,selections....
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).