Skip to content

Commit

Permalink
core: handle enabled_metadata repos
Browse files Browse the repository at this point in the history
In #728, we started querying enabled repos using get_n_solvables().
However, there are different kinds of enabled repos, and
`dnf_repo_get_enabled()` reflects that through the bitmask it returns:
  - DNF_REPO_ENABLED_NONE: repo disabled
  - DNF_REPO_ENABLED_PACKAGES: repo enabled for package installs
  - DNF_REPO_ENABLED_METADATA: repo enabled for metadata

We were treating it as a boolean, though really, we should only print
data about repos with ENABLED_PACKAGES on, which are the actual repos
libdnf can fetch packages from. Repos with only ENABLED_METADATA on are
not fetched by default, and thus will cause SIGSEGV when trying to
get_n_solvables().

I ran into this while trying to debug #720 on F25 AH, which has this
repo by default:

  [fedora-cisco-openh264]
  name=Fedora $releasever openh264 (From Cisco) - $basearch
  baseurl=https://codecs.fedoraproject.org/openh264/$releasever/$basearch/
  enabled=0
  enabled_metadata=1

Closes: #736
Approved by: cgwalters
  • Loading branch information
jlebon authored and rh-atomic-bot committed Apr 13, 2017
1 parent 530ab23 commit f13db89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/rpmostree-compose-builtin-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ install_packages_in_root (RpmOstreeTreeComposeContext *self,
for (guint i = 0; i < repos->len; i++)
{
DnfRepo *repo = repos->pdata[i];
if (dnf_repo_get_enabled (repo))
if (dnf_repo_get_enabled (repo) & DNF_REPO_ENABLED_PACKAGES)
{
g_autoptr(GDateTime) ts = g_date_time_new_from_unix_utc (dnf_repo_get_timestamp_generated (repo));
g_autofree char *formatted = g_date_time_format (ts, "%Y-%m-%d %T");
Expand Down
2 changes: 1 addition & 1 deletion src/libpriv/rpmostree-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ rpmostree_context_prepare_install (RpmOstreeContext *self,
for (guint i = 0; i < repos->len; i++)
{
DnfRepo *repo = repos->pdata[i];
if (!dnf_repo_get_enabled (repo))
if ((dnf_repo_get_enabled (repo) & DNF_REPO_ENABLED_PACKAGES) == 0)
continue;
if (first)
first = FALSE;
Expand Down

0 comments on commit f13db89

Please sign in to comment.