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("
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);
295 *
file <<
"</setup>" << endl <<
"<trial>" << endl;
300 void addTagIf(
const std::string & tag_r,
bool yesno_r =
true )
318 const Arch & systemArchitecture,
320 const std::set<std::string> & multiversionSpec,
321 const std::string & systemPath)
322 :dumpFile (controlPath)
325 file =
new ofstream(controlPath.c_str());
330 *
file <<
"<?xml version=\"1.0\"?>" << endl
331 <<
"<!-- testcase generated by YaST -->" << endl
333 <<
"<setup arch=\"" << systemArchitecture <<
"\">" << endl
334 <<
TAB <<
"<system file=\"" << systemPath <<
"\"/>" << endl << endl;
335 for ( RepositoryTable::const_iterator it = repoTable.begin();
336 it != repoTable.end(); ++it ) {
338 *
file <<
TAB <<
"<!-- " << endl
339 <<
TAB <<
"- alias : " << repo.
alias() << endl;
344 *
file <<
TAB <<
"- url : " << *itUrl << endl;
346 *
file <<
TAB <<
"- path : " << repo.
path() << endl;
347 *
file <<
TAB <<
"- type : " << repo.
type() << endl;
348 *
file <<
TAB <<
"- generated : " << (it->first.generatedTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
349 *
file <<
TAB <<
"- outdated : " << (it->first.suggestedExpirationTimestamp()).
form(
"%Y-%m-%d %H:%M:%S" ) << endl;
350 *
file <<
TAB <<
" -->" << endl;
353 <<
"-package.xml.gz\" name=\"" << repo.
alias() <<
"\""
354 <<
" priority=\"" << repo.
priority()
355 <<
"\" />" << endl << endl;
366 for (
Locale l : requestedLocales )
368 const char * fate = ( addedLocales.count(l) ?
"\" fate=\"added" :
"" );
369 *
file <<
TAB <<
"<locale name=\"" << l << fate <<
"\" />" << endl;
371 for (
Locale l : removedLocales )
373 *
file <<
TAB <<
"<locale name=\"" << l <<
"\" fate=\"removed\" />" << endl;
384 for_( it, modaliasList.begin(), modaliasList.end() ) {
389 for_( it, multiversionSpec.begin(), multiversionSpec.end() ) {
390 *
file <<
TAB <<
"<multiversion name=\"" << *it
398 :dumpFile (
"/var/log/YaST2/solverTestcase/solver-test.xml")
406 *
file <<
"</trial>" << endl
407 <<
"</test>" << endl;
414 <<
" kind=\"" << pi_r.
kind() <<
"\""
415 <<
" name=\"" << pi_r.
name() <<
"\""
416 <<
" arch=\"" << pi_r.
arch() <<
"\""
419 <<
" status=\"" << pi_r.
status() <<
"\""
426 <<
" kind=\"" << pi_r.
kind() <<
"\""
427 <<
" name=\"" << pi_r.
name() <<
"\""
428 <<
" arch=\"" << pi_r.
arch() <<
"\""
431 <<
" status=\"" << pi_r.
status() <<
"\""
438 <<
" kind=\"" << pi_r.
kind() <<
"\""
439 <<
" name=\"" << pi_r.
name() <<
"\""
440 <<
" arch=\"" << pi_r.
arch() <<
"\""
443 <<
" status=\"" << pi_r.
status() <<
"\""
449 *
file <<
"<uninstall kind=\"" << pi_r.
kind() <<
"\""
450 <<
" name=\"" << pi_r.
name() <<
"\""
451 <<
" status=\"" << pi_r.
status() <<
"\""
457 for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
458 *
file <<
"<addRequire " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
460 for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
461 *
file <<
"<addConflict " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
467 for_( it, upgradeRepos_r.begin(), upgradeRepos_r.end() )
469 *
file <<
"<upgradeRepo name=\"" << it->alias() <<
"\"/>" << endl;
476 :dumpPath(
"/var/log/YaST2/solverTestcase")
479 Testcase::Testcase(
const std::string & path)
483 Testcase::~Testcase()
486 bool Testcase::createTestcase(Resolver & resolver,
bool dumpPool,
bool runSolver)
488 PathInfo path (dumpPath);
490 if ( !path.isExist() ) {
492 ERR <<
"Cannot create directory " << dumpPath << endl;
497 ERR << dumpPath <<
" is not a directory." << endl;
510 resolver.resolvePool();
513 ResPool pool = resolver.pool();
515 PoolItemList items_to_install;
516 PoolItemList items_to_remove;
517 PoolItemList items_locked;
518 PoolItemList items_keep;
519 HelixResolvable_Ptr system = NULL;
522 system =
new HelixResolvable(dumpPath +
"/solver-system.xml.gz");
524 for (
const PoolItem & pi : pool )
526 if ( system && pi.status().isInstalled() ) {
528 system->addResolvable( pi );
531 Repository repo = pi.repository();
533 if (repoTable.find (repo) == repoTable.end()) {
534 repoTable[repo] =
new HelixResolvable(dumpPath +
"/"
536 +
"-package.xml.gz");
538 repoTable[repo]->addResolvable( pi );
542 if ( pi.status().isToBeInstalled()
543 && !(pi.status().isBySolver())) {
544 items_to_install.push_back( pi );
546 if ( pi.status().isKept()
547 && !(pi.status().isBySolver())) {
548 items_keep.push_back( pi );
550 if ( pi.status().isToBeUninstalled()
551 && !(pi.status().isBySolver())) {
552 items_to_remove.push_back( pi );
554 if ( pi.status().isLocked()
555 && !(pi.status().isBySolver())) {
556 items_locked.push_back( pi );
561 HelixControl control (dumpPath +
"/solver-test.xml",
566 "solver-system.xml.gz");
569 control.addTagIf(
"ignorealreadyrecommended", resolver.ignoreAlreadyRecommended() );
570 control.addTagIf(
"onlyRequires", resolver.onlyRequires() );
571 control.addTagIf(
"forceResolve", resolver.forceResolve() );
573 control.addTagIf(
"cleandepsOnRemove", resolver.cleandepsOnRemove() );
575 control.addTagIf(
"allowDowngrade", resolver.allowDowngrade() );
576 control.addTagIf(
"allowNameChange", resolver.allowNameChange() );
577 control.addTagIf(
"allowArchChange", resolver.allowArchChange() );
578 control.addTagIf(
"allowVendorChange", resolver.allowVendorChange() );
580 control.addTagIf(
"dupAllowDowngrade", resolver.dupAllowDowngrade() );
581 control.addTagIf(
"dupAllowNameChange", resolver.dupAllowNameChange() );
582 control.addTagIf(
"dupAllowArchChange", resolver.dupAllowArchChange() );
583 control.addTagIf(
"dupAllowVendorChange", resolver.dupAllowVendorChange() );
585 control.closeSetup();
588 for (
const PoolItem & pi : items_to_install )
589 { control.installResolvable( pi ); }
591 for (
const PoolItem & pi : items_locked )
592 { control.lockResolvable( pi ); }
594 for (
const PoolItem & pi : items_keep )
595 { control.keepResolvable( pi ); }
597 for (
const PoolItem & pi : items_to_remove )
598 { control.deleteResolvable( pi ); }
600 control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
601 control.addDependencies (SystemCheck::instance().requiredSystemCap(),
602 SystemCheck::instance().conflictSystemCap());
603 control.addUpgradeRepos( resolver.upgradeRepos() );
605 control.addTagIf(
"distupgrade", resolver.isUpgradeMode() );
606 control.addTagIf(
"update", resolver.isUpdateMode() );
607 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)
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.
Common template to define ifgzstream/ofgzstream reading/writing gzip files.
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.
gzstream_detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.
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.
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.