From b8c804e891dae27dd7d5ded293a1f2e1d59102e2 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 31 Oct 2011 09:48:46 +0100 Subject: [PATCH] Check for obj validity with prop_object_type(), use xbps_pkg_has_rundeps(). --- lib/repository_finddeps.c | 2 +- lib/repository_findpkg.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/repository_finddeps.c b/lib/repository_finddeps.c index 202d10d7..1fb88b05 100644 --- a/lib/repository_finddeps.c +++ b/lib/repository_finddeps.c @@ -457,7 +457,7 @@ xbps_repository_find_pkg_deps(prop_dictionary_t transd, assert(prop_object_type(repo_pkgd) == PROP_TYPE_DICTIONARY); pkg_rdeps = prop_dictionary_get(repo_pkgd, "run_depends"); - if (pkg_rdeps == NULL) + if (prop_object_type(pkg_rdeps) != PROP_TYPE_ARRAY) return 0; prop_dictionary_get_cstring_nocopy(repo_pkgd, "pkgver", &pkgver); diff --git a/lib/repository_findpkg.c b/lib/repository_findpkg.c index e70ad1af..c01bb026 100644 --- a/lib/repository_findpkg.c +++ b/lib/repository_findpkg.c @@ -82,7 +82,6 @@ repository_find_pkg(const char *pattern, const char *reason) } xbps_dbg_printf("%s: pattern %s reason %s\n", __func__, pattern, reason); - /* * Find out if the pkg has been found in repository pool. */ @@ -117,10 +116,11 @@ repository_find_pkg(const char *pattern, const char *reason) * Prepare required package dependencies and add them into the * "unsorted" array in transaction dictionary. */ - rv = xbps_repository_find_pkg_deps(transd, mdeps, pkg_repod); - if (rv != 0) - goto out; - + if (xbps_pkg_has_rundeps(pkg_repod)) { + rv = xbps_repository_find_pkg_deps(transd, mdeps, pkg_repod); + if (rv != 0) + goto out; + } /* * Set package state in dictionary with same state than the * package currently uses, otherwise not-installed. @@ -169,7 +169,7 @@ repository_find_pkg(const char *pattern, const char *reason) pkgver, repoloc); out: - if (pkg_repod) + if (prop_object_type(pkg_repod) == PROP_TYPE_DICTIONARY) prop_object_release(pkg_repod); return rv;