Go to the documentation of this file.
17 #define ZYPP_USE_RESOLVER_INTERNALS
66 result +=
"<" + tag +
">";
73 result +=
"</" + tag +
">";
78 std::string
helixXML(
const T &obj );
114 str <<
" />" << endl;
123 str <<
"<dep name='packageand("
127 && detail.
lhs().
id() == NAMESPACE_OTHERPROVIDERS) {
128 str <<
"<dep name='otherproviders("
135 detail = detail.rhs().detail();
138 && detail.
lhs().
id() == NAMESPACE_MODALIAS) {
139 str <<
"<dep name='modalias(";
140 if (!packageName.
empty())
141 str << packageName <<
":";
160 for ( ; it != caps.
end(); ++it)
172 CapabilitySet::const_iterator it = caps.begin();
174 for ( ; it != caps.end(); ++it)
186 if ( ! caps.
empty() )
194 str <<
"<" << item.
kind() <<
">" << endl;
198 if ( isKind<Package>( item ) ) {
199 str <<
TAB <<
"<history>" << endl <<
TAB <<
"<update>" << endl;
202 str <<
TAB <<
"</update>" << endl <<
TAB <<
"</history>" << endl;
217 str <<
"</" << item.
kind() <<
">" << endl;
258 *
file <<
"<channel><subchannel>" << endl;
263 *
file <<
"</subchannel></channel>" << endl;
284 const Arch & systemArchitecture,
286 const std::set<std::string> & multiversionSpec,
287 const std::string & systemPath);
294 *
file <<
"</setup>" << endl <<
"<trial>" << endl;
302 void addTagIf(
const std::string & tag_r,
bool yesno_r =
true )
305 writeTag() <<
"<" << tag_r <<
"/>" << endl;
320 const Arch & systemArchitecture,
322 const std::set<std::string> & multiversionSpec,
323 const std::string & systemPath)
324 :dumpFile (controlPath)
327 file =
new ofstream(controlPath.c_str());
332 *
file <<
"<?xml version=\"1.0\"?>" << endl
333 <<
"<!-- libzypp resolver testcase -->" << endl
335 <<
"<setup arch=\"" << systemArchitecture <<
"\">" << endl
336 <<
TAB <<
"<system file=\"" << systemPath <<
"\"/>" << endl << endl;
337 for ( RepositoryTable::const_iterator it = repoTable.begin();
338 it != repoTable.end(); ++it ) {
340 *
file <<
TAB <<
"<!-- " << endl
341 <<
TAB <<
"- alias : " << repo.
alias() << endl;
346 *
file <<
TAB <<
"- url : " << *itUrl << endl;
348 *
file <<
TAB <<
"- path : " << repo.
path() << endl;
349 *
file <<
TAB <<
"- type : " << repo.
type() << endl;
350 *
file <<
TAB <<
"- generated : " << (it->first.generatedTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
351 *
file <<
TAB <<
"- outdated : " << (it->first.suggestedExpirationTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
352 *
file <<
TAB <<
" -->" << endl;
355 <<
"-package.xml.gz\" name=\"" << repo.
alias() <<
"\""
356 <<
" priority=\"" << repo.
priority()
357 <<
"\" />" << endl << endl;
368 for (
Locale l : requestedLocales )
370 const char * fate = ( addedLocales.count(l) ?
"\" fate=\"added" :
"" );
371 *
file <<
TAB <<
"<locale name=\"" << l << fate <<
"\" />" << endl;
373 for (
Locale l : removedLocales )
375 *
file <<
TAB <<
"<locale name=\"" << l <<
"\" fate=\"removed\" />" << endl;
386 for_( it, modaliasList.begin(), modaliasList.end() ) {
391 for_( it, multiversionSpec.begin(), multiversionSpec.end() ) {
392 *
file <<
TAB <<
"<multiversion name=\"" << *it
402 *
file <<
"</trial>" << endl
403 <<
"</test>" << endl;
410 <<
" kind=\"" << pi_r.
kind() <<
"\""
411 <<
" name=\"" << pi_r.
name() <<
"\""
412 <<
" arch=\"" << pi_r.
arch() <<
"\""
415 <<
" status=\"" << pi_r.
status() <<
"\""
422 <<
" kind=\"" << pi_r.
kind() <<
"\""
423 <<
" name=\"" << pi_r.
name() <<
"\""
424 <<
" arch=\"" << pi_r.
arch() <<
"\""
427 <<
" status=\"" << pi_r.
status() <<
"\""
434 <<
" kind=\"" << pi_r.
kind() <<
"\""
435 <<
" name=\"" << pi_r.
name() <<
"\""
436 <<
" arch=\"" << pi_r.
arch() <<
"\""
439 <<
" status=\"" << pi_r.
status() <<
"\""
445 *
file <<
"<uninstall kind=\"" << pi_r.
kind() <<
"\""
446 <<
" name=\"" << pi_r.
name() <<
"\""
447 <<
" status=\"" << pi_r.
status() <<
"\""
453 for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
454 *
file <<
"<addRequire " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
456 for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
457 *
file <<
"<addConflict " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
463 for_( it, upgradeRepos_r.begin(), upgradeRepos_r.end() )
465 *
file <<
"<upgradeRepo name=\"" << it->alias() <<
"\"/>" << endl;
472 :dumpPath(
"/var/log/YaST2/solverTestcase")
475 Testcase::Testcase(
const std::string & path)
479 Testcase::~Testcase()
482 bool Testcase::createTestcase(Resolver & resolver,
bool dumpPool,
bool runSolver)
484 PathInfo path (dumpPath);
486 if ( !path.isExist() ) {
488 ERR <<
"Cannot create directory " << dumpPath << endl;
493 ERR << dumpPath <<
" is not a directory." << endl;
506 resolver.resolvePool();
509 ResPool pool = resolver.pool();
511 PoolItemList items_to_install;
512 PoolItemList items_to_remove;
513 PoolItemList items_locked;
514 PoolItemList items_keep;
515 HelixResolvable_Ptr system = NULL;
518 system =
new HelixResolvable(dumpPath +
"/solver-system.xml.gz");
520 for (
const PoolItem & pi : pool )
522 if ( system && pi.status().isInstalled() ) {
524 system->addResolvable( pi );
527 Repository repo = pi.repository();
529 if (repoTable.find (repo) == repoTable.end()) {
530 repoTable[repo] =
new HelixResolvable(dumpPath +
"/"
532 +
"-package.xml.gz");
534 repoTable[repo]->addResolvable( pi );
538 if ( pi.status().isToBeInstalled()
539 && !(pi.status().isBySolver())) {
540 items_to_install.push_back( pi );
542 if ( pi.status().isKept()
543 && !(pi.status().isBySolver())) {
544 items_keep.push_back( pi );
546 if ( pi.status().isToBeUninstalled()
547 && !(pi.status().isBySolver())) {
548 items_to_remove.push_back( pi );
550 if ( pi.status().isLocked()
551 && !(pi.status().isBySolver())) {
552 items_locked.push_back( pi );
557 HelixControl control (dumpPath +
"/solver-test.xml",
562 "solver-system.xml.gz");
565 control.writeTag() <<
"<focus value=\"" << resolver.focus() <<
"\"/>" << endl;
567 control.addTagIf(
"ignorealreadyrecommended", resolver.ignoreAlreadyRecommended() );
568 control.addTagIf(
"onlyRequires", resolver.onlyRequires() );
569 control.addTagIf(
"forceResolve", resolver.forceResolve() );
571 control.addTagIf(
"cleandepsOnRemove", resolver.cleandepsOnRemove() );
573 control.addTagIf(
"allowDowngrade", resolver.allowDowngrade() );
574 control.addTagIf(
"allowNameChange", resolver.allowNameChange() );
575 control.addTagIf(
"allowArchChange", resolver.allowArchChange() );
576 control.addTagIf(
"allowVendorChange", resolver.allowVendorChange() );
578 control.addTagIf(
"dupAllowDowngrade", resolver.dupAllowDowngrade() );
579 control.addTagIf(
"dupAllowNameChange", resolver.dupAllowNameChange() );
580 control.addTagIf(
"dupAllowArchChange", resolver.dupAllowArchChange() );
581 control.addTagIf(
"dupAllowVendorChange", resolver.dupAllowVendorChange() );
583 control.closeSetup();
586 for (
const PoolItem & pi : items_to_install )
587 { control.installResolvable( pi ); }
589 for (
const PoolItem & pi : items_locked )
590 { control.lockResolvable( pi ); }
592 for (
const PoolItem & pi : items_keep )
593 { control.keepResolvable( pi ); }
595 for (
const PoolItem & pi : items_to_remove )
596 { control.deleteResolvable( pi ); }
598 control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
599 control.addDependencies (SystemCheck::instance().requiredSystemCap(),
600 SystemCheck::instance().conflictSystemCap());
601 control.addUpgradeRepos( resolver.upgradeRepos() );
603 control.addTagIf(
"distupgrade", resolver.isUpgradeMode() );
604 control.addTagIf(
"update", resolver.isUpdateMode() );
605 control.addTagIf(
"verify", resolver.isVerifyingMode() );
sat::detail::IdType id() const
Expert backdoor.
sat::detail::IdType IdType
static Pool instance()
Singleton ctor.
std::map< Repository, HelixResolvable_Ptr > RepositoryTable
Combining sat::Solvable and ResStatus.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static const Dep SUPPLEMENTS
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
static const epoch_t noepoch
Value representing noepoch.
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
Base class for Exception.
void deleteResolvable(const PoolItem &pi_r)
RepoInfo repoInfo() const
std::string helixXML(const T &obj)
What is known about a repository.
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
static const Dep ENHANCES
const_iterator begin() const
Iterator pointing to the first Capability.
IMPL_PTR_TYPE(SATResolver)
epoch_t epoch() const
Epoch.
Edition represents [epoch:]version[-release]
Base class for reference counted objects.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
DEFINE_PTR_TYPE(HelixResolvable)
unsigned priority() const
Repository priority for solver.
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
static const Dep REQUIRES
void addDependencies(const CapabilitySet &capRequire, const CapabilitySet &capConflict)
std::string release() const
Release.
HelixResolvable(const std::string &path)
std::string xml_escape(const std::string &text)
bool isExpression() const
void addResolvable(const PoolItem item)
std::string asString() const
Conversion to std::string
static const Dep PREREQUIRES
Access to the sat-pools string space.
Creates a file in helix format which contains all controll action of a testcase ( file is known as *-...
std::unordered_set< Capability > CapabilitySet
void keepResolvable(const PoolItem &pi_r)
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)
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
std::string alias() const
unique identifier for this source.
const_iterator end() const
Iterator pointing behind the last Capability.
static const Dep SUGGESTS
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
void addUpgradeRepos(const std::set< Repository > &upgradeRepos_r)
static ZConfig & instance()
Singleton ctor.
Easy-to use interface to the ZYPP dependency resolver.
static const Dep RECOMMENDS
String related utilities and Regular expression matching.
std::string numstring(char n, int w=0)
std::string version() const
Version.
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 PoolItem &pi_r)
const std::string & asString() const
String representation of relational operator.
static const Dep OBSOLETES
static const Dep CONFLICTS
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
static const Dep PROVIDES
std::string asSeconds() const
Convert to string representation of calendar time in numeric form (like "1029255142").
const std::string & asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Turn on excessive logging for the lifetime of this object.
CapDetail detail() const
Helper providing more detailed information about a Capability.
ResStatus & status() const
Returns the current status.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Common template to define ifgzstream/ofgzstream reading/writing compressed files.
std::ostream & writeTag()
std::unordered_set< Locale > LocaleSet
std::string xml_tag_enclose(const std::string &text, const std::string &tag, bool escape=false)
Exchange LineWriter for the lifetime of this object.
std::vector< std::string > ModaliasList
void installResolvable(const PoolItem &pi_r)
String related utilities and Regular expression matching.
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
void addTagIf(const std::string &tag_r, bool yesno_r=true)
Enumeration class of dependency types.
bool empty() const
Whether the container is empty.
static Modalias & instance()
Singleton access.
'Language[_Country]' codes.
constexpr bool empty() const
Whether the string is empty.
Container of Capability (currently read only).
void logfile(const Pathname &logfile_r)
Set path for the logfile.
repo::RepoType type() const
Type of repository,.
Creates a file in helix format which includes all available or installed packages,...
Helper providing more detailed information about a Capability.
Pathname path() const
Repository path.
static LogControl instance()
Singleton access.
const LocaleSet & getRequestedLocales() const
Return the requested locales.
detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.