27 const std::string & r,
const std::string &
a )
29 , edition_set( !v.
empty() )
35 void _remember( PoolItem p ) { poolItem = p; }
37 bool operator()( PoolItem p )
39 if ( arch_set && arch != p->arch() )
43 if ( edition_set && p->edition().match( edition ) != 0 )
46 || poolItem->arch().compare( p->arch() ) < 0
47 || poolItem->edition().compare( p->edition() ) < 0 )
53 static PoolItem get_poolItem(
const std::string & source_alias,
54 const std::string & package_name,
55 const std::string & kind_name =
"",
56 const std::string & ver =
"",
57 const std::string & rel =
"",
58 const std::string & arch =
"" )
66 FindPackage info(
kind, ver, rel, arch );
69 pool.byIdentEnd (
kind, package_name ),
70 resfilter::ByRepository( source_alias ),
73 poolItem = info.poolItem;
77 pool.byIdentEnd (
kind, package_name ),
79 poolItem = info.poolItem;
82 catch (
const Exception & e ) {
84 WAR <<
"Can't find kind[" << kind_name <<
"]:'" << package_name
85 <<
"': source '" << source_alias <<
"' not defined" << std::endl;
89 WAR <<
"Can't find kind: " <<
kind <<
":'" << package_name
90 <<
"' in source '" << source_alias <<
"': no such name/kind" << std::endl;
97 const bool isKeep = ( entry.first ==
"keep" );
98 const auto & props = entry.second;
100 auto getProp = [&](
const std::string & k ) -> std::string {
101 auto it = props.find(k);
102 return it != props.end() ? it->second : std::string();
106 std::string source_alias = getProp (
"channel");
107 std::string package_name = getProp (
"name");
108 if (package_name.empty())
109 package_name = getProp (
"package");
110 std::string kind_name = getProp (
"kind");
111 std::string version = getProp (
"version");
112 if ( version.empty() )
113 version = getProp (
"ver");
114 std::string release = getProp (
"release");
115 if ( release.empty() )
116 release = getProp (
"rel");
117 std::string architecture = getProp (
"arch");
119 if ( version.empty() )
121 if ( kind_name.empty() )
122 kind_name =
"package";
133 WAR <<
"Unknown Selectable " << kind_name <<
":" << package_name << std::endl;
139 poolItem = get_poolItem (source_alias, package_name, kind_name, version, release, architecture );
141 MIL <<
"Locking " << package_name <<
" from channel " << source_alias << poolItem << std::endl;
144 WAR <<
"Unknown package " << source_alias <<
"::" << package_name << std::endl;
150 std::string kind_name = getProp (
"kind");
151 std::string name = getProp (
"name");
153 name = getProp (
"package");
155 std::string source_alias = getProp (
"channel");
156 if (source_alias.empty())
157 source_alias =
"@System";
161 WAR <<
"transact need 'name' parameter" << std::endl;
167 poolItem = get_poolItem( source_alias, name, kind_name, getProp (
"version"), getProp (
"release") );
171 if (source_alias ==
"@System") {
181 WAR <<
"Unknown item " << source_alias <<
"::" << name << std::endl;
205 {
return _pimpl->priority; }
232 {
return _pimpl->channel; }
235 {
return _pimpl->package; }
247 {
return _pimpl->architecture; }
250 {
return _pimpl->systemRepo; }
256 {
return _pimpl->resolverFocus; }
259 {
return _pimpl->globalPath; }
262 {
return _pimpl->hardwareInfoFile; }
265 {
return _pimpl->systemCheck; }
268 {
return _pimpl->modaliasList; }
271 {
return _pimpl->localesTracker; }
274 {
return _pimpl->vendorLists; }
277 {
return _pimpl->autoinstalled; }
280 {
return _pimpl->multiversionSpec; }
283 {
return _pimpl->forceInstallTasks; }
289 {
return _pimpl->set_licence; }
292 {
return _pimpl->show_mediaid; }
295 {
return _pimpl->ignorealreadyrecommended; }
298 {
return _pimpl->onlyRequires; }
301 {
return _pimpl->forceResolve; }
304 {
return _pimpl->cleandepsOnRemove; }
307 {
return _pimpl->noUpdateProvide; }
310 {
return _pimpl->allowDowngrade; }
313 {
return _pimpl->allowNameChange; }
316 {
return _pimpl->allowArchChange; }
319 {
return _pimpl->allowVendorChange; }
322 {
return _pimpl->dupAllowDowngrade; }
325 {
return _pimpl->dupAllowNameChange; }
328 {
return _pimpl->dupAllowArchChange; }
331 {
return _pimpl->dupAllowVendorChange; }
335 const auto &setup =
data();
336 if ( !setup.architecture.empty() )
338 MIL <<
"Setting architecture to '" << setup.architecture <<
"'" << std::endl;
340 setenv (
"ZYPP_TESTSUITE_FAKE_ARCH", setup.architecture.c_str(), 1);
343 if ( setup.systemRepo ) {
344 if (!
loadRepo( manager, *
this, *setup.systemRepo ) )
346 ERR <<
"Can't setup 'system'" << std::endl;
351 if ( !setup.hardwareInfoFile.empty() ) {
352 setenv(
"ZYPP_MODALIAS_SYSFS", setup.hardwareInfoFile.asString().c_str(), 1 );
353 MIL <<
"setting HardwareInfo to: " << setup.hardwareInfoFile.asString() << std::endl;
356 for (
const auto &channel : setup.repos ) {
357 if ( !
loadRepo( manager, *
this, channel ) )
359 ERR <<
"Can't setup 'channel'" << std::endl;
364 if ( !setup.systemCheck.empty() ) {
365 MIL <<
"setting systemCheck to: " << setup.systemCheck.asString() << std::endl;
366 SystemCheck::instance().setFile( setup.systemCheck );
374 const auto &repoData =
data.data();
376 MIL <<
"'" << pathname <<
"'" << std::endl;
382 if ( repoData.type == TrType::Url ) {
384 MIL <<
"Load from Url '" << repoData.path <<
"'" << std::endl;
388 nrepo.
setName ( repoData.alias );
400 ERR <<
"Couldn't load packages from Url '" << repoData.path <<
"'" << std::endl;
406 MIL <<
"Load from File '" << pathname <<
"'" << std::endl;
409 if ( repoData.alias ==
"@System" ) {
418 nrepo.
setName ( repoData.alias );
425 if ( repoData.type == TrType::Helix )
429 MIL <<
"Loaded " << satRepo.
solvablesSize() <<
" resolvables from " << ( repoData.path.empty()?pathname.
asString():repoData.path) <<
"." << std::endl;
433 ERR <<
"Couldn't load packages from XML file '" << repoData.path <<
"'" << std::endl;
489 for (
const auto & entry :
locks() )
490 applyLockEntry( entry,
pool );
495 Resolver_Ptr resolver =
getZYpp()->resolver();
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Base class for Exception.
What is known about a repository.
void addBaseUrl(Url url)
Add a base url.
void setPriority(unsigned newval_r)
Set repository priority for solver.
creates and provides information about known sources.
void refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy=RefreshIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local raw cache.
void buildCache(const RepoInfo &info, CacheBuildPolicy policy=BuildIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local cache.
void loadFromCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Load resolvables into the pool.
void addHelix(const Pathname &file_r)
Load Solvables from a helix-file.
void addTesttags(const Pathname &file_r)
Load Solvables from a libsolv testtags-file.
size_type solvablesSize() const
Number of solvables in Repository.
void setInfo(const RepoInfo &info_r)
Set RepoInfo for this repository.
static const ResKind nokind
Value representing nokind ("").
static const ResKind package
static ResKind fromBuiltin(const std::string &str)
Converts the string representation of a kind to its ResKind value or noKind if the passed string is n...
static ResPool instance()
Singleton ctor.
TraitsType::KindType Kind
static VendorAttr & noTargetInstance()
Singleton, settings used if no Target is active.
void addVendorList(VendorList &&list_r)
Adding new equivalent vendor strings container.
Arch systemArchitecture() const
The system architecture zypp uses.
void setSystemArchitecture(const Arch &arch_r)
Override the zypp system architecture.
static ZConfig & instance()
Singleton ctor.
const std::set< std::string > & multiversionSpec() const
Url asUrl(const std::string &scheme_r) const
Url representation using scheme_r schema .
const std::string & asString() const
String representation.
RWCOW_pointer< ForceInstallImpl > _pimpl
const std::string & package() const
const std::string & kind() const
const std::string & channel() const
const ForceInstallImpl & data() const
const RepoDataImpl & data() const
TestcaseRepoType type() const
RWCOW_pointer< RepoDataImpl > _pimpl
const std::string & path() const
const std::string & alias() const
Arch architecture() const
const std::vector< RepoData > & repos() const
bool applySetup(zypp::RepoManager &manager) const
ResolverFocus resolverFocus() const
bool onlyRequires() const
const target::Modalias::ModaliasList & modaliasList() const
bool noUpdateProvide() const
const std::vector< ForceInstall > & forceInstallTasks() const
const std::optional< RepoData > & systemRepo() const
const std::vector< std::vector< std::string > > & vendorLists() const
const std::set< std::string > & multiversionSpec() const
bool dupAllowVendorChange() const
RWCOW_pointer< TestcaseSetupImpl > _pimpl
bool allowNameChange() const
const sat::StringQueue & autoinstalled() const
bool allowDowngrade() const
static bool loadRepo(zypp::RepoManager &manager, const TestcaseSetup &setup, const RepoData &data)
const Pathname & systemCheck() const
std::pair< std::string, std::map< std::string, std::string > > LockEntry
lock/keep node data extracted from trial nodes and applied as pool setup.
TestcaseSetupImpl & data()
bool dupAllowNameChange() const
bool allowArchChange() const
bool cleandepsOnRemove() const
bool show_mediaid() const
bool forceResolve() const
const Pathname & globalPath() const
const Pathname & hardwareInfoFile() const
bool ignorealreadyrecommended() const
bool allowVendorChange() const
const base::SetTracker< LocaleSet > & localesTracker() const
bool dupAllowArchChange() const
const std::vector< LockEntry > & locks() const
bool dupAllowDowngrade() const
void setAutorefresh(bool autorefresh)
enable or disable autorefresh
void setAlias(const std::string &alias)
set the repository alias
void setName(const std::string &name)
set the repository name
void setEnabled(bool enabled)
enable or disable the repository
void setAutoInstalled(const Queue &autoInstalled_r)
Set ident list of all autoinstalled solvables.
static Pool instance()
Singleton ctor.
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
void setRequestedLocales(const LocaleSet &locales_r)
Set the requested locales.
Repository systemRepo()
Return the system repository, create it if missing.
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
std::vector< std::string > ModaliasList
static Modalias & instance()
Singleton access.
const ModaliasList & modaliasList() const
List of modaliases found on system.
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
intrusive_ptr< Selectable > Ptr
@ Edition
Editions with v-r setparator highlighted.
@ AS_VENDOR_LISTS
VendorAttr vendor-equivalence lists.
@ AS_AUTOINSTALLED
setAutoInstalled
@ AS_SOLVER_FLAGS
Resolver flags, focus, DUP flags.
@ AS_MODALIAS
Modalias list.
@ AS_LOCKS
lock/keep nodes extracted from trial nodes
@ AS_MULTIVERSION
ZConfig multiversion spec.
@ AS_LOCALES
initRequestedLocales + setRequestedLocales
bool empty() const
Whether neither idents nor provides are set.
Queue StringQueue
Queue with String ids.
ResolverFocus
The resolver's general attitude.
ZYpp::Ptr getZYpp()
relates: ZYppFactory Convenience to get the Pointer to the ZYpp instance.
const ResKind ResTraits< Package >::kind(ResKind::package)
int invokeOnEach(TIterator begin_r, TIterator end_r, TFilter filter_r, TFunction fnc_r)
Iterate through [begin_r,end_r) and invoke fnc_r on each item that passes filter_r.
Track added/removed set items based on an initial set.
const set_type & current() const
Return the current set.
const set_type & added() const
Return the set of added items.
const set_type & removed() const
Return the set of removed items.