summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/add.c7
-rw-r--r--lib/libalpm/be_local.c7
-rw-r--r--lib/libalpm/be_package.c11
-rw-r--r--lib/libalpm/be_sync.c5
-rw-r--r--lib/libalpm/util.c7
5 files changed, 21 insertions, 16 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 9b678136..a8284355 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -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 */
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 0f60b6d8..564e1097 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -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)
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 18fc14af..cc430b17 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -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);
}
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 66e351b5..36725251 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -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);
}
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 5960be6a..f4c33a0d 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -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) {