mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58: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:
parent
2a57c2068c
commit
e1e4bbb79d
@ -37,6 +37,7 @@
|
|||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.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) {
|
if(chdir(handle->root) != 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
|
||||||
handle->root, strerror(errno));
|
handle->root, strerror(errno));
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
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
|
/* Using compressed size for calculations here, as newpkg->isize is not
|
||||||
* exact when it comes to comparing to the ACTUAL uncompressed size
|
* exact when it comes to comparing to the ACTUAL uncompressed size
|
||||||
* (missing metadata sizes) */
|
* (missing metadata sizes) */
|
||||||
int64_t pos = archive_position_compressed(archive);
|
int64_t pos = _alpm_archive_compressed_ftell(archive);
|
||||||
percent = (pos * 100) / newpkg->size;
|
percent = (pos * 100) / newpkg->size;
|
||||||
if(percent >= 100) {
|
if(percent >= 100) {
|
||||||
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 */
|
/* extract the next file from the archive */
|
||||||
errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
|
errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
|
||||||
}
|
}
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
|
|
||||||
/* restore the old cwd if we have it */
|
/* restore the old cwd if we have it */
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "alpm.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_filter_gzip(mtree);
|
||||||
archive_read_support_format_mtree(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"),
|
_alpm_log(pkg->handle, ALPM_LOG_ERROR, _("error while reading file %s: %s\n"),
|
||||||
mtfile, archive_error_string(mtree));
|
mtfile, archive_error_string(mtree));
|
||||||
pkg->handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
pkg->handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
archive_read_finish(mtree);
|
_alpm_archive_read_free(mtree);
|
||||||
goto error;
|
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,
|
static int _cache_mtree_close(const alpm_pkg_t UNUSED *pkg,
|
||||||
struct archive *mtree)
|
struct archive *mtree)
|
||||||
{
|
{
|
||||||
return archive_read_finish(mtree);
|
return _alpm_archive_read_free(mtree);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _cache_force_load(alpm_pkg_t *pkg)
|
static int _cache_force_load(alpm_pkg_t *pkg)
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
@ -74,7 +75,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
|
|||||||
changelog = malloc(sizeof(struct package_changelog));
|
changelog = malloc(sizeof(struct package_changelog));
|
||||||
if(!changelog) {
|
if(!changelog) {
|
||||||
pkg->handle->pm_errno = ALPM_ERR_MEMORY;
|
pkg->handle->pm_errno = ALPM_ERR_MEMORY;
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -84,7 +85,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* we didn't find a changelog */
|
/* we didn't find a changelog */
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ static int _package_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct package_changelog *changelog = fp;
|
struct package_changelog *changelog = fp;
|
||||||
ret = archive_read_finish(changelog->archive);
|
ret = _alpm_archive_read_free(changelog->archive);
|
||||||
CLOSE(changelog->fd);
|
CLOSE(changelog->fd);
|
||||||
free(changelog);
|
free(changelog);
|
||||||
return ret;
|
return ret;
|
||||||
@ -471,7 +472,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
|||||||
goto pkg_invalid;
|
goto pkg_invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
|
|
||||||
/* internal fields for package struct */
|
/* internal fields for package struct */
|
||||||
@ -503,7 +504,7 @@ pkg_invalid:
|
|||||||
handle->pm_errno = ALPM_ERR_PKG_INVALID;
|
handle->pm_errno = ALPM_ERR_PKG_INVALID;
|
||||||
error:
|
error:
|
||||||
_alpm_pkg_free(newpkg);
|
_alpm_pkg_free(newpkg);
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
@ -383,7 +384,7 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive)
|
|||||||
{
|
{
|
||||||
int per_package;
|
int per_package;
|
||||||
|
|
||||||
switch(archive_compression(archive)) {
|
switch(_alpm_archive_filter_code(archive)) {
|
||||||
case ARCHIVE_COMPRESSION_NONE:
|
case ARCHIVE_COMPRESSION_NONE:
|
||||||
per_package = 3015;
|
per_package = 3015;
|
||||||
break;
|
break;
|
||||||
@ -471,7 +472,7 @@ static int sync_db_populate(alpm_db_t *db)
|
|||||||
count, db->treename);
|
count, db->treename);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "libarchive-compat.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "handle.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);
|
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);
|
archive_read_support_format_all(*archive);
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "opening archive %s\n", path);
|
_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;
|
return fd;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
archive_read_finish(*archive);
|
_alpm_archive_read_free(*archive);
|
||||||
*archive = NULL;
|
*archive = NULL;
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
@ -392,7 +393,7 @@ int _alpm_unpack(alpm_handle_t *handle, const char *path, const char *prefix,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
archive_read_finish(archive);
|
_alpm_archive_read_free(archive);
|
||||||
CLOSE(fd);
|
CLOSE(fd);
|
||||||
if(cwdfd >= 0) {
|
if(cwdfd >= 0) {
|
||||||
if(fchdir(cwdfd) != 0) {
|
if(fchdir(cwdfd) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user