Allow manifests to contain includes

Start handling the case where a manifest has an includes line. This line
will be used to specify other manifests that are to be installed with
the containing manifest.
This commit is contained in:
William Douglas
2016-03-11 23:36:13 +00:00
parent d4dea3f0a8
commit deba09525a
2 changed files with 12 additions and 0 deletions
+1
View File
@@ -51,6 +51,7 @@ struct manifest {
struct list *files;
struct list *manifests; /* struct file for possible manifests */
struct list *submanifests; /* struct manifest for subscribed manifests */
struct list *includes; /* manifest names included in manifest */
char *component;
};
+11
View File
@@ -156,6 +156,7 @@ static struct manifest *manifest_from_file(int version, char *component)
int count = 0;
int deleted = 0;
struct manifest *manifest;
struct list *includes = NULL;
char *filename;
uint64_t contentsize = 0;
int manifest_hdr_version;
@@ -219,6 +220,12 @@ static struct manifest *manifest_from_file(int version, char *component)
if (strncmp(line, "contentsize:", 12) == 0) {
contentsize = strtoull(c, NULL, 10);
}
if (strncmp(line, "includes:", 9) == 0) {
includes = list_prepend_data(includes, strdup(c));
if (!includes->data) {
abort();
}
}
}
manifest = alloc_manifest(version, component);
@@ -228,6 +235,7 @@ static struct manifest *manifest_from_file(int version, char *component)
manifest->contentsize = contentsize;
manifest->manifest_version = manifest_enc_version;
manifest->includes = includes;
/* empty line */
while (!feof(infile)) {
@@ -387,6 +395,9 @@ void free_manifest(struct manifest *manifest)
if (manifest->submanifests) {
list_free_list_and_data(manifest->submanifests, free_manifest_data);
}
if (manifest->includes) {
list_free_list_and_data(manifest->includes, free);
}
free(manifest->component);
free(manifest);
}