Goal
-
class Goal
Centralized point to perform operations with RPMs, Comps groups, and Modules.
Public Functions
-
explicit Goal(const libdnf5::BaseWeakPtr &base)
-
~Goal()
-
void add_module_enable(const std::string &spec, const libdnf5::GoalJobSettings &settings)
Add module enable request to the goal. Throws libdnf5::AssertionError when used with libdnf5 compiled without modules enabled.
- Parameters:
spec – A string with module spec to enable.
settings – A structure to override default goal settings.
-
void add_module_disable(const std::string &spec, const libdnf5::GoalJobSettings &settings)
Add module disable request to the goal. Throws libdnf5::AssertionError when used with libdnf5 compiled without modules enabled.
- Parameters:
spec – A string with module spec to disable.
settings – A structure to override default goal settings.
-
void add_module_reset(const std::string &spec, const libdnf5::GoalJobSettings &settings)
Add module reset request to the goal. Throws libdnf5::AssertionError when used with libdnf5 compiled without modules enabled.
- Parameters:
spec – A string with module spec to reset.
settings – A structure to override default goal settings.
-
void add_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
High level API for an artifact installation. A spec can be either a package specification matched against NEVRA, provides, and file provides, or it can be a path to local rpm file, or URL of rpm to be installed. By using
@
prefix you can also specify a group, environmental group, or a module to be installed.- Parameters:
spec – A string with installation spec
settings – A structure to override default goal settings.
-
void add_debug_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Process spec to install related debug info and debug source packages
- Parameters:
spec – A string with installation spec
settings – A structure to override default goal settings.
-
void add_upgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)
High level API for an artifact upgrade. See
add_install()
for details.- Parameters:
spec – A string with upgrade spec
settings – A structure to override default goal settings.
minimal – Whether to do smallest possible upgrade
-
void add_downgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
High level API for an artifact downgrade. See
add_install()
for details.- Parameters:
spec – A string with upgrade spec
settings – A structure to override default goal settings.
-
void add_reinstall(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
High level API for an artifact reinstall. See
add_install()
for details.- Parameters:
spec – A string with reinstall spec
settings – A structure to override default goal settings.
-
void add_remove(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
High level API for an artifact removal. See
add_install()
for details.- Parameters:
spec – A string with reinstall spec
settings – A structure to override default goal settings.
-
void add_rpm_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add install request to the goal. The
spec
will be resolved to packages in the resolve() call. The operation will not result in a reinstall if the requested package is already installed. By default usesclean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
spec – A string describing the Goal install request.
settings – A structure to override default goal settings. The value
from_repo_ids
is not used.
-
void add_rpm_install(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add install request to the goal. The operation will not result in a reinstall when requested package with the same NEVRA is already installed. By default uses
clean_requirements_on_remove
set tofalse
.- Parameters:
rpm_package – A package to be installed.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
are used.
-
void add_rpm_install(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add install request to the goal. The operation will not result in a reinstall when requested package with the same NEVRA is already installed. By default uses
clean_requirements_on_remove
set tofalse
.- Parameters:
package_set – A package_set containing candidates for the install action.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
are used.
-
void add_rpm_install_or_reinstall(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add install or reinstall request to the goal. By default uses
clean_requirements_on_remove
set tofalse
.- Parameters:
rpm_package – A package to be installed or reinstalled.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
are used.
-
void add_rpm_install_or_reinstall(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add install or reinstall request to the goal. By default uses
clean_requirements_on_remove
set tofalse
.- Parameters:
package_set – A package_set containing candidates for the install or reinstall action.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
are used.
-
void add_rpm_reinstall(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add reinstall request to the goal. The
spec
will be resolved to packages in the resolve() call. By default usesclean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
spec – A string describing the Goal reinstall request.
settings – A structure to override default goal settings. The value
from_repo_ids
is not used (not implemented yet).
-
void add_rpm_reinstall(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add reinstall request to the goal. By default uses
clean_requirements_on_remove
set tofalse
.- Parameters:
rpm_package – A package to be reinstalled.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
are used.
-
void add_rpm_remove(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add remove request to the goal. The
spec
will be resolved to packages in the resolve() call. By default usesclean_requirements_on_remove
according to ConfigMain, which can be overridden insettings
.- Parameters:
spec – A string describing the Goal remove request.
settings – A structure to override default goal settings. Values
strict
andbest
are not used.
-
void add_rpm_remove(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add remove request to the goal. By default uses
clean_requirements_on_remove
value from ConfigMain, which can be overridden insettings
.- Parameters:
rpm_package – A package to be removed.
settings – A structure to override default goal settings. Only clean_requirements_on_remove is used.
-
void add_rpm_remove(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add remove request to the goal. By default uses
clean_requirements_on_remove
value from ConfigMain, which can be overridden insettings
.- Parameters:
package_set – A package_set containing packages that will be removed
settings – A structure to override default goal settings. Only
clean_requirements_on_remove
is used.
-
void add_rpm_upgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)
Add upgrade request to the goal. The
spec
will be resolved to packages in the resolve() call. By default usesclean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
spec – A string describing the Goal upgrade request.
settings – A structure to override default goal settings. Values
from_repo_ids
andstrict
are not used.minimal – Whether to do smallest possible upgrade
-
void add_rpm_upgrade(const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)
Add upgrade job of all installed packages to the goal if not limited in
settings
. By default usesclean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
settings – A structure to override default goal settings. Values
from_repo_ids
andstrict
are not used.minimal – Whether to do smallest possible upgrade
-
void add_rpm_upgrade(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)
Add upgrade request to the goal. By default uses
clean_requirements_on_remove
set tofalse
, which can be overridden insettings
. Supports obsoletes and architecture change to/from “noarch”.- Parameters:
rpm_package – A package that will be used as candidate for the upgrade action.
settings – A structure to override default goal settings. Only
clean_requirements_on_remove
andbest
values are used.minimal – Whether to do smallest possible upgrade
-
void add_rpm_upgrade(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings(), bool minimal = false)
Add upgrade request to the goal. By default uses
clean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
package_set – A package_set containing candidates for the upgrade action.
settings – A structure to override default goal settings. Only
clean_requirements_on_remove
andbest
values are used.minimal – Whether to do smallest possible upgrade
-
void add_rpm_downgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add downgrade request to the goal. The
spec
will be resolved to packages in the resolve() call. By default usesclean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
spec – A string describing the Goal downgrade request.
settings – A structure to override default goal settings. The value
from_repo_ids
is not used.
-
void add_rpm_downgrade(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add downgrade request to the goal. By default uses
clean_requirements_on_remove
set tofalse
, which can be overridden insettings
. Ignores obsoletes. Only installed packages with the same name, architecture and higher version can be downgraded. Skips package if the same or lower version is installed.- Parameters:
rpm_package – A package that will be used as candidate for the downgrade action.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
are used.
-
void add_rpm_distro_sync(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add distrosync request to the goal. The
spec
will be resolved to packages in the resolve() call. By default usesclean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
spec – A string describing the Goal distrosync request.
settings – A structure to override default goal settings. The value
from_repo_ids
is not used.
-
void add_rpm_distro_sync(const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add distrosync job of all installed packages to the goal if not limited in
settings
. By default usesclean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
settings – A structure to override default goal settings. Values
from_repo_ids
is not used.
-
void add_rpm_distro_sync(const libdnf5::rpm::Package &rpm_package, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add distrosync request to the goal. By default uses
clean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
rpm_package – A package hat will be used as candidate for the distrosync action.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
values are used.
-
void add_rpm_distro_sync(const libdnf5::rpm::PackageSet &package_set, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add distrosync request to the goal. By default uses
clean_requirements_on_remove
set tofalse
, which can be overridden insettings
.- Parameters:
package_set – A package_set containing candidates for the distrosync action.
settings – A structure to override default goal settings. Only
strict
,best
, andclean_requirements_on_remove
values are used.
-
void add_rpm_reason_change(const std::string &spec, const libdnf5::transaction::TransactionItemReason reason, const std::string &group_id = {}, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add reason change request to the goal.
- Parameters:
spec – A string describing the requested package
reason – New reason for the package
group_id – Id of group the package belongs to (only relevant in case the reason is GROUP)
settings – A structure to override default goal settings. Only ResolveSpecSettings values are used
-
void add_group_install(const std::string &spec, const libdnf5::transaction::TransactionItemReason reason, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add group install request to the goal. The
spec
will be resolved to groups in the resolve() call. Also packages of the types specified in setting.group_package_types be installed.- Parameters:
spec – A string describing the Goal group install request.
reason – Reason why the group is installed (USER/DEPENDENCY)
settings – A structure to override default goal settings.
-
void add_group_remove(const std::string &spec, const libdnf5::transaction::TransactionItemReason reason, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add group remove request to the goal. The
spec
will be resolved to groups in the resolve() call. Also packages not belonging to another group and not explicitly user-installed will get removed.- Parameters:
spec – A string describing the Goal group remove request.
reason – Reason why the group is removed.
settings – A structure to override default goal settings.
-
void add_group_upgrade(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Add group upgrade request to the goal. Upgrades the packages from the group and upgrades the group itself. The latter comprises of installing packages that were added to the group by the distribution and removing packages that got removed from the group as far as they were not installed explicitly by the user and are not required by any other installed package.
- Parameters:
spec – A string with group specification
settings – A structure to override default goal settings.
-
void add_provide_install(const std::string &spec, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Request to install providers of the
spec
. Useful to install package using rich dependencies. Thespec
(e.g. “(depA and depB)”) is not parsed but directly passed to the solver to install package(s) which provide thespec
. Solver then creates a job like: “job install provides depA and depB”.- Parameters:
spec – A string with libsolv relational dependency.
settings – A structure to override default goal settings. The value
from_repo_ids
is not used.
-
void add_serialized_transaction(const std::filesystem::path &transaction_path, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Warning
This method is experimental/unstable and should not be relied on. It may be removed without warning Add serialized transaction request to the goal. Only one serialized transaction can be added per goal.
- Parameters:
transaction_path – A path to JSON serialized transaction.
settings – A structure to override default goal settings. the packages and comps have relative paths in trans file.
-
void add_revert_transactions(const std::vector<libdnf5::transaction::Transaction> &transactions, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Warning
This method is experimental/unstable and should not be relied on. It may be removed without warning Add revert request of history transactions to the goal. Can be called only once per Goal.
- Parameters:
transactions – A vector of history transactions to be reverted.
settings – A structure to override default goal settings.
-
void add_redo_transaction(const libdnf5::transaction::Transaction &transaction, const libdnf5::GoalJobSettings &settings = libdnf5::GoalJobSettings())
Warning
This method is experimental/unstable and should not be relied on. It may be removed without warning Add redo request of history transaction to the goal. Can be called only once per Goal.
- Parameters:
transaction – A history transaction to be repeated.
settings – A structure to override default goal settings.
-
void set_allow_erasing(bool value)
When true it allows to remove installed packages to resolve dependency problems.
-
bool get_allow_erasing() const
Return the currets setting of allow_erasing.
-
base::Transaction resolve()
Resolve all jobs and return a transaction object. Every time it resolves specs (strings) to packages
- Returns:
transaction object
-
explicit Goal(const libdnf5::BaseWeakPtr &base)