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(" 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;
283 const RepositoryTable & sourceTable,
284 const Arch & systemArchitecture,
286 const std::set<std::string> & multiversionSpec,
287 const std::string & systemPath);
295 *file <<
"</setup>" << endl <<
"<trial>" << endl;
301 {
return *file << (_inSetup ?
TAB :
""); }
303 void addTagIf(
const std::string & tag_r,
bool yesno_r =
true )
306 writeTag() <<
"<" << tag_r <<
"/>" << endl;
309 void installResolvable(
const PoolItem & pi_r );
310 void lockResolvable(
const PoolItem & pi_r );
311 void keepResolvable(
const PoolItem & pi_r );
312 void deleteResolvable(
const PoolItem & pi_r );
314 void addUpgradeRepos(
const std::set<Repository> & upgradeRepos_r );
320 const RepositoryTable & repoTable,
321 const Arch & systemArchitecture,
323 const std::set<std::string> & multiversionSpec,
324 const std::string & systemPath)
328 file =
new ofstream(controlPath.c_str());
333 *
file <<
"<?xml version=\"1.0\"?>" << endl
334 <<
"<!-- testcase generated by YaST -->" << 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;
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
401 :
dumpFile (
"/var/log/YaST2/solverTestcase/solver-test.xml")
409 *
file <<
"</trial>" << endl
410 <<
"</test>" << endl;
417 <<
" kind=\"" << pi_r.
kind() <<
"\"" 418 <<
" name=\"" << pi_r.
name() <<
"\"" 419 <<
" arch=\"" << pi_r.
arch() <<
"\"" 422 <<
" status=\"" << pi_r.
status() <<
"\"" 429 <<
" kind=\"" << pi_r.
kind() <<
"\"" 430 <<
" name=\"" << pi_r.
name() <<
"\"" 431 <<
" arch=\"" << pi_r.
arch() <<
"\"" 434 <<
" status=\"" << pi_r.
status() <<
"\"" 441 <<
" kind=\"" << pi_r.
kind() <<
"\"" 442 <<
" name=\"" << pi_r.
name() <<
"\"" 443 <<
" arch=\"" << pi_r.
arch() <<
"\"" 446 <<
" status=\"" << pi_r.
status() <<
"\"" 452 *
file <<
"<uninstall kind=\"" << pi_r.
kind() <<
"\"" 453 <<
" name=\"" << pi_r.
name() <<
"\"" 454 <<
" status=\"" << pi_r.
status() <<
"\"" 460 for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
461 *
file <<
"<addRequire " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
463 for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
464 *
file <<
"<addConflict " <<
" name=\"" << iter->asString() <<
"\"" <<
"/>" << endl;
470 for_( it, upgradeRepos_r.begin(), upgradeRepos_r.end() )
472 *
file <<
"<upgradeRepo name=\"" << it->alias() <<
"\"/>" << endl;
479 :dumpPath(
"/var/log/YaST2/solverTestcase")
482 Testcase::Testcase(
const std::string & path)
486 Testcase::~Testcase()
489 bool Testcase::createTestcase(
Resolver & resolver,
bool dumpPool,
bool runSolver)
491 PathInfo path (dumpPath);
493 if ( !path.isExist() ) {
495 ERR <<
"Cannot create directory " << dumpPath << endl;
500 ERR << dumpPath <<
" is not a directory." << endl;
516 ResPool pool = resolver.pool();
517 RepositoryTable repoTable;
518 PoolItemList items_to_install;
519 PoolItemList items_to_remove;
520 PoolItemList items_locked;
521 PoolItemList items_keep;
522 HelixResolvable_Ptr system = NULL;
529 if ( system && pi.status().isInstalled() ) {
531 system->addResolvable( pi );
536 if (repoTable.find (repo) == repoTable.end()) {
539 +
"-package.xml.gz");
541 repoTable[repo]->addResolvable( pi );
545 if ( pi.status().isToBeInstalled()
546 && !(pi.status().isBySolver())) {
547 items_to_install.push_back( pi );
549 if ( pi.status().isKept()
550 && !(pi.status().isBySolver())) {
551 items_keep.push_back( pi );
553 if ( pi.status().isToBeUninstalled()
554 && !(pi.status().isBySolver())) {
555 items_to_remove.push_back( pi );
557 if ( pi.status().isLocked()
558 && !(pi.status().isBySolver())) {
559 items_locked.push_back( pi );
569 "solver-system.xml.gz");
572 control.
writeTag() <<
"<focus value=\"" << resolver.
focus() <<
"\"/>" << endl;
593 for (
const PoolItem & pi : items_to_install )
596 for (
const PoolItem & pi : items_locked )
599 for (
const PoolItem & pi : items_keep )
602 for (
const PoolItem & pi : items_to_remove )
605 control.
addDependencies (resolver.extraRequires(), resolver.extraConflicts());
607 SystemCheck::instance().conflictSystemCap());
610 control.
addTagIf(
"distupgrade", resolver.isUpgradeMode() );
611 control.
addTagIf(
"update", resolver.isUpdateMode() );
612 control.
addTagIf(
"verify", resolver.isVerifyingMode() );
static const epoch_t noepoch
Value representing noepoch.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
bool resolvePool()
Resolve package dependencies:
std::ostream & writeTag()
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
IdType id() const
Expert backdoor.
Enumeration class of dependency types.
Helper providing more detailed information about a Capability.
bool dupAllowVendorChange() const
std::string release() const
Release.
bool allowVendorChange() const
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/ *'.
String related utilities and Regular expression matching.
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)
bool ignoreAlreadyRecommended() const
bool dupAllowNameChange() const
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.
bool allowNameChange() const
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.
String related utilities and Regular expression matching.
Dependency resolver interface.
DEFINE_PTR_TYPE(HelixResolvable)
bool dupAllowArchChange() const
Common template to define ifgzstream/ofgzstream reading/writing gzip files.
sat::detail::IdType IdType
bool cleandepsOnRemove() const
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.
bool forceResolve() const
void addUpgradeRepos(const std::set< Repository > &upgradeRepos_r)
Base class for reference counted objects.
bool allowArchChange() const
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
bool dupAllowDowngrade() const
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)
ResolverFocus focus() const
void addTagIf(const std::string &tag_r, bool yesno_r=true)
std::string asString() const
bool onlyRequires() const
Easy-to use interface to the ZYPP dependency resolver.
bool allowDowngrade() 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