diff options
Diffstat (limited to 'src/cli/stasis_indexer')
| -rw-r--r-- | src/cli/stasis_indexer/helpers.c | 7 | ||||
| -rw-r--r-- | src/cli/stasis_indexer/junitxml_report.c | 10 | ||||
| -rw-r--r-- | src/cli/stasis_indexer/readmes.c | 5 | ||||
| -rw-r--r-- | src/cli/stasis_indexer/stasis_indexer_main.c | 17 |
4 files changed, 31 insertions, 8 deletions
diff --git a/src/cli/stasis_indexer/helpers.c b/src/cli/stasis_indexer/helpers.c index 097b0ca..92e2dd4 100644 --- a/src/cli/stasis_indexer/helpers.c +++ b/src/cli/stasis_indexer/helpers.c @@ -257,7 +257,7 @@ int get_files(struct StrList **out, const char *path, const char *pattern, ...) return -1; } if ((size_t) len > sizeof(userpattern)) { - SYSWARN("%s: userpattern truncated!", __FUNCTION__); + SYSWARN("userpattern truncated!"); } va_end(args); if (!strlen(userpattern)) { @@ -297,7 +297,10 @@ int get_files(struct StrList **out, const char *path, const char *pattern, ...) struct StrList *get_docker_images(struct Delivery *ctx, char *pattern) { char *tarball = NULL; - asprintf(&tarball, "%s*.tar*", pattern); + if (asprintf(&tarball, "%s*.tar*", pattern) < 0) { + SYSERROR("unable to allocate bytes for tarball pattern: %s", pattern); + return NULL; + } if (!tarball) { SYSERROR("Unable to allocate bytes for docker image wildcard pattern"); return NULL; diff --git a/src/cli/stasis_indexer/junitxml_report.c b/src/cli/stasis_indexer/junitxml_report.c index 073bb61..a7dcd06 100644 --- a/src/cli/stasis_indexer/junitxml_report.c +++ b/src/cli/stasis_indexer/junitxml_report.c @@ -30,7 +30,17 @@ static int write_report_output(struct Delivery *ctx, FILE *destfp, const char *x } char *bname_tmp = strdup(xmlfilename); + if (!bname_tmp) { + SYSERROR("unable to allocate bytes for temporary basename"); + return -1; + } + char *bname = strdup(path_basename(bname_tmp)); + if (!bname) { + SYSERROR("unable to allocate bytes for basename"); + return -1; + } + if (endswith(bname, ".xml")) { bname[strlen(bname) - 4] = 0; } diff --git a/src/cli/stasis_indexer/readmes.c b/src/cli/stasis_indexer/readmes.c index de9e2f2..836df5c 100644 --- a/src/cli/stasis_indexer/readmes.c +++ b/src/cli/stasis_indexer/readmes.c @@ -101,10 +101,9 @@ int indexer_readmes(struct Delivery **ctx, const size_t nelem) { fprintf(indexfp, "- Receipt: [STASIS input file](../config/%s.ini)\n", current->info.release_name); char *pattern = NULL; - asprintf(&pattern, "*%s*%s*", + if (asprintf(&pattern, "*%s*%s*", current->info.build_number, - strstr((*ctx)->rules.release_fmt, "%p") ? current->meta.python_compact : "" ); - if (!pattern) { + strstr((*ctx)->rules.release_fmt, "%p") ? current->meta.python_compact : "" ) < 0) { SYSERROR("Unable to allocate bytes for pattern"); fclose(indexfp); return -1; diff --git a/src/cli/stasis_indexer/stasis_indexer_main.c b/src/cli/stasis_indexer/stasis_indexer_main.c index 2bf72fd..e87122e 100644 --- a/src/cli/stasis_indexer/stasis_indexer_main.c +++ b/src/cli/stasis_indexer/stasis_indexer_main.c @@ -48,9 +48,9 @@ int indexer_combine_rootdirs(const char *dest, char **rootdirs, const size_t roo if (!access(srcdir_with_output, F_OK)) { srcdir = srcdir_with_output; } - snprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd), "'%s'/ ", srcdir); + snprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd) - non_format_len("'%s'/ "), "'%s'/ ", srcdir); } - snprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd), " %s/", destdir); + snprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd) - non_format_len(" %s/"), " %s/", destdir); if (globals.verbose) { puts(cmd); @@ -304,7 +304,17 @@ int main(const int argc, char *argv[]) { struct Delivery ctx = {0}; - printf(BANNER, VERSION, AUTHOR); + char *version = center_text(VERSION, strlen(STASIS_BANNER_HEADER)); + if (!version) { + SYSERROR("%s", "version too long?"); + version = strdup(VERSION); + if (!version) { + SYSERROR("%s", "unable to allocate uncentered fallback version string"); + exit(1); + } + } + printf(BANNER, version, AUTHOR); + guard_free(version); indexer_init_dirs(&ctx, workdir); @@ -325,6 +335,7 @@ int main(const int argc, char *argv[]) { mkdirs(ctx.storage.wheel_artifact_dir, 0755); } + msg(STASIS_MSG_L1, "Configure Micromamba\n"); struct MicromambaInfo m; if (micromamba_configure(&ctx, &m)) { SYSERROR("Unable to configure micromamba"); |
