Skip to content

Commit 9369c6a

Browse files
committed
pkglist: Canonicalize "no packages" to "no database found"
It can happen that we successfully query zero packages. For example, when rpm-ostree on RHEL8 (assuming bdb database) is trying to parse an ostree commit generated from fedora (sqlite rpmdb), librpm will just give us nothing. Eventually perhaps we may need to fall back to actually running the target commit as a container just to get this data for cases like that. Specifically, I hit this doing `rpm-ostree rebase --experimental ostree-unverified-image:registry:quay.io/cgwalters/fcos-derivation-example` on RHCOS8.
1 parent 752f914 commit 9369c6a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/app/rpmostree-builtin-shlib-backend.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ impl_packagelist_from_commit (OstreeRepo *repo, const char *commit, GError **err
7676
}
7777

7878
g_autoptr(GVariant) pkgs = rpmostree_variant_pkgs_from_sack (rsack);
79+
// It can happen that we successfully query zero packages. For example,
80+
// when rpm-ostree on RHEL8 (assuming bdb database) is trying to parse an
81+
// ostree commit generated from fedora (sqlite rpmdb), librpm will just give us
82+
// nothing. Eventually perhaps we may need to fall back to actually running
83+
// the target commit as a container just to get this data for cases like that.
84+
if (g_variant_n_children (pkgs) == 0)
85+
return g_variant_new_maybe ((GVariantType*) RPMOSTREE_SHLIB_IPC_PKGLIST, NULL);
7986
return g_variant_ref_sink (g_variant_new_maybe ((GVariantType*) RPMOSTREE_SHLIB_IPC_PKGLIST, pkgs));
8087
}
8188

0 commit comments

Comments
 (0)