Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-16 13:16:49 -0500
committerDan McGee <dan@archlinux.org>2011-07-03 14:29:30 -0500
commit6a6fc3107f477e579b0dd21553d48e073e3efdf4 (patch)
treea7c5ad4c723f7d2ceea76ebc7ff8214257ae8fe5 /lib/libalpm/be_package.c
parenta2995f586e492e0d2cb85e7e9ebb5f3857891465 (diff)
Move alpm filelists to a struct object
This allows us to capture size and mode data when building filelists from package files. Future patches will take advantage of this newly available information, and frontends can use it as well. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_package.c')
-rw-r--r--lib/libalpm/be_package.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index a4c6c559..da5076e5 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -328,7 +328,12 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
* already been handled (for future possibilities) */
} else if(full) {
/* Keep track of all files for filelist generation */
- newpkg->files = alpm_list_add(newpkg->files, strdup(entry_name));
+ alpm_file_t *file;
+ CALLOC(file, 1, sizeof(alpm_file_t), goto error);
+ STRDUP(file->name, entry_name, goto error);
+ file->size = archive_entry_size(entry);
+ file->mode = archive_entry_mode(entry);
+ newpkg->files = alpm_list_add(newpkg->files, file);
files_count++;
}
@@ -368,11 +373,14 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
if(full) {
/* "checking for conflicts" requires a sorted list, ensure that here */
_alpm_log(handle, PM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
- newpkg->files = alpm_list_msort(newpkg->files, files_count, _alpm_str_cmp);
+ newpkg->files = alpm_list_msort(newpkg->files, files_count,
+ _alpm_files_cmp);
newpkg->infolevel = INFRQ_ALL;
} else {
/* get rid of any partial filelist we may have collected, it is invalid */
- FREELIST(newpkg->files);
+ alpm_list_free_inner(newpkg->files, (alpm_list_fn_free)_alpm_files_free);
+ alpm_list_free(newpkg->files);
+ newpkg->files = NULL;
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC;
}