diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/core.h | 13 | ||||
-rw-r--r-- | include/delivery.h | 7 | ||||
-rw-r--r-- | include/github.h | 10 | ||||
-rw-r--r-- | include/template.h | 52 | ||||
-rw-r--r-- | include/template_func_proto.h | 9 |
5 files changed, 72 insertions, 19 deletions
diff --git a/include/core.h b/include/core.h index ac9ae2f..d065096 100644 --- a/include/core.h +++ b/include/core.h @@ -38,6 +38,8 @@ #include "relocation.h" #include "wheel.h" #include "junitxml.h" +#include "github.h" +#include "template_func_proto.h" #define guard_runtime_free(X) do { if (X) { runtime_free(X); X = NULL; } } while (0) #define guard_strlist_free(X) do { if ((*X)) { strlist_free(X); (*X) = NULL; } } while (0) @@ -57,6 +59,11 @@ } \ } while (0) +struct EnvCtl { + unsigned flags; + const char *name[10]; +}; + struct STASIS_GLOBAL { bool verbose; //!< Enable verbose output bool always_update_base_environment; //!< Update base environment immediately after activation @@ -65,6 +72,7 @@ struct STASIS_GLOBAL { bool enable_docker; //!< Enable docker image builds bool enable_artifactory; //!< Enable artifactory uploads bool enable_testing; //!< Enable package testing + bool enable_overwrite; //!< Enable release file clobbering struct StrList *conda_packages; //!< Conda packages to install after initial activation struct StrList *pip_packages; //!< Pip packages to install after initial activation char *tmpdir; //!< Path to temporary storage directory @@ -85,8 +93,13 @@ struct STASIS_GLOBAL { char *repo; char *url; } jfrog; + struct EnvCtl envctl[]; }; extern struct STASIS_GLOBAL globals; + +#define STASIS_ENVCTL_PASSTHRU 0 << 1 +#define STASIS_ENVCTL_REQUIRED 1 << 1 +#define STASIS_ENVCTL_REDACT 2 << 1 extern const char *VERSION; extern const char *AUTHOR; extern const char *BANNER; diff --git a/include/delivery.h b/include/delivery.h index 971705f..969c803 100644 --- a/include/delivery.h +++ b/include/delivery.h @@ -391,4 +391,11 @@ int *bootstrap_build_info(struct Delivery *ctx); int delivery_dump_metadata(struct Delivery *ctx); +/** + * Determine whether a release on-disk matches the release name in use + * @param ctx Delivery context + * @return 0=no, 1=yes + */ +int delivery_exists(struct Delivery *ctx); + #endif //STASIS_DELIVERY_H diff --git a/include/github.h b/include/github.h new file mode 100644 index 0000000..cebeabf --- /dev/null +++ b/include/github.h @@ -0,0 +1,10 @@ +#ifndef STASIS_GITHUB_H +#define STASIS_GITHUB_H + +#include <curl/curl.h> + +#define STASIS_GITHUB_API_VERSION "2022-11-28" + +int get_github_release_notes(const char *api_token, const char *repo, const char *tag, const char *target_commitish, char **output); + +#endif //STASIS_GITHUB_H
\ No newline at end of file diff --git a/include/template.h b/include/template.h index ba62667..e3d83fb 100644 --- a/include/template.h +++ b/include/template.h @@ -40,28 +40,42 @@ char *tpl_render(char *str); */ int tpl_render_to_file(char *str, const char *filename); -struct tplfunc_frame *tpl_getfunc(char *key); -struct tplfunc_frame; -typedef int tplfunc(struct tplfunc_frame *frame, void *result); +typedef int tplfunc(void *frame, void *data_out); + struct tplfunc_frame { - char *key; - tplfunc *func; - int argc; + char *key; ///< Name of the function + tplfunc *func; ///< Pointer to the function + void *data_in; ///< Pointer to internal data (can be NULL) + int argc; ///< Maximum number of arguments to accept union { - char **t_char_refptr; - char *t_char_ptr; - void *t_void_ptr; - int *t_int_ptr; - unsigned *t_uint_ptr; - float *t_float_ptr; - double *t_double_ptr; - char t_char; - int t_int; - unsigned t_uint; - float t_float; - double t_double; + char **t_char_refptr; ///< &pointer + char *t_char_ptr; ///< pointer + void *t_void_ptr; ///< pointer to void + int *t_int_ptr; ///< pointer to int + unsigned *t_uint_ptr; ///< pointer to unsigned int + float *t_float_ptr; ///< pointer to float + double *t_double_ptr; ///< pointer to double + char t_char; ///< type of char + int t_int; ///< type of int + unsigned t_uint; ///< type of unsigned int + float t_float; ///< type of float + double t_double; ///< type of double } argv[10]; // accept up to 10 arguments }; -void tpl_register_func(char *key, struct tplfunc_frame *frame); + +/** + * Register a template function + * @param key function name to expose to "func:" interface + * @param tplfunc_ptr pointer to function of type tplfunc + * @param argc number of function arguments to accept + */ +void tpl_register_func(char *key, void *tplfunc_ptr, int argc, void *data_in); + +/** + * Get the function frame associated with a template function + * @param key function name + * @return tplfunc_frame structure + */ +struct tplfunc_frame *tpl_getfunc(char *key); #endif //STASIS_TEMPLATE_H diff --git a/include/template_func_proto.h b/include/template_func_proto.h new file mode 100644 index 0000000..212759c --- /dev/null +++ b/include/template_func_proto.h @@ -0,0 +1,9 @@ +#ifndef TEMPLATE_FUNC_PROTO_H +#define TEMPLATE_FUNC_PROTO_H + +#include "template.h" + +int get_github_release_notes_tplfunc_entrypoint(void *frame, void *data_out); +int get_github_release_notes_auto_tplfunc_entrypoint(void *frame, void *data_out); + +#endif //TEMPLATE_FUNC_PROTO_H
\ No newline at end of file |