1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 07:48:50 -05:00

Use libarchive compat header for relevant symbols

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Dave Reisner 2013-01-28 20:23:25 -05:00 committed by Allan McRae
parent 2a57c2068c
commit e1e4bbb79d
5 changed files with 21 additions and 16 deletions

View File

@ -37,6 +37,7 @@
#include "alpm.h"
#include "alpm_list.h"
#include "handle.h"
#include "libarchive-compat.h"
#include "trans.h"
#include "util.h"
#include "log.h"
@ -555,7 +556,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
if(chdir(handle->root) != 0) {
_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
handle->root, strerror(errno));
archive_read_finish(archive);
_alpm_archive_read_free(archive);
CLOSE(fd);
ret = -1;
goto cleanup;
@ -577,7 +578,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
/* Using compressed size for calculations here, as newpkg->isize is not
* exact when it comes to comparing to the ACTUAL uncompressed size
* (missing metadata sizes) */
int64_t pos = archive_position_compressed(archive);
int64_t pos = _alpm_archive_compressed_ftell(archive);
percent = (pos * 100) / newpkg->size;
if(percent >= 100) {
percent = 100;
@ -597,7 +598,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
/* extract the next file from the archive */
errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
}
archive_read_finish(archive);
_alpm_archive_read_free(archive);
CLOSE(fd);
/* restore the old cwd if we have it */

View File

@ -35,6 +35,7 @@
/* libalpm */
#include "db.h"
#include "alpm_list.h"
#include "libarchive-compat.h"
#include "log.h"
#include "util.h"
#include "alpm.h"
@ -241,11 +242,11 @@ static struct archive *_cache_mtree_open(alpm_pkg_t *pkg)
archive_read_support_filter_gzip(mtree);
archive_read_support_format_mtree(mtree);
if((r = archive_read_open_file(mtree, mtfile, ALPM_BUFFER_SIZE))) {
if((r = _alpm_archive_read_open_file(mtree, mtfile, ALPM_BUFFER_SIZE))) {
_alpm_log(pkg->handle, ALPM_LOG_ERROR, _("error while reading file %s: %s\n"),
mtfile, archive_error_string(mtree));
pkg->handle->pm_errno = ALPM_ERR_LIBARCHIVE;
archive_read_finish(mtree);
_alpm_archive_read_free(mtree);
goto error;
}
@ -279,7 +280,7 @@ static int _cache_mtree_next(const alpm_pkg_t UNUSED *pkg,
static int _cache_mtree_close(const alpm_pkg_t UNUSED *pkg,
struct archive *mtree)
{
return archive_read_finish(mtree);
return _alpm_archive_read_free(mtree);
}
static int _cache_force_load(alpm_pkg_t *pkg)

View File

@ -32,6 +32,7 @@
/* libalpm */
#include "alpm_list.h"
#include "alpm.h"
#include "libarchive-compat.h"
#include "util.h"
#include "log.h"
#include "handle.h"
@ -74,7 +75,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
changelog = malloc(sizeof(struct package_changelog));
if(!changelog) {
pkg->handle->pm_errno = ALPM_ERR_MEMORY;
archive_read_finish(archive);
_alpm_archive_read_free(archive);
CLOSE(fd);
return NULL;
}
@ -84,7 +85,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
}
}
/* we didn't find a changelog */
archive_read_finish(archive);
_alpm_archive_read_free(archive);
CLOSE(fd);
errno = ENOENT;
@ -124,7 +125,7 @@ static int _package_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
{
int ret;
struct package_changelog *changelog = fp;
ret = archive_read_finish(changelog->archive);
ret = _alpm_archive_read_free(changelog->archive);
CLOSE(changelog->fd);
free(changelog);
return ret;
@ -471,7 +472,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
goto pkg_invalid;
}
archive_read_finish(archive);
_alpm_archive_read_free(archive);
CLOSE(fd);
/* internal fields for package struct */
@ -503,7 +504,7 @@ pkg_invalid:
handle->pm_errno = ALPM_ERR_PKG_INVALID;
error:
_alpm_pkg_free(newpkg);
archive_read_finish(archive);
_alpm_archive_read_free(archive);
if(fd >= 0) {
CLOSE(fd);
}

View File

@ -31,6 +31,7 @@
/* libalpm */
#include "util.h"
#include "log.h"
#include "libarchive-compat.h"
#include "alpm.h"
#include "alpm_list.h"
#include "package.h"
@ -383,7 +384,7 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive)
{
int per_package;
switch(archive_compression(archive)) {
switch(_alpm_archive_filter_code(archive)) {
case ARCHIVE_COMPRESSION_NONE:
per_package = 3015;
break;
@ -471,7 +472,7 @@ static int sync_db_populate(alpm_db_t *db)
count, db->treename);
cleanup:
archive_read_finish(archive);
_alpm_archive_read_free(archive);
if(fd >= 0) {
CLOSE(fd);
}

View File

@ -49,6 +49,7 @@
/* libalpm */
#include "util.h"
#include "log.h"
#include "libarchive-compat.h"
#include "alpm.h"
#include "alpm_list.h"
#include "handle.h"
@ -240,7 +241,7 @@ int _alpm_open_archive(alpm_handle_t *handle, const char *path,
RET_ERR(handle, ALPM_ERR_LIBARCHIVE, -1);
}
archive_read_support_compression_all(*archive);
_alpm_archive_read_support_filter_all(*archive);
archive_read_support_format_all(*archive);
_alpm_log(handle, ALPM_LOG_DEBUG, "opening archive %s\n", path);
@ -271,7 +272,7 @@ int _alpm_open_archive(alpm_handle_t *handle, const char *path,
return fd;
error:
archive_read_finish(*archive);
_alpm_archive_read_free(*archive);
*archive = NULL;
if(fd >= 0) {
CLOSE(fd);
@ -392,7 +393,7 @@ int _alpm_unpack(alpm_handle_t *handle, const char *path, const char *prefix,
cleanup:
umask(oldmask);
archive_read_finish(archive);
_alpm_archive_read_free(archive);
CLOSE(fd);
if(cwdfd >= 0) {
if(fchdir(cwdfd) != 0) {