libzypp 17.38.6
architecturecomponent.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8----------------------------------------------------------------------*/
10#include <zypp/ng/sat/pool.h>
11#include <set>
12
13extern "C"
14{
15#include <solv/poolarch.h>
16#include <solv/repo.h>
17}
18
19namespace zyppng::sat {
20
22 {
23 _provider = std::move(provider);
24 if ( _pool )
25 _pool->setDirty ( PoolInvalidation::Data, {"ArchitectureComponent: resetting the architecture provider"} );
26 }
27
28
33
35 {
36 if ( _watcher.remember( pool.serial() ) ) {
37 ::pool_setarch( pool.get(), arch().asString().c_str() );
38 }
39 }
40
45
47 {
48 detail::CRepo * repo_r = id;
49 if ( ! pool.isSystemRepo( repo_r ) )
50 {
51 // Filter out unwanted archs
52 std::set<detail::IdType> sysids;
53 {
54 zypp::Arch arch = this->arch();
56 for ( auto it = sysarchs.begin(); it != sysarchs.end(); ++it )
57 sysids.insert( it->id() );
58
59 // unfortunately libsolv treats src/nosrc as architecture:
60 sysids.insert( ARCH_SRC );
61 sysids.insert( ARCH_NOSRC );
62 }
63
64 detail::IdType blockBegin = 0;
65 unsigned blockSize = 0;
66 for ( detail::IdType i = repo_r->start; i < repo_r->end; ++i )
67 {
68 detail::CSolvable * s( pool.get()->solvables + i );
69 if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
70 {
71 // Remember an unwanted arch entry:
72 if ( ! blockBegin )
73 blockBegin = i;
74 ++blockSize;
75 }
76 else if ( blockSize )
77 {
78 // Free remembered entries
79 ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*resusePoolIDs*/false );
80 blockBegin = blockSize = 0;
81 }
82 }
83 if ( blockSize ) {
84 // Free remembered entries
85 ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*resusePoolIDs*/false );
86 }
87 }
88 }
89
90} // namespace zyppng::sat
Architecture.
Definition Arch.h:37
static CompatSet compatSet(const Arch &targetArch_r)
Return a set of all Arch's compatibleWith a targetArch_r.
Definition Arch.cc:793
std::set< Arch, CompareByGT< Arch > > CompatSet
Reversed arch order, best Arch first.
Definition Arch.h:122
Simple serial number watcher.
std::function< zypp::Arch()> ArchitectureProvider
Provider function returning an Arch.
void onRepoAdded(Pool &pool, detail::RepoIdType id) override
void setProvider(ArchitectureProvider provider)
Set a custom architecture provider.
zypp::Arch arch() const
Get the current architecture.
Orchestrator for a libsolv pool instance.
Definition pool.h:37
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
Definition Patch.cc:122
zypp::sat::detail::CSolvable CSolvable
zypp::sat::detail::RepoIdType RepoIdType
zypp::sat::detail::IdType IdType
zypp::sat::detail::CRepo CRepo
This file contains private API, this might break at any time between releases.
@ Data
Structural or data change (e.g., Rootfs, Arch, or Repo content).