Adapt to const hif_package_get_nevra()

See https://github.com/rpm-software-management/libhif/pull/158

Closes: #366
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-06-30 18:14:09 -04:00 committed by Atomic Bot
parent f9ff54f4ab
commit 1aa6e1d300
3 changed files with 7 additions and 11 deletions

2
libhif

@ -1 +1 @@
Subproject commit 085abba96cc9370f0f95e1d1c3b067b3b4105cc0 Subproject commit c84818ac9ddf365e5825018a45e13b47ae5aeddf

View File

@ -42,7 +42,6 @@ struct RpmOstreePackage
GObject parent_instance; GObject parent_instance;
RpmOstreeRefSack *sack; RpmOstreeRefSack *sack;
HifPackage *hypkg; HifPackage *hypkg;
char *cached_nevra;
}; };
G_DEFINE_TYPE(RpmOstreePackage, rpm_ostree_package, G_TYPE_OBJECT) G_DEFINE_TYPE(RpmOstreePackage, rpm_ostree_package, G_TYPE_OBJECT)
@ -51,7 +50,6 @@ static void
rpm_ostree_package_finalize (GObject *object) rpm_ostree_package_finalize (GObject *object)
{ {
RpmOstreePackage *pkg = (RpmOstreePackage*)object; RpmOstreePackage *pkg = (RpmOstreePackage*)object;
free (pkg->cached_nevra);
g_object_unref (pkg->hypkg); g_object_unref (pkg->hypkg);
/* We do internal refcounting of the sack because hawkey doesn't */ /* We do internal refcounting of the sack because hawkey doesn't */
@ -84,9 +82,7 @@ rpm_ostree_package_init (RpmOstreePackage *p)
const char * const char *
rpm_ostree_package_get_nevra (RpmOstreePackage *p) rpm_ostree_package_get_nevra (RpmOstreePackage *p)
{ {
if (p->cached_nevra == NULL) return hif_package_get_nevra (p->hypkg);
p->cached_nevra = hif_package_get_nevra (p->hypkg);
return p->cached_nevra;
} }
/** /**

View File

@ -1188,7 +1188,7 @@ import_one_package (RpmOstreeContext *self,
if (!rpmostree_unpacker_unpack_to_ostree (unpacker, ostreerepo, sepolicy, if (!rpmostree_unpacker_unpack_to_ostree (unpacker, ostreerepo, sepolicy,
&ostree_commit, cancellable, error)) &ostree_commit, cancellable, error))
{ {
g_autofree char *nevra = hif_package_get_nevra (pkg); const char *nevra = hif_package_get_nevra (pkg);
g_prefix_error (error, "Unpacking %s: ", nevra); g_prefix_error (error, "Unpacking %s: ", nevra);
goto out; goto out;
} }
@ -1290,7 +1290,7 @@ ostree_checkout_package (OstreeRepo *repo,
out: out:
if (error && *error) if (error && *error)
{ {
g_autofree char *nevra = hif_package_get_nevra (pkg); const char *nevra = hif_package_get_nevra (pkg);
g_prefix_error (error, "Unpacking %s: ", nevra); g_prefix_error (error, "Unpacking %s: ", nevra);
} }
return ret; return ret;
@ -1732,7 +1732,7 @@ ts_callback (const void * h,
case RPMCALLBACK_INST_OPEN_FILE: case RPMCALLBACK_INST_OPEN_FILE:
{ {
HifPackage *pkg = (void*)key; HifPackage *pkg = (void*)key;
g_autofree char *nevra = hif_package_get_nevra (pkg); const char *nevra = hif_package_get_nevra (pkg);
g_autofree char *path = glnx_fdrel_abspath (tdata->tmp_metadata_dfd, nevra); g_autofree char *path = glnx_fdrel_abspath (tdata->tmp_metadata_dfd, nevra);
g_assert (tdata->current_trans_fd == NULL); g_assert (tdata->current_trans_fd == NULL);
tdata->current_trans_fd = Fopen (path, "r.ufdio"); tdata->current_trans_fd = Fopen (path, "r.ufdio");
@ -1758,7 +1758,7 @@ get_header_for_package (int tmp_metadata_dfd,
{ {
Header hdr = NULL; Header hdr = NULL;
glnx_fd_close int metadata_fd = -1; glnx_fd_close int metadata_fd = -1;
g_autofree char *nevra = hif_package_get_nevra (pkg); const char *nevra = hif_package_get_nevra (pkg);
if ((metadata_fd = openat (tmp_metadata_dfd, nevra, O_RDONLY | O_CLOEXEC)) < 0) if ((metadata_fd = openat (tmp_metadata_dfd, nevra, O_RDONLY | O_CLOEXEC)) < 0)
{ {
@ -1915,7 +1915,7 @@ rpmostree_context_assemble_commit (RpmOstreeContext *self,
g_autofree char *cached_rev = NULL; g_autofree char *cached_rev = NULL;
g_autoptr(GVariant) pkg_commit = NULL; g_autoptr(GVariant) pkg_commit = NULL;
g_autoptr(GVariant) header_variant = NULL; g_autoptr(GVariant) header_variant = NULL;
g_autofree char *nevra = hif_package_get_nevra (pkg); const char *nevra = hif_package_get_nevra (pkg);
{ {
g_autofree char *branch_head_rev = NULL; g_autofree char *branch_head_rev = NULL;