summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-16 20:16:49 +0200
committerDan McGee <dan@archlinux.org>2011-07-03 21:29:30 +0200
commit6a6fc3107f477e579b0dd21553d48e073e3efdf4 (patch)
treea7c5ad4c723f7d2ceea76ebc7ff8214257ae8fe5 /lib/libalpm/be_local.c
parenta2995f586e492e0d2cb85e7e9ebb5f3857891465 (diff)
downloadpacman-6a6fc3107f477e579b0dd21553d48e073e3efdf4.tar.gz
pacman-6a6fc3107f477e579b0dd21553d48e073e3efdf4.tar.xz
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_local.c')
-rw-r--r--lib/libalpm/be_local.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 65579673..f1056d40 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -632,9 +632,11 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
_alpm_strtrim(line);
if(strcmp(line, "%FILES%") == 0) {
while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) {
- char *linedup;
- STRDUP(linedup, line, goto error);
- info->files = alpm_list_add(info->files, linedup);
+ alpm_file_t *file;
+ CALLOC(file, 1, sizeof(alpm_file_t), goto error);
+ STRDUP(file->name, line, goto error);
+ /* TODO: lstat file, get mode/size */
+ info->files = alpm_list_add(info->files, file);
}
} else if(strcmp(line, "%BACKUP%") == 0) {
while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) {
@@ -835,14 +837,15 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
if(info->files) {
fprintf(fp, "%%FILES%%\n");
for(lp = info->files; lp; lp = lp->next) {
- fprintf(fp, "%s\n", (char *)lp->data);
+ const alpm_file_t *file = lp->data;
+ fprintf(fp, "%s\n", file->name);
}
fprintf(fp, "\n");
}
if(info->backup) {
fprintf(fp, "%%BACKUP%%\n");
for(lp = info->backup; lp; lp = lp->next) {
- alpm_backup_t *backup = lp->data;
+ const alpm_backup_t *backup = lp->data;
fprintf(fp, "%s\t%s\n", backup->name, backup->hash);
}
fprintf(fp, "\n");