xbps_register_pkg: fix by adding pkgd into regpkgdb array.

This commit is contained in:
Juan RP 2011-12-28 09:21:01 +01:00
parent c0f81bd482
commit caaba09295
2 changed files with 6 additions and 2 deletions

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.3" #define XBPS_PKGINDEX_VERSION "1.3"
#define XBPS_API_VERSION "20111228" #define XBPS_API_VERSION "20111228-1"
#define XBPS_VERSION "0.12" #define XBPS_VERSION "0.12"
/** /**

View File

@ -43,6 +43,7 @@ int
xbps_register_pkg(prop_dictionary_t pkgrd, bool flush) xbps_register_pkg(prop_dictionary_t pkgrd, bool flush)
{ {
struct xbps_handle *xhp; struct xbps_handle *xhp;
prop_array_t array;
prop_dictionary_t pkgd = NULL; prop_dictionary_t pkgd = NULL;
prop_array_t provides, reqby; prop_array_t provides, reqby;
const char *pkgname, *version, *desc, *pkgver; const char *pkgname, *version, *desc, *pkgver;
@ -67,7 +68,6 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool flush)
assert(version != NULL); assert(version != NULL);
assert(desc != NULL); assert(desc != NULL);
assert(pkgver != NULL); assert(pkgver != NULL);
assert(xhp->regpkgdb != NULL);
pkgd = xbps_regpkgdb_get_pkgd(pkgname, false); pkgd = xbps_regpkgdb_get_pkgd(pkgname, false);
if (pkgd == NULL) { if (pkgd == NULL) {
@ -125,6 +125,10 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool flush)
goto out; goto out;
} }
} }
array = prop_dictionary_get(xhp->regpkgdb, "packages");
rv = xbps_array_replace_dict_by_name(array, pkgd, pkgname);
if (rv != 0)
goto out;
if (flush) if (flush)
rv = xbps_regpkgdb_update(xhp, true); rv = xbps_regpkgdb_update(xhp, true);