libzypp: zyppng::sat::PackagePolicyComponent Class Reference

libzypp 17.38.7

zyppng::sat::PackagePolicyComponent Class Reference

Component managing package-level policies: retracted packages, PTF tracking, and the "reboot needed" hint. More...

`#include <zypp/ng/sat/components/packagepolicycomponent.h>`

Inheritance diagram for zyppng::sat::PackagePolicyComponent:

## Public Member Functions
| PackagePolicyComponent ()
| ~PackagePolicyComponent () override=default
PreparedStage | stage () const override
void | attach (Pool &p) override
| called when the component is attached to a pool
void | prepare (PreparedPool &pp) override
| Called by Pool::prepare() — evaluates all specs against the prepared pool.
void | onInvalidate (Pool &pool, PoolInvalidation invalidation) override
| Called when pool content changes — resets all evaluated forms.
void | onReset (Pool &pool) override
| Called on full pool reset — resets all evaluated forms.
Retracted packages
bool | isRetracted (const Solvable &solv_r) const
PTF (Program Temporary Fix)
bool | isPtfMaster (const Solvable &solv_r) const
bool | isPtfPackage (const Solvable &solv_r) const
Public Member Functions inherited from zyppng::sat::IPreparedPoolComponent
virtual int | priority () const
| Fine-grained ordering within a stage.
Public Member Functions inherited from zyppng::sat::detail::IBasicPoolComponent
virtual void | checkDirty (Pool &)
| Probe external state.
virtual void | onRepoAdded (Pool &, RepoIdType)
virtual void | onRepoRemoved (Pool &, RepoIdType)
virtual | ~IBasicPoolComponent ()=default
| IBasicPoolComponent ()=default
| IBasicPoolComponent (const IBasicPoolComponent &)=delete
| IBasicPoolComponent (IBasicPoolComponent &&)=delete
IBasicPoolComponent & | operator= (const IBasicPoolComponent &)=delete
IBasicPoolComponent & | operator= (IBasicPoolComponent &&)=delete

## Reboot-needed hint
Pool * | _pool = nullptr
SolvableSpec | _retractedSpec
| hardwired: provides retracted-patch-package()
SolvableSpec | _ptfMasterSpec
| hardwired: provides ptf()
SolvableSpec | _ptfPackageSpec
| hardwired: provides ptf-package()
SolvableSpec | _needrebootSpec
| user-supplied
std::optional< EvaluatedSolvableSpec > | _retractedEval
std::optional< EvaluatedSolvableSpec > | _ptfMasterEval
std::optional< EvaluatedSolvableSpec > | _ptfPackageEval
std::optional< EvaluatedSolvableSpec > | _needrebootEval
void | setNeedrebootSpec (SolvableSpec spec)
| Replace the reboot-needed spec.
bool | isNeedreboot (const Solvable &solv_r) const

## Detailed Description

Component managing package-level policies: retracted packages, PTF tracking, and the "reboot needed" hint.

Design
  Each policy is represented by two pieces of state:
  - A SolvableSpec (pure data: idents + provides tokens). This is the definition of the set and is what callers configure via `setNeedrebootSpec()`. The retracted/PTF specs are hardwired.
  - An `std::optional<EvaluatedSolvableSpec>` that is constructed in `prepare(Pool&)` and reset to `nullopt` by `onInvalidate()`. Once evaluated, contains() is O(1) with no pool access.

Lifecycle
  - `prepare(Pool&)` is called by the Pool during its own prepare() cycle. This is where the specs are expanded and the evaluated forms constructed.
  - `onInvalidate()` resets the evaluated forms so they are rebuilt on the next `prepare()` call.

Note
  The hardwired retracted/PTF provides tokens are the same strings used in the legacy `zypp::sat::Pool`: `"retracted-patch-package()"`, `"ptf()"`, `"ptf-package()"`.

Definition at line 47 of file packagepolicycomponent.h.

## Constructor & Destructor Documentation

## ◆ PackagePolicyComponent()

zyppng::sat::PackagePolicyComponent::PackagePolicyComponent | ( |  | ) |

Definition at line 21 of file packagepolicycomponent.cc.

## ◆ ~PackagePolicyComponent()

zyppng::sat::PackagePolicyComponent::~PackagePolicyComponent | ( |  | ) |
| overridedefault

## Member Function Documentation

## ◆ stage()

PreparedStage zyppng::sat::PackagePolicyComponent::stage | ( |  | ) | const
| inlineoverridevirtual

Reimplemented from zyppng::sat::IPreparedPoolComponent.

Definition at line 53 of file packagepolicycomponent.h.

## ◆ attach()

