pkgdb: switch to zplists by default.

This commit is contained in:
Juan RP 2014-10-17 10:11:56 +02:00
parent 47310d3408
commit 83f5e35ec7
3 changed files with 9 additions and 10 deletions

2
NEWS
View File

@ -1,5 +1,7 @@
xbps-0.42 (???):
* pkgdb: switch to zplists by default.
* Fixed issue #62 (Dup replaced pkgs in transaction); see
https://github.com/voidlinux/xbps/issues/62

View File

@ -82,7 +82,7 @@ xbps_pkgdb_lock(struct xbps_handle *xhp)
}
/* if pkgdb is unexistent, create it with an empty dictionary */
xhp->pkgdb = xbps_dictionary_create();
if (!xbps_dictionary_externalize_to_file(xhp->pkgdb, xhp->pkgdb_plist)) {
if (!xbps_dictionary_externalize_to_zfile(xhp->pkgdb, xhp->pkgdb_plist)) {
rv = errno;
xbps_dbg_printf(xhp, "[pkgdb] failed to create pkgdb "
"%s: %s\n", xhp->pkgdb_plist, strerror(rv));
@ -155,11 +155,11 @@ xbps_pkgdb_update(struct xbps_handle *xhp, bool flush)
return cached_rv;
if (xhp->pkgdb && flush) {
pkgdb_storage = xbps_dictionary_internalize_from_file(xhp->pkgdb_plist);
pkgdb_storage = xbps_dictionary_internalize_from_zfile(xhp->pkgdb_plist);
if (pkgdb_storage == NULL ||
!xbps_dictionary_equals(xhp->pkgdb, pkgdb_storage)) {
/* flush dictionary to storage */
if (!xbps_dictionary_externalize_to_file(xhp->pkgdb, xhp->pkgdb_plist))
if (!xbps_dictionary_externalize_to_zfile(xhp->pkgdb, xhp->pkgdb_plist))
return errno;
}
if (pkgdb_storage)
@ -170,7 +170,7 @@ xbps_pkgdb_update(struct xbps_handle *xhp, bool flush)
cached_rv = 0;
}
/* update copy in memory */
if ((xhp->pkgdb = xbps_dictionary_internalize_from_file(xhp->pkgdb_plist)) == NULL) {
if ((xhp->pkgdb = xbps_dictionary_internalize_from_zfile(xhp->pkgdb_plist)) == NULL) {
if (errno == ENOENT)
xhp->pkgdb = xbps_dictionary_create();
else
@ -190,9 +190,6 @@ xbps_pkgdb_release(struct xbps_handle *xhp)
if (xhp->pkgdb == NULL)
return;
/* write pkgdb to storage in case it was modified */
(void)xbps_pkgdb_update(xhp, true);
xbps_object_release(xhp->pkgdb);
xhp->pkgdb = NULL;
xbps_dbg_printf(xhp, "[pkgdb] released ok.\n");
@ -348,7 +345,7 @@ xbps_pkgdb_get_pkg_files(struct xbps_handle *xhp, const char *pkg)
plist = xbps_xasprintf("%s/.%s-files.plist", xhp->metadir, pkgname);
free(pkgname);
pkgfilesd = xbps_dictionary_internalize_from_file(plist);
pkgfilesd = xbps_dictionary_internalize_from_zfile(plist);
free(plist);
if (pkgfilesd == NULL) {

View File

@ -50,7 +50,7 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
* - <metadir>/pkgdb-0.38.plist
* - <metadir>/.<pkgname>-files.plist
*/
opkgdb = xbps_dictionary_internalize_from_file(opkgdb_plist);
opkgdb = xbps_dictionary_internalize_from_zfile(opkgdb_plist);
if (opkgdb == NULL)
return EINVAL;
@ -93,7 +93,7 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
* Copy pkg metadata objs to the new pkgdb.
*/
pkgmeta = xbps_xasprintf("%s/.%s.plist", xhp->metadir, pkgname);
pkgmetad = xbps_dictionary_internalize_from_file(pkgmeta);
pkgmetad = xbps_dictionary_internalize_from_zfile(pkgmeta);
if (pkgmetad == NULL) {
rv = EINVAL;
xbps_dbg_printf(xhp, "%s: cannot open %s: %s\n",