From b849abb47d3aaa6b048f70ab2d89dd63de875af2 Mon Sep 17 00:00:00 2001 From: William Douglas Date: Thu, 5 May 2016 20:51:37 +0000 Subject: [PATCH] Add helper to create a file list from bundles In order to support verify_fix_path from bundle_add, a generic file list from bundle list needs to be implemented to replace the one embedded in the current consolidate_submanifests function. This function will be used to generate a file list to be passed to a new function for consolidating a list of files (created in the following patch). Note the list of files this creates is not sorted. --- include/swupd.h | 1 + src/helpers.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/swupd.h b/include/swupd.h index 3e1c58ac..0bfddb08 100644 --- a/include/swupd.h +++ b/include/swupd.h @@ -257,6 +257,7 @@ void delete_motd(void); extern int get_dirfd_path(const char *fullname); extern int verify_fix_path(char *targetpath, struct manifest *manifest); extern void set_local_download(void); +extern struct list *files_from_bundles(struct list *bundles); /* subscription.c */ struct list *free_list_file(struct list *item); diff --git a/src/helpers.c b/src/helpers.c index 4c5036d7..a88c10e8 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -851,3 +851,24 @@ void set_local_download(void) return; } + +struct list *files_from_bundles(struct list *bundles) +{ + struct list *files = NULL; + struct list *list; + struct manifest *bundle; + + list = list_head(bundles); + while (list) { + struct list *bfiles; + bundle = list->data; + list = list->next; + if (!bundle) { + continue; + } + bfiles = list_clone(bundle->files); + files = list_concat(bfiles, files); + } + + return files; +}