lib/package_conflicts.c: adapt to pkgdb 0.21 format.

This commit is contained in:
Juan RP 2013-03-06 12:55:00 +01:00
parent 5f71d1e40d
commit 5409e51822

View File

@ -1,5 +1,5 @@
/*- /*-
* Copyright (c) 2012 Juan Romero Pardines. * Copyright (c) 2012-2013 Juan Romero Pardines.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -40,8 +40,8 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp,
prop_dictionary_t pkgd; prop_dictionary_t pkgd;
prop_object_t obj; prop_object_t obj;
prop_object_iterator_t iter; prop_object_iterator_t iter;
const char *cfpkg, *repopkgver, *pkgver, *pkgname, *repopkgname; const char *cfpkg, *repopkgver, *pkgver;
char *buf; char *pkgname, *repopkgname, *buf;
pkg_cflicts = prop_dictionary_get(pkg_repod, "conflicts"); pkg_cflicts = prop_dictionary_get(pkg_repod, "conflicts");
if (pkg_cflicts == NULL || prop_array_count(pkg_cflicts) == 0) if (pkg_cflicts == NULL || prop_array_count(pkg_cflicts) == 0)
@ -49,7 +49,8 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp,
trans_cflicts = prop_dictionary_get(xhp->transd, "conflicts"); trans_cflicts = prop_dictionary_get(xhp->transd, "conflicts");
prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgver", &repopkgver); prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgver", &repopkgver);
prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgname", &repopkgname); repopkgname = xbps_pkg_name(repopkgver);
assert(repopkgname);
iter = prop_array_iterator(pkg_cflicts); iter = prop_array_iterator(pkg_cflicts);
assert(iter); assert(iter);
@ -62,13 +63,15 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp,
*/ */
if ((pkgd = xbps_pkgdb_get_pkg(xhp, cfpkg)) || if ((pkgd = xbps_pkgdb_get_pkg(xhp, cfpkg)) ||
(pkgd = xbps_pkgdb_get_virtualpkg(xhp, cfpkg))) { (pkgd = xbps_pkgdb_get_virtualpkg(xhp, cfpkg))) {
prop_dictionary_get_cstring_nocopy(pkgd,
"pkgname", &pkgname);
if (strcmp(pkgname, repopkgname) == 0)
continue;
prop_dictionary_get_cstring_nocopy(pkgd, prop_dictionary_get_cstring_nocopy(pkgd,
"pkgver", &pkgver); "pkgver", &pkgver);
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
if (strcmp(pkgname, repopkgname) == 0) {
free(pkgname);
continue;
}
free(pkgname);
xbps_dbg_printf(xhp, "found conflicting installed " xbps_dbg_printf(xhp, "found conflicting installed "
"pkg %s with pkg in transaction %s\n", pkgver, "pkg %s with pkg in transaction %s\n", pkgver,
repopkgver); repopkgver);
@ -83,13 +86,15 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp,
*/ */
if ((pkgd = xbps_find_pkg_in_array(unsorted, cfpkg)) || if ((pkgd = xbps_find_pkg_in_array(unsorted, cfpkg)) ||
(pkgd = xbps_find_virtualpkg_in_array(xhp, unsorted, cfpkg))) { (pkgd = xbps_find_virtualpkg_in_array(xhp, unsorted, cfpkg))) {
prop_dictionary_get_cstring_nocopy(pkgd,
"pkgname", &pkgname);
if (strcmp(pkgname, repopkgname) == 0)
continue;
prop_dictionary_get_cstring_nocopy(pkgd, prop_dictionary_get_cstring_nocopy(pkgd,
"pkgver", &pkgver); "pkgver", &pkgver);
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
if (strcmp(pkgname, repopkgname) == 0) {
free(pkgname);
continue;
}
free(pkgname);
xbps_dbg_printf(xhp, "found conflicting pkgs in " xbps_dbg_printf(xhp, "found conflicting pkgs in "
"transaction %s <-> %s\n", pkgver, repopkgver); "transaction %s <-> %s\n", pkgver, repopkgver);
buf = xbps_xasprintf("%s conflicts with " buf = xbps_xasprintf("%s conflicts with "
@ -100,4 +105,5 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp,
} }
} }
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
free(repopkgname);
} }