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:
24
lib/unpack.c
24
lib/unpack.c
@ -40,9 +40,9 @@ int SYMEXPORT
|
||||
xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
{
|
||||
prop_string_t filename, repoloc, arch;
|
||||
struct archive *ar;
|
||||
struct archive *ar = NULL;
|
||||
const char *pkgname;
|
||||
char *binfile;
|
||||
char *binfile = NULL;
|
||||
int pkg_fd, rv = 0;
|
||||
|
||||
assert(pkg != NULL);
|
||||
@ -73,8 +73,8 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
|
||||
ar = archive_read_new();
|
||||
if (ar == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out2;
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -85,7 +85,7 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
|
||||
if ((rv = archive_read_open_fd(ar, pkg_fd,
|
||||
ARCHIVE_READ_BLOCKSIZE)) != 0)
|
||||
goto out3;
|
||||
goto out;
|
||||
|
||||
rv = unpack_archive_fini(ar, pkg, essential);
|
||||
/*
|
||||
@ -95,7 +95,7 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
if (rv == 0) {
|
||||
if (fsync(pkg_fd) == -1) {
|
||||
rv = errno;
|
||||
goto out3;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Set package state to unpacked.
|
||||
@ -103,12 +103,14 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
rv = xbps_set_pkg_state_installed(pkgname,
|
||||
XBPS_PKG_STATE_UNPACKED);
|
||||
}
|
||||
out3:
|
||||
archive_read_finish(ar);
|
||||
out2:
|
||||
(void)close(pkg_fd);
|
||||
|
||||
out:
|
||||
free(binfile);
|
||||
if (ar)
|
||||
archive_read_finish(ar);
|
||||
if (pkg_fd != -1)
|
||||
(void)close(pkg_fd);
|
||||
if (binfile)
|
||||
free(binfile);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
Reference in New Issue
Block a user