17 #define ZYPP_USE_RESOLVER_INTERNALS
54 using namespace zypp::str;
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);
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() );
static const epoch_t noepoch
Value representing noepoch.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
std::string alias() const
unique identifier for this source.
static const Dep RECOMMENDS
static const Dep SUPPLEMENTS
static const Dep CONFLICTS
Container of Capability (currently read only).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
bool empty() const
Whether the container is empty.
static ZConfig & instance()
Singleton ctor.
const std::string & asString() const
Enumeration class of dependency types.
Helper providing more detailed information about a Capability.
std::string release() const
Release.
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.
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
What is known about a repository.
Access to the sat-pools string space.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Edition represents [epoch:]version[-release]
Exchange LineWriter for the lifetime of this object.
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
void deleteResolvable(const PoolItem &pi_r)
unsigned priority() const
Repository priority for solver.
void lockResolvable(const PoolItem &pi_r)
void logfile(const Pathname &logfile_r)
Set path for the logfile.
std::string asString() const
Conversion to std::string
static LogControl instance()
Singleton access.
static const Dep SUGGESTS
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
std::string xml_tag_enclose(const std::string &text, const std::string &tag, bool escape=false)
static const Dep ENHANCES
std::map< Repository, HelixResolvable_Ptr > RepositoryTable
void addDependencies(const CapabilitySet &capRequire, const CapabilitySet &capConflict)
void keepResolvable(const PoolItem &pi_r)
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
static Pool instance()
Singleton ctor.
CapDetail detail() const
Helper providing more detailed information about a Capability.
DEFINE_PTR_TYPE(HelixResolvable)
Common template to define ifgzstream/ofgzstream reading/writing gzip files.
sat::detail::IdType IdType
std::string helixXML(const T &obj)
HelixResolvable(const std::string &path)
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
static const Dep REQUIRES
epoch_t epoch() const
Epoch.
void addResolvable(const PoolItem item)
std::string version() const
Version.
ResStatus & status() const
Returns the current status.
void addUpgradeRepos(const std::set< Repository > &upgradeRepos_r)
Base class for reference counted objects.
Turn on excessive logging for the lifetime of this object.
static const Dep PROVIDES
std::string numstring(char n, int w=0)
constexpr bool empty() const
Whether the string is empty.
bool isExpression() const
std::vector< std::string > ModaliasList
const std::string & asString() const
String representation of relational operator.
'Language[_Country]' codes.
repo::RepoType type() const
Type of repository,.
const_iterator end() const
Iterator pointing behind the last Capability.
std::unordered_set< Capability > CapabilitySet
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
static Modalias & instance()
Singleton access.
Base class for Exception.
const LocaleSet & getRequestedLocales() const
Return the requested locales.
std::string xml_escape(const std::string &text)
static const Dep OBSOLETES
gzstream_detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.
std::string asSeconds() const
Convert to string representation of calendar time in numeric form (like "1029255142").
Creates a file in helix format which contains all controll action of a testcase ( file is known as *-...
IMPL_PTR_TYPE(SATResolver)
Combining sat::Solvable and ResStatus.
void installResolvable(const PoolItem &pi_r)
void addTagIf(const std::string &tag_r, bool yesno_r=true)
std::string asString() const
static const Dep PREREQUIRES
const_iterator begin() const
Iterator pointing to the first Capability.
std::unordered_set< Locale > LocaleSet
Creates a file in helix format which includes all available or installed packages,patches,selections....
Pathname path() const
Repository path.
sat::detail::IdType id() const
Expert backdoor.
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
RepoInfo repoInfo() const