17 #define ZYPP_USE_RESOLVER_INTERNALS
66 result +=
"<" + tag +
">";
73 result +=
"</" + tag +
">";
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() );
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
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.
bool isExpression() const
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.
sat::detail::IdType id() const
Expert backdoor.
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.
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
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
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.
Common template to define ifgzstream/ofgzstream reading/writing gzip files.
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)
void addDependencies(const CapabilitySet &capRequire, const CapabilitySet &capConflict)
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)
static Modalias & instance()
Singleton access.
std::vector< std::string > ModaliasList
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)
DEFINE_PTR_TYPE(HelixResolvable)
std::string helixXML(const T &obj)
std::map< Repository, HelixResolvable_Ptr > RepositoryTable
IMPL_PTR_TYPE(SATResolver)
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.
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< Capability > CapabilitySet
std::unordered_set< Locale > LocaleSet
gzstream_detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.
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
const std::string & asString() const
String representation of dependency type.
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.
RepoInfo repoInfo() const