Major changes in libxbps to implement caching in some cases.
libxbps:
- Moved repolist code to lib/repository_pool.c.
- Renamed xbps_{prepare,release}_repolist_data() to
xbps_repository_pool_{init,release} respectively.
- Moved regpkgdb dict code to lib/regpkgs_dictionary.c.
- Renamed xbps_{prepare,release}_regpkgdb_dict() to
xbps_regpkgs_dictionary_{init,release} respectively.
- Use a global reference count for repository_pool and regpkgs_dictionary,
this gives a substantial performance gain while looking for dependencies
in repository pool, among other things.
- Make xbps_find_pkg_* functions return errno and use it to detect
for spurious errors in code using them.
- Add code to detect when a dependency is already unpacked.
xbps-bin:
- Do not set pkg state to unpacked in the transaction, it's set already
while a package is unpacked.
- While installing or updating packages, it now knows when a dependency
is already unpacked and shows it as "unconfigured".
Bump XBPS_RELVER to 20091126.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126022250-uu8x0fa86l4scb5x
This commit is contained in:
@@ -50,29 +50,33 @@ xbps_check_pkg_integrity_all(void)
|
||||
{
|
||||
prop_dictionary_t d;
|
||||
prop_object_t obj;
|
||||
prop_object_iterator_t iter;
|
||||
prop_object_iterator_t iter = NULL;
|
||||
const char *pkgname, *version;
|
||||
int rv = 0;
|
||||
size_t npkgs = 0, nbrokenpkgs = 0;
|
||||
|
||||
d = xbps_prepare_regpkgdb_dict();
|
||||
d = xbps_regpkgs_dictionary_init();
|
||||
if (d == NULL)
|
||||
return ENODEV;
|
||||
|
||||
iter = xbps_get_array_iter_from_dict(d, "packages");
|
||||
if (iter == NULL)
|
||||
return ENOENT;
|
||||
if (iter == NULL) {
|
||||
rv = ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
||||
if (!prop_dictionary_get_cstring_nocopy(obj,
|
||||
"pkgname", &pkgname)) {
|
||||
prop_object_iterator_release(iter);
|
||||
return errno;
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
if (!prop_dictionary_get_cstring_nocopy(obj,
|
||||
"version", &version)) {
|
||||
prop_object_iterator_release(iter);
|
||||
return errno;
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
printf("Checking %s-%s ...\n", pkgname, version);
|
||||
if ((rv = xbps_check_pkg_integrity(pkgname)) != 0)
|
||||
@@ -80,11 +84,15 @@ xbps_check_pkg_integrity_all(void)
|
||||
npkgs++;
|
||||
printf("\033[1A\033[K");
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
|
||||
printf("%zu package%s processed: %zu broken.\n", npkgs,
|
||||
npkgs == 1 ? "" : "s", nbrokenpkgs);
|
||||
|
||||
out:
|
||||
if (iter)
|
||||
prop_object_iterator_release(iter);
|
||||
|
||||
xbps_regpkgs_dictionary_release();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -312,7 +320,6 @@ out1:
|
||||
prop_object_release(propsd);
|
||||
out:
|
||||
prop_object_release(pkgd);
|
||||
xbps_release_regpkgdb_dict();
|
||||
|
||||
if (broken)
|
||||
rv = EINVAL;
|
||||
|
||||
@@ -246,7 +246,9 @@ show_transaction_sizes(prop_object_iterator_t iter)
|
||||
uint64_t tsize = 0, dlsize = 0, instsize = 0;
|
||||
const char *tract;
|
||||
char size[64];
|
||||
bool trans_inst = false, trans_up = false;
|
||||
bool trans_inst, trans_up, trans_conf;
|
||||
|
||||
trans_inst = trans_up = trans_conf = false;
|
||||
|
||||
/*
|
||||
* Iterate over the list of packages that are going to be
|
||||
@@ -275,6 +277,8 @@ show_transaction_sizes(prop_object_iterator_t iter)
|
||||
trans_inst = true;
|
||||
else if (strcmp(tract, "update") == 0)
|
||||
trans_up = true;
|
||||
else if (strcmp(tract, "configure") == 0)
|
||||
trans_conf = true;
|
||||
}
|
||||
prop_object_iterator_reset(iter);
|
||||
|
||||
@@ -291,6 +295,11 @@ show_transaction_sizes(prop_object_iterator_t iter)
|
||||
show_package_list(iter, "update");
|
||||
printf("\n\n");
|
||||
}
|
||||
if (trans_conf) {
|
||||
printf("The following packages will be configured:\n\n");
|
||||
show_package_list(iter, "configure");
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Show total download/installed size for all required packages.
|
||||
@@ -386,7 +395,7 @@ xbps_exec_transaction(const char *pkgname, bool force, bool update)
|
||||
"repository pool.\n", pkgname);
|
||||
return rv;
|
||||
} else if (rv != 0 && rv != ENOENT) {
|
||||
printf("Unexpected error: %s", strerror(rv));
|
||||
printf("Unexpected error: %s", strerror(errno));
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -410,13 +419,6 @@ xbps_exec_transaction(const char *pkgname, bool force, bool update)
|
||||
show_missing_deps(trans->dict, pkgname);
|
||||
goto out2;
|
||||
}
|
||||
|
||||
if (!prop_dictionary_get_cstring_nocopy(trans->dict,
|
||||
"origin", &trans->originpkgname)) {
|
||||
rv = errno;
|
||||
goto out2;
|
||||
}
|
||||
|
||||
if (update) {
|
||||
/*
|
||||
* Sort the package transaction dictionary.
|
||||
@@ -426,8 +428,13 @@ xbps_exec_transaction(const char *pkgname, bool force, bool update)
|
||||
strerror(rv));
|
||||
goto out2;
|
||||
}
|
||||
} else {
|
||||
if (!prop_dictionary_get_cstring_nocopy(trans->dict,
|
||||
"origin", &trans->originpkgname)) {
|
||||
rv = errno;
|
||||
goto out2;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* It's time to run the transaction!
|
||||
*/
|
||||
@@ -654,13 +661,6 @@ exec_transaction(struct transaction *trans)
|
||||
return rv;
|
||||
}
|
||||
autoinst = false;
|
||||
/*
|
||||
* Set package state to unpacked in the transaction
|
||||
* dictionary.
|
||||
*/
|
||||
if ((rv = xbps_set_pkg_state_dictionary(obj,
|
||||
XBPS_PKG_STATE_UNPACKED)) != 0)
|
||||
return rv;
|
||||
}
|
||||
prop_object_iterator_reset(trans->iter);
|
||||
/*
|
||||
|
||||
@@ -157,7 +157,7 @@ main(int argc, char **argv)
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
sigaction(SIGQUIT, &sa, NULL);
|
||||
|
||||
if ((dict = xbps_prepare_regpkgdb_dict()) == NULL) {
|
||||
if ((dict = xbps_regpkgs_dictionary_init()) == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
rv = errno;
|
||||
printf("Couldn't initialized regpkgdb dict: %s\n",
|
||||
@@ -319,8 +319,6 @@ out:
|
||||
static void
|
||||
cleanup(int signum)
|
||||
{
|
||||
xbps_release_repolist_data();
|
||||
xbps_release_regpkgdb_dict();
|
||||
|
||||
xbps_regpkgs_dictionary_release();
|
||||
exit(signum);
|
||||
}
|
||||
|
||||
@@ -69,8 +69,6 @@ xbps_show_pkg_deps(const char *pkgname)
|
||||
prop_object_release(propsd);
|
||||
prop_object_release(pkgd);
|
||||
|
||||
xbps_release_regpkgdb_dict();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -89,7 +87,6 @@ xbps_show_pkg_reverse_deps(const char *pkgname)
|
||||
rv = xbps_callback_array_iter_in_dict(pkgd, "requiredby",
|
||||
list_strings_sep_in_array, NULL);
|
||||
prop_object_release(pkgd);
|
||||
xbps_release_regpkgdb_dict();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user