summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-09-28 20:51:33 +0000
committerJudd Vinet <judd@archlinux.org>2006-09-28 20:51:33 +0000
commitcf6da173f62ee96703714e66f8538069a46a63e3 (patch)
tree164ba65ccd916674929f2e058a40fe7f6abced52 /lib/libalpm/sync.c
parent54008798efcc9646f622f6b052ecd83281d57cda (diff)
downloadpacman-cf6da173f62ee96703714e66f8538069a46a63e3.tar.xz
removed libtar support in favour of libarchive
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 3223c916..05746bbc 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -29,8 +29,6 @@
#endif
#include <dirent.h>
#include <libintl.h>
-#include <libtar.h>
-#include <zlib.h>
/* pacman */
#include "log.h"
#include "util.h"
@@ -110,27 +108,27 @@ static pmsyncpkg_t *find_pkginsync(char *needle, PMList *haystack)
PMList *_alpm_sync_load_dbarchive(char *archive)
{
PMList *lp = NULL;
- TAR *tar = NULL;
- tartype_t gztype = {
- (openfunc_t)_alpm_gzopen_frontend,
- (closefunc_t)gzclose,
- (readfunc_t)gzread,
- (writefunc_t)gzwrite
- };
-
- if(tar_open(&tar, archive, &gztype, O_RDONLY, 0, TAR_GNU) == -1) {
+ register struct archive *_archive;
+ struct archive_entry *entry;
+
+ if((_archive = archive_read_new()) == NULL) {
+ pm_errno = PM_ERR_LIBARCHIVE_ERROR;
+ goto error;
+ }
+ archive_read_support_compression_all(_archive);
+ archive_read_support_format_all(_archive);
+
+ if(archive_read_open_file(_archive, archive, 10240) != ARCHIVE_OK) {
pm_errno = PM_ERR_NOT_A_FILE;
goto error;
}
- tar_close(tar);
+ archive_read_finish(_archive);
return(lp);
error:
- if(tar) {
- tar_close(tar);
- }
+ archive_read_finish(_archive);
return(NULL);
}