aboutsummaryrefslogtreecommitdiff
path: root/src/delivery.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-08-05 11:59:45 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-08-05 11:59:45 -0400
commit1524075828995e14fef035ff5884134997c7479a (patch)
tree0ece450ec17839a26d5c564b753e291cf774aa40 /src/delivery.c
parent202e69c8951a38187489c66e994dd593755d62cb (diff)
downloadstasis-1524075828995e14fef035ff5884134997c7479a.tar.gz
Add handler for space-delimited lists
* This needs attention, however. The INI writer has no way to know a list with spaces is a list; this happens in the value conversion functions. * Add type_hint member to INIData structure. At some point support with be added for all INIVAL_TYPE_* defines. Right now it's only used with arrays. * Zero out line buffer in ini_open after each iteration * Do not strip raw INI data. Let the conversion functions handle it * Add spaces to key value pairs in rendered INI output.
Diffstat (limited to 'src/delivery.c')
-rw-r--r--src/delivery.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/delivery.c b/src/delivery.c
index b1997f6..a55171a 100644
--- a/src/delivery.c
+++ b/src/delivery.c
@@ -54,7 +54,15 @@ static void conv_strlist(struct StrList **x, char *tok, union INIVal val) {
if (val.as_char_p) {
char *tplop = tpl_render(val.as_char_p);
if (tplop) {
+ lstrip(tplop);
strip(tplop);
+ // Special handler for space delimited lists
+ if (strpbrk(tok, " ")) {
+ // crunch all spaces
+ normalize_space(tplop);
+ // replace spaces with line feeds
+ replace_text(tplop, " ", "\n", 0);
+ }
strlist_append_tokenize((*x), tplop, tok);
guard_free(tplop);
}
@@ -548,7 +556,7 @@ static int populate_delivery_ini(struct Delivery *ctx) {
conv_str(&ctx->conda.installer_baseurl, val);
ini_getval(ini, "conda", "conda_packages", INIVAL_TYPE_STR_ARRAY, &val);
- conv_strlist(&ctx->conda.conda_packages, LINE_SEP, val);
+ conv_strlist(&ctx->conda.conda_packages, " "LINE_SEP, val);
for (size_t i = 0; i < strlist_count(ctx->conda.conda_packages); i++) {
char *pkg = strlist_item(ctx->conda.conda_packages, i);
@@ -558,7 +566,7 @@ static int populate_delivery_ini(struct Delivery *ctx) {
}
ini_getval(ini, "conda", "pip_packages", INIVAL_TYPE_STR_ARRAY, &val);
- conv_strlist(&ctx->conda.pip_packages, LINE_SEP, val);
+ conv_strlist(&ctx->conda.pip_packages, " "LINE_SEP, val);
for (size_t i = 0; i < strlist_count(ctx->conda.pip_packages); i++) {
char *pkg = strlist_item(ctx->conda.pip_packages, i);
@@ -1201,7 +1209,7 @@ static const struct Test *requirement_from_test(struct Delivery *ctx, const char
result = NULL;
for (size_t i = 0; i < sizeof(ctx->tests) / sizeof(ctx->tests[0]); i++) {
- if (strstr(name, ctx->tests[i].name)) {
+ if (ctx->tests[i].name && strstr(name, ctx->tests[i].name)) {
result = &ctx->tests[i];
break;
}