libdnf5 library, libdnf5 plugins: Do not export private symbols

This commit is contained in:
Jaroslav Rohel 2024-03-14 14:19:17 +01:00 committed by kolage
parent 70d8f146ad
commit 4328898f1d
102 changed files with 585 additions and 447 deletions

View File

@ -21,3 +21,9 @@
// be renamed to Perl_get_context
#undef get_context
%}
// Define empty macros. They are used to define the visibility of symbols.
#define LIBDNF_API
#define LIBDNF_LOCAL
#define LIBDNF_PLUGIN_API

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_ADVISORY_ADVISORY_HPP
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/defs.h"
#include <string>
#include <vector>
@ -43,7 +44,7 @@ public:
};
/// An advisory, represents advisory used to track security updates
class Advisory {
class LIBDNF_API Advisory {
public:
Advisory(const Advisory & src);
Advisory & operator=(const Advisory & src);
@ -147,7 +148,7 @@ private:
friend class AdvisorySetIterator;
friend class AdvisorySet;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -25,13 +25,15 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "advisory_package.hpp"
#include "advisory_set.hpp"
#include "libdnf5/defs.h"
#include <vector>
namespace libdnf5::advisory {
//TODO(amatej): add unit tests for AdvisoryCollection
class AdvisoryCollection {
class LIBDNF_API AdvisoryCollection {
public:
AdvisoryCollection(const AdvisoryCollection & src);
AdvisoryCollection & operator=(const AdvisoryCollection & src);
@ -76,7 +78,7 @@ private:
friend AdvisorySet;
friend class AdvisoryQuery;
AdvisoryCollection(const BaseWeakPtr & base, AdvisoryId advisory, int index);
LIBDNF_LOCAL AdvisoryCollection(const BaseWeakPtr & base, AdvisoryId advisory, int index);
/// Get all AdvisoryPackages stored in this AdvisoryCollection
///
@ -85,9 +87,9 @@ private:
/// them when collecting AdvisoryPackages from multiple collections.
/// @param with_filenames Filenames of AdvisoryPackages are not always useful, this allows skipping them.
/// The filename is stored as a c string (not libsolv id) this incurs slowdown.
void get_packages(std::vector<AdvisoryPackage> & output, bool with_filenames = false);
LIBDNF_LOCAL void get_packages(std::vector<AdvisoryPackage> & output, bool with_filenames = false);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,11 +23,12 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "advisory.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
namespace libdnf5::advisory {
class AdvisoryModule {
class LIBDNF_API AdvisoryModule {
public:
AdvisoryModule(const AdvisoryModule & src);
AdvisoryModule(AdvisoryModule && src) noexcept;
@ -87,8 +88,8 @@ public:
private:
friend class AdvisoryCollection;
class Impl;
AdvisoryModule(Impl * private_module);
class LIBDNF_LOCAL Impl;
LIBDNF_LOCAL AdvisoryModule(Impl * private_module);
ImplPtr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "advisory.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <vector>
@ -41,7 +42,7 @@ class Goal;
namespace libdnf5::advisory {
class AdvisoryPackage {
class LIBDNF_API AdvisoryPackage {
public:
AdvisoryPackage(const AdvisoryPackage & src);
AdvisoryPackage(AdvisoryPackage && src) noexcept;
@ -124,8 +125,8 @@ private:
friend class libdnf5::rpm::PackageQuery;
friend class libdnf5::Goal;
class Impl;
AdvisoryPackage(Impl * private_pkg);
class LIBDNF_LOCAL Impl;
LIBDNF_LOCAL AdvisoryPackage(Impl * private_pkg);
ImplPtr<Impl> p_impl;
};

View File

@ -28,6 +28,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/sack/query_cmp.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/package_set.hpp"
@ -35,7 +36,7 @@ namespace libdnf5::advisory {
/// AdvisoryQuery is the only way how to access advisories.
/// It is constructed using Base and filled with advisories from enabled repositories in its RepoSack.
class AdvisoryQuery : public AdvisorySet {
class LIBDNF_API AdvisoryQuery : public AdvisorySet {
public:
/// Create a new AdvisoryQuery instance.
///
@ -112,7 +113,7 @@ public:
const libdnf5::rpm::PackageSet & package_set, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ) const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,11 +22,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "advisory.hpp"
#include "libdnf5/defs.h"
#include <memory>
namespace libdnf5::advisory {
class AdvisoryReference {
class LIBDNF_API AdvisoryReference {
public:
AdvisoryReference(const AdvisoryReference & src);
AdvisoryReference & operator=(const AdvisoryReference & src);
@ -72,9 +74,9 @@ private:
/// @param advisory AdvisoryId into libsolv pool.
/// @param index Index of this reference in its advisory.
/// @return New AdvisoryReference instance.
AdvisoryReference(const BaseWeakPtr & base, AdvisoryId advisory, int index);
LIBDNF_LOCAL AdvisoryReference(const BaseWeakPtr & base, AdvisoryId advisory, int index);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -25,6 +25,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "advisory_set_iterator.hpp"
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <cstddef>
#include <memory>
@ -38,7 +39,7 @@ class SolvMap;
namespace libdnf5::advisory {
class AdvisorySet {
class LIBDNF_API AdvisorySet {
public:
using iterator = AdvisorySetIterator;
@ -128,8 +129,8 @@ public:
private:
friend AdvisorySetIterator;
friend class AdvisoryQuery;
AdvisorySet(const BaseWeakPtr & base, libdnf5::solv::SolvMap & solv_map);
class Impl;
LIBDNF_LOCAL AdvisorySet(const BaseWeakPtr & base, libdnf5::solv::SolvMap & solv_map);
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "advisory.hpp"
#include "libdnf5/defs.h"
#include <cstddef>
#include <iterator>
#include <memory>
@ -33,7 +35,7 @@ namespace libdnf5::advisory {
class AdvisorySet;
class AdvisorySetIterator {
class LIBDNF_API AdvisorySetIterator {
public:
using iterator_category = std::forward_iterator_tag;
using difference_type = std::ptrdiff_t;
@ -61,9 +63,9 @@ public:
void end();
private:
explicit AdvisorySetIterator(const AdvisorySet & advisory_set);
LIBDNF_LOCAL explicit AdvisorySetIterator(const AdvisorySet & advisory_set);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -26,6 +26,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/conf/config_main.hpp"
#include "libdnf5/conf/vars.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/logger/log_router.hpp"
#include "libdnf5/module/module_sack.hpp"
#include "libdnf5/plugin/plugin_info.hpp"
@ -55,7 +56,7 @@ class InternalBaseUser;
/// Instances of :class:`libdnf5::Base` are the central point of functionality supplied by libdnf5.
/// An application will typically create a single instance of this class which it will keep for the run-time needed to accomplish its packaging tasks.
/// :class:`.Base` instances are stateful objects owning various data.
class Base {
class LIBDNF_API Base {
public:
/// Constructs a new Base instance and sets the destination loggers.
Base(std::vector<std::unique_ptr<Logger>> && loggers = {});
@ -132,8 +133,6 @@ public:
libdnf5::BaseWeakPtr get_weak_ptr();
class Impl;
private:
friend class libdnf5::InternalBaseUser;
friend class libdnf5::base::Transaction;
@ -148,13 +147,14 @@ private:
friend class libdnf5::repo::SolvRepo;
/// Load plugins according to configuration
void load_plugins();
LIBDNF_LOCAL void load_plugins();
WeakPtrGuard<Base, false> base_guard;
// Impl has to be the second data member (right after base_guard which is needed for its construction) because it
// contains Pool and that has be destructed last.
// See commit: https://github.com/rpm-software-management/dnf5/commit/c8e26cb545aed0d6ca66545d51eda7568efdf232
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -24,6 +24,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/goal_elements.hpp"
#include "libdnf5/base/transaction.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/package.hpp"
@ -31,7 +32,7 @@ namespace libdnf5 {
/// Centralized point to perform operations with RPMs, Comps groups, and Modules
class Goal {
class LIBDNF_API Goal {
public:
explicit Goal(const libdnf5::BaseWeakPtr & base);
explicit Goal(libdnf5::Base & base);
@ -396,8 +397,8 @@ public:
libdnf5::BaseWeakPtr get_base() const;
private:
rpm::PackageId get_running_kernel_internal();
class Impl;
LIBDNF_LOCAL rpm::PackageId get_running_kernel_internal();
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,6 +24,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/advisory/advisory_query.hpp"
#include "libdnf5/comps/group/package.hpp"
#include "libdnf5/conf/config_main.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/nevra.hpp"
#include <cstdint>
@ -153,7 +154,7 @@ enum class GoalAction {
};
/// Convert GoalAction enum to user-readable string
std::string goal_action_to_string(GoalAction action);
LIBDNF_API std::string goal_action_to_string(GoalAction action);
/// Check whether the action is a replay action
bool goal_action_is_replay(GoalAction action);
@ -166,7 +167,7 @@ enum class GoalUsedSetting { UNUSED, USED_TRUE, USED_FALSE };
/// Configure SPEC resolving.
/// Important for queries that resolve SPEC.
struct ResolveSpecSettings {
struct LIBDNF_API ResolveSpecSettings {
public:
ResolveSpecSettings();
~ResolveSpecSettings();
@ -248,11 +249,11 @@ public:
bool get_group_search_environments() const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};
struct GoalJobSettings : public ResolveSpecSettings {
struct LIBDNF_API GoalJobSettings : public ResolveSpecSettings {
public:
GoalJobSettings();
~GoalJobSettings();
@ -367,13 +368,13 @@ private:
/// @return Resolved value.
/// @exception libdnf5::AssertionError When a different value already stored or when invalid value
/// @since 1.0
bool resolve_skip_broken(const libdnf5::ConfigMain & cfg_main);
LIBDNF_LOCAL bool resolve_skip_broken(const libdnf5::ConfigMain & cfg_main);
/// Resolve skip_broken value and store the result as the value used. When GoalSetting::auto it returns false
///
/// @return Resolved value.
/// @exception libdnf5::AssertionError When a different value already stored
/// @since 1.0
bool resolve_skip_broken();
LIBDNF_LOCAL bool resolve_skip_broken();
/// Resolve skip_unavailable value and store the result as the value used.
///
@ -381,7 +382,7 @@ private:
/// @return Resolved value.
/// @exception libdnf5::AssertionError When a different value already stored or when invalid value
/// @since 1.0
bool resolve_skip_unavailable(const libdnf5::ConfigMain & cfg_main);
LIBDNF_LOCAL bool resolve_skip_unavailable(const libdnf5::ConfigMain & cfg_main);
/// Resolve best value and store the result as the value used.
///
@ -389,27 +390,27 @@ private:
/// @return Resolved value.
/// @exception libdnf5::AssertionError When a different value already stored or when invalid value
/// @since 1.0
bool resolve_best(const libdnf5::ConfigMain & cfg_main);
LIBDNF_LOCAL bool resolve_best(const libdnf5::ConfigMain & cfg_main);
/// Resolve clean_requirements_on_remove value and store the result as the value used.
///
/// @param cfg_main Main config used to resolve GoalSetting::auto
/// @return Resolved value.
/// @exception libdnf5::AssertionError When a different value already stored or when invalid value
/// @since 1.0
bool resolve_clean_requirements_on_remove(const libdnf5::ConfigMain & cfg_main);
LIBDNF_LOCAL bool resolve_clean_requirements_on_remove(const libdnf5::ConfigMain & cfg_main);
/// Resolve clean_requirements_on_remove value and store the result as the value used.
///
/// @return Resolved value.
/// @exception libdnf5::AssertionError When a different value already stored or when invalid value
/// @since 1.0
bool resolve_clean_requirements_on_remove();
LIBDNF_LOCAL bool resolve_clean_requirements_on_remove();
/// Compute and store effective group_package_types value. Used only for goal jobs operating on groups.
/// @return group_package_types value if set, cfg_main.group_package_types value otherwise.
/// @exception libdnf5::AssertionError When a different value already stored or when invalid value
libdnf5::comps::PackageType resolve_group_package_types(const libdnf5::ConfigMain & cfg_main);
LIBDNF_LOCAL libdnf5::comps::PackageType resolve_group_package_types(const libdnf5::ConfigMain & cfg_main);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,6 +24,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/goal_elements.hpp"
#include "libdnf5/base/solver_problems.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/transaction/transaction_item_type.hpp"
#include <optional>
@ -33,7 +34,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::base {
/// Contain information, hint, or a problem created during libdnf5::Goal::resolve()
class LogEvent {
class LIBDNF_API LogEvent {
public:
/// Public constructor
LogEvent(
@ -70,7 +71,7 @@ public:
private:
/// Convert an element from resolve log to string;
static std::string to_string(
LIBDNF_LOCAL static std::string to_string(
libdnf5::GoalAction action,
libdnf5::GoalProblem problem,
const std::set<std::string> & additional_data,
@ -79,7 +80,7 @@ private:
const std::optional<std::string> & spec,
const std::optional<SolverProblems> & solver_problems);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,11 +24,12 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "goal_elements.hpp"
#include "libdnf5/defs.h"
namespace libdnf5::base {
/// Represent problems detected by a RPM solver (libsolv)
class SolverProblems {
class LIBDNF_API SolverProblems {
public:
/// Public constructor
SolverProblems(
@ -61,7 +62,7 @@ public:
private:
friend class Transaction;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -26,6 +26,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/log_event.hpp"
#include "libdnf5/base/solver_problems.hpp"
#include "libdnf5/common/proc.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/transaction_callbacks.hpp"
#include <optional>
@ -44,7 +45,7 @@ class TransactionModule;
class TransactionPackage;
/// Error related to processing transaction
class TransactionError : public Error {
class LIBDNF_API TransactionError : public Error {
public:
using Error::Error;
/// @return Error class' domain name"
@ -54,7 +55,7 @@ public:
};
class Transaction {
class LIBDNF_API Transaction {
public:
/// enum representing Transaction run result
enum class TransactionRunResult {
@ -193,9 +194,9 @@ private:
friend class TransactionPackage;
friend class libdnf5::Goal;
Transaction(const libdnf5::BaseWeakPtr & base);
LIBDNF_LOCAL Transaction(const libdnf5::BaseWeakPtr & base);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
std::unique_ptr<libdnf5::rpm::TransactionCallbacks> callbacks;

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/transaction.hpp"
#include "libdnf5/comps/environment/environment.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/transaction/transaction_item_action.hpp"
#include "libdnf5/transaction/transaction_item_reason.hpp"
#include "libdnf5/transaction/transaction_item_state.hpp"
@ -30,7 +31,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::base {
class TransactionEnvironment {
class LIBDNF_API TransactionEnvironment {
public:
using Reason = transaction::TransactionItemReason;
using State = transaction::TransactionItemState;
@ -67,9 +68,10 @@ public:
private:
friend class Transaction::Impl;
TransactionEnvironment(const libdnf5::comps::Environment & grp, Action action, Reason reason, bool with_optional);
LIBDNF_LOCAL TransactionEnvironment(
const libdnf5::comps::Environment & grp, Action action, Reason reason, bool with_optional);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,6 +24,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/transaction.hpp"
#include "libdnf5/comps/group/group.hpp"
#include "libdnf5/comps/group/package.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/package.hpp"
#include "libdnf5/transaction/transaction_item_action.hpp"
#include "libdnf5/transaction/transaction_item_reason.hpp"
@ -32,7 +33,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::base {
class TransactionGroup {
class LIBDNF_API TransactionGroup {
public:
using Reason = transaction::TransactionItemReason;
using State = transaction::TransactionItemState;
@ -70,9 +71,10 @@ public:
private:
friend class Transaction::Impl;
TransactionGroup(const libdnf5::comps::Group & grp, Action action, Reason reason, const PackageType & types);
LIBDNF_LOCAL TransactionGroup(
const libdnf5::comps::Group & grp, Action action, Reason reason, const PackageType & types);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_BASE_TRANSACTION_MODULE_HPP
#include "libdnf5/base/transaction.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/transaction/transaction_item_action.hpp"
#include "libdnf5/transaction/transaction_item_reason.hpp"
#include "libdnf5/transaction/transaction_item_state.hpp"
@ -29,7 +30,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::base {
class TransactionModule {
class LIBDNF_API TransactionModule {
public:
using Reason = transaction::TransactionItemReason;
using State = transaction::TransactionItemState;
@ -73,9 +74,10 @@ public:
private:
friend class Transaction::Impl;
TransactionModule(const std::string & module_name, const std::string & module_stream, Action action, Reason reason);
LIBDNF_LOCAL TransactionModule(
const std::string & module_name, const std::string & module_stream, Action action, Reason reason);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_BASE_TRANSACTION_PACKAGE_HPP
#include "libdnf5/base/transaction.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/package.hpp"
#include "libdnf5/transaction/transaction_item_action.hpp"
#include "libdnf5/transaction/transaction_item_reason.hpp"
@ -35,7 +36,7 @@ class RpmTransactionTest;
namespace libdnf5::base {
/// Describe transaction operation related to rpm Package
class TransactionPackage {
class LIBDNF_API TransactionPackage {
public:
using Action = transaction::TransactionItemAction;
using Reason = transaction::TransactionItemReason;
@ -82,14 +83,14 @@ private:
friend class ::BaseGoalTest;
friend class ::RpmTransactionTest;
TransactionPackage(const libdnf5::rpm::Package & pkg, Action action, Reason reason);
LIBDNF_LOCAL TransactionPackage(const libdnf5::rpm::Package & pkg, Action action, Reason reason);
TransactionPackage(const libdnf5::rpm::Package & pkg, Action action, Reason reason, State state);
LIBDNF_LOCAL TransactionPackage(const libdnf5::rpm::Package & pkg, Action action, Reason reason, State state);
TransactionPackage(
LIBDNF_LOCAL TransactionPackage(
const libdnf5::rpm::Package & pkg, Action action, Reason reason, const std::optional<std::string> & group_id);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -20,6 +20,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_COMMON_EXCEPTION_HPP
#define LIBDNF5_COMMON_EXCEPTION_HPP
#include "libdnf5/defs.h"
#include "libdnf5/utils/bgettext/bgettext-mark-common.h"
#include "libdnf5/utils/format.hpp"
@ -81,7 +82,7 @@ struct SourceLocation {
/// An AssertionError is a fault in the program logic, it is thrown when an
/// incorrect sequence of actions has led to an invalid state in which it is
/// impossible to continue running the program.
class AssertionError : public std::logic_error {
class LIBDNF_API AssertionError : public std::logic_error {
public:
explicit AssertionError(const char * assertion, const SourceLocation & location, const std::string & message);
@ -106,7 +107,7 @@ private:
/// into a standard runtime exception which could be handled,
/// whereas with the previous `AssertionError` exception the process
/// is terminated and the system state is captured for debugging purposes.
class UserAssertionError : public std::logic_error {
class LIBDNF_API UserAssertionError : public std::logic_error {
public:
explicit UserAssertionError(const char * assertion, const SourceLocation & location, const std::string & message);
@ -143,7 +144,7 @@ concept AllowedErrorArgTypes =
/// `get_domain_name()` should always return the exception's class name and its
/// namespace (including enclosing class names in case the exception is nested in
/// other classes) respectively.
class Error : public std::runtime_error {
class LIBDNF_API Error : public std::runtime_error {
public:
/// A constructor that supports formatting the error message.
///
@ -175,7 +176,7 @@ protected:
/// An exception class for system errors represented by the `errno` error code.
class SystemError : public Error {
class LIBDNF_API SystemError : public Error {
public:
/// Constructs the error from the `errno` error code and generates the
/// message from the system error description.
@ -212,7 +213,7 @@ private:
};
/// An exception class for file system errors represented by the `errno` error code and a path.
class FileSystemError : public Error {
class LIBDNF_API FileSystemError : public Error {
public:
/// Constructs the error from the `errno` error code, filesystem path and a formatted message.
/// The formatted message is prepended to the generated system error message.
@ -243,7 +244,7 @@ private:
// TODO(lukash) This class is used throughout the code where more specific exceptions should be thrown.
// Kept as a reminder to replace all those with the correct exception classes.
class RuntimeError : public Error {
class LIBDNF_API RuntimeError : public Error {
public:
using Error::Error;
const char * get_name() const noexcept override { return "RuntimeError"; }
@ -258,7 +259,7 @@ enum FormatDetailLevel {
/// Formats the error message of an exception.
/// If the exception is nested, recurses to format the message of the exception it holds.
std::string format(const std::exception & e, FormatDetailLevel detail);
LIBDNF_API std::string format(const std::exception & e, FormatDetailLevel detail);
} // namespace libdnf5

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_COMMON_PROC_HPP
#define LIBDNF5_COMMON_PROC_HPP
#include "libdnf5/defs.h"
#include <sys/types.h>
@ -31,13 +33,13 @@ constexpr uid_t INVALID_UID = static_cast<uid_t>(-1);
/// @param pid process id
/// @return libdnf5::INVALID_UID if fails, login uid otherwise
/// @since 5.0
uid_t read_login_uid_from_proc(pid_t pid) noexcept;
LIBDNF_API uid_t read_login_uid_from_proc(pid_t pid) noexcept;
/// Return the current user login uid, if available.
/// The getuid() is returned instead if there was a problem.
/// The value is cached.
/// @since 5.0
uid_t get_login_uid() noexcept;
LIBDNF_API uid_t get_login_uid() noexcept;
} // namespace libdnf5

View File

@ -22,16 +22,18 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "query_cmp.hpp"
#include "libdnf5/defs.h"
#include <cstdint>
#include <vector>
namespace libdnf5::sack {
bool match_int64(int64_t value, QueryCmp cmp, int64_t pattern);
bool match_int64(int64_t value, QueryCmp cmp, const std::vector<int64_t> & patterns);
bool match_int64(const std::vector<int64_t> & values, QueryCmp cmp, int64_t pattern);
bool match_int64(const std::vector<int64_t> & values, QueryCmp cmp, const std::vector<int64_t> & patterns);
LIBDNF_API bool match_int64(int64_t value, QueryCmp cmp, int64_t pattern);
LIBDNF_API bool match_int64(int64_t value, QueryCmp cmp, const std::vector<int64_t> & patterns);
LIBDNF_API bool match_int64(const std::vector<int64_t> & values, QueryCmp cmp, int64_t pattern);
LIBDNF_API bool match_int64(const std::vector<int64_t> & values, QueryCmp cmp, const std::vector<int64_t> & patterns);
} // namespace libdnf5::sack

View File

@ -22,16 +22,19 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "query_cmp.hpp"
#include "libdnf5/defs.h"
#include <string>
#include <vector>
namespace libdnf5::sack {
bool match_string(const std::string & value, QueryCmp cmp, const std::string & pattern);
bool match_string(const std::string & value, QueryCmp cmp, const std::vector<std::string> & patterns);
bool match_string(const std::vector<std::string> & values, QueryCmp cmp, const std::string & pattern);
bool match_string(const std::vector<std::string> & values, QueryCmp cmp, const std::vector<std::string> & patterns);
LIBDNF_API bool match_string(const std::string & value, QueryCmp cmp, const std::string & pattern);
LIBDNF_API bool match_string(const std::string & value, QueryCmp cmp, const std::vector<std::string> & patterns);
LIBDNF_API bool match_string(const std::vector<std::string> & values, QueryCmp cmp, const std::string & pattern);
LIBDNF_API bool match_string(
const std::vector<std::string> & values, QueryCmp cmp, const std::vector<std::string> & patterns);
} // namespace libdnf5::sack

View File

@ -26,6 +26,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/set.hpp"
#include "libdnf5/defs.h"
#include <cstdint>
#include <map>
@ -36,7 +37,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::sack {
extern const BgettextMessage msg_err_exact_one_object;
LIBDNF_API extern const BgettextMessage msg_err_exact_one_object;
/// Query is a Set with filtering capabilities.
template <typename T>

View File

@ -20,33 +20,35 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_COMMON_XDG_HPP
#define LIBDNF5_COMMON_XDG_HPP
#include "libdnf5/defs.h"
#include <filesystem>
namespace libdnf5::xdg {
/// Returns user home directory.
std::filesystem::path get_user_home_dir();
LIBDNF_API std::filesystem::path get_user_home_dir();
/// Returns user cache directory.
/// A base directory relative to which user specific non-essential data files should be stored.
std::filesystem::path get_user_cache_dir();
LIBDNF_API std::filesystem::path get_user_cache_dir();
/// Returns user configuration directory.
/// A base directory relative to which user specific configuration files should be stored.
std::filesystem::path get_user_config_dir();
LIBDNF_API std::filesystem::path get_user_config_dir();
/// Returns user data directory.
/// A base directory relative to which user specific data files should be stored.
std::filesystem::path get_user_data_dir();
LIBDNF_API std::filesystem::path get_user_data_dir();
/// Returns user state directory.
/// A base directory relative to which user specific state data should be stored.
std::filesystem::path get_user_state_dir();
LIBDNF_API std::filesystem::path get_user_state_dir();
/// Returns user runtime directory.
/// A base directory relative to which user-specific non-essential runtime files and other file objects
/// (such as sockets, named pipes, ...) should be stored.
std::filesystem::path get_user_runtime_dir();
LIBDNF_API std::filesystem::path get_user_runtime_dir();
} // namespace libdnf5::xdg

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_COMPS_ENVIRONMENT_ENVIRONMENT_HPP
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/transaction/transaction_item_reason.hpp"
#include <set>
@ -45,7 +46,7 @@ public:
// @replaces dnf:dnf/comps.py:class:Environment
class Environment {
class LIBDNF_API Environment {
public:
~Environment();
@ -141,9 +142,9 @@ protected:
private:
friend class EnvironmentQuery;
void add_environment_id(const EnvironmentId & environment_id);
LIBDNF_LOCAL void add_environment_id(const EnvironmentId & environment_id);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/sack/query.hpp"
#include "libdnf5/comps/environment/environment.hpp"
#include "libdnf5/defs.h"
#include <string>
#include <vector>
@ -31,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::comps {
class EnvironmentQuery : public libdnf5::sack::Query<Environment> {
class LIBDNF_API EnvironmentQuery : public libdnf5::sack::Query<Environment> {
public:
// Create new query with newly composed environments (using only solvables from currently enabled repositories)
explicit EnvironmentQuery(const libdnf5::BaseWeakPtr & base, bool empty = false);
@ -57,7 +58,7 @@ public:
private:
friend Environment;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/comps/group/package.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/transaction/transaction_item_reason.hpp"
#include <set>
@ -46,7 +47,7 @@ public:
// @replaces dnf:dnf/comps.py:class:Group
class Group {
class LIBDNF_API Group {
public:
~Group();
@ -158,9 +159,9 @@ protected:
private:
friend class GroupQuery;
void add_group_id(const GroupId & group_id);
LIBDNF_LOCAL void add_group_id(const GroupId & group_id);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "package_type.hpp"
#include "libdnf5/defs.h"
#include <string>
namespace libdnf5::comps {
@ -30,7 +32,7 @@ namespace libdnf5::comps {
// @replaces dnf:dnf/comps.py:class:Package
// @replaces dnf:dnf/comps.py:class:CompsTransPkg
class Package {
class LIBDNF_API Package {
public:
Package(const std::string & name, PackageType type, const std::string & condition);
@ -68,7 +70,7 @@ public:
void set_condition(const std::string & value);
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_COMPS_GROUP_PACKAGE_TYPE_HPP
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <string>
#include <vector>
@ -34,7 +35,7 @@ enum class PackageType : int {
OPTIONAL = 1 << 3 // not installed by default, but can be checked in the UI
};
class InvalidPackageType : public libdnf5::Error {
class LIBDNF_API InvalidPackageType : public libdnf5::Error {
public:
InvalidPackageType(const std::string & type);
InvalidPackageType(const PackageType type);
@ -66,10 +67,10 @@ inline constexpr bool any(PackageType flags) {
return static_cast<std::underlying_type<PackageType>::type>(flags) != 0;
}
PackageType package_type_from_string(const std::string & type);
PackageType package_type_from_string(const std::vector<std::string> types);
std::string package_type_to_string(const PackageType type);
std::vector<std::string> package_types_to_strings(const PackageType types);
LIBDNF_API PackageType package_type_from_string(const std::string & type);
LIBDNF_API PackageType package_type_from_string(const std::vector<std::string> types);
LIBDNF_API std::string package_type_to_string(const PackageType type);
LIBDNF_API std::vector<std::string> package_types_to_strings(const PackageType types);
} // namespace libdnf5::comps

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/sack/query.hpp"
#include "libdnf5/comps/group/group.hpp"
#include "libdnf5/defs.h"
#include <string>
#include <vector>
@ -31,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::comps {
class GroupQuery : public libdnf5::sack::Query<Group> {
class LIBDNF_API GroupQuery : public libdnf5::sack::Query<Group> {
public:
// Create new query with newly composed groups (using only solvables from currently enabled repositories)
explicit GroupQuery(const libdnf5::BaseWeakPtr & base, bool empty = false);
@ -67,7 +68,7 @@ public:
private:
friend Group;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -25,13 +25,14 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "option_binds.hpp"
#include "vars.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/logger/logger.hpp"
namespace libdnf5 {
/// Base class for configurations objects
class Config {
class LIBDNF_API Config {
public:
OptionBinds & opt_binds() noexcept;
@ -46,7 +47,7 @@ public:
Option::Priority priority);
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -37,7 +37,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5 {
/// Holds global configuration
class ConfigMain : public Config {
class LIBDNF_API ConfigMain : public Config {
public:
ConfigMain();
~ConfigMain();
@ -297,7 +297,7 @@ public:
Option::Priority priority = Option::Priority::MAINCONFIG) override;
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -29,7 +29,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5 {
/// Error accessing config file other than ENOENT; e.g. we don't have read permission
class InaccessibleConfigError : public Error {
class LIBDNF_API InaccessibleConfigError : public Error {
public:
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5"; }
@ -37,7 +37,7 @@ public:
};
/// Configuration file is missing
class MissingConfigError : public Error {
class LIBDNF_API MissingConfigError : public Error {
public:
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5"; }
@ -45,27 +45,27 @@ public:
};
/// Configuration file is invalid
class InvalidConfigError : public Error {
class LIBDNF_API InvalidConfigError : public Error {
public:
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5"; }
const char * get_name() const noexcept override { return "InvalidConfigError"; }
};
class ConfigParserError : public Error {
class LIBDNF_API ConfigParserError : public Error {
public:
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5"; }
const char * get_name() const noexcept override { return "ConfigParserError"; }
};
class ConfigParserSectionNotFoundError : public ConfigParserError {
class LIBDNF_API ConfigParserSectionNotFoundError : public ConfigParserError {
public:
explicit ConfigParserSectionNotFoundError(const std::string & section);
const char * get_name() const noexcept override { return "ConfigParserSectionNotFoundError"; }
};
class ConfigParserOptionNotFoundError : public ConfigParserError {
class LIBDNF_API ConfigParserOptionNotFoundError : public ConfigParserError {
public:
explicit ConfigParserOptionNotFoundError(const std::string & section, const std::string & option);
const char * get_name() const noexcept override { return "ConfigParserOptionNotFoundError"; }
@ -81,7 +81,7 @@ public:
* The parsed items are stored into the PreserveOrderMap.
* ConfigParser preserve order of items. Comments and empty lines are kept.
*/
struct ConfigParser {
struct LIBDNF_API ConfigParser {
public:
using Container = PreserveOrderMap<std::string, PreserveOrderMap<std::string, std::string>>;
@ -140,7 +140,7 @@ public:
Container & get_data() noexcept;
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <string>
@ -29,7 +30,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5 {
/// Option exception
class OptionError : public Error {
class LIBDNF_API OptionError : public Error {
public:
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5"; }
@ -37,21 +38,21 @@ public:
};
/// Exception that is generated when an invalid input value is detected.
class OptionInvalidValueError : public OptionError {
class LIBDNF_API OptionInvalidValueError : public OptionError {
public:
using OptionError::OptionError;
const char * get_name() const noexcept override { return "OptionInvalidValueError"; }
};
/// Exception that is generated when not allowed input value is detected.
class OptionValueNotAllowedError : public OptionInvalidValueError {
class LIBDNF_API OptionValueNotAllowedError : public OptionInvalidValueError {
public:
using OptionInvalidValueError::OptionInvalidValueError;
const char * get_name() const noexcept override { return "OptionValueNotAllowedError"; }
};
/// Exception that is generated during read an empty Option.
class OptionValueNotSetError : public OptionError {
class LIBDNF_API OptionValueNotSetError : public OptionError {
public:
using OptionError::OptionError;
const char * get_name() const noexcept override { return "OptionValueNotSetError"; }
@ -60,7 +61,7 @@ public:
/// Option class is an abstract class. Parent of all options. Options are used to store a configuration.
// @replaces libdnf:conf/Option.hpp:class:Option
class Option {
class LIBDNF_API Option {
public:
// TODO(jrohel): Prioroties are under discussion and probably will be modified.
// @replaces libdnf:conf/Option.hpp:enum class:Option::Priority
@ -128,7 +129,7 @@ protected:
const std::string & get_lock_comment() const noexcept;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -48,7 +48,7 @@ public:
/// Maps the options names (text names read from config file, command line, ...) to options objects.
/// Supports user defined functions for processing new value and converting value to string.
class OptionBinds {
class LIBDNF_API OptionBinds {
public:
/// Extends the option with user-defined functions for processing a new value and converting value to a string.
/// It is used as additional level of processing when the option is accessed by its text name.
@ -66,10 +66,11 @@ public:
private:
friend class OptionBinds;
Item(Option & option, NewStringFunc new_string_func, GetValueStringFunc get_value_string_func, bool add_value);
explicit Item(Option & option);
LIBDNF_LOCAL Item(
Option & option, NewStringFunc new_string_func, GetValueStringFunc get_value_string_func, bool add_value);
LIBDNF_LOCAL explicit Item(Option & option);
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
@ -102,7 +103,7 @@ public:
const_iterator find(const std::string & id) const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -32,7 +32,7 @@ namespace libdnf5 {
/// Conversion from string to bool is done according to vectors which contains strings of true and false values.
/// Conversion is case insensitive for input. Values must be lower case in vectors.
// @replaces libdnf:conf/OptionBool.hpp:class:OptionBool
class OptionBool : public Option {
class LIBDNF_API OptionBool : public Option {
public:
using ValueType = bool;
@ -109,7 +109,7 @@ public:
std::string to_string(bool value) const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -32,7 +32,7 @@ namespace libdnf5 {
/// It supports default value.
/// It supports user defined function for conversion from string.
// @replaces libdnf:conf/OptionEnum.hpp:class:OptionEnum<std::string>
class OptionEnum : public Option {
class LIBDNF_API OptionEnum : public Option {
public:
using ValueType = std::string;
using FromStringFunc = std::function<std::string(const std::string &)>;
@ -75,7 +75,7 @@ public:
std::string from_string(const std::string & value) const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -31,7 +31,7 @@ namespace libdnf5 {
/// Support default value, minimal and maximal values, user defined function for conversion from string.
// @replaces libdnf:conf/OptionNumber.hpp:class:OptionNumber<T>
template <typename T>
class OptionNumber : public Option {
class LIBDNF_API OptionNumber : public Option {
public:
using ValueType = T;
using FromStringFunc = std::function<ValueType(const std::string &)>;
@ -109,7 +109,7 @@ public:
std::string to_string(ValueType value) const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -36,7 +36,7 @@ public:
/// Option that stores file/directory path.
/// Support default value, and path verification (absolute, existence).
// @replaces libdnf:conf/OptionPath.hpp:class:OptionPath
class OptionPath : public OptionString {
class LIBDNF_API OptionPath : public OptionString {
public:
/// Constructor sets default value and conditions.
// @replaces libdnf:conf/OptionPath.hpp:ctor:OptionPath.OptionPath(const std::string & defaultValue, bool exists = false, bool absPath = false)
@ -76,7 +76,7 @@ public:
void test(const std::string & value) const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -28,7 +28,7 @@ namespace libdnf5 {
/// Option that stores an integer value of seconds.
/// Support default value, minimal and maximal values.
// @replaces libdnf:conf/OptionSeconds.hpp:class:OptionSeconds
class OptionSeconds : public OptionNumber<std::int32_t> {
class LIBDNF_API OptionSeconds : public OptionNumber<std::int32_t> {
public:
OptionSeconds(ValueType default_value, ValueType min, ValueType max);
OptionSeconds(ValueType default_value, ValueType min);

View File

@ -28,7 +28,7 @@ namespace libdnf5 {
/// Option that stores string value.
/// Support default value, and check of an input value using the regular expression
// @replaces libdnf:conf/OptionString.hpp:class:OptionString
class OptionString : public Option {
class LIBDNF_API OptionString : public Option {
public:
using ValueType = std::string;
@ -75,7 +75,7 @@ public:
private:
friend class OptionPath;
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -36,7 +36,7 @@ namespace libdnf5 {
/// Support default value, and check of an input value using the regular expression.
// @replaces libdnf:conf/OptionStringList.hpp:class:OptionStringList
template <typename T, bool IsAppend = false>
class OptionStringContainer : public Option {
class LIBDNF_API OptionStringContainer : public Option {
public:
using ValueType = T;
@ -116,10 +116,10 @@ protected:
void test_item(const std::string & item) const;
private:
void init_regex_matcher();
void test_item_worker(const std::string & item) const;
LIBDNF_LOCAL void init_regex_matcher();
LIBDNF_LOCAL void test_item_worker(const std::string & item) const;
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -42,7 +42,7 @@ class ReadOnlyVariableError : public Error {
///
/// The class loads the variables from the environment as well as from a list
/// of directories.
struct Vars {
struct LIBDNF_API Vars {
public:
enum class Priority {
DEFAULT = 10,
@ -123,12 +123,12 @@ private:
///
/// @param installroot The path to the installroot
/// @param directories The directories to load vars from
void load(const std::string & installroot, const std::vector<std::string> & directories);
LIBDNF_LOCAL void load(const std::string & installroot, const std::vector<std::string> & directories);
/// @brief Detects the system's arch, basearch and relesever.
///
/// @param installroot The installroot directory
void detect_vars(const std::string & installroot);
LIBDNF_LOCAL void detect_vars(const std::string & installroot);
/// @brief Loads DNF vars from a directory.
///
@ -137,13 +137,13 @@ private:
/// file's contents.
///
/// @param directory Path to a directory with DNF vars
void load_from_dir(const std::string & directory);
LIBDNF_LOCAL void load_from_dir(const std::string & directory);
/// @brief Loads DNF vars from the environment.
///
/// Reads environment variables that match "DNF[0-9]" and
/// "DNF_VAR_[A-Za-z0-9_]+" patterns. The "DNF_VAR_" prefix is cut off.
void load_from_env();
LIBDNF_LOCAL void load_from_env();
/// @brief Set a variable to a value, only obtaining the value if needed using `get_value`
///
@ -151,7 +151,7 @@ private:
/// @param get_value Function that returns the (optional) value for the variable
/// @param prio Source/Priority of the value
/// @throw ReadOnlyVariableError if the variable is read-only
void set_lazy(
LIBDNF_LOCAL void set_lazy(
const std::string & name,
const std::function<const std::unique_ptr<const std::string>()> & get_value,
Priority prio);
@ -161,15 +161,15 @@ private:
/// @param text String with variable expressions
/// @param depth The recursive depth
/// @return Pair of the resulting string and the number of characters scanned in `text`
std::pair<std::string, size_t> substitute_expression(std::string_view text, unsigned int depth) const;
LIBDNF_LOCAL std::pair<std::string, size_t> substitute_expression(std::string_view text, unsigned int depth) const;
/// @brief Split releasever on the first "." into its "major" and "minor" components
///
/// @param releasever A releasever string, possibly containing a "."
/// @return releasever_major, releasever_minor
static std::tuple<std::string, std::string> split_releasever(const std::string & releasever);
LIBDNF_LOCAL static std::tuple<std::string, std::string> split_releasever(const std::string & releasever);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "logger.hpp"
#include "libdnf5/base/base.hpp"
#include "libdnf5/defs.h"
namespace libdnf5 {
@ -31,13 +32,14 @@ namespace libdnf5 {
/// @param base Reference to Base for loading the configured logger path.
/// @param filename Name of the log file.
/// @return Instance of a new file logger.
std::unique_ptr<libdnf5::Logger> create_file_logger(libdnf5::Base & base, const std::string & filename);
LIBDNF_API std::unique_ptr<libdnf5::Logger> create_file_logger(libdnf5::Base & base, const std::string & filename);
/// @brief Helper method for creating a rotating file logger in `logdir` location with given file name.
/// @param base Reference to Base for loading the configured parameters.
/// @param filename Name of the log file.
/// @return Instance of a new rotating file logger.
std::unique_ptr<libdnf5::Logger> create_rotating_file_logger(libdnf5::Base & base, const std::string & filename);
LIBDNF_API std::unique_ptr<libdnf5::Logger> create_rotating_file_logger(
libdnf5::Base & base, const std::string & filename);
} // namespace libdnf5

View File

@ -27,7 +27,7 @@ namespace libdnf5 {
/// GlobalLogger contains methods for setting the target (logger) for global messages - messages that are
/// generated by libraries (eg librepo) without binding to the Base object.
class GlobalLogger {
class LIBDNF_API GlobalLogger {
public:
explicit GlobalLogger();
~GlobalLogger();

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "logger.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <memory>
#include <vector>
@ -32,7 +33,7 @@ namespace libdnf5 {
/// LogRouter is an implementation of logging class that forwards incoming logging messages to several other loggers.
/// Loggers can be addressed via index. Index is serial number of the logger starting from zero.
class LogRouter : public Logger {
class LIBDNF_API LogRouter : public Logger {
public:
/// Constructs a new LogRouter instance with an empty set of destination loggers.
explicit LogRouter();
@ -67,7 +68,7 @@ public:
const std::string & message) noexcept override;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -20,6 +20,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_LOGGER_LOGGER_HPP
#define LIBDNF5_LOGGER_LOGGER_HPP
#include "libdnf5/defs.h"
#include "libdnf5/utils/format.hpp"
#include <unistd.h>
@ -34,7 +35,7 @@ namespace libdnf5 {
/// Logger is an abstract interface used for logging.
/// An implementation (inherited class) can call callbacks, log the messages to memory, file, or somewhere else.
class Logger {
class LIBDNF_API Logger {
public:
explicit Logger();
@ -99,7 +100,7 @@ public:
};
class StringLogger : public Logger {
class LIBDNF_API StringLogger : public Logger {
public:
explicit StringLogger();
~StringLogger() override;

View File

@ -23,12 +23,14 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "logger.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
namespace libdnf5 {
/// MemoryBufferLogger is an implementation of logging class that stores incoming logging messages into memory buffer.
/// It is usually used as temporary logger until a final logger is configured.
class MemoryBufferLogger : public Logger {
class LIBDNF_API MemoryBufferLogger : public Logger {
public:
struct Item {
std::chrono::time_point<std::chrono::system_clock> time;
@ -52,7 +54,7 @@ public:
void write_to_logger(Logger & logger);
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -22,12 +22,13 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "logger.hpp"
#include "libdnf5/defs.h"
namespace libdnf5 {
/// NullLogger is an implementation of logging class that discards all incoming logging messages.
/// It can be used in case when no logs are needed.
class NullLogger : public Logger {
class LIBDNF_API NullLogger : public Logger {
public:
explicit NullLogger();
~NullLogger() override;

View File

@ -24,6 +24,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <filesystem>
@ -31,7 +32,7 @@ namespace libdnf5 {
/// RotatingFileLogger is an implementation of a rotating file logger.
/// It can be used simultaneously in multiple processes and threads.
class RotatingFileLogger : public StringLogger {
class LIBDNF_API RotatingFileLogger : public StringLogger {
public:
/// Construct a new instance of the `RotatingFileLogger` class.
///
@ -59,7 +60,7 @@ public:
void write(const char * line) noexcept override;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "logger.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <memory>
#include <ostream>
@ -31,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5 {
/// StreamLogger is an implementation of logging class that writes messages into a stream.
class StreamLogger : public StringLogger {
class LIBDNF_API StreamLogger : public StringLogger {
public:
explicit StreamLogger(std::unique_ptr<std::ostream> && log_stream);
~StreamLogger() override;
@ -39,12 +40,12 @@ public:
void write(const char * line) noexcept override;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
/// Logger that logs to a stream stored as a reference, meant to be used with std::cerr and std::cout.
class StdCStreamLogger : public StringLogger {
class LIBDNF_API StdCStreamLogger : public StringLogger {
public:
explicit StdCStreamLogger(std::ostream & log_stream);
~StdCStreamLogger() override;
@ -52,7 +53,7 @@ public:
void write(const char * line) noexcept override;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_MODULE_MODULE_DEPENDENCY_HPP
#define LIBDNF5_MODULE_MODULE_DEPENDENCY_HPP
#include "libdnf5/defs.h"
#include <memory>
#include <string>
#include <vector>
@ -27,7 +29,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::module {
class ModuleDependency {
class LIBDNF_API ModuleDependency {
public:
ModuleDependency(const std::string & module_name, const std::vector<std::string> & streams);
@ -53,7 +55,7 @@ public:
std::string to_string();
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -20,6 +20,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_MODULE_MODULE_ITEM_HPP
#define LIBDNF5_MODULE_MODULE_ITEM_HPP
#include "libdnf5/defs.h"
#include "libdnf5/module/module_dependency.hpp"
#include "libdnf5/module/module_profile.hpp"
#include "libdnf5/module/module_sack_weak.hpp"
@ -53,7 +54,7 @@ public:
// Represents one modulemd document (uniquely described by name:stream:version:context:arch, but there can theoretically be more objects with the same NSVCA)
// @replaces libdnf:module/ModuleItem.hpp:class:ModuleItem
class ModuleItem {
class LIBDNF_API ModuleItem {
public:
bool operator==(const ModuleItem & rhs) const noexcept;
bool operator!=(const ModuleItem & rhs) const noexcept;
@ -188,30 +189,31 @@ private:
friend class ModuleMetadata;
friend ::ModuleTest;
ModuleItem(_ModulemdModuleStream * md_stream, const ModuleSackWeakPtr & module_sack, const std::string & repo_id);
LIBDNF_LOCAL ModuleItem(
_ModulemdModuleStream * md_stream, const ModuleSackWeakPtr & module_sack, const std::string & repo_id);
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getNameCStr()
const char * get_name_cstr() const;
LIBDNF_LOCAL const char * get_name_cstr() const;
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getStreamCStr()
const char * get_stream_cstr() const;
LIBDNF_LOCAL const char * get_stream_cstr() const;
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getContextCStr()
const char * get_context_cstr() const;
LIBDNF_LOCAL const char * get_context_cstr() const;
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getArchCStr()
const char * get_arch_cstr() const;
LIBDNF_LOCAL const char * get_arch_cstr() const;
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getNameStream()
std::string get_name_stream() const;
LIBDNF_LOCAL std::string get_name_stream() const;
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getNameStreamVersion()
std::string get_name_stream_version() const;
LIBDNF_LOCAL std::string get_name_stream_version() const;
/// @return The "name:stream:computed_static_context" string if computed_static_context exists, otherwise,
/// the "name:stream:version:context" string.
std::string get_name_stream_staticcontext() const;
LIBDNF_LOCAL std::string get_name_stream_staticcontext() const;
/// @return The "name:stream:computed_static_context:arch" string if computed_static_context exists, otherwise,
/// the "name:stream:version:context:arch" string.
std::string get_name_stream_staticcontext_arch() const;
LIBDNF_LOCAL std::string get_name_stream_staticcontext_arch() const;
std::vector<ModuleProfile> get_profiles_internal(const char * name) const;
LIBDNF_LOCAL std::vector<ModuleProfile> get_profiles_internal(const char * name) const;
static std::vector<ModuleDependency> get_module_dependencies(
LIBDNF_LOCAL static std::vector<ModuleDependency> get_module_dependencies(
_ModulemdModuleStream * md_stream, bool remove_platform);
// TODO(pkratoch): Make this private once it's not used in tests.
@ -222,10 +224,11 @@ private:
/// @since 5.0
//
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getRequires(bool removePlatform=false)
static std::string get_module_dependencies_string(_ModulemdModuleStream * md_stream, bool remove_platform);
std::string get_module_dependencies_string(bool remove_platform = false) const;
LIBDNF_LOCAL static std::string get_module_dependencies_string(
_ModulemdModuleStream * md_stream, bool remove_platform);
LIBDNF_LOCAL std::string get_module_dependencies_string(bool remove_platform = false) const;
static std::string get_name_stream(_ModulemdModuleStream * md_stream);
LIBDNF_LOCAL static std::string get_name_stream(_ModulemdModuleStream * md_stream);
/// Create solvable with:
/// Name: $name:$stream:$context
@ -235,22 +238,22 @@ private:
/// Provides: module($name:$stream)
/// Conflicts: module($name)
/// Description: $name:$stream
void create_solvable();
void create_dependencies() const;
void create_solvable_and_dependencies();
LIBDNF_LOCAL void create_solvable();
LIBDNF_LOCAL void create_dependencies() const;
LIBDNF_LOCAL void create_solvable_and_dependencies();
/// @brief Create platform solvable. Intended to be used for autodetecting modular platform ID.
/// @param module_sack Reference to a modular sack where the target pool with solvables is located.
/// @param name Platform name.
/// @param stream Platform stream.
static void create_platform_solvable(
LIBDNF_LOCAL static void create_platform_solvable(
const ModuleSackWeakPtr & module_sack, const std::string & name, const std::string & stream);
libdnf5::module::ModuleSackWeakPtr get_module_sack() const;
LIBDNF_LOCAL libdnf5::module::ModuleSackWeakPtr get_module_sack() const;
void set_computed_static_context(const std::string & context);
LIBDNF_LOCAL void set_computed_static_context(const std::string & context);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_MODULE_MODULE_PROFILE_HPP
#define LIBDNF5_MODULE_MODULE_PROFILE_HPP
#include "libdnf5/defs.h"
#include <memory>
#include <string>
#include <vector>
@ -31,7 +33,7 @@ namespace libdnf5::module {
// @replaces libdnf:module:modulemd/ModuleProfile.hpp:class:ModuleProfile
class ModuleProfile {
class LIBDNF_API ModuleProfile {
public:
/// @return The profile name.
/// @since 5.0
@ -69,9 +71,9 @@ private:
friend class ModuleItem;
// @replaces libdnf:module:modulemd/ModuleProfile.hpp:ctor:ModuleProfile.ModuleProfile(ModulemdProfile * profile)
ModuleProfile(_ModulemdProfile * profile, const bool is_default);
LIBDNF_LOCAL ModuleProfile(_ModulemdProfile * profile, const bool is_default);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,6 +24,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/sack/query.hpp"
#include "libdnf5/common/sack/query_cmp.hpp"
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/module/module_item.hpp"
#include "libdnf5/module/nsvcap.hpp"
@ -34,7 +35,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::module {
// TODO(pkratoch): Store pointers to ModuleItems instead of ModuleItems to allow faster copying
class ModuleQuery : public libdnf5::sack::Query<ModuleItem> {
class LIBDNF_API ModuleQuery : public libdnf5::sack::Query<ModuleItem> {
public:
/// Create a new ModuleQuery instance.
///
@ -181,7 +182,7 @@ public:
private:
friend ModuleItem;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -25,6 +25,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/base/solver_problems.hpp"
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/module/module_item.hpp"
#include "libdnf5/module/module_sack_weak.hpp"
@ -56,7 +57,7 @@ class RepoSack;
namespace libdnf5::module {
/// Container with data and methods related to modules
class ModuleSack {
class LIBDNF_API ModuleSack {
public:
~ModuleSack();
@ -94,13 +95,13 @@ private:
friend class ModuleGoalPrivate;
friend class ModuleQuery;
ModuleSack(const BaseWeakPtr & base);
LIBDNF_LOCAL ModuleSack(const BaseWeakPtr & base);
BaseWeakPtr get_base() const;
LIBDNF_LOCAL BaseWeakPtr get_base() const;
/// Load information about modules from file to ModuleSack. It is critical to load all module information from
/// all available repositories when modular metadata are available.
void add(const std::string & file_content, const std::string & repo_id);
LIBDNF_LOCAL void add(const std::string & file_content, const std::string & repo_id);
// TODO(pkratoch): Implement adding defaults from "/etc/dnf/modules.defaults.d/", which are defined by user.
// They are added with priority 1000 after everything else is loaded.
@ -109,13 +110,13 @@ private:
//
// @replaces libdnf:ModulePackageContainer.hpp:method:ModulePackageContainer.addDefaultsFromDisk()
// @replaces libdnf:ModulePackageContainer.hpp:method:ModulePackageContainer.moduleDefaultsResolve()
void add_defaults_from_disk();
LIBDNF_LOCAL void add_defaults_from_disk();
WeakPtrGuard<ModuleSack, false> data_guard;
bool active_modules_resolved = false;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_MODULE_MODULE_STATUS_HPP
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <string>
@ -32,7 +33,7 @@ namespace libdnf5::module {
// AVAILABLE - otherwise.
enum class ModuleStatus { AVAILABLE, ENABLED, DISABLED };
class InvalidModuleStatus : public libdnf5::Error {
class LIBDNF_API InvalidModuleStatus : public libdnf5::Error {
public:
InvalidModuleStatus(const std::string & status);
@ -41,8 +42,8 @@ public:
};
std::string module_status_to_string(ModuleStatus status);
ModuleStatus module_status_from_string(const std::string & status);
LIBDNF_API std::string module_status_to_string(ModuleStatus status);
LIBDNF_API ModuleStatus module_status_from_string(const std::string & status);
} // namespace libdnf5::module

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_MODULE_NSCVAP_HPP
#define LIBDNF5_MODULE_NSCVAP_HPP
#include "libdnf5/defs.h"
#include <memory>
#include <string>
#include <vector>
@ -28,7 +30,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::module {
class Nsvcap {
class LIBDNF_API Nsvcap {
public:
enum class Form {
NSVCAP = 1,
@ -116,7 +118,7 @@ public:
void set_profile(std::string && profile);
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "plugin_version.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/version.hpp"
#include <string>
@ -44,7 +45,7 @@ namespace libdnf5::plugin {
class IPluginData;
/// @brief A base class for implementing LIBDNF5 plugins that introduce additional logic into the library using hooks.
class IPlugin {
class LIBDNF_PLUGIN_API IPlugin {
public:
explicit IPlugin(IPluginData & data);
virtual ~IPlugin();
@ -120,7 +121,7 @@ public:
Base & get_base() const noexcept;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
@ -131,22 +132,22 @@ extern "C" {
/// Returns the version of the API supported by the plugin.
/// Same result as IPlugin::get_api_version(), but can be called without creating an IPlugin instance.
libdnf5::PluginAPIVersion libdnf_plugin_get_api_version(void);
LIBDNF_PLUGIN_API libdnf5::PluginAPIVersion libdnf_plugin_get_api_version(void);
/// Returns the name of the plugin. It can be called at any time.
/// Same result as IPlugin::get_name(), but can be called without creating an IPlugin instance.
const char * libdnf_plugin_get_name(void);
LIBDNF_PLUGIN_API const char * libdnf_plugin_get_name(void);
/// Returns the version of the plugin. It can be called at any time.
/// Same result as IPlugin::get_version(), but can be called without creating an IPlugin instance.
libdnf5::plugin::Version libdnf_plugin_get_version(void);
LIBDNF_PLUGIN_API libdnf5::plugin::Version libdnf_plugin_get_version(void);
/// Creates a new plugin instance. Passes the API version to the plugin.
libdnf5::plugin::IPlugin * libdnf_plugin_new_instance(
LIBDNF_PLUGIN_API libdnf5::plugin::IPlugin * libdnf_plugin_new_instance(
libdnf5::LibraryVersion library_version, libdnf5::plugin::IPluginData & data, libdnf5::ConfigParser & parser);
/// Deletes plugin instance.
void libdnf_plugin_delete_instance(libdnf5::plugin::IPlugin * plugin_instance);
LIBDNF_PLUGIN_API void libdnf_plugin_delete_instance(libdnf5::plugin::IPlugin * plugin_instance);
}
#endif

View File

@ -24,11 +24,12 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "plugin_version.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/version.hpp"
namespace libdnf5::plugin {
class PluginInfo {
class LIBDNF_API PluginInfo {
public:
~PluginInfo();
@ -62,10 +63,10 @@ public:
/// @return the value of the `name` attribute or nullptr
const char * get_attribute(const char * name) const noexcept;
class Impl;
class LIBDNF_LOCAL Impl;
private:
explicit PluginInfo(Impl & p_impl);
LIBDNF_LOCAL explicit PluginInfo(Impl & p_impl);
ImplPtr<Impl> p_impl;
};

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/conf/config_main.hpp"
#include "libdnf5/conf/option_child.hpp"
#include "libdnf5/defs.h"
#include <memory>
@ -29,7 +30,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::repo {
/// Holds repo configuration options. Default values of some options are inherited from ConfigMain.
class ConfigRepo : public Config {
class LIBDNF_API ConfigRepo : public Config {
public:
ConfigRepo(ConfigMain & main_config, const std::string & id);
~ConfigRepo();
@ -165,7 +166,7 @@ public:
Option::Priority priority = Option::Priority::REPOCONFIG) override;
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_REPO_DOWNLOAD_CALLBACKS_HPP
#define LIBDNF5_REPO_DOWNLOAD_CALLBACKS_HPP
#include "libdnf5/defs.h"
namespace libdnf5 {
class Base;
@ -30,7 +32,7 @@ namespace libdnf5::repo {
/// Base class for download callbacks.
/// To implement a callback, inherit from this class and override the virtual methods.
class DownloadCallbacks {
class LIBDNF_API DownloadCallbacks {
public:
enum class FastestMirrorStage {
/// Fastest mirror detection started. ptr is `nullptr`.

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/exception.hpp"
#include "libdnf5/conf/config_main.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/repo/repo_weak.hpp"
#include <memory>
@ -36,7 +37,7 @@ class FileDownloadError : public Error {
};
class FileDownloader {
class LIBDNF_API FileDownloader {
public:
explicit FileDownloader(const libdnf5::BaseWeakPtr & base);
explicit FileDownloader(libdnf5::Base & base);
@ -73,7 +74,7 @@ public:
void set_resume(bool value);
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_REPO_PACKAGE_DOWNLOADER_HPP
#include "libdnf5/conf/config_main.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/package.hpp"
#include <memory>
@ -35,7 +36,7 @@ class PackageDownloadError : public Error {
};
class PackageDownloader {
class LIBDNF_API PackageDownloader {
public:
explicit PackageDownloader(const libdnf5::BaseWeakPtr & base);
explicit PackageDownloader(libdnf5::Base & base);
@ -75,7 +76,7 @@ public:
void force_keep_packages(bool value);
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -28,6 +28,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/repo/repo_errors.hpp"
#include "libdnf5/repo/repo_weak.hpp"
#include "libdnf5/rpm/package.hpp"
@ -55,7 +56,7 @@ class RepoDownloader;
/// RPM repository
/// Represents a repository used to download packages.
/// Remote metadata is cached locally.
class Repo {
class LIBDNF_API Repo {
public:
enum class Type { AVAILABLE, SYSTEM, COMMANDLINE };
@ -312,7 +313,7 @@ public:
static std::string type_to_string(Type type);
private:
class Impl;
class LIBDNF_LOCAL Impl;
friend class RepoSack;
friend class rpm::Package;
friend class rpm::PackageSack;
@ -323,13 +324,13 @@ private:
/// Loads the repository objects into sacks.
///
/// Also writes the libsolv's solv/solvx cache files.
void load();
LIBDNF_LOCAL void load();
/// Downloads repository metadata.
// @replaces libdnf:repo/Repo.hpp:method:Repo.downloadMetadata(const std::string & destdir)
void download_metadata(const std::string & destdir);
LIBDNF_LOCAL void download_metadata(const std::string & destdir);
void add_libsolv_testcase(const std::string & path);
LIBDNF_LOCAL void add_libsolv_testcase(const std::string & path);
/// Adds an RPM package at `path` to the repository.
///
@ -341,38 +342,38 @@ private:
/// @param with_hdrid If true, libsolv calculates header checksum and stores it.
/// @throws RepoRpmError if the RPM file can't be read or is corrupted.
/// @return PackageId of the added package.
libdnf5::rpm::Package add_rpm_package(const std::string & path, bool with_hdrid);
LIBDNF_LOCAL libdnf5::rpm::Package add_rpm_package(const std::string & path, bool with_hdrid);
void make_solv_repo();
LIBDNF_LOCAL void make_solv_repo();
void load_available_repo();
void load_system_repo();
LIBDNF_LOCAL void load_available_repo();
LIBDNF_LOCAL void load_system_repo();
void internalize();
LIBDNF_LOCAL void internalize();
/// If the repository is not already marked as expired, it checks for the presence of the repository cache
/// expiration attribute, and if the metadata_expire configuration value is set, also checks the modification times
/// of the main configuration file, the repository configuration file, and the cached primary file.
/// Depending on the result, the repository may be marked as expired.
void recompute_expired();
LIBDNF_LOCAL void recompute_expired();
/// @brief Clones repodata and solv files from the root cache. The original user repository cache is deleted.
/// The intended use case is for cloning the root cache when the user one is invalid or empty.
/// @return Whether at least the repodata cache cloning was successful.
bool clone_root_metadata();
LIBDNF_LOCAL bool clone_root_metadata();
RepoDownloader & get_downloader() const;
LIBDNF_LOCAL RepoDownloader & get_downloader() const;
bool is_loaded() const;
LIBDNF_LOCAL bool is_loaded() const;
/// Requires that the repo is loaded
SolvRepo & get_solv_repo() const;
LIBDNF_LOCAL SolvRepo & get_solv_repo() const;
/// Mark this repository as fresh (it is not expired).
void mark_fresh();
LIBDNF_LOCAL void mark_fresh();
// Add xml comps file at `path` to the repository.
void add_xml_comps(const std::string & path);
LIBDNF_LOCAL void add_xml_comps(const std::string & path);
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <filesystem>
#include <string>
@ -31,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::repo {
struct RepoCacheRemoveStatistics {
struct LIBDNF_API RepoCacheRemoveStatistics {
RepoCacheRemoveStatistics();
~RepoCacheRemoveStatistics();
@ -50,7 +51,7 @@ struct RepoCacheRemoveStatistics {
private:
friend class RepoCache;
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
@ -65,7 +66,7 @@ public:
/// Repository cache management class.
class RepoCache {
class LIBDNF_API RepoCache {
public:
using RemoveStatistics = RepoCacheRemoveStatistics;
@ -150,7 +151,7 @@ public:
private:
friend RepoCacheRemoveStatistics;
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_REPO_REPO_CALLBACKS_HPP
#define LIBDNF5_REPO_REPO_CALLBACKS_HPP
#include "libdnf5/defs.h"
#include <string>
#include <vector>
@ -32,7 +34,7 @@ namespace libdnf5::repo {
/// Base class for repository callbacks.
/// To implement callbacks, inherit from this class and override virtual methods.
class RepoCallbacks {
class LIBDNF_API RepoCallbacks {
public:
explicit RepoCallbacks();
RepoCallbacks(const RepoCallbacks &) = delete;

View File

@ -25,6 +25,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/sack/query.hpp"
#include "libdnf5/common/sack/query_cmp.hpp"
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/repo/repo.hpp"
#include <string>
@ -41,7 +42,7 @@ using RepoSackWeakPtr = WeakPtr<RepoSack, false>;
namespace libdnf5::repo {
class RepoQuery : public libdnf5::sack::Query<RepoWeakPtr> {
class LIBDNF_API RepoQuery : public libdnf5::sack::Query<RepoWeakPtr> {
public:
#ifndef SWIG
using Query<RepoWeakPtr>::Query;
@ -123,7 +124,7 @@ public:
void filter_type(Repo::Type type, sack::QueryCmp cmp = libdnf5::sack::QueryCmp::EQ);
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -26,6 +26,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/sack/sack.hpp"
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/logger/logger.hpp"
@ -35,7 +36,7 @@ class RepoSack;
using RepoSackWeakPtr = WeakPtr<RepoSack, false>;
class RepoSack : public sack::Sack<Repo> {
class LIBDNF_API RepoSack : public sack::Sack<Repo> {
public:
/// Creates a new clear repository with default configuration.
/// @param id The new repo id
@ -149,34 +150,35 @@ private:
friend class rpm::PackageSack;
friend class libdnf5::Goal;
explicit RepoSack(const libdnf5::BaseWeakPtr & base);
explicit RepoSack(libdnf5::Base & base);
LIBDNF_LOCAL explicit RepoSack(const libdnf5::BaseWeakPtr & base);
LIBDNF_LOCAL explicit RepoSack(libdnf5::Base & base);
/// Loads repositories configuration overrides from drop-in directories. No new repositories are created.
/// Only the configuration of the corresponding existing repositories is modified.
void load_repos_configuration_overrides();
LIBDNF_LOCAL void load_repos_configuration_overrides();
/// If not created yet, creates the cmdline repository and returns it.
/// @return The cmdline repository.
libdnf5::repo::RepoWeakPtr get_cmdline_repo();
LIBDNF_LOCAL libdnf5::repo::RepoWeakPtr get_cmdline_repo();
/// If not created yet, creates the stored transaction repository and returns it.
/// @return The stored transaction repository.
libdnf5::repo::RepoWeakPtr get_stored_transaction_repo();
LIBDNF_LOCAL libdnf5::repo::RepoWeakPtr get_stored_transaction_repo();
/// Add given path to comps to the stored_transaction repository.
/// @param path Path to a local xml comps file to be inserted to stored_transaction repo.
void add_stored_transaction_comps(const std::string & path);
LIBDNF_LOCAL void add_stored_transaction_comps(const std::string & path);
/// Add given path to rpm to the stored_transaction repository.
/// @param path Path to a local rpm file to be inserted to stored_transaction repo.
/// @param calculate_checksum Whether libsolv should calculate and store checksum of added packages. Setting to true significantly reduces performance.
/// @return Newly created rpm::Package object in cmdline repo
libdnf5::rpm::Package add_stored_transaction_package(const std::string & path, bool calculate_checksum = false);
LIBDNF_LOCAL libdnf5::rpm::Package add_stored_transaction_package(
const std::string & path, bool calculate_checksum = false);
void internalize_repos();
LIBDNF_LOCAL void internalize_repos();
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -21,6 +21,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_RPM_ARCH_HPP
#define LIBDNF5_RPM_ARCH_HPP
#include "libdnf5/defs.h"
#include <string>
#include <vector>
@ -28,12 +30,12 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::rpm {
/// Returns a list of architectures supported by libdnf5.
std::vector<std::string> get_supported_arches();
LIBDNF_API std::vector<std::string> get_supported_arches();
/// Returns base architecture of the given `arch`. In case the base arch is not
/// found the function returns empty string.
/// @param arch Architecture.
std::string get_base_arch(const std::string & arch);
LIBDNF_API std::string get_base_arch(const std::string & arch);
} // namespace libdnf5::rpm

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_RPM_CHECKSUM_HPP
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <memory>
#include <string>
@ -29,7 +30,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::rpm {
/// Class contains checksum and checksum type
class Checksum {
class LIBDNF_API Checksum {
public:
~Checksum();
Checksum(const Checksum & src);
@ -50,9 +51,9 @@ private:
friend class Package;
/// Require checksum in hex and libsolv checksum type
Checksum(const char * checksum, int libsolv_type);
LIBDNF_LOCAL Checksum(const char * checksum, int libsolv_type);
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <sstream>
#include <string>
@ -31,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::rpm {
struct NevraIncorrectInputError : public Error {
struct LIBDNF_API NevraIncorrectInputError : public Error {
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5::rpm"; }
const char * get_name() const noexcept override { return "NevraIncorrectInputError"; }
@ -39,7 +40,7 @@ struct NevraIncorrectInputError : public Error {
// @replaces hawkey:hawkey/__init__.py:class:Nevra
struct Nevra {
struct LIBDNF_API Nevra {
public:
enum class Form { NEVRA = 1, NEVR = 2, NEV = 3, NA = 4, NAME = 5 };
@ -71,7 +72,7 @@ public:
bool operator==(const Nevra & other) const;
// NOTE: required by cppunit asserts
friend std::ostringstream & operator<<(std::ostringstream & out, const Nevra & nevra);
//friend std::ostringstream & operator<<(std::ostringstream & out, const Nevra & nevra);
/// Returns false when parsing failed and stored data are in inconsistency state.
@ -108,7 +109,7 @@ public:
bool has_just_name() const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
@ -118,6 +119,9 @@ inline std::vector<Nevra> Nevra::parse(const std::string & nevra_str) {
}
LIBDNF_API std::ostringstream & operator<<(std::ostringstream & out, const Nevra & nevra);
/// Create a full nevra string (always contains epoch) from an object
template <typename T>
inline std::string to_full_nevra_string(const T & obj) {
@ -188,7 +192,7 @@ inline void copy_nevra_attributes(const F & from, T & to) {
/// Compare alpha and numeric segments of two versions.
/// @return 1 if `lhs` < `rhs`, -1 if `lhs` > `rhs`, 0 if they are equal
int rpmvercmp(const char * lhs, const char * rhs);
LIBDNF_API int rpmvercmp(const char * lhs, const char * rhs);
/// Compare evr part of two objects

View File

@ -25,6 +25,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "reldep_list.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/repo/repo_weak.hpp"
#include "libdnf5/transaction/transaction_item_reason.hpp"
@ -64,7 +65,7 @@ public:
int id{0};
};
struct Changelog {
struct LIBDNF_API Changelog {
public:
Changelog(time_t timestamp, const std::string & author, const std::string & text);
~Changelog();
@ -79,7 +80,7 @@ public:
const std::string & get_text() const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};
@ -88,7 +89,7 @@ private:
// @replaces libdnf:libdnf/hy-package.h:struct:DnfPackage
// @replaces dnf:dnf/package.py:class:Package
class Package {
class LIBDNF_API Package {
public:
~Package();
Package(const Package & src);
@ -553,11 +554,11 @@ private:
friend class libdnf5::rpm::Transaction;
// TODO(jrohel): Assumes unique `rpmdbid`. Support for opening more rpm databases at once?
Package(const BaseWeakPtr & base, unsigned long long rpmdbid);
LIBDNF_LOCAL Package(const BaseWeakPtr & base, unsigned long long rpmdbid);
bool is_cached() const;
LIBDNF_LOCAL bool is_cached() const;
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -30,6 +30,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/sack/exclude_flags.hpp"
#include "libdnf5/common/sack/query_cmp.hpp"
#include "libdnf5/defs.h"
#include <string>
#include <vector>
@ -47,7 +48,7 @@ namespace libdnf5::rpm {
// @replaces libdnf/hy-query.h:struct:HyQuery
// @replaces libdnf/sack/query.hpp:struct:Query
// @replaces hawkey:hawkey/__init__.py:class:Query
class PackageQuery : public PackageSet {
class LIBDNF_API PackageQuery : public PackageSet {
public:
using ExcludeFlags = libdnf5::sack::ExcludeFlags;
@ -1003,10 +1004,11 @@ public:
void filter_versionlock();
private:
std::vector<std::vector<Package>> filter_leaves(bool return_grouped_leaves);
LIBDNF_LOCAL std::vector<std::vector<Package>> filter_leaves(bool return_grouped_leaves);
friend libdnf5::Goal;
class PQImpl;
class LIBDNF_LOCAL PQImpl;
std::unique_ptr<PQImpl> p_pq_impl;
};

View File

@ -28,6 +28,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/exception.hpp"
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/versionlock_config.hpp"
#include "libdnf5/transaction/transaction_item_reason.hpp"
@ -79,7 +80,7 @@ class PackageSet;
class PackageSack;
using PackageSackWeakPtr = WeakPtr<PackageSack, false>;
class PackageSack {
class LIBDNF_API PackageSack {
public:
explicit PackageSack(const libdnf5::BaseWeakPtr & base);
explicit PackageSack(libdnf5::Base & base);
@ -197,7 +198,7 @@ private:
friend libdnf5::base::Transaction;
friend class libdnf5::module::ModuleSack;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -26,6 +26,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "package_set_iterator.hpp"
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <cstddef>
#include <memory>
@ -45,7 +46,7 @@ class SolvMap;
namespace libdnf5::rpm {
// @replaces libdnf:sack/packageset.hpp:struct:PackageSet
class PackageSet {
class LIBDNF_API PackageSet {
public:
using iterator = PackageSetIterator;
@ -161,8 +162,10 @@ private:
friend class libdnf5::advisory::AdvisoryPackage;
friend libdnf5::Goal;
PackageSet(const BaseWeakPtr & base, libdnf5::solv::SolvMap & solv_map);
class Impl;
LIBDNF_LOCAL PackageSet(const BaseWeakPtr & base, libdnf5::solv::SolvMap & solv_map);
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "package.hpp"
#include "libdnf5/defs.h"
#include <cstddef>
#include <iterator>
#include <memory>
@ -33,7 +35,7 @@ namespace libdnf5::rpm {
class PackageSet;
class PackageSetIterator {
class LIBDNF_API PackageSetIterator {
public:
using iterator_category = std::forward_iterator_tag;
using difference_type = std::ptrdiff_t;
@ -63,7 +65,7 @@ public:
private:
explicit PackageSetIterator(const PackageSet & package_set);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/impl_ptr.hpp"
#include "libdnf5/defs.h"
#include <memory>
#include <string>
@ -46,7 +47,7 @@ public:
// @replaces libdnf/dnf-reldep.h:struct:DnfReldep
// @replaces libdnf/repo/solvable/Dependency.hpp:struct:Dependency
// @replaces hawkey:hawkey/__init__.py:class:Reldep
class Reldep {
class LIBDNF_API Reldep {
public:
enum class CmpType { NONE = 0, GT = (1 << 0), EQ = (1 << 1), GTE = (GT | EQ), LT = (1 << 2), LTE = (LT | EQ) };
@ -118,7 +119,7 @@ private:
/// @param cmp_type p_cmpType: ComparisonType, and their combinations
// @replaces libdnf/repo/solvable/Dependency.hpp:method:get_id()
// @replaces libdnf/dnf-reldep.h:function:dnf_reldep_new(DnfSack *sack, const char *name, int cmp_type, const char *evr)
Reldep(const BaseWeakPtr & base, const char * name, const char * version, CmpType cmp_type);
LIBDNF_LOCAL Reldep(const BaseWeakPtr & base, const char * name, const char * version, CmpType cmp_type);
/// @brief Returns Id of parsed reldep
///
@ -129,7 +130,7 @@ private:
/// @param create Whether a new Id should be created when name does not exist
/// @return DependencyId
// @replaces libdnf/repo/solvable/Dependency.hpp:method:getReldepId(DnfSack *sack, const char *name, const char *version, int cmpType)
static ReldepId get_reldep_id(
LIBDNF_LOCAL static ReldepId get_reldep_id(
const BaseWeakPtr & base, const char * name, const char * version, CmpType cmp_type, int create = 1);
/// @brief Returns Id of reldep or raises std::runtime_error if parsing fails
@ -139,9 +140,10 @@ private:
/// @return DependencyId
/// @param create Whether a new Id should be created when name does not exist
// @replaces libdnf/repo/solvable/Dependency.hpp:method:getReldepId(DnfSack *sack, const char * reldepStr)
static ReldepId get_reldep_id(const BaseWeakPtr & base, const std::string & reldep_str, int create = 1);
LIBDNF_LOCAL static ReldepId get_reldep_id(
const BaseWeakPtr & base, const std::string & reldep_str, int create = 1);
class Impl;
class LIBDNF_LOCAL Impl;
ImplPtr<Impl> p_impl;
};

View File

@ -25,6 +25,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "reldep_list_iterator.hpp"
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/defs.h"
#include <memory>
@ -33,7 +34,7 @@ namespace libdnf5::rpm {
// @replaces libdnf/dnf-reldep-list.h:struct:DnfReldepList
// @replaces libdnf/repo/solvable/DependencyContainer.hpp:struct:DependencyContainer
class ReldepList {
class LIBDNF_API ReldepList {
public:
// @replaces libdnf/repo/solvable/DependencyContainer.hpp:method:DependencyContainer(const DependencyContainer &src)
ReldepList(const ReldepList & src);
@ -119,9 +120,9 @@ private:
/// @return bool false if parsing or reldep creation fails
///
// @replaces libdnf/repo/solvable/DependencyContainer.hpp:method:addReldep(const char *reldepStr)
bool add_reldep(const std::string & reldep_str, int create);
LIBDNF_LOCAL bool add_reldep(const std::string & reldep_str, int create);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "reldep.hpp"
#include "libdnf5/defs.h"
#include <cstddef>
#include <iterator>
#include <memory>
@ -33,7 +35,7 @@ namespace libdnf5::rpm {
class ReldepList;
class ReldepListIterator {
class LIBDNF_API ReldepListIterator {
public:
explicit ReldepListIterator(const ReldepList & reldep_list);
ReldepListIterator(const ReldepListIterator & other);
@ -57,7 +59,7 @@ public:
void end();
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base.hpp"
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include "libdnf5/rpm/package.hpp"
#include <functional>
@ -29,14 +30,14 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace libdnf5::rpm {
class SignatureCheckError : public Error {
class LIBDNF_API SignatureCheckError : public Error {
public:
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5::rpm"; }
const char * get_name() const noexcept override { return "SignatureCheckError"; }
};
class KeyImportError : public Error {
class LIBDNF_API KeyImportError : public Error {
public:
using Error::Error;
const char * get_domain_name() const noexcept override { return "libdnf5::rpm"; }
@ -45,7 +46,7 @@ public:
using RpmKeyPktPtr = std::unique_ptr<uint8_t, std::function<void(uint8_t * pkt)>>;
class KeyInfo {
class LIBDNF_API KeyInfo {
public:
const std::string & get_key_id() const noexcept;
std::string get_short_key_id() const;
@ -77,11 +78,11 @@ protected:
void add_user_id(const char * user_id);
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};
class RpmSignature {
class LIBDNF_API RpmSignature {
public:
enum class CheckResult { OK, SKIPPED, FAILED_KEY_MISSING, FAILED_NOT_TRUSTED, FAILED_NOT_SIGNED, FAILED };
@ -119,7 +120,7 @@ public:
static std::string check_result_to_string(CheckResult result);
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_RPM_TRANSACTION_CALLBACKS_HPP
#define LIBDNF5_RPM_TRANSACTION_CALLBACKS_HPP
#include "libdnf5/defs.h"
#include "libdnf5/rpm/nevra.hpp"
#include <cstdint>
@ -40,7 +41,7 @@ using TransactionItem = base::TransactionPackage;
/// Base class for Transaction callbacks
/// User implements Transaction callbacks by inheriting this class and overriding its methods.
class TransactionCallbacks {
class LIBDNF_API TransactionCallbacks {
public:
/// Scriptlet type
// TODO(jrohel): Are all scriptlets types present and correct?

View File

@ -22,6 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_RPM_VERSIONLOCK_CONFIG_HPP
#include "libdnf5/common/sack/query_cmp.hpp"
#include "libdnf5/defs.h"
#include <filesystem>
#include <map>
@ -35,7 +36,7 @@ namespace libdnf5::rpm {
/// Key can be one of "epoch", "evr", "arch".
/// Supported comparison operators are "<", "<=", "=", ">=", ">", "!=".
/// @since 5.1.13
class VersionlockCondition {
class LIBDNF_API VersionlockCondition {
public:
enum class Keys { EPOCH, EVR, ARCH };
@ -80,7 +81,7 @@ private:
/// package name and a set of conditions. All conditions must be true
/// for package version to get locked.
/// @since 5.1.13
class VersionlockPackage {
class LIBDNF_API VersionlockPackage {
public:
/// Creates an instance of `VersionlockPackage` class specifying the
/// name of package.
@ -122,7 +123,7 @@ private:
/// Class contains parsed versionlock configuration file.
/// @since 5.1.13
class VersionlockConfig {
class LIBDNF_API VersionlockConfig {
public:
/// Get list of configured versionlock entries.
std::vector<VersionlockPackage> & get_packages() { return packages; }
@ -136,7 +137,7 @@ private:
/// Creates an instance of `VersionlockConfig` specifying the config file
/// to read.
/// @param path Path to versionlock configuration file.
VersionlockConfig(const std::filesystem::path & path);
LIBDNF_LOCAL VersionlockConfig(const std::filesystem::path & path);
std::filesystem::path path;
std::vector<VersionlockPackage> packages{};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "comps_group.hpp"
#include "libdnf5/comps/group/package.hpp"
#include "libdnf5/defs.h"
#include <memory>
#include <vector>
@ -40,7 +41,7 @@ class CompsEnvironmentGroupDbUtils;
/// to perform comps transaction and then stored in the transaction (history) database.
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:class:CompsEnvironmentItem
class CompsEnvironment : public TransactionItem {
class LIBDNF_API CompsEnvironment : public TransactionItem {
public:
/// Get string representation of the object, which equals to environment_id
///
@ -58,69 +59,69 @@ private:
friend CompsEnvironmentDbUtils;
friend CompsEnvironmentGroupDbUtils;
explicit CompsEnvironment(const Transaction & trans);
LIBDNF_LOCAL explicit CompsEnvironment(const Transaction & trans);
/// Get text id of the environment (xml element: `<comps><environment><id>VALUE</id>...`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.getEnvironmentId()
const std::string & get_environment_id() const noexcept;
LIBDNF_LOCAL const std::string & get_environment_id() const noexcept;
/// Set text id of the environment (xml element: `<comps><environment><id>VALUE</id>...`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.setEnvironmentId(const std::string & value)
void set_environment_id(const std::string & value);
LIBDNF_LOCAL void set_environment_id(const std::string & value);
/// Get name of the environment (xml element: `<comps><environment><name>VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.getName()
const std::string & get_name() const noexcept;
LIBDNF_LOCAL const std::string & get_name() const noexcept;
/// Set name of the environment (xml element: `<comps><environment><name>VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.setName(const std::string & value)
void set_name(const std::string & value);
LIBDNF_LOCAL void set_name(const std::string & value);
/// Get translated name of the environment in the current locale (xml element: `<comps><environment><name xml:lang="...">VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.getTranslatedName()
const std::string & get_translated_name() const noexcept;
LIBDNF_LOCAL const std::string & get_translated_name() const noexcept;
/// Set translated name of the environment in the current locale (xml element: `<comps><environment><name xml:lang="...">VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.setTranslatedName(const std::string & value)
void set_translated_name(const std::string & value);
LIBDNF_LOCAL void set_translated_name(const std::string & value);
/// Get types of the packages to be installed with the environment (related xml elements: `<comps><group><packagelist><packagereq type="VALUE" ...>`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.getPackageTypes()
libdnf5::comps::PackageType get_package_types() const noexcept;
LIBDNF_LOCAL libdnf5::comps::PackageType get_package_types() const noexcept;
/// Set types of the packages to be installed with the environment (related xml elements: `<comps><group><packagelist><packagereq type="VALUE" ...>`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.setPackageTypes(libdnf::CompsPackageType value)
void set_package_types(libdnf5::comps::PackageType value);
LIBDNF_LOCAL void set_package_types(libdnf5::comps::PackageType value);
/// Create a new CompsEnvironmentGroup object and return a reference to it.
/// The object is owned by the CompsEnvironment.
CompsEnvironmentGroup & new_group();
LIBDNF_LOCAL CompsEnvironmentGroup & new_group();
/// Get list of groups associated with the environment.
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentItem.getGroups()
std::vector<CompsEnvironmentGroup> & get_groups();
LIBDNF_LOCAL std::vector<CompsEnvironmentGroup> & get_groups();
// TODO(dmach): rewrite into TransactionSack.list_installed_environments(); how to deal with references to different transactions? We don't want all of them loaded into memory.
//static std::vector< TransactionItemPtr > getTransactionItemsByPattern(
// libdnf5::utils::SQLite3Ptr conn,
// const std::string &pattern);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:class:CompsEnvironmentGroup
class CompsEnvironmentGroup {
class LIBDNF_API CompsEnvironmentGroup {
public:
~CompsEnvironmentGroup();
CompsEnvironmentGroup(const CompsEnvironmentGroup & src);
@ -136,44 +137,44 @@ private:
/// Get database id (primary key)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.getId()
int64_t get_id() const noexcept;
LIBDNF_LOCAL int64_t get_id() const noexcept;
/// Set database id (primary key)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.setId(int64_t value)
void set_id(int64_t value);
LIBDNF_LOCAL void set_id(int64_t value);
/// Get groupid of a group associated with a comps environment (xml element: `<comps><environment><grouplist><groupid>VALUE</groupid>`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.getGroupId()
const std::string & get_group_id() const noexcept;
LIBDNF_LOCAL const std::string & get_group_id() const noexcept;
/// Set groupid of a group associated with a comps environment (xml element: `<comps><environment><grouplist><groupid>VALUE</groupid>`)
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.setGroupId(const std::string & value)
void set_group_id(const std::string & value);
LIBDNF_LOCAL void set_group_id(const std::string & value);
/// Get a flag that determines if the group was present after the transaction it's associated with has finished.
/// If the group was installed before running the transaction, it's still counted as installed.
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.getInstalled()
bool get_installed() const noexcept;
LIBDNF_LOCAL bool get_installed() const noexcept;
/// Set a flag that determines if the group was present after the transaction it's associated with has finished.
/// If the group was installed before running the transaction, it's still counted as installed.
///
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.setInstalled(bool value)
void set_installed(bool value);
LIBDNF_LOCAL void set_installed(bool value);
// TODO(dmach): this is not entirely clear; investigate and document
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.getGroupType()
libdnf5::comps::PackageType get_group_type() const noexcept;
LIBDNF_LOCAL libdnf5::comps::PackageType get_group_type() const noexcept;
// TODO(dmach): this is not entirely clear; investigate and document
// @replaces libdnf:transaction/CompsEnvironmentItem.hpp:method:CompsEnvironmentGroup.setGroupType(libdnf::CompsPackageType value)
void set_group_type(libdnf5::comps::PackageType value);
LIBDNF_LOCAL void set_group_type(libdnf5::comps::PackageType value);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -23,6 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "transaction_item.hpp"
#include "libdnf5/comps/group/package.hpp"
#include "libdnf5/defs.h"
#include <memory>
#include <vector>
@ -40,7 +41,7 @@ class CompsGroupPackageDbUtils;
/// to perform comps transaction and then stored in the transaction (history) database.
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:class:CompsGroupItem
class CompsGroup : public TransactionItem {
class LIBDNF_API CompsGroup : public TransactionItem {
public:
/// Get string representation of the object, which equals to group_id
///
@ -59,63 +60,63 @@ private:
friend CompsGroupDbUtils;
friend CompsGroupPackageDbUtils;
explicit CompsGroup(const Transaction & trans);
LIBDNF_LOCAL explicit CompsGroup(const Transaction & trans);
/// Get text id of the group (xml element: `<comps><group><id>VALUE</id>...`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.getGroupId()
const std::string & get_group_id() const noexcept;
LIBDNF_LOCAL const std::string & get_group_id() const noexcept;
/// Get text id of the group (xml element: `<comps><group><id>VALUE</id>...`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.setGroupId(const std::string & value)
void set_group_id(const std::string & value);
LIBDNF_LOCAL void set_group_id(const std::string & value);
/// Get name of the group (xml element: `<comps><group><name>VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.getName()
const std::string & get_name() const noexcept;
LIBDNF_LOCAL const std::string & get_name() const noexcept;
/// Set name of the group (xml element: `<comps><group><name>VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.setName(const std::string & value)
void set_name(const std::string & value);
LIBDNF_LOCAL void set_name(const std::string & value);
/// Get translated name of the group in the current locale (xml element: `<comps><group><name xml:lang="...">VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.getTranslatedName()
const std::string & get_translated_name() const noexcept;
LIBDNF_LOCAL const std::string & get_translated_name() const noexcept;
/// Set translated name of the group in the current locale (xml element: `<comps><group><name xml:lang="...">VALUE</name>...`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.setTranslatedName(const std::string & value)
void set_translated_name(const std::string & value);
LIBDNF_LOCAL void set_translated_name(const std::string & value);
/// Get types of the packages to be installed with the group (related xml elements: `<comps><group><packagelist><packagereq type="VALUE" ...>`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.getPackageTypes()
libdnf5::comps::PackageType get_package_types() const noexcept;
LIBDNF_LOCAL libdnf5::comps::PackageType get_package_types() const noexcept;
/// Set types of the packages to be installed with the group (related xml elements: `<comps><group><packagelist><packagereq type="VALUE" ...>`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.setPackageTypes(libdnf::CompsPackageType value)
void set_package_types(libdnf5::comps::PackageType value);
LIBDNF_LOCAL void set_package_types(libdnf5::comps::PackageType value);
/// Create a new CompsGroupPackage object and return a reference to it.
/// The object is owned by the CompsGroup.
CompsGroupPackage & new_package();
LIBDNF_LOCAL CompsGroupPackage & new_package();
/// Get list of packages associated with the group.
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupItem.getPackages()
std::vector<CompsGroupPackage> & get_packages();
LIBDNF_LOCAL std::vector<CompsGroupPackage> & get_packages();
// TODO(dmach): rewrite into TransactionSack.list_installed_groups(); how to deal with references to different transactions? We don't want all of them loaded into memory.
//static std::vector< TransactionItemPtr > getTransactionItemsByPattern(
// libdnf5::utils::SQLite3Ptr conn,
// const std::string &pattern);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};
@ -123,7 +124,7 @@ private:
/// CompsGroupPackage represents a package associated with a comps group
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:class:CompsGroupPackage
class CompsGroupPackage {
class LIBDNF_API CompsGroupPackage {
public:
~CompsGroupPackage();
CompsGroupPackage(const CompsGroupPackage & src);
@ -139,48 +140,48 @@ private:
/// Get database id (primary key)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.getId()
int64_t get_id() const noexcept;
LIBDNF_LOCAL int64_t get_id() const noexcept;
/// Set database id (primary key)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.setId(int64_t value)
void set_id(int64_t value);
LIBDNF_LOCAL void set_id(int64_t value);
/// Get name of a package associated with a comps group (xml element: `<comps><group><packagelist><packagereq>VALUE</packagereq>`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.getName()
const std::string & get_name() const noexcept;
LIBDNF_LOCAL const std::string & get_name() const noexcept;
/// Set name of a package associated with a comps group (xml element: `<comps><group><packagelist><packagereq>VALUE</packagereq>`)
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.setName(const std::string & value)
void set_name(const std::string & value);
LIBDNF_LOCAL void set_name(const std::string & value);
/// Get a flag that determines if the package was present after the transaction it's associated with has finished.
/// If the package was installed before running the transaction, it's still counted as installed.
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.getInstalled()
bool get_installed() const noexcept;
LIBDNF_LOCAL bool get_installed() const noexcept;
/// Set a flag that determines if the package was present after the transaction it's associated with has finished.
/// If the package was installed before running the transaction, it's still counted as installed.
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.setInstalled(bool value)
void set_installed(bool value);
LIBDNF_LOCAL void set_installed(bool value);
/// Get type of package associated with a comps group (xml element: `<comps><group><packagelist><packagereq type="VALUE" ...>`)
/// See `enum class comps::PackageType` documentation for more details.
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.getPackageType()
libdnf5::comps::PackageType get_package_type() const noexcept;
LIBDNF_LOCAL libdnf5::comps::PackageType get_package_type() const noexcept;
/// Set type of package associated with a comps group (xml element: `<comps><group><packagelist><packagereq type="VALUE" ...>`)
/// See `enum class libdnf5::comps::PackageType` documentation for more details.
///
// @replaces libdnf:transaction/CompsGroupItem.hpp:method:CompsGroupPackage.setPackageType(libdnf::PackageType value)
void set_package_type(libdnf5::comps::PackageType value);
LIBDNF_LOCAL void set_package_type(libdnf5::comps::PackageType value);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -20,7 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_TRANSACTION_OFFLINE_HPP
#define LIBDNF5_TRANSACTION_OFFLINE_HPP
#include <libdnf5/conf/const.hpp>
#include "libdnf5/conf/const.hpp"
#include "libdnf5/defs.h"
#include <filesystem>
#include <memory>
@ -52,7 +53,7 @@ class OfflineTransactionState;
/// Data of the initiated offline transaction state, by default stored in the
/// /usr/lib/sysimage/libdnf5/offline/offline-transaction-state.toml file.
struct OfflineTransactionStateData {
struct LIBDNF_API OfflineTransactionStateData {
public:
friend OfflineTransactionState;
@ -103,13 +104,13 @@ public:
const std::string & get_module_platform_id() const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};
/// Class to handle offline transaction state.
class OfflineTransactionState {
class LIBDNF_API OfflineTransactionState {
public:
OfflineTransactionState() = delete;
~OfflineTransactionState();
@ -133,9 +134,9 @@ public:
std::filesystem::path get_path() const;
private:
class Impl;
class LIBDNF_LOCAL Impl;
/// Read offline transaction state data from the file
void read();
LIBDNF_LOCAL void read();
std::unique_ptr<Impl> p_impl;
};

View File

@ -22,6 +22,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "transaction_item.hpp"
#include "libdnf5/defs.h"
#include <memory>
@ -35,7 +37,7 @@ class RpmDbUtils;
/// to perform rpm transaction and then stored in the transaction (history) database.
///
// @replaces libdnf:transaction/RPMItem.hpp:class:RPMItem
class Package : public TransactionItem {
class LIBDNF_API Package : public TransactionItem {
public:
/// Get package name
///
@ -77,35 +79,35 @@ private:
friend RpmDbUtils;
friend Transaction;
explicit Package(const Transaction & trans);
LIBDNF_LOCAL explicit Package(const Transaction & trans);
/// Set package name
///
// @replaces libdnf:transaction/RPMItem.hpp:method:RPMItem.setName(const std::string & value)
void set_name(const std::string & value);
LIBDNF_LOCAL void set_name(const std::string & value);
/// Get package epoch as an integer
uint32_t get_epoch_int() const;
LIBDNF_LOCAL uint32_t get_epoch_int() const;
/// Set package epoch
///
// @replaces libdnf:transaction/RPMItem.hpp:method:RPMItem.setEpoch(int32_t value)
void set_epoch(const std::string & value);
LIBDNF_LOCAL void set_epoch(const std::string & value);
/// Set package version
///
// @replaces libdnf:transaction/RPMItem.hpp:method:RPMItem.setVersion(const std::string & value)
void set_version(const std::string & value);
LIBDNF_LOCAL void set_version(const std::string & value);
/// Set package release
///
// @replaces libdnf:transaction/RPMItem.hpp:method:RPMItem.setRelease(const std::string & value)
void set_release(const std::string & value);
LIBDNF_LOCAL void set_release(const std::string & value);
/// Set package arch
///
// @replaces libdnf:transaction/RPMItem.hpp:method:RPMItem.setArch(const std::string & value)
void set_arch(const std::string & value);
LIBDNF_LOCAL void set_arch(const std::string & value);
/*
// TODO(dmach): Implement TransactionSack.new_filter().filter_package_pattern()
@ -117,9 +119,9 @@ private:
libdnf5::utils::SQLite3 & conn, const std::string & name, const std::string & arch, int64_t maxTransactionId);
*/
bool operator<(const Package & other) const;
LIBDNF_LOCAL bool operator<(const Package & other) const;
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -29,6 +29,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/transaction_group.hpp"
#include "libdnf5/base/transaction_module.hpp"
#include "libdnf5/base/transaction_package.hpp"
#include "libdnf5/defs.h"
#include <memory>
#include <set>
@ -57,10 +58,10 @@ class TransactionHistory;
// @replaces libdnf:transaction/Types.hpp:enum:TransactionState
enum class TransactionState : int { STARTED = 1, OK = 2, ERROR = 3 };
std::string transaction_state_to_string(TransactionState state);
TransactionState transaction_state_from_string(const std::string & state);
LIBDNF_API std::string transaction_state_to_string(TransactionState state);
LIBDNF_API TransactionState transaction_state_from_string(const std::string & state);
class InvalidTransactionState : public libdnf5::Error {
class LIBDNF_API InvalidTransactionState : public libdnf5::Error {
public:
InvalidTransactionState(const std::string & state);
@ -76,7 +77,7 @@ public:
/// to change packages on disk.
///
// @replaces libdnf:transaction/Transaction.hpp:class:Transaction
class Transaction {
class LIBDNF_API Transaction {
public:
using State = TransactionState;
@ -176,7 +177,7 @@ private:
/// be filled by the user and saved to the database.
///
/// @param base The base.
explicit Transaction(const libdnf5::BaseWeakPtr & base);
LIBDNF_LOCAL explicit Transaction(const libdnf5::BaseWeakPtr & base);
/// Constructs the transaction with a known id which needs to exist in the
/// database. The data are then lazily loaded from the database on first call
@ -184,78 +185,79 @@ private:
///
/// @param base The base.
/// @param id The id of the transaction.
Transaction(const libdnf5::BaseWeakPtr & base, int64_t id);
LIBDNF_LOCAL Transaction(const libdnf5::BaseWeakPtr & base, int64_t id);
/// Set Transaction database id (primary key)
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setId(int64_t value)
void set_id(int64_t value);
LIBDNF_LOCAL void set_id(int64_t value);
/// Set a user-specified comment describing the transaction
void set_comment(const std::string & value);
LIBDNF_LOCAL void set_comment(const std::string & value);
/// Set date and time of the transaction start
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setDtBegin(int64_t value)
void set_dt_start(int64_t value);
LIBDNF_LOCAL void set_dt_start(int64_t value);
/// Set date and time of the transaction end
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setDtEnd(int64_t value)
void set_dt_end(int64_t value);
LIBDNF_LOCAL void set_dt_end(int64_t value);
/// Set the description of the transaction (e.g. the CLI command that was executed)
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setCmdline(const std::string & value)
void set_description(const std::string & value);
LIBDNF_LOCAL void set_description(const std::string & value);
/// Set UID of a user that started the transaction
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setUserId(uint32_t value)
void set_user_id(uint32_t value);
LIBDNF_LOCAL void set_user_id(uint32_t value);
/// Set $releasever variable value that was used during the transaction
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setReleasever(const std::string & value)
void set_releasever(const std::string & value);
LIBDNF_LOCAL void set_releasever(const std::string & value);
/// Set RPM database version after the transaction
/// Format: `<rpm_count>`:`<sha1 of sorted SHA1HEADER fields of installed RPMs>`
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setRpmdbVersionEnd(const std::string & value)
void set_rpmdb_version_end(const std::string & value);
LIBDNF_LOCAL void set_rpmdb_version_end(const std::string & value);
/// Set RPM database version before the transaction
/// Format: `<rpm_count>`:`<sha1 of sorted SHA1HEADER fields of installed RPMs>`
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setRpmdbVersionBegin(const std::string & value)
void set_rpmdb_version_begin(const std::string & value);
LIBDNF_LOCAL void set_rpmdb_version_begin(const std::string & value);
/// Set transaction state
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.setState(libdnf::TransactionState value)
void set_state(State value);
LIBDNF_LOCAL void set_state(State value);
/// Create a new rpm package in the transaction and return a reference to it.
/// The package is owned by the transaction.
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.addItem(std::shared_ptr<Item> item, const std::string & repoid, libdnf::TransactionItemAction action, libdnf::TransactionItemReason reason)
Package & new_package();
LIBDNF_LOCAL Package & new_package();
/// Fill the transaction packages.
void fill_transaction_packages(const std::vector<libdnf5::base::TransactionPackage> & transaction_packages);
LIBDNF_LOCAL void fill_transaction_packages(
const std::vector<libdnf5::base::TransactionPackage> & transaction_packages);
/// Fill the transaction groups.
/// @param transaction_groups Groups that are part of the transaction
/// @param installed_names Names of currently installed plus inbound packages
void fill_transaction_groups(
LIBDNF_LOCAL void fill_transaction_groups(
const std::vector<libdnf5::base::TransactionGroup> & transaction_groups,
const std::set<std::string> & installed_names);
/// Fill the transaction environmental groups.
/// @param transaction_groups Environmental groups that are part of the transaction
/// @param installed_names Ids of currently installed plus inbound groups
void fill_transaction_environments(
LIBDNF_LOCAL void fill_transaction_environments(
const std::vector<libdnf5::base::TransactionEnvironment> & transaction_environments,
const std::set<std::string> & installed_group_ids);
@ -263,25 +265,25 @@ private:
/// The group is owned by the transaction.
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.addItem(std::shared_ptr<Item> item, const std::string & repoid, libdnf::TransactionItemAction action, libdnf::TransactionItemReason reason)
CompsGroup & new_comps_group();
LIBDNF_LOCAL CompsGroup & new_comps_group();
/// Create a new comps environment in the transaction and return a reference to it.
/// The environment is owned by the transaction.
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.addItem(std::shared_ptr<Item> item, const std::string & repoid, libdnf::TransactionItemAction action, libdnf::TransactionItemReason reason)
CompsEnvironment & new_comps_environment();
LIBDNF_LOCAL CompsEnvironment & new_comps_environment();
/// Start the transaction by inserting it into the database
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.begin()
void start();
LIBDNF_LOCAL void start();
/// Finish the transaction by updating it's state in the database
///
// @replaces libdnf:transaction/private/Transaction.hpp:method:Transaction.finish(libdnf::TransactionState state)
void finish(TransactionState state);
LIBDNF_LOCAL void finish(TransactionState state);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,6 +24,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "libdnf5/base/base_weak.hpp"
#include "libdnf5/common/weak_ptr.hpp"
#include "libdnf5/defs.h"
namespace libdnf5::transaction {
@ -32,7 +33,7 @@ class TransactionHistory;
using TransactionHistoryWeakPtr = libdnf5::WeakPtr<TransactionHistory, false>;
/// A class for working with transactions recorded in the transaction history database.
class TransactionHistory {
class LIBDNF_API TransactionHistory {
public:
explicit TransactionHistory(const libdnf5::BaseWeakPtr & base);
explicit TransactionHistory(libdnf5::Base & base);
@ -87,9 +88,9 @@ public:
private:
/// Create a new Transaction object.
libdnf5::transaction::Transaction new_transaction();
LIBDNF_LOCAL libdnf5::transaction::Transaction new_transaction();
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -24,6 +24,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "transaction_item_reason.hpp"
#include "transaction_item_state.hpp"
#include "libdnf5/defs.h"
#include <string>
@ -41,7 +43,7 @@ class CompsGroupPackageDbUtils;
class CompsEnvironmentGroupDbUtils;
class TransactionItem {
class LIBDNF_API TransactionItem {
public:
using Action = TransactionItemAction;
using Reason = TransactionItemReason;
@ -85,57 +87,57 @@ private:
friend CompsGroupPackageDbUtils;
friend CompsEnvironmentGroupDbUtils;
explicit TransactionItem(const Transaction & trans);
LIBDNF_LOCAL explicit TransactionItem(const Transaction & trans);
/// Get database id (primary key) of the transaction item (table 'trans_item')
int64_t get_id() const noexcept;
LIBDNF_LOCAL int64_t get_id() const noexcept;
/// Set database id (primary key) of the transaction item (table 'trans_item')
void set_id(int64_t value);
LIBDNF_LOCAL void set_id(int64_t value);
/// Set action associated with the transaction item in the transaction
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.setAction(libdnf::TransactionItemAction value)
void set_action(Action value);
LIBDNF_LOCAL void set_action(Action value);
/// Get name of the action associated with the transaction item in the transaction
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.getActionName()
std::string get_action_name();
LIBDNF_LOCAL std::string get_action_name();
/// Get abbreviated name of the action associated with the transaction item in the transaction
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.getActionShort()
std::string get_action_short();
LIBDNF_LOCAL std::string get_action_short();
/// Set reason of the action associated with the transaction item in the transaction
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.setReason(libdnf::TransactionItemReason value)
void set_reason(Reason value);
LIBDNF_LOCAL void set_reason(Reason value);
/// Set transaction item state
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.setState(libdnf::TransactionItemState value)
void set_state(State value);
LIBDNF_LOCAL void set_state(State value);
/// Get transaction item repoid (text identifier of a repository)
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.setRepoid(const std::string & value)
void set_repoid(const std::string & value);
LIBDNF_LOCAL void set_repoid(const std::string & value);
/// Has the item appeared on the system during the transaction?
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.isForwardAction()
bool is_inbound_action() const;
LIBDNF_LOCAL bool is_inbound_action() const;
/// Has the item got removed from the system during the transaction?
///
// @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.isBackwardAction()
bool is_outbound_action() const;
LIBDNF_LOCAL bool is_outbound_action() const;
// TODO(dmach): Reimplement in Package class; it's most likely not needed in Comps{Group,Environment}
// std::vector< TransactionItemPtr > replacedBy;
const Transaction & get_transaction() const;
LIBDNF_LOCAL const Transaction & get_transaction() const;
// TODO(dmach): Reimplement in Package class
//const std::vector< TransactionItemPtr > &getReplacedBy() const noexcept { return replacedBy; }
@ -146,12 +148,12 @@ private:
//void saveState();
/// Get database id (primary key) of the item (table 'item'; other item tables such 'rpm' inherit from it via 1:1 relation)
int64_t get_item_id() const noexcept;
LIBDNF_LOCAL int64_t get_item_id() const noexcept;
/// Set database id (primary key) of the item (table 'item'; other item tables such 'rpm' inherit from it via 1:1 relation)
void set_item_id(int64_t value);
LIBDNF_LOCAL void set_item_id(int64_t value);
class Impl;
class LIBDNF_LOCAL Impl;
std::unique_ptr<Impl> p_impl;
};

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_TRANSACTION_ITEM_ACTION_HPP
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <string>
@ -47,7 +48,7 @@ enum class TransactionItemAction : int {
};
class InvalidTransactionItemAction : public libdnf5::Error {
class LIBDNF_API InvalidTransactionItemAction : public libdnf5::Error {
public:
InvalidTransactionItemAction(const std::string & action);
@ -56,13 +57,13 @@ public:
};
std::string transaction_item_action_to_string(TransactionItemAction action);
TransactionItemAction transaction_item_action_from_string(const std::string & action);
LIBDNF_API std::string transaction_item_action_to_string(TransactionItemAction action);
LIBDNF_API TransactionItemAction transaction_item_action_from_string(const std::string & action);
std::string transaction_item_action_to_letter(TransactionItemAction action);
LIBDNF_API std::string transaction_item_action_to_letter(TransactionItemAction action);
bool transaction_item_action_is_inbound(TransactionItemAction action);
bool transaction_item_action_is_outbound(TransactionItemAction action);
LIBDNF_API bool transaction_item_action_is_inbound(TransactionItemAction action);
LIBDNF_API bool transaction_item_action_is_outbound(TransactionItemAction action);
} // namespace libdnf5::transaction

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_TRANSACTION_TRANSACTION_ITEM_REASON_HPP
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <string>
@ -38,7 +39,7 @@ enum class TransactionItemReason : int {
};
class InvalidTransactionItemReason : public libdnf5::Error {
class LIBDNF_API InvalidTransactionItemReason : public libdnf5::Error {
public:
InvalidTransactionItemReason(const std::string & reason);
@ -47,8 +48,8 @@ public:
};
std::string transaction_item_reason_to_string(TransactionItemReason reason);
TransactionItemReason transaction_item_reason_from_string(const std::string & reason);
LIBDNF_API std::string transaction_item_reason_to_string(TransactionItemReason reason);
LIBDNF_API TransactionItemReason transaction_item_reason_from_string(const std::string & reason);
/// Compare transaction items and return:
@ -56,13 +57,13 @@ TransactionItemReason transaction_item_reason_from_string(const std::string & re
/// 1 if lhs > rhs
/// 0 if lhs == rhs
/// Higher number means a better (or a stronger) reason.
int transaction_item_reason_compare(TransactionItemReason lhs, TransactionItemReason rhs);
LIBDNF_API int transaction_item_reason_compare(TransactionItemReason lhs, TransactionItemReason rhs);
bool operator<(TransactionItemReason lhs, TransactionItemReason rhs);
bool operator<=(TransactionItemReason lhs, TransactionItemReason rhs);
bool operator>(TransactionItemReason lhs, TransactionItemReason rhs);
bool operator>=(TransactionItemReason lhs, TransactionItemReason rhs);
LIBDNF_API bool operator<(TransactionItemReason lhs, TransactionItemReason rhs);
LIBDNF_API bool operator<=(TransactionItemReason lhs, TransactionItemReason rhs);
LIBDNF_API bool operator>(TransactionItemReason lhs, TransactionItemReason rhs);
LIBDNF_API bool operator>=(TransactionItemReason lhs, TransactionItemReason rhs);
} // namespace libdnf5::transaction

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_TRANSACTION_TRANSACTION_ITEM_STATE_HPP
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <string>
@ -30,7 +31,7 @@ namespace libdnf5::transaction {
enum class TransactionItemState : int { STARTED = 1, OK = 2, ERROR = 3 };
class InvalidTransactionItemState : public libdnf5::Error {
class LIBDNF_API InvalidTransactionItemState : public libdnf5::Error {
public:
InvalidTransactionItemState(const std::string & state);
@ -39,8 +40,8 @@ public:
};
std::string transaction_item_state_to_string(TransactionItemState state);
TransactionItemState transaction_item_state_from_string(const std::string & state);
LIBDNF_API std::string transaction_item_state_to_string(TransactionItemState state);
LIBDNF_API TransactionItemState transaction_item_state_from_string(const std::string & state);
} // namespace libdnf5::transaction

View File

@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#define LIBDNF5_TRANSACTION_ITEM_TYPE_HPP
#include "libdnf5/common/exception.hpp"
#include "libdnf5/defs.h"
#include <string>
@ -30,7 +31,7 @@ namespace libdnf5::transaction {
enum class TransactionItemType : int { PACKAGE, GROUP, ENVIRONMENT, MODULE };
class InvalidTransactionItemType : public libdnf5::Error {
class LIBDNF_API InvalidTransactionItemType : public libdnf5::Error {
public:
InvalidTransactionItemType(const std::string & type);
@ -39,8 +40,8 @@ public:
};
std::string transaction_item_type_to_string(TransactionItemType action);
TransactionItemType transaction_item_type_from_string(const std::string & action);
LIBDNF_API std::string transaction_item_type_to_string(TransactionItemType action);
LIBDNF_API TransactionItemType transaction_item_type_from_string(const std::string & action);
} // namespace libdnf5::transaction

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_UTILS_FS_FILE_HPP
#define LIBDNF5_UTILS_FS_FILE_HPP
#include "libdnf5/defs.h"
#include <cstdio>
#include <filesystem>
@ -30,7 +32,7 @@ namespace libdnf5::utils::fs {
/// fashion. Errors are handled by raising instances of
/// `libdnf5::FileSystemError` so that there's a single exception type
/// being raised for all filesystem-related errors.
class File {
class LIBDNF_API File {
public:
/// Creates an instance of `File` without opening any file.
File();

View File

@ -22,6 +22,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "file.hpp"
#include "libdnf5/defs.h"
#include <filesystem>
#include <optional>
#include <string>
@ -31,7 +33,7 @@ namespace libdnf5::utils::fs {
/// Object that creates and holds a temp directory.
/// The directory gets removed when the object is deleted.
class TempDir {
class LIBDNF_API TempDir {
public:
/// Creates a temporary directory in the system temporary directory path.
explicit TempDir(const std::string & name_prefix);
@ -60,7 +62,7 @@ private:
/// A mkstemp wrapper that creates and owns a temporary file, which will be
/// deleted in the destructor unless released. Throws instances of
/// `libdnf5::FileSystemError` on any I/O failure.
class TempFile {
class LIBDNF_API TempFile {
public:
/// Creates a temporary file in the system temporary directory path.
///

View File

@ -20,13 +20,15 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_UTILS_LOCKER_HPP
#define LIBDNF5_UTILS_LOCKER_HPP
#include "libdnf5/defs.h"
#include <string>
namespace libdnf5::utils {
/// Object for implementing a simple file mutex mechanism
/// or checking read/write access on a given path.
class Locker {
class LIBDNF_API Locker {
public:
/// Create a Locker object at a given path
explicit Locker(const std::string & path);
@ -47,7 +49,7 @@ public:
void unlock();
private:
bool lock(short int type);
LIBDNF_LOCAL bool lock(short int type);
std::string path;
int lock_fd{-1};

View File

@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#ifndef LIBDNF5_VERSION_HPP
#define LIBDNF5_VERSION_HPP
#include "defs.h"
#include <cstdint>
namespace libdnf5 {
@ -48,11 +50,11 @@ static constexpr PluginAPIVersion PLUGIN_API_VERSION{.major = 2, .minor = 0};
/// @return Library version
/// @since 5.0
LibraryVersion get_library_version() noexcept;
LIBDNF_API LibraryVersion get_library_version() noexcept;
/// @return Plugin API version implemented in the library
/// @since 5.0
PluginAPIVersion get_plugin_api_version() noexcept;
LIBDNF_API PluginAPIVersion get_plugin_api_version() noexcept;
} // namespace libdnf5

View File

@ -1,3 +1,6 @@
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
add_subdirectory("actions")
add_subdirectory("python_plugins_loader")
add_subdirectory("rhsm")

Some files were not shown because too many files have changed in this diff Show More