API clean up (part 2), plus misc changes and improvements.

- Rename regpkgs_dictionary to regpkgdb_dictionary to better describe what is is.
- Change some funcs in plist.c to return a boolean rather than int.
- Hide more internal funcs off the API.
- Simplify xbps_repository_update_pkg() and remove its second arg.
- Hide implementation details in xbps_repository_pool, now to iterate over the
  pool you have to use xbps_repository_pool_foreach and its struct
  repository_pool_index.
- Introduce xbps_{init,end}, to initialize/destroy some stuff in the library.
- Introduce xbps_dbg_printf to printf stuff for debugging purposes.
- xbps-{bin,repo}:  added -d arg to enable debugging output.
- Before checking if a config file needs to be installed or such, check that
  package contains the "conf_files" array.
- Remove obsolete dirs as well while updating packages.
- If transaction dictionary is ready remove the "missing_deps" array.

Bump XBPS_RELVER to 20101118.

--HG--
rename : lib/regpkgs_dictionary.c => lib/regpkgdb_dictionary.c
This commit is contained in:
Juan RP
2010-11-19 13:40:13 +01:00
parent ffc255b715
commit fdec663855
33 changed files with 1426 additions and 943 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2009 Juan Romero Pardines.
* Copyright (c) 2009-2010 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -54,7 +54,7 @@ add_pkg_into_reqby(prop_dictionary_t pkgd, const char *reqname)
if (reqstr == NULL) {
if (alloc)
prop_object_release(array);
return errno;
return ENOMEM;
}
if (!xbps_add_obj_to_array(array, reqstr)) {
@ -132,20 +132,27 @@ xbps_requiredby_pkg_remove(const char *pkgname)
plist = xbps_xasprintf("%s/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, XBPS_REGPKGDB);
if (plist == NULL)
return EINVAL;
return ENOMEM;
if ((dict = prop_dictionary_internalize_from_zfile(plist)) == NULL) {
free(plist);
xbps_dbg_printf("[reqby-rm] cannot internalize "
"regpkgdb plist for '%s': %s\n", pkgname, strerror(errno));
return errno;
}
rv = xbps_callback_array_iter_in_dict(dict, "packages",
remove_pkg_from_reqby, __UNCONST(pkgname));
if (rv == 0) {
if (!prop_dictionary_externalize_to_zfile(dict, plist))
rv = errno;
if (rv != 0)
goto out;
if (!prop_dictionary_externalize_to_zfile(dict, plist)) {
xbps_dbg_printf("[reqby-rm] cannot externalize plist for "
"'%s': %s\n", pkgname, strerror(errno));
rv = errno;
}
out:
prop_object_release(dict);
free(plist);
@ -174,7 +181,7 @@ xbps_requiredby_pkg_add(prop_array_t regar, prop_dictionary_t pkg)
while ((obj = prop_object_iterator_next(iter)) != NULL) {
str = prop_string_cstring_nocopy(obj);
if (str == NULL) {
rv = errno;
rv = EINVAL;
goto out;
}
rdepname = xbps_get_pkgpattern_name(str);
@ -182,10 +189,11 @@ xbps_requiredby_pkg_add(prop_array_t regar, prop_dictionary_t pkg)
rv = EINVAL;
goto out;
}
iter2 = prop_array_iterator(regar);
if (iter2 == NULL) {
free(rdepname);
rv = ENOMEM;
free(rdepname);
goto out;
}