17#define ZYPP_USE_RESOLVER_INTERNALS
67 result +=
"<" + tag +
">";
74 result +=
"</" + tag +
">";
84 std::stringstream
str;
96 std::stringstream
str;
104 std::stringstream
str;
107 if (
detail.isVersioned()) {
111 if (!
detail.ed().release().empty())
115 str <<
" />" << endl;
119 }
else if (
detail.isExpression()) {
121 &&
detail.lhs().detail().isNamed()
122 &&
detail.rhs().detail().isNamed()) {
124 str <<
"<dep name='packageand("
128 &&
detail.lhs().id() == NAMESPACE_OTHERPROVIDERS) {
129 str <<
"<dep name='otherproviders("
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;
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)
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;
344 itUrl !=
repo.baseUrlsEnd();
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")
476Testcase::Testcase(
const std::string & path)
483bool Testcase::createTestcase(
Resolver & resolver,
bool dumpPool,
bool runSolver)
487 if ( !path.isExist() ) {
489 ERR <<
"Cannot create directory " << dumpPath << endl;
503 zypp::base::LogControl::TmpLineWriter tempRedirect;
505 zypp::base::LogControl::TmpExcessive excessive;
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;
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()) {
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 );
563 "solver-system.xml.gz");
566 control.writeTag() <<
"<focus value=\"" << resolver.
focus() <<
"\"/>" << endl;
569 control.addTagIf(
"onlyRequires", resolver.
onlyRequires() );
570 control.addTagIf(
"forceResolve", resolver.
forceResolve() );
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() );
const std::string & asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Helper providing more detailed information about a Capability.
Container of Capability (currently read only).
const_iterator begin() const
Iterator pointing to the first Capability.
const_iterator end() const
Iterator pointing behind the last Capability.
bool empty() const
Whether the container is empty.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
CapDetail detail() const
Helper providing more detailed information about a Capability.
std::string asSeconds() const
Convert to string representation of calendar time in numeric form (like "1029255142").
Edition represents [epoch:]version[-release]
std::string version() const
Version.
static const epoch_t noepoch
Value representing noepoch.
std::string release() const
Release.
epoch_t epoch() const
Epoch.
Base class for Exception.
Access to the sat-pools string space.
sat::detail::IdType IdType
constexpr bool empty() const
Whether the string is empty.
std::string asString() const
Conversion to std::string
'Language[_Country]' codes.
Combining sat::Solvable and ResStatus.
ResStatus & status() const
Returns the current status.
What is known about a repository.
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
IdType id() const
Expert backdoor.
Dependency resolver interface.
bool cleandepsOnRemove() const
bool forceResolve() const
bool dupAllowDowngrade() const
bool ignoreAlreadyRecommended() const
bool allowNameChange() const
bool allowDowngrade() const
bool resolvePool()
Resolve package dependencies:
bool dupAllowArchChange() const
bool dupAllowNameChange() const
bool allowArchChange() const
bool dupAllowVendorChange() const
ResolverFocus focus() const
bool allowVendorChange() const
bool onlyRequires() const
static ZConfig & instance()
Singleton ctor.
static LogControl instance()
Singleton access.
void logfile(const Pathname &logfile_r)
Set path for the logfile.
Base class for reference counted objects.
Wrapper class for stat/lstat.
std::string alias() const
unique identifier for this source.
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
static Pool instance()
Singleton ctor.
const LocaleSet & getRequestedLocales() const
Return the requested locales.
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
Creates a file in helix format which contains all controll action of a testcase ( file is known as *-...
void installResolvable(const PoolItem &pi_r)
void deleteResolvable(const PoolItem &pi_r)
void addUpgradeRepos(const std::set< Repository > &upgradeRepos_r)
std::ostream & writeTag()
void addDependencies(const CapabilitySet &capRequire, const CapabilitySet &capConflict)
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)
void keepResolvable(const PoolItem &pi_r)
void lockResolvable(const PoolItem &pi_r)
void addTagIf(const std::string &tag_r, bool yesno_r=true)
Creates a file in helix format which includes all available or installed packages,...
HelixResolvable(const std::string &path)
void addResolvable(const PoolItem item)
std::vector< std::string > ModaliasList
static Modalias & instance()
Singleton access.
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
std::string xml_tag_enclose(const std::string &text, const std::string &tag, bool escape=false)
std::string helixXML(const T &obj)
std::map< Repository, HelixResolvable_Ptr > RepositoryTable
std::string xml_escape(const std::string &text)
String related utilities and Regular expression matching.
std::string numstring(char n, int w=0)
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
_dumpPath dumpPath(const Pathname &root_r, const Pathname &sub_r)
dumpPath iomaip to dump '(root_r)sub_r' output,
ZYPP_API detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Locale > LocaleSet
detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.
std::unordered_set< Capability > CapabilitySet
bool isKind(const ResKind &val_r)
Convenient test for ResKinds.
Enumeration class of dependency types.
const std::string & asString() const ZYPP_API
String representation of dependency type.
RepoInfo repoInfo() const
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
#define IMPL_PTR_TYPE(NAME)