Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[context,API] Functions for accessing configuration options #1109

Conversation

jrohel
Copy link
Contributor

@jrohel jrohel commented Dec 14, 2020

  1. C wrapper for libdnf::OptionBinds::Item class methods getPriority(), getValueString(), newString().
  2. Function dnf_conf_add_setopt for adding setopt.

Added:

gchar *dnf_conf_main_get_option(const gchar *name, enum DnfConfPriority *priority, GError ** error);
gboolean dnf_conf_main_set_option(const gchar *name, enum DnfConfPriority priority, const gchar *value, GError ** error);
gboolean dnf_conf_add_setopt(const gchar * key, enum DnfConfPriority priority, const gchar * value, GError ** error);

@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

⚠️ Please note that our current plans include removal of these comments in the near future (at least 2 weeks after including this disclaimer), if you have serious concerns regarding their removal or would like to continue receiving them please reach out to us. ⚠️

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/rpm-software-management-libdnf-1109
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@@ -107,6 +107,7 @@ typedef enum {
DNF_ERROR_CANNOT_WRITE_CACHE, /* Since: 0.7.0 */
DNF_ERROR_NO_CAPABILITY, /* Since: 0.7.0 */
DNF_ERROR_REMOVAL_OF_PROTECTED_PKG, /* Since: 0.7.0 */
DNF_ERROR_UNKNOWN_OPTION, /* Since: 0.56.0 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring needs to be updated for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added docstring for the new error code.

To be honest, I don't like this enum. Old explicitly assigned numbers look chaotic. And DNF_ERROR_LAST equals 55 (54 before), but DNF_ERROR_UNFINISHED_TRANSACTION equals 66. It look messy.
And we must be careful that the newly added error codes do not conflict with the existing explicitly defined ones.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you on this, and this is something we should fix for libdnf v5.

@jrohel jrohel force-pushed the feature/context_api_access_main_conf branch from c56f382 to 4d2262e Compare December 27, 2020 09:44
In fact, it is a C wrapper for libdnf::OptionBinds::Item class methods
getPriority(), getValueString(), newString().

Added:
gchar *dnf_conf_main_get_option(const gchar *name,
    enum DnfConfPriority *priority, GError ** error);

gboolean dnf_conf_main_set_option(const gchar *name,
    enum DnfConfPriority priority, const gchar *value, GError ** error);
Sets the option value and priority. Supports also repositories options.
Repository(ies) can be specified with globs.

Added:
gboolean dnf_conf_add_setopt(const gchar * key,
    enum DnfConfPriority priority, const gchar * value, GError ** error);

key is option_name or repository_id.option_name
@jrohel jrohel force-pushed the feature/context_api_access_main_conf branch from 4d2262e to 3120686 Compare January 2, 2021 18:57
@jrohel jrohel changed the title [context,API] Functions for accessing main/global configuration options [context,API] Functions for accessing configuration options Jan 2, 2021
@Conan-Kudo
Copy link
Member

@rh-atomic-bot r+

@rh-atomic-bot
Copy link

📌 Commit 3120686 has been approved by Conan-Kudo

@rh-atomic-bot
Copy link

⌛ Testing commit 3120686 with merge 45981d5...

rh-atomic-bot pushed a commit that referenced this pull request Jan 7, 2021
Sets the option value and priority. Supports also repositories options.
Repository(ies) can be specified with globs.

Added:
gboolean dnf_conf_add_setopt(const gchar * key,
    enum DnfConfPriority priority, const gchar * value, GError ** error);

key is option_name or repository_id.option_name

Closes: #1109
Approved by: Conan-Kudo
rh-atomic-bot pushed a commit that referenced this pull request Jan 7, 2021
Closes: #1109
Approved by: Conan-Kudo
@rh-atomic-bot
Copy link

☀️ Test successful - status-papr
Approved by: Conan-Kudo
Pushing 45981d5 to dnf-4-master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants