17#define ZYPP_USE_RESOLVER_INTERNALS
20#include <zypp/base/Logger.h>
21#include <zypp/base/LogControl.h>
23#include <zypp/base/String.h>
24#include <zypp/base/PtrTypes.h>
25#include <zypp/base/NonCopyable.h>
26#include <zypp/base/ReferenceCounted.h>
28#include <zypp/parser/xml/XmlEscape.h>
31#include <zypp/PathInfo.h>
36#include <zypp/sat/detail/PoolImpl.h>
37#include <zypp/solver/detail/Resolver.h>
64inline std::string
xml_tag_enclose(
const std::string &text,
const std::string &tag,
bool escape =
false )
67 result +=
"<" + tag +
">";
74 result +=
"</" + tag +
">";
84 std::stringstream
str;
96 std::stringstream
str;
104 std::stringstream
str;
115 str <<
" />" << endl;
124 str <<
"<dep name='packageand("
129 str <<
"<dep name='otherproviders("
140 str <<
"<dep name='modalias(";
158 std::stringstream
str;
172 std::stringstream
str;
173 CapabilitySet::const_iterator
it =
caps.begin();
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,
295 *
file <<
"</setup>" << endl <<
"<trial>" << endl;
321 const Arch & systemArchitecture,
323 const std::set<std::string> & multiversionSpec,
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();
341 *
file <<
TAB <<
"<!-- " << endl
342 <<
TAB <<
"- alias : " << repo.
alias() << 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;
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;
410 *
file <<
"<install channel=\"" <<
pi_r.repoInfo().alias() <<
"\""
411 <<
" kind=\"" <<
pi_r.kind() <<
"\""
412 <<
" name=\"" <<
pi_r.name() <<
"\""
413 <<
" arch=\"" <<
pi_r.arch() <<
"\""
414 <<
" version=\"" <<
pi_r.edition().version() <<
"\""
415 <<
" release=\"" <<
pi_r.edition().release() <<
"\""
416 <<
" status=\"" <<
pi_r.status() <<
"\""
422 *
file <<
"<lock channel=\"" <<
pi_r.repoInfo().alias() <<
"\""
423 <<
" kind=\"" <<
pi_r.kind() <<
"\""
424 <<
" name=\"" <<
pi_r.name() <<
"\""
425 <<
" arch=\"" <<
pi_r.arch() <<
"\""
426 <<
" version=\"" <<
pi_r.edition().version() <<
"\""
427 <<
" release=\"" <<
pi_r.edition().release() <<
"\""
428 <<
" status=\"" <<
pi_r.status() <<
"\""
434 *
file <<
"<keep channel=\"" <<
pi_r.repoInfo().alias() <<
"\""
435 <<
" kind=\"" <<
pi_r.kind() <<
"\""
436 <<
" name=\"" <<
pi_r.name() <<
"\""
437 <<
" arch=\"" <<
pi_r.arch() <<
"\""
438 <<
" version=\"" <<
pi_r.edition().version() <<
"\""
439 <<
" release=\"" <<
pi_r.edition().release() <<
"\""
440 <<
" status=\"" <<
pi_r.status() <<
"\""
446 *
file <<
"<uninstall kind=\"" <<
pi_r.kind() <<
"\""
447 <<
" name=\"" <<
pi_r.name() <<
"\""
448 <<
" status=\"" <<
pi_r.status() <<
"\""
455 *
file <<
"<addRequire " <<
" name=\"" <<
iter->asString() <<
"\"" <<
"/>" << endl;
458 *
file <<
"<addConflict " <<
" name=\"" <<
iter->asString() <<
"\"" <<
"/>" << endl;
466 *
file <<
"<upgradeRepo name=\"" <<
it->alias() <<
"\"/>" << endl;
473 :
dumpPath(
"/var/log/YaST2/solverTestcase")
476Testcase::Testcase(
const std::string & path)
487 if ( !path.isExist() ) {
489 ERR <<
"Cannot create directory " <<
dumpPath << endl;
510 ResPool pool = resolver.pool();
523 if (
system &&
pi.status().isInstalled() ) {
533 +
"-package.xml.gz");
539 if (
pi.status().isToBeInstalled()
540 && !(
pi.status().isBySolver())) {
543 if (
pi.status().isKept()
544 && !(
pi.status().isBySolver())) {
547 if (
pi.status().isToBeUninstalled()
548 && !(
pi.status().isBySolver())) {
551 if (
pi.status().isLocked()
552 && !(
pi.status().isBySolver())) {
563 "solver-system.xml.gz");
566 control.writeTag() <<
"<focus value=\"" << resolver.
focus() <<
"\"/>" << endl;
599 control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
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...
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Helper providing more detailed information about a Capability.
bool isExpression() const
Container of Capability (currently read only).
sat::detail::IdType id() const
Expert backdoor.
CapDetail detail() const
Helper providing more detailed information about a Capability.
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
std::string asString() const
Conversion to std::string
'Language[_Country]' codes.
Combining sat::Solvable and ResStatus.
What is known about a repository.
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
repo::RepoType type() const
Type of repository,.
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Pathname path() const
Repository path.
unsigned priority() const
Repository priority for solver.
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
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.
Base class for reference counted objects.
Common template to define ifgzstream/ofgzstream reading/writing compressed files.
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 assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
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 form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
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
Enumeration class of dependency types.
static const Dep SUGGESTS
static const Dep CONFLICTS
static const Dep REQUIRES
static const Dep RECOMMENDS
static const Dep SUPPLEMENTS
static const Dep PROVIDES
static const Dep OBSOLETES
static const Dep PREREQUIRES
static const Dep ENHANCES
const std::string & asString() const
String representation of relational operator.
Turn on excessive logging for the lifetime of this object.
Exchange LineWriter for the lifetime of this object.
#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)