core: don't use rpmfiles if missing

Starting from v4.12, rpmteFI has been deprecated in favour of
rpmteFiles. Make use of it if we can, otherwise fall back to the older
API.

Closes: #824
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2017-06-08 15:10:15 -04:00 committed by Atomic Bot
parent 1977e3cfba
commit cba24435b0
3 changed files with 13 additions and 1 deletions

View File

@ -77,6 +77,12 @@ AC_SEARCH_LIBS([rpmsqSetInterruptSafety], [rpmio],
AC_DEFINE([BUILDOPT_HAVE_RPMSQ_SET_INTERRUPT_SAFETY], 0, [Set to 1 if we have interrupt safety API])
)
# rpmfiles was made public in rpm >= 4.12, el7 is still on 4.11
AC_SEARCH_LIBS([rpmfilesNew], [rpm],
AC_DEFINE([BUILDOPT_HAVE_RPMFILES], 1, [Set to 1 if we have rpmfiles API]),
AC_DEFINE([BUILDOPT_HAVE_RPMFILES], 0, [Set to 1 if we have rpmfiles API])
)
# Remember to update AM_CPPFLAGS in Makefile.am when bumping GIO req.
PKG_CHECK_MODULES(PKGDEP_GIO_UNIX, [gio-unix-2.0])
PKG_CHECK_MODULES(PKGDEP_RPMOSTREE, [gio-unix-2.0 >= 2.40.0 json-glib-1.0

View File

@ -1770,8 +1770,12 @@ delete_package_from_root (RpmOstreeContext *self,
GCancellable *cancellable,
GError **error)
{
#if BUILDOPT_HAVE_RPMFILES /* use rpmfiles API if possible, rpmteFI is deprecated */
g_auto(rpmfiles) files = rpmteFiles (pkg);
g_auto(rpmfi) fi = rpmfilesIter (files, RPMFI_ITER_FWD);
#else
rpmfi fi = rpmteFI (pkg); /* rpmfi owned by rpmte */
#endif
g_autoptr(GPtrArray) deleted_dirs = g_ptr_array_new_with_free_func (g_free);

View File

@ -68,9 +68,11 @@ rpmhdrs_diff_prnt_block (gboolean changelogs, struct RpmHeadersDiff *diff);
* itself. TODO: Move them to libdnf */
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(Header, headerFree, NULL)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(rpmfi, rpmfiFree, NULL)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(rpmfiles, rpmfilesFree, NULL)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(rpmts, rpmtsFree, NULL)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(rpmdbMatchIterator, rpmdbFreeIterator, NULL)
#if BUILDOPT_HAVE_RPMFILES
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(rpmfiles, rpmfilesFree, NULL)
#endif
void
rpmhdrs_diff_prnt_diff (struct RpmHeadersDiff *diff);