libzypp: zypp/ng/sat/components/packagepolicycomponent.h Source File

libzypp 17.38.10

packagepolicycomponent.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
13#ifndef ZYPP_NG_SAT_COMPONENTS_PACKAGEPOLICYCOMPONENT_H_INCLUDED
14#define ZYPP_NG_SAT_COMPONENTS_PACKAGEPOLICYCOMPONENT_H_INCLUDED
15
16#include "poolcomponents.h"
17#include <zypp/ng/sat/solvablespec.h>
18#include <zypp/ng/sat/solvable.h>
19#include <optional>
20
21namespace zyppng::sat {
22
47 class PackagePolicyComponent : public IPreparedPoolComponent
48 {
49 public:
50 PackagePolicyComponent();
51 ~PackagePolicyComponent() override = default;
52
53 PreparedStage stage() const override { return PreparedStage::Policy; }
54
56 void attach(Pool &p) override;
57
59 void prepare( PreparedPool & pp ) override;
60
62 void onInvalidate( Pool & pool, PoolInvalidation invalidation ) override;
63
65 void onReset( Pool & pool ) override;
66
69 bool isRetracted( const Solvable & solv_r ) const;
71
74 bool isPtfMaster ( const Solvable & solv_r ) const;
75 bool isPtfPackage( const Solvable & solv_r ) const;
77
80
86 void setNeedrebootSpec( SolvableSpec spec );
87
88 bool isNeedreboot( const Solvable & solv_r ) const;
90
91 private:
92 Pool *_pool = nullptr;
93 // --- spec (definition) layer ---
94 SolvableSpec _retractedSpec;
95 SolvableSpec _ptfMasterSpec;
96 SolvableSpec _ptfPackageSpec;
97 SolvableSpec _needrebootSpec;
98
99 // --- evaluated (cache) layer ---
100 // Populated by prepare(); reset to nullopt by onInvalidate().
101 std::optional<EvaluatedSolvableSpec> _retractedEval;
102 std::optional<EvaluatedSolvableSpec> _ptfMasterEval;
103 std::optional<EvaluatedSolvableSpec> _ptfPackageEval;
104 std::optional<EvaluatedSolvableSpec> _needrebootEval;
105 };
106
107
108} // namespace zyppng::sat
109
110#endif // ZYPP_NG_SAT_COMPONENTS_PACKAGEPOLICYCOMPONENT_H_INCLUDED
zyppng::sat::IPreparedPoolComponent
Interface for components that run AFTER the whatprovides index is built.
Definition poolcomponents.h:113
zyppng::sat::PackagePolicyComponent::_pool
Pool * _pool
Definition packagepolicycomponent.h:92
zyppng::sat::PackagePolicyComponent::stage
PreparedStage stage() const override
Definition packagepolicycomponent.h:53
zyppng::sat::PackagePolicyComponent::~PackagePolicyComponent
~PackagePolicyComponent() override=default
zyppng::sat::PackagePolicyComponent::_needrebootEval
std::optional< EvaluatedSolvableSpec > _needrebootEval
Definition packagepolicycomponent.h:104
zyppng::sat::PackagePolicyComponent::attach
void attach(Pool &p) override
called when the component is attached to a pool
Definition packagepolicycomponent.cc:40
zyppng::sat::PackagePolicyComponent::prepare
void prepare(PreparedPool &pp) override
Called by Pool::prepare() — evaluates all specs against the prepared pool.
Definition packagepolicycomponent.cc:46
zyppng::sat::PackagePolicyComponent::setNeedrebootSpec
void setNeedrebootSpec(SolvableSpec spec)
Replace the reboot-needed spec.
Definition packagepolicycomponent.cc:87
zyppng::sat::PackagePolicyComponent::onReset
void onReset(Pool &pool) override
Called on full pool reset — resets all evaluated forms.
Definition packagepolicycomponent.cc:66
zyppng::sat::PackagePolicyComponent::_ptfMasterSpec
SolvableSpec _ptfMasterSpec
hardwired: provides ptf()
Definition packagepolicycomponent.h:95
zyppng::sat::PackagePolicyComponent::_ptfPackageEval
std::optional< EvaluatedSolvableSpec > _ptfPackageEval
Definition packagepolicycomponent.h:103
zyppng::sat::PackagePolicyComponent::isNeedreboot
bool isNeedreboot(const Solvable &solv_r) const
Definition packagepolicycomponent.cc:97
zyppng::sat::PackagePolicyComponent::isRetracted
bool isRetracted(const Solvable &solv_r) const
Definition packagepolicycomponent.cc:78
zyppng::sat::PackagePolicyComponent::onInvalidate
void onInvalidate(Pool &pool, PoolInvalidation invalidation) override
Called when pool content changes — resets all evaluated forms.
Definition packagepolicycomponent.cc:54
zyppng::sat::PackagePolicyComponent::_ptfMasterEval
std::optional< EvaluatedSolvableSpec > _ptfMasterEval
Definition packagepolicycomponent.h:102
zyppng::sat::PackagePolicyComponent::PackagePolicyComponent
PackagePolicyComponent()
Definition packagepolicycomponent.cc:21
zyppng::sat::PackagePolicyComponent::_retractedEval
std::optional< EvaluatedSolvableSpec > _retractedEval
Definition packagepolicycomponent.h:101
zyppng::sat::PackagePolicyComponent::_ptfPackageSpec
SolvableSpec _ptfPackageSpec
hardwired: provides ptf-package()
Definition packagepolicycomponent.h:96
zyppng::sat::PackagePolicyComponent::_retractedSpec
SolvableSpec _retractedSpec
hardwired: provides retracted-patch-package()
Definition packagepolicycomponent.h:94
zyppng::sat::PackagePolicyComponent::isPtfPackage
bool isPtfPackage(const Solvable &solv_r) const
Definition packagepolicycomponent.cc:84
zyppng::sat::PackagePolicyComponent::_needrebootSpec
SolvableSpec _needrebootSpec
user-supplied
Definition packagepolicycomponent.h:97
zyppng::sat::PackagePolicyComponent::isPtfMaster
bool isPtfMaster(const Solvable &solv_r) const
Definition packagepolicycomponent.cc:81
zyppng::sat::Pool
Orchestrator for a libsolv pool instance.
Definition pool.h:37
zyppng::sat::PreparedPool
A move-only, non-owning view of a Pool that guarantees the whatprovides index is valid.
Definition preparedpool.h:51
zyppng::sat::SolvableSpec
A pure data container describing a set of solvables by ident and/or provides.
Definition solvablespec.h:55
zyppng::sat::Solvable
A Solvable object within the sat Pool.
Definition solvable.h:66
zypp::pool
Definition ByIdent.h:24
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
zyppng::sat::PreparedStage
PreparedStage
Execution stages for IPreparedPoolComponent (post-index phase).
Definition poolcomponents.h:45
zyppng::sat::PreparedStage::Policy
@ Policy
Blacklists, Reboot Specs, Storage Policy.
Definition poolcomponents.h:46
zyppng::sat::PoolInvalidation
PoolInvalidation
Defines the scope of an invalidation request for the Pool.
Definition poolconstants.h:66
poolcomponents.h
solvable.h
solvablespec.h
This file contains private API, this might break at any time between releases.