Skip to content

Commit

Permalink
countme: Force disable Count Me logic in DNF
Browse files Browse the repository at this point in the history
Make sure that we do not use the internal Count Me logic in DNF in
rpm-ostree as we have our own external implementation that is aware of
the different behavior regarding repo handling.

See also the discussions in:
  - rpm-software-management/libdnf#1174
  - rpm-software-management/libdnf#1068
  - coreos#2671
  • Loading branch information
travier committed Apr 13, 2021
1 parent 2944034 commit 2826a80
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/rpmostree-compose-builtin-rojig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ install_packages (RpmOstreeRojigCompose *self,
{ int tf_dfd = self->treefile_rs->get_workdir();
g_autofree char *abs_tf_path = glnx_fdrel_abspath (tf_dfd, ".");
dnf_context_set_repo_dir (dnfctx, abs_tf_path);
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);
}

/* For compose, always try to refresh metadata; we're used in build servers
Expand Down Expand Up @@ -353,6 +355,8 @@ impl_rojig_build (RpmOstreeRojigCompose *self,

g_autofree char *reposdir_abspath = glnx_fdrel_abspath (self->workdir_dfd, "rojig-repos");
dnf_context_set_repo_dir (dnfctx, reposdir_abspath);
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);
if (!rpmostree_context_setup (corectx, NULL, NULL, treespec, cancellable, error))
return FALSE;
if (!rpmostree_context_prepare_rojig (corectx, TRUE, cancellable, error))
Expand Down
4 changes: 4 additions & 0 deletions src/app/rpmostree-compose-builtin-tree.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ install_packages (RpmOstreeTreeComposeContext *self,
{ int tf_dfd = (*self->treefile_rs)->get_workdir();
g_autofree char *abs_tf_path = glnx_fdrel_abspath (tf_dfd, ".");
dnf_context_set_repo_dir (dnfctx, abs_tf_path);
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);
}

/* By default, retain packages in addition to metadata with --cachedir, unless
Expand Down Expand Up @@ -1529,6 +1531,8 @@ rpmostree_compose_builtin_extensions (int argc,
{ int tf_dfd = treefile->get_workdir();
g_autofree char *abs_tf_path = glnx_fdrel_abspath (tf_dfd, ".");
dnf_context_set_repo_dir (rpmostree_context_get_dnf (ctx), abs_tf_path);
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);
}

#define TMP_EXTENSIONS_ROOTFS "rpmostree-extensions.tmp"
Expand Down
5 changes: 4 additions & 1 deletion src/app/rpmostree-ex-builtin-rojig2commit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ rpm_ostree_rojig2commit_context_new (RpmOstreeRojig2CommitContext **out_context,

DnfContext *dnfctx = rpmostree_context_get_dnf (self->ctx);

if (opt_rpmmd_reposdir)
if (opt_rpmmd_reposdir) {
dnf_context_set_repo_dir (dnfctx, opt_rpmmd_reposdir);
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);
}

*out_context = util::move_nullify (self);
return TRUE;
Expand Down
6 changes: 6 additions & 0 deletions src/libpriv/rpmostree-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ rpmostree_context_new_system (OstreeRepo *repo,
dnf_context_set_http_proxy (self->dnfctx, g_getenv ("http_proxy"));

dnf_context_set_repo_dir (self->dnfctx, "/etc/yum.repos.d");
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);
dnf_context_set_cache_dir (self->dnfctx, RPMOSTREE_CORE_CACHEDIR RPMOSTREE_DIR_CACHE_REPOMD);
dnf_context_set_solv_dir (self->dnfctx, RPMOSTREE_CORE_CACHEDIR RPMOSTREE_DIR_CACHE_SOLV);
dnf_context_set_lock_dir (self->dnfctx, "/run/rpm-ostree/" RPMOSTREE_DIR_LOCK);
Expand Down Expand Up @@ -452,6 +454,8 @@ rpmostree_context_new_tree (int userroot_dfd,

{ g_autofree char *reposdir = glnx_fdrel_abspath (userroot_dfd, "rpmmd.repos.d");
dnf_context_set_repo_dir (ret->dnfctx, reposdir);
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);
}
{ const char *cache_rpmmd = glnx_strjoina ("cache/", RPMOSTREE_DIR_CACHE_REPOMD);
g_autofree char *cachedir = glnx_fdrel_abspath (userroot_dfd, cache_rpmmd);
Expand Down Expand Up @@ -516,6 +520,8 @@ rpmostree_context_configure_from_deployment (RpmOstreeContext *self,

/* point libhif to the yum.repos.d and os-release of the merge deployment */
dnf_context_set_repo_dir (self->dnfctx, reposdir);
/* Force disable the count me logic */
dnf_conf_add_setopt("*.countme", DNF_CONF_COMMANDLINE, "false", NULL);

/* point the core to the passwd & group of the merge deployment */
g_assert (!self->passwd_dir);
Expand Down

0 comments on commit 2826a80

Please sign in to comment.