void zyppng::sat::PackagePolicyComponent::attach | ( | Pool & | p | ) |
| overridevirtual

called when the component is attached to a pool

Reimplemented from zyppng::sat::IPreparedPoolComponent.

Definition at line 40 of file packagepolicycomponent.cc.

## ◆ prepare()

void zyppng::sat::PackagePolicyComponent::prepare | ( | PreparedPool & | pp | ) |
| overridevirtual

Called by Pool::prepare() — evaluates all specs against the prepared pool.

Reimplemented from zyppng::sat::IPreparedPoolComponent.

Definition at line 46 of file packagepolicycomponent.cc.

## ◆ onInvalidate()

void zyppng::sat::PackagePolicyComponent::onInvalidate | ( | Pool & | pool,
|  | PoolInvalidation | invalidation )
| overridevirtual

Called when pool content changes — resets all evaluated forms.

Reimplemented from zyppng::sat::detail::IBasicPoolComponent.

Definition at line 54 of file packagepolicycomponent.cc.

## ◆ onReset()

void zyppng::sat::PackagePolicyComponent::onReset | ( | Pool & | pool | ) |
| overridevirtual

Called on full pool reset — resets all evaluated forms.

Reimplemented from zyppng::sat::detail::IBasicPoolComponent.

Definition at line 66 of file packagepolicycomponent.cc.

## ◆ isRetracted()

bool zyppng::sat::PackagePolicyComponent::isRetracted | ( | const Solvable & | solv_r | ) | const

Definition at line 78 of file packagepolicycomponent.cc.

## ◆ isPtfMaster()

bool zyppng::sat::PackagePolicyComponent::isPtfMaster | ( | const Solvable & | solv_r | ) | const

Definition at line 81 of file packagepolicycomponent.cc.

## ◆ isPtfPackage()

bool zyppng::sat::PackagePolicyComponent::isPtfPackage | ( | const Solvable & | solv_r | ) | const

Definition at line 84 of file packagepolicycomponent.cc.

## ◆ setNeedrebootSpec()

void zyppng::sat::PackagePolicyComponent::setNeedrebootSpec | ( | SolvableSpec | spec | ) |

Replace the reboot-needed spec.

The spec is evaluated on the next `prepare()` call. Pass an empty SolvableSpec to disable the hint entirely.

Definition at line 87 of file packagepolicycomponent.cc.

## ◆ isNeedreboot()

bool zyppng::sat::PackagePolicyComponent::isNeedreboot | ( | const Solvable & | solv_r | ) | const

Definition at line 97 of file packagepolicycomponent.cc.

## Member Data Documentation

## ◆ _pool

Pool* zyppng::sat::PackagePolicyComponent::_pool = nullptr
| private

Definition at line 92 of file packagepolicycomponent.h.

## ◆ _retractedSpec

SolvableSpec zyppng::sat::PackagePolicyComponent::_retractedSpec
| private

hardwired: provides retracted-patch-package()

Definition at line 94 of file packagepolicycomponent.h.

## ◆ _ptfMasterSpec

SolvableSpec zyppng::sat::PackagePolicyComponent::_ptfMasterSpec
| private

hardwired: provides ptf()

Definition at line 95 of file packagepolicycomponent.h.

## ◆ _ptfPackageSpec

SolvableSpec zyppng::sat::PackagePolicyComponent::_ptfPackageSpec
| private

hardwired: provides ptf-package()

Definition at line 96 of file packagepolicycomponent.h.

## ◆ _needrebootSpec

SolvableSpec zyppng::sat::PackagePolicyComponent::_needrebootSpec
| private

user-supplied

Definition at line 97 of file packagepolicycomponent.h.

## ◆ _retractedEval

std::optional<EvaluatedSolvableSpec> zyppng::sat::PackagePolicyComponent::_retractedEval
| private

Definition at line 101 of file packagepolicycomponent.h.

## ◆ _ptfMasterEval

std::optional<EvaluatedSolvableSpec> zyppng::sat::PackagePolicyComponent::_ptfMasterEval
| private

Definition at line 102 of file packagepolicycomponent.h.

## ◆ _ptfPackageEval

std::optional<EvaluatedSolvableSpec> zyppng::sat::PackagePolicyComponent::_ptfPackageEval
| private

Definition at line 103 of file packagepolicycomponent.h.

## ◆ _needrebootEval

std::optional<EvaluatedSolvableSpec> zyppng::sat::PackagePolicyComponent::_needrebootEval
| private

Definition at line 104 of file packagepolicycomponent.h.

The documentation for this class was generated from the following files:

- zypp/ng/sat/components/packagepolicycomponent.h
- zypp/ng/sat/components/packagepolicycomponent.cc