From 7d675a70bf92bd1606f77fae01c6e56afdcee5ef Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 21 Jun 2024 12:36:55 -0400 Subject: Rebrand OhMyCal (OMC) as STASIS --- include/artifactory.h | 18 +-- include/conda.h | 8 +- include/config.h.in | 18 +-- include/copy.h | 6 +- include/core.h | 99 +++++++++++++ include/deliverable.h | 394 -------------------------------------------------- include/delivery.h | 394 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/docker.h | 16 +- include/download.h | 6 +- include/environment.h | 6 +- include/ini.h | 6 +- include/junitxml.h | 6 +- include/omc.h | 99 ------------- include/os_darwin.h | 4 +- include/os_linux.h | 4 +- include/recipe.h | 6 +- include/relocation.h | 8 +- include/rules.h | 8 +- include/str.h | 24 +-- include/strlist.h | 6 +- include/system.h | 8 +- include/template.h | 8 +- include/utils.h | 58 ++++---- include/wheel.h | 6 +- 24 files changed, 608 insertions(+), 608 deletions(-) create mode 100644 include/core.h delete mode 100644 include/deliverable.h create mode 100644 include/delivery.h delete mode 100644 include/omc.h (limited to 'include') diff --git a/include/artifactory.h b/include/artifactory.h index 0883eef..6880d17 100644 --- a/include/artifactory.h +++ b/include/artifactory.h @@ -1,10 +1,10 @@ //! @file artifactory.h -#ifndef OMC_ARTIFACTORY_H -#define OMC_ARTIFACTORY_H +#ifndef STASIS_ARTIFACTORY_H +#define STASIS_ARTIFACTORY_H #include #include -#include "omc.h" +#include "core.h" //! JFrog Artifactory Authentication struct struct JFRT_Auth { @@ -276,13 +276,13 @@ int jfrog_cli_rt_build_collect_env(struct JFRT_Auth *auth, char *build_name, cha int jfrog_cli_rt_build_publish(struct JFRT_Auth *auth, char *build_name, char *build_number); /** - * Configure JFrog CLI authentication according to OMC specs + * Configure JFrog CLI authentication according to STASIS specs * - * This function will use the OMC_JF_* environment variables to configure the authentication - * context. With this in mind, if an OMC_JF_* environment variable is not defined, the original value of + * This function will use the STASIS_JF_* environment variables to configure the authentication + * context. With this in mind, if an STASIS_JF_* environment variable is not defined, the original value of * the structure member will be used instead. * - * Use OMC_JF_* variables to configure context + * Use STASIS_JF_* variables to configure context * * ```c * struct JFRT_Auth auth_ctx; @@ -299,7 +299,7 @@ int jfrog_cli_rt_build_publish(struct JFRT_Auth *auth, char *build_name, char *b * jfrt_auth_init(&auth_ctx); * ``` * - * Use your own input without OMC's help. Purely an illustrative example. + * Use your own input without STASIS's help. Purely an illustrative example. * * ```c * struct JFRT_Auth auth_ctx; @@ -320,4 +320,4 @@ int jfrt_auth_init(struct JFRT_Auth *auth_ctx); */ void jfrt_upload_init(struct JFRT_Upload *ctx); -#endif //OMC_ARTIFACTORY_H \ No newline at end of file +#endif //STASIS_ARTIFACTORY_H \ No newline at end of file diff --git a/include/conda.h b/include/conda.h index 9cbbf9c..086a842 100644 --- a/include/conda.h +++ b/include/conda.h @@ -1,10 +1,10 @@ //! @file conda.h -#ifndef OMC_CONDA_H -#define OMC_CONDA_H +#ifndef STASIS_CONDA_H +#define STASIS_CONDA_H #include #include -#include "omc.h" +#include "core.h" #define CONDA_INSTALL_PREFIX "conda" @@ -167,4 +167,4 @@ int conda_env_export(char *name, char *output_dir, char *output_filename); * @return exit code from "conda" */ int conda_index(const char *path); -#endif //OMC_CONDA_H +#endif //STASIS_CONDA_H diff --git a/include/config.h.in b/include/config.h.in index fe6beb2..0df955d 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1,28 +1,28 @@ -#ifndef OMC_CONFIG_H -#define OMC_CONFIG_H +#ifndef STASIS_CONFIG_H +#define STASIS_CONFIG_H -#define OMC_SYSCONFDIR "@SYSCONFDIR@/omc" +#define STASIS_SYSCONFDIR "@SYSCONFDIR@/stasis" #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) -#define OMC_OS_WINDOWS +#define STASIS_OS_WINDOWS #elif defined(__linux__) -#define OMC_OS_LINUX +#define STASIS_OS_LINUX #include "os_linux.h" #elif defined(unix) || defined(__unix__) || defined(__unix) -#define OMC_OS_UNIX +#define STASIS_OS_UNIX #elif defined(__APPLE__) -#define OMC_OS_DARWIN +#define STASIS_OS_DARWIN #include "os_darwin.h" #else -#define OMC_OS_UNKNOWN +#define STASIS_OS_UNKNOWN #error Operating system unknown/unsupported #endif // OS detection -#endif // OMC_CONFIG_H +#endif // STASIS_CONFIG_H diff --git a/include/copy.h b/include/copy.h index 5a53d7d..609a6cf 100644 --- a/include/copy.h +++ b/include/copy.h @@ -1,5 +1,5 @@ //! @file copy.h -#ifndef OMC_COPY_H +#ifndef STASIS_COPY_H #include #include @@ -8,7 +8,7 @@ #include #include #include -#include "omc.h" +#include "core.h" #define CT_OWNER 1 << 1 #define CT_PERM 1 << 2 @@ -58,4 +58,4 @@ int mkdirs(const char *_path, mode_t mode); */ int copy2(const char *src, const char *dest, unsigned op); -#endif // OMC_COPY_H \ No newline at end of file +#endif // STASIS_COPY_H \ No newline at end of file diff --git a/include/core.h b/include/core.h new file mode 100644 index 0000000..1a7ddea --- /dev/null +++ b/include/core.h @@ -0,0 +1,99 @@ +//! @file stasis.h +#ifndef STASIS_CORE_H +#define STASIS_CORE_H + +#include +#include +#include +#include +#include +#include +#include + +#define SYSERROR(MSG, ...) do { \ + fprintf(stderr, "%s:%s:%d:%s - ", path_basename(__FILE__), __FUNCTION__, __LINE__, strerror(errno) ? "info" : strerror(errno)); \ + fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \ +} while (0) +#define STASIS_BUFSIZ 8192 +#define STASIS_NAME_MAX 255 +#define STASIS_DIRSTACK_MAX 1024 +#define STASIS_TIME_STR_MAX 128 +#define HTTP_ERROR(X) X >= 400 + +#include "config.h" +#include "template.h" +#include "utils.h" +#include "copy.h" +#include "ini.h" +#include "conda.h" +#include "environment.h" +#include "artifactory.h" +#include "docker.h" +#include "delivery.h" +#include "str.h" +#include "strlist.h" +#include "system.h" +#include "download.h" +#include "recipe.h" +#include "relocation.h" +#include "wheel.h" +#include "junitxml.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) +#define guard_free(X) do { if (X) { free(X); X = NULL; } } while (0) +#define GENERIC_ARRAY_FREE(ARR) do { \ + for (size_t ARR_I = 0; ARR && ARR[ARR_I] != NULL; ARR_I++) { \ + guard_free(ARR[ARR_I]); \ + } \ + guard_free(ARR); \ +} while (0) + +#define COE_CHECK_ABORT(COND, MSG) \ + do {\ + if (!globals.continue_on_error && COND) { \ + msg(STASIS_MSG_ERROR, MSG ": Aborting execution (--continue-on-error/-C is not enabled)\n"); \ + exit(1); \ + } \ + } while (0) + +struct STASIS_GLOBAL { + bool verbose; //!< Enable verbose output + bool always_update_base_environment; //!< Update base environment immediately after activation + bool continue_on_error; //!< Do not stop on test failures + bool conda_fresh_start; //!< Always install a new copy of Conda + bool enable_docker; //!< Enable docker image builds + bool enable_artifactory; //!< Enable artifactory uploads + bool enable_testing; //!< Enable package testing + 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 + char *conda_install_prefix; //!< Path to install conda + char *sysconfdir; //!< Path where STASIS reads its configuration files (mission directory, etc) + struct { + char *tox_posargs; + } workaround; + struct Jfrog { + char *jfrog_artifactory_base_url; + char *jfrog_artifactory_product; + char *cli_major_ver; + char *version; + char *os; + char *arch; + char *remote_filename; + char *repo; + char *url; + } jfrog; +}; +extern struct STASIS_GLOBAL globals; +extern const char *VERSION; +extern const char *AUTHOR; +extern const char *BANNER; + + +/** + * Free memory allocated in global configuration structure + */ +void globals_free(); + +#endif //STASIS_CORE_H diff --git a/include/deliverable.h b/include/deliverable.h deleted file mode 100644 index effd098..0000000 --- a/include/deliverable.h +++ /dev/null @@ -1,394 +0,0 @@ -/// @file deliverable.h - -#ifndef OMC_DELIVERABLE_H -#define OMC_DELIVERABLE_H - -#include -#include -#include -#include -#include "omc.h" - -#define DELIVERY_PLATFORM_MAX 4 -#define DELIVERY_PLATFORM_MAXLEN 65 -#define DELIVERY_PLATFORM 0 -#define DELIVERY_PLATFORM_CONDA_SUBDIR 1 -#define DELIVERY_PLATFORM_CONDA_INSTALLER 2 -#define DELIVERY_PLATFORM_RELEASE 3 - -#define DELIVERY_REWRITE_SPEC_STAGE_1 0 -#define DELIVERY_REWRITE_SPEC_STAGE_2 1 - -#define INSTALL_PKG_CONDA 1 << 1 ///< Toggle conda package installation -#define INSTALL_PKG_CONDA_DEFERRED 1 << 2 ///< Toggle deferred conda package installation -#define INSTALL_PKG_PIP 1 << 3 ///< Toggle pip package installation -#define INSTALL_PKG_PIP_DEFERRED 1 << 4 ///< Toggle deferred package installation from source - -#define DEFER_CONDA 0 ///< Build conda packages -#define DEFER_PIP 1 ///< Build python packages - -struct Content { - unsigned type; - char *filename; - char *data; -}; - -/*! \struct Delivery - * \brief A structure describing a full delivery object - */ -struct Delivery { - /*! \struct OMC_INI_FP - * \brief Container for INIFILE handles - */ - struct OMC_INI_FP { - struct INIFILE *delivery; - struct INIFILE *cfg; - struct INIFILE *mission; - char *delivery_path; - char *cfg_path; - char *mission_path; - } _omc_ini_fp; - - /*! \struct System - * \brief System information - */ - struct System { - char *arch; - ///< System CPU architecture ident - char **platform; - ///< System platform name - } system; - /*! \struct Storage - * \brief Storage paths - */ - struct Storage { - char *root; ///< Top-level storage area - char *tmpdir; ///< Temporary storage area (within root) - char *output_dir; ///< Base path to where all artifacts are stored - char *delivery_dir; ///< Delivery artifact output directory - char *cfgdump_dir; ///< Base path to where input configuration dumps are stored - char *tools_dir; ///< Tools storage - char *mission_dir; ///< Mission data storage - char *package_dir; ///< Base path to where all packages are stored - char *results_dir; ///< Base path to where test results are stored - char *meta_dir; ///< Base path to where metadata records are stored - char *conda_install_prefix; ///< Path to install Conda - char *conda_artifact_dir; ///< Base path to store compiled conda packages - char *conda_staging_dir; ///< Base path to copy compiled conda packages - char *conda_staging_url; ///< URL to access compiled conda packages - char *docker_artifact_dir; ///< Base path to store saved docker images - char *wheel_artifact_dir; ///< Base path to store compiled wheel packages (Unused) - char *wheel_staging_dir; ///< Base path to copy compiled wheel packages (Unused) - char *wheel_staging_url; ///< URL to access compiled wheel packages (Unused) - char *build_dir; ///< Base path to store source code and recipes - char *build_recipes_dir; ///< Path to store conda recipes - char *build_sources_dir; ///< Path to store source code - char *build_testing_dir; ///< Path to store test data (Unused) - char *build_docker_dir; ///< Path to store docker build script - } storage; - - /*! \struct Meta - * \brief Metadata related to the delivery - */ - struct Meta { - char *name; ///< delivery name - char *version; ///< delivery version - int rc; ///< build iteration - char *python; ///< version of python to use - char *python_compact; ///< shortened python identifier - char *based_on; ///< URL to previous final configuration - char *mission; ///< hst, jwst, roman - char *codename; ///< HST uses codenames - bool final; ///< is this a final release? - } meta; - - /*! \struct Info - * \brief Release information (name & datetime) - */ - struct Info { - char *release_name; ///< The fully combined release string - char *build_name; - char *build_number; - struct tm *time_info; ///< Delivery time structure - time_t time_now; ///< Time stamp for when OMC execution started - char *time_str_epoch; ///< String representation of Unix epoch - } info; - - /*! \struct Conda - * \brief Conda configuration - * - * This includes lists describing packages to be delivered - */ - struct Conda { - char *installer_baseurl; ///< URL describing where Conda will be downloaded from - char *installer_name; ///< Name of installer (Miniconda3, Miniforge3, etc) - char *installer_version; ///< Version of installer - char *installer_platform; ///< Platform/OS target of installer - char *installer_arch; ///< CPU architecture target of installer - char *installer_path; ///< Absolute path of installer on-disk - char *tool_version; ///< Installed version of conda - char *tool_build_version; ///< Installed version of "build" package - struct StrList *conda_packages; ///< Conda packages to deliver - struct StrList *conda_packages_defer; ///< Conda recipes to be built for delivery - struct StrList *pip_packages; ///< Python packages to install (pip) - struct StrList *pip_packages_defer; ///< Python packages to be built for delivery - struct StrList *wheels_packages; ///< Wheel packages built for delivery - } conda; - - /*! \struct Runtime - * \brief Global runtime variables - */ - struct Runtime { - RuntimeEnv *environ; ///< Environment variables - } runtime; - - /*! \struct Test - * \brief Test information - */ - struct Test { - char *name; ///< Name of package - char *version; ///< Version of package - char *repository; ///< Git repository of package - char *script; ///< Commands to execute - char *build_recipe; ///< Conda recipe to build (optional) - char *repository_info_ref; ///< Git commit hash - char *repository_info_tag; ///< Git tag (first parent) - struct StrList *repository_remove_tags; ///< Git tags to remove (to fix duplicate commit tags) - struct Runtime runtime; ///< Environment variables specific to the test context - } tests[1000]; ///< An array of tests - - struct Deploy { - struct JFRT_Auth jfrog_auth; - - struct JFrog { - struct StrList *files; - struct JFRT_Upload upload_ctx; - char *repo; - char *dest; - } jfrog[1000]; - - struct Docker { - struct DockerCapabilities capabilities; - char *image_compression; - char *dockerfile; - char *registry; - char *test_script; - struct StrList *build_args; - struct StrList *tags; - } docker; - } deploy; - - struct Rule { - struct INIFILE *_handle; - bool enable_final; ///< true=allow rc value replacement, false=keep rc value even if final release - char *release_fmt; ///< Release format string - char *build_name_fmt; ///< Build name format string - char *build_number_fmt; ///< Build number format string - struct Content content[1000]; - } rules; -}; - -/** - * Initializes a Deliver structure - * @param ctx pointer to Delivery context - * @param ini pointer to INIFILE describing a delivery - * @param cfg pointer to INIFILE describing extra configuration data - * @return `0` on success - * @return Non-zero on error - */ -int delivery_init(struct Delivery *ctx); - -/** - * Free memory allocated by delivery_init() - * @param ctx pointer to Delivery context - */ -void delivery_free(struct Delivery *ctx); - -/** - * Print Delivery metadata - * @param ctx pointer to Delivery context - */ -void delivery_meta_show(struct Delivery *ctx); - -/** - * Print Delivery conda configuration - * @param ctx pointer to Delivery context - */ -void delivery_conda_show(struct Delivery *ctx); - -/** - * Print Delivery tests - * @param ctx pointer to Delivery context - */ -void delivery_tests_show(struct Delivery *ctx); - -/** - * Print Delivery initial runtime environment - * @param ctx pointner to Delivery context - */ -void delivery_runtime_show(struct Delivery *ctx); - -/** - * Build Conda recipes associated with the Delivery - * @param ctx pointer to Delivery context - * @return 0 on success - * @return Non-zero on error - */ -int delivery_build_recipes(struct Delivery *ctx); - -/** - * Produce a list of wheels built for the Delivery (Unused) - * @param ctx pointer to Delivery context - * @return pointer to StrList - * @return NULL on error - */ -struct StrList *delivery_build_wheels(struct Delivery *ctx); - -/** - * Copy wheel packages to artifact storage - * @param ctx pointer to Delivery context - * @return 0 on success - * @return Non-zero on error - */ -int delivery_index_wheel_artifacts(struct Delivery *ctx); - -/** - * Generate a header block that is applied to delivery artifacts - * @param ctx pointer to Delivery context - * @return header on success - * @return NULL on error - */ -char *delivery_get_release_header(struct Delivery *ctx); - -/** - * Finalizes a delivery artifact for distribution - * @param ctx poitner to Delivery context - * @param filename path to delivery artifact (Conda YAML file) - */ -void delivery_rewrite_spec(struct Delivery *ctx, char *filename, unsigned stage); - -/** - * Copy compiled wheels to artifact storage - * @param ctx pointer to Delivery context - * @return 0 on success - * @return Non-zero on error - */ -int delivery_copy_wheel_artifacts(struct Delivery *ctx); - -/** - * Copy built Conda packages to artifact storage - * @param ctx poitner to Delivery context - * @return 0 on success - * @return Non-zero on error - */ -int delivery_copy_conda_artifacts(struct Delivery *ctx); - -/** - * Retrieve Conda installer - * @param installer_url URL to installation script - */ -int delivery_get_installer(struct Delivery *ctx, char *installer_url); - -/** - * Generate URL based on Delivery context - * @param ctx pointer to Delivery context - * @param result pointer to char - * @return in result - */ -void delivery_get_installer_url(struct Delivery *ctx, char *result); - -/** - * Install packages based on Delivery context - * @param ctx pointer to Delivery context - * @param conda_install_dir path to install Conda - * @param env_name name of Conda environment to create - * @param type INSTALL_PKG_CONDA - * @param type INSTALL_PKG_CONDA_DEFERRED - * @param type INSTALL_PKG_PIP - * @param type INSTALL_PKG_PIP_DEFERRED - * @param manifest pointer to array of StrList (package list(s)) - */ -int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, char *env_name, int type, struct StrList *manifest[]); - -/** - * Update "conda index" on Conda artifact storage - * @param ctx pointer to Delivery context - * @return 0 on success - * @return Non-zero on error - */ -int delivery_index_conda_artifacts(struct Delivery *ctx); - -/** - * Execute Delivery test array - * @param ctx pointer to Delivery context - */ -void delivery_tests_run(struct Delivery *ctx); - -/** - * Determine which packages are to be installed directly from conda or pip, - * and which packages need to be built locally - * @param ctx pointer to Delivery context - * @param type DEFER_CONDA (filter conda packages) - * @param type DEFER_PIP (filter python packages) - */ -void delivery_defer_packages(struct Delivery *ctx, int type); - -/** - * Configure and activate a Conda installation based on Delivery context - * @param ctx pointer to Delivery context - * @param conda_install_dir path to Conda installation - */ -void delivery_conda_enable(struct Delivery *ctx, char *conda_install_dir); - -/** - * Install Conda - * @param install_script path to Conda installation script - * @param conda_install_dir path to install Conda - */ -void delivery_install_conda(char *install_script, char *conda_install_dir); - -/** - * Generate a formatted release string - * - * Formatters: - * - * - `%%n` = Delivery Name - * - `%%c` = Delivery Codename (HST mission, only) - * - `%%m` = Mission - * - `%%R` = Delivery Revision number (or "final") - * - `%%r` = Delivery Revision number - * - `%%v` = Delivery Version - * - `%%P` = Python version (i.e. 3.9.1) - * - `%%p` = Compact Python version (i.e. 3.9.1 -> 39) - * - `%%a` = System architecture name - * - `%%o` = System platform name - * - `%%t` = Delivery timestamp (Unix Epoch) - * - * @param ctx pointer to Delivery context - * @param dest NULL pointer to string, or initialized string - * @param fmt release format string - * @return 0 on success, -1 on error - */ -int delivery_format_str(struct Delivery *ctx, char **dest, const char *fmt); - -// helper function -void delivery_gather_tool_versions(struct Delivery *ctx); - -// helper function -int delivery_init_tmpdir(struct Delivery *ctx); - -int delivery_init_artifactory(struct Delivery *ctx); - -int delivery_artifact_upload(struct Delivery *ctx); - -int delivery_mission_render_files(struct Delivery *ctx); - -int delivery_docker(struct Delivery *ctx); - -int delivery_fixup_test_results(struct Delivery *ctx); - -int *bootstrap_build_info(struct Delivery *ctx); - -int delivery_dump_metadata(struct Delivery *ctx); - -#endif //OMC_DELIVERABLE_H diff --git a/include/delivery.h b/include/delivery.h new file mode 100644 index 0000000..971705f --- /dev/null +++ b/include/delivery.h @@ -0,0 +1,394 @@ +/// @file delivery.h + +#ifndef STASIS_DELIVERY_H +#define STASIS_DELIVERY_H + +#include +#include +#include +#include +#include "core.h" + +#define DELIVERY_PLATFORM_MAX 4 +#define DELIVERY_PLATFORM_MAXLEN 65 +#define DELIVERY_PLATFORM 0 +#define DELIVERY_PLATFORM_CONDA_SUBDIR 1 +#define DELIVERY_PLATFORM_CONDA_INSTALLER 2 +#define DELIVERY_PLATFORM_RELEASE 3 + +#define DELIVERY_REWRITE_SPEC_STAGE_1 0 +#define DELIVERY_REWRITE_SPEC_STAGE_2 1 + +#define INSTALL_PKG_CONDA 1 << 1 ///< Toggle conda package installation +#define INSTALL_PKG_CONDA_DEFERRED 1 << 2 ///< Toggle deferred conda package installation +#define INSTALL_PKG_PIP 1 << 3 ///< Toggle pip package installation +#define INSTALL_PKG_PIP_DEFERRED 1 << 4 ///< Toggle deferred package installation from source + +#define DEFER_CONDA 0 ///< Build conda packages +#define DEFER_PIP 1 ///< Build python packages + +struct Content { + unsigned type; + char *filename; + char *data; +}; + +/*! \struct Delivery + * \brief A structure describing a full delivery object + */ +struct Delivery { + /*! \struct STASIS_INI_FP + * \brief Container for INIFILE handles + */ + struct STASIS_INI_FP { + struct INIFILE *delivery; + struct INIFILE *cfg; + struct INIFILE *mission; + char *delivery_path; + char *cfg_path; + char *mission_path; + } _stasis_ini_fp; + + /*! \struct System + * \brief System information + */ + struct System { + char *arch; + ///< System CPU architecture ident + char **platform; + ///< System platform name + } system; + /*! \struct Storage + * \brief Storage paths + */ + struct Storage { + char *root; ///< Top-level storage area + char *tmpdir; ///< Temporary storage area (within root) + char *output_dir; ///< Base path to where all artifacts are stored + char *delivery_dir; ///< Delivery artifact output directory + char *cfgdump_dir; ///< Base path to where input configuration dumps are stored + char *tools_dir; ///< Tools storage + char *mission_dir; ///< Mission data storage + char *package_dir; ///< Base path to where all packages are stored + char *results_dir; ///< Base path to where test results are stored + char *meta_dir; ///< Base path to where metadata records are stored + char *conda_install_prefix; ///< Path to install Conda + char *conda_artifact_dir; ///< Base path to store compiled conda packages + char *conda_staging_dir; ///< Base path to copy compiled conda packages + char *conda_staging_url; ///< URL to access compiled conda packages + char *docker_artifact_dir; ///< Base path to store saved docker images + char *wheel_artifact_dir; ///< Base path to store compiled wheel packages (Unused) + char *wheel_staging_dir; ///< Base path to copy compiled wheel packages (Unused) + char *wheel_staging_url; ///< URL to access compiled wheel packages (Unused) + char *build_dir; ///< Base path to store source code and recipes + char *build_recipes_dir; ///< Path to store conda recipes + char *build_sources_dir; ///< Path to store source code + char *build_testing_dir; ///< Path to store test data (Unused) + char *build_docker_dir; ///< Path to store docker build script + } storage; + + /*! \struct Meta + * \brief Metadata related to the delivery + */ + struct Meta { + char *name; ///< delivery name + char *version; ///< delivery version + int rc; ///< build iteration + char *python; ///< version of python to use + char *python_compact; ///< shortened python identifier + char *based_on; ///< URL to previous final configuration + char *mission; ///< hst, jwst, roman + char *codename; ///< HST uses codenames + bool final; ///< is this a final release? + } meta; + + /*! \struct Info + * \brief Release information (name & datetime) + */ + struct Info { + char *release_name; ///< The fully combined release string + char *build_name; + char *build_number; + struct tm *time_info; ///< Delivery time structure + time_t time_now; ///< Time stamp for when STASIS execution started + char *time_str_epoch; ///< String representation of Unix epoch + } info; + + /*! \struct Conda + * \brief Conda configuration + * + * This includes lists describing packages to be delivered + */ + struct Conda { + char *installer_baseurl; ///< URL describing where Conda will be downloaded from + char *installer_name; ///< Name of installer (Miniconda3, Miniforge3, etc) + char *installer_version; ///< Version of installer + char *installer_platform; ///< Platform/OS target of installer + char *installer_arch; ///< CPU architecture target of installer + char *installer_path; ///< Absolute path of installer on-disk + char *tool_version; ///< Installed version of conda + char *tool_build_version; ///< Installed version of "build" package + struct StrList *conda_packages; ///< Conda packages to deliver + struct StrList *conda_packages_defer; ///< Conda recipes to be built for delivery + struct StrList *pip_packages; ///< Python packages to install (pip) + struct StrList *pip_packages_defer; ///< Python packages to be built for delivery + struct StrList *wheels_packages; ///< Wheel packages built for delivery + } conda; + + /*! \struct Runtime + * \brief Global runtime variables + */ + struct Runtime { + RuntimeEnv *environ; ///< Environment variables + } runtime; + + /*! \struct Test + * \brief Test information + */ + struct Test { + char *name; ///< Name of package + char *version; ///< Version of package + char *repository; ///< Git repository of package + char *script; ///< Commands to execute + char *build_recipe; ///< Conda recipe to build (optional) + char *repository_info_ref; ///< Git commit hash + char *repository_info_tag; ///< Git tag (first parent) + struct StrList *repository_remove_tags; ///< Git tags to remove (to fix duplicate commit tags) + struct Runtime runtime; ///< Environment variables specific to the test context + } tests[1000]; ///< An array of tests + + struct Deploy { + struct JFRT_Auth jfrog_auth; + + struct JFrog { + struct StrList *files; + struct JFRT_Upload upload_ctx; + char *repo; + char *dest; + } jfrog[1000]; + + struct Docker { + struct DockerCapabilities capabilities; + char *image_compression; + char *dockerfile; + char *registry; + char *test_script; + struct StrList *build_args; + struct StrList *tags; + } docker; + } deploy; + + struct Rule { + struct INIFILE *_handle; + bool enable_final; ///< true=allow rc value replacement, false=keep rc value even if final release + char *release_fmt; ///< Release format string + char *build_name_fmt; ///< Build name format string + char *build_number_fmt; ///< Build number format string + struct Content content[1000]; + } rules; +}; + +/** + * Initializes a Deliver structure + * @param ctx pointer to Delivery context + * @param ini pointer to INIFILE describing a delivery + * @param cfg pointer to INIFILE describing extra configuration data + * @return `0` on success + * @return Non-zero on error + */ +int delivery_init(struct Delivery *ctx); + +/** + * Free memory allocated by delivery_init() + * @param ctx pointer to Delivery context + */ +void delivery_free(struct Delivery *ctx); + +/** + * Print Delivery metadata + * @param ctx pointer to Delivery context + */ +void delivery_meta_show(struct Delivery *ctx); + +/** + * Print Delivery conda configuration + * @param ctx pointer to Delivery context + */ +void delivery_conda_show(struct Delivery *ctx); + +/** + * Print Delivery tests + * @param ctx pointer to Delivery context + */ +void delivery_tests_show(struct Delivery *ctx); + +/** + * Print Delivery initial runtime environment + * @param ctx pointner to Delivery context + */ +void delivery_runtime_show(struct Delivery *ctx); + +/** + * Build Conda recipes associated with the Delivery + * @param ctx pointer to Delivery context + * @return 0 on success + * @return Non-zero on error + */ +int delivery_build_recipes(struct Delivery *ctx); + +/** + * Produce a list of wheels built for the Delivery (Unused) + * @param ctx pointer to Delivery context + * @return pointer to StrList + * @return NULL on error + */ +struct StrList *delivery_build_wheels(struct Delivery *ctx); + +/** + * Copy wheel packages to artifact storage + * @param ctx pointer to Delivery context + * @return 0 on success + * @return Non-zero on error + */ +int delivery_index_wheel_artifacts(struct Delivery *ctx); + +/** + * Generate a header block that is applied to delivery artifacts + * @param ctx pointer to Delivery context + * @return header on success + * @return NULL on error + */ +char *delivery_get_release_header(struct Delivery *ctx); + +/** + * Finalizes a delivery artifact for distribution + * @param ctx poitner to Delivery context + * @param filename path to delivery artifact (Conda YAML file) + */ +void delivery_rewrite_spec(struct Delivery *ctx, char *filename, unsigned stage); + +/** + * Copy compiled wheels to artifact storage + * @param ctx pointer to Delivery context + * @return 0 on success + * @return Non-zero on error + */ +int delivery_copy_wheel_artifacts(struct Delivery *ctx); + +/** + * Copy built Conda packages to artifact storage + * @param ctx poitner to Delivery context + * @return 0 on success + * @return Non-zero on error + */ +int delivery_copy_conda_artifacts(struct Delivery *ctx); + +/** + * Retrieve Conda installer + * @param installer_url URL to installation script + */ +int delivery_get_installer(struct Delivery *ctx, char *installer_url); + +/** + * Generate URL based on Delivery context + * @param ctx pointer to Delivery context + * @param result pointer to char + * @return in result + */ +void delivery_get_installer_url(struct Delivery *ctx, char *result); + +/** + * Install packages based on Delivery context + * @param ctx pointer to Delivery context + * @param conda_install_dir path to install Conda + * @param env_name name of Conda environment to create + * @param type INSTALL_PKG_CONDA + * @param type INSTALL_PKG_CONDA_DEFERRED + * @param type INSTALL_PKG_PIP + * @param type INSTALL_PKG_PIP_DEFERRED + * @param manifest pointer to array of StrList (package list(s)) + */ +int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, char *env_name, int type, struct StrList *manifest[]); + +/** + * Update "conda index" on Conda artifact storage + * @param ctx pointer to Delivery context + * @return 0 on success + * @return Non-zero on error + */ +int delivery_index_conda_artifacts(struct Delivery *ctx); + +/** + * Execute Delivery test array + * @param ctx pointer to Delivery context + */ +void delivery_tests_run(struct Delivery *ctx); + +/** + * Determine which packages are to be installed directly from conda or pip, + * and which packages need to be built locally + * @param ctx pointer to Delivery context + * @param type DEFER_CONDA (filter conda packages) + * @param type DEFER_PIP (filter python packages) + */ +void delivery_defer_packages(struct Delivery *ctx, int type); + +/** + * Configure and activate a Conda installation based on Delivery context + * @param ctx pointer to Delivery context + * @param conda_install_dir path to Conda installation + */ +void delivery_conda_enable(struct Delivery *ctx, char *conda_install_dir); + +/** + * Install Conda + * @param install_script path to Conda installation script + * @param conda_install_dir path to install Conda + */ +void delivery_install_conda(char *install_script, char *conda_install_dir); + +/** + * Generate a formatted release string + * + * Formatters: + * + * - `%%n` = Delivery Name + * - `%%c` = Delivery Codename (HST mission, only) + * - `%%m` = Mission + * - `%%R` = Delivery Revision number (or "final") + * - `%%r` = Delivery Revision number + * - `%%v` = Delivery Version + * - `%%P` = Python version (i.e. 3.9.1) + * - `%%p` = Compact Python version (i.e. 3.9.1 -> 39) + * - `%%a` = System architecture name + * - `%%o` = System platform name + * - `%%t` = Delivery timestamp (Unix Epoch) + * + * @param ctx pointer to Delivery context + * @param dest NULL pointer to string, or initialized string + * @param fmt release format string + * @return 0 on success, -1 on error + */ +int delivery_format_str(struct Delivery *ctx, char **dest, const char *fmt); + +// helper function +void delivery_gather_tool_versions(struct Delivery *ctx); + +// helper function +int delivery_init_tmpdir(struct Delivery *ctx); + +int delivery_init_artifactory(struct Delivery *ctx); + +int delivery_artifact_upload(struct Delivery *ctx); + +int delivery_mission_render_files(struct Delivery *ctx); + +int delivery_docker(struct Delivery *ctx); + +int delivery_fixup_test_results(struct Delivery *ctx); + +int *bootstrap_build_info(struct Delivery *ctx); + +int delivery_dump_metadata(struct Delivery *ctx); + +#endif //STASIS_DELIVERY_H diff --git a/include/docker.h b/include/docker.h index a5fdbc4..ff8a8d5 100644 --- a/include/docker.h +++ b/include/docker.h @@ -1,17 +1,17 @@ //! @file docker.h -#ifndef OMC_DOCKER_H -#define OMC_DOCKER_H +#ifndef STASIS_DOCKER_H +#define STASIS_DOCKER_H //! Flag to squelch output from docker_exec() -#define OMC_DOCKER_QUIET 1 << 1 +#define STASIS_DOCKER_QUIET 1 << 1 //! Flag for older style docker build -#define OMC_DOCKER_BUILD 1 << 1 +#define STASIS_DOCKER_BUILD 1 << 1 //! Flag for docker buildx -#define OMC_DOCKER_BUILD_X 1 << 2 +#define STASIS_DOCKER_BUILD_X 1 << 2 //! Compress "docker save"ed images with a compression program -#define OMC_DOCKER_IMAGE_COMPRESSION "zstd" +#define STASIS_DOCKER_IMAGE_COMPRESSION "zstd" struct DockerCapabilities { int podman; //!< Is "docker" really podman? @@ -42,7 +42,7 @@ int docker_capable(struct DockerCapabilities *result); /** * Execute a docker command * - * Use the `OMC_DOCKER_QUIET` flag to suppress all output from stdout and stderr. + * Use the `STASIS_DOCKER_QUIET` flag to suppress all output from stdout and stderr. * * ```c * if (docker_exec("run --rm -t ubuntu:latest /bin/bash -c 'echo Hello world'", 0)) { @@ -87,4 +87,4 @@ void docker_sanitize_tag(char *str); int docker_validate_compression_program(char *prog); -#endif //OMC_DOCKER_H +#endif //STASIS_DOCKER_H diff --git a/include/download.h b/include/download.h index 568809e..058812e 100644 --- a/include/download.h +++ b/include/download.h @@ -1,10 +1,10 @@ //! @file download.h -#ifndef OMC_DOWNLOAD_H -#define OMC_DOWNLOAD_H +#ifndef STASIS_DOWNLOAD_H +#define STASIS_DOWNLOAD_H #include size_t download_writer(void *fp, size_t size, size_t nmemb, void *stream); long download(char *url, const char *filename, char **errmsg); -#endif //OMC_DOWNLOAD_H +#endif //STASIS_DOWNLOAD_H diff --git a/include/environment.h b/include/environment.h index 484f02c..34bc600 100644 --- a/include/environment.h +++ b/include/environment.h @@ -1,8 +1,8 @@ /** * @file environment.h */ -#ifndef OMC_ENVIRONMENT_H -#define OMC_ENVIRONMENT_H +#ifndef STASIS_ENVIRONMENT_H +#define STASIS_ENVIRONMENT_H #include #include @@ -20,4 +20,4 @@ char *runtime_expand_var(RuntimeEnv *env, char *input); void runtime_export(RuntimeEnv *env, char **keys); void runtime_apply(RuntimeEnv *env); void runtime_free(RuntimeEnv *env); -#endif //OMC_ENVIRONMENT_H +#endif //STASIS_ENVIRONMENT_H diff --git a/include/ini.h b/include/ini.h index 022a066..af2639b 100644 --- a/include/ini.h +++ b/include/ini.h @@ -1,7 +1,7 @@ /// @file ini.h -#ifndef OMC_INI_H -#define OMC_INI_H +#ifndef STASIS_INI_H +#define STASIS_INI_H #include #include @@ -217,4 +217,4 @@ int ini_write(struct INIFILE *ini, FILE **stream, unsigned mode); * @param ini */ void ini_free(struct INIFILE **ini); -#endif //OMC_INI_H +#endif //STASIS_INI_H diff --git a/include/junitxml.h b/include/junitxml.h index 2d94eb8..504b8e4 100644 --- a/include/junitxml.h +++ b/include/junitxml.h @@ -1,6 +1,6 @@ /// @file junitxml.h -#ifndef OMC_JUNITXML_H -#define OMC_JUNITXML_H +#ifndef STASIS_JUNITXML_H +#define STASIS_JUNITXML_H #include #define JUNIT_RESULT_STATE_NONE 0 @@ -132,4 +132,4 @@ struct JUNIT_Testsuite *junitxml_testsuite_read(const char *filename); */ void junitxml_testsuite_free(struct JUNIT_Testsuite **testsuite); -#endif //OMC_JUNITXML_H +#endif //STASIS_JUNITXML_H diff --git a/include/omc.h b/include/omc.h deleted file mode 100644 index e728207..0000000 --- a/include/omc.h +++ /dev/null @@ -1,99 +0,0 @@ -//! @file omc.h -#ifndef OMC_OMC_H -#define OMC_OMC_H - -#include -#include -#include -#include -#include -#include -#include - -#define SYSERROR(MSG, ...) do { \ - fprintf(stderr, "%s:%s:%d:%s - ", path_basename(__FILE__), __FUNCTION__, __LINE__, strerror(errno) ? "info" : strerror(errno)); \ - fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \ -} while (0) -#define OMC_BUFSIZ 8192 -#define OMC_NAME_MAX 255 -#define OMC_DIRSTACK_MAX 1024 -#define OMC_TIME_STR_MAX 128 -#define HTTP_ERROR(X) X >= 400 - -#include "config.h" -#include "template.h" -#include "utils.h" -#include "copy.h" -#include "ini.h" -#include "conda.h" -#include "environment.h" -#include "artifactory.h" -#include "docker.h" -#include "deliverable.h" -#include "str.h" -#include "strlist.h" -#include "system.h" -#include "download.h" -#include "recipe.h" -#include "relocation.h" -#include "wheel.h" -#include "junitxml.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) -#define guard_free(X) do { if (X) { free(X); X = NULL; } } while (0) -#define GENERIC_ARRAY_FREE(ARR) do { \ - for (size_t ARR_I = 0; ARR && ARR[ARR_I] != NULL; ARR_I++) { \ - guard_free(ARR[ARR_I]); \ - } \ - guard_free(ARR); \ -} while (0) - -#define COE_CHECK_ABORT(COND, MSG) \ - do {\ - if (!globals.continue_on_error && COND) { \ - msg(OMC_MSG_ERROR, MSG ": Aborting execution (--continue-on-error/-C is not enabled)\n"); \ - exit(1); \ - } \ - } while (0) - -struct OMC_GLOBAL { - bool verbose; //!< Enable verbose output - bool always_update_base_environment; //!< Update base environment immediately after activation - bool continue_on_error; //!< Do not stop on test failures - bool conda_fresh_start; //!< Always install a new copy of Conda - bool enable_docker; //!< Enable docker image builds - bool enable_artifactory; //!< Enable artifactory uploads - bool enable_testing; //!< Enable package testing - 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 - char *conda_install_prefix; //!< Path to install conda - char *sysconfdir; //!< Path where OMC reads its configuration files (mission directory, etc) - struct { - char *tox_posargs; - } workaround; - struct Jfrog { - char *jfrog_artifactory_base_url; - char *jfrog_artifactory_product; - char *cli_major_ver; - char *version; - char *os; - char *arch; - char *remote_filename; - char *repo; - char *url; - } jfrog; -}; -extern struct OMC_GLOBAL globals; -extern const char *VERSION; -extern const char *AUTHOR; -extern const char *BANNER; - - -/** - * Free memory allocated in global configuration structure - */ -void globals_free(); - -#endif //OMC_OMC_H diff --git a/include/os_darwin.h b/include/os_darwin.h index 390968c..e8513ff 100644 --- a/include/os_darwin.h +++ b/include/os_darwin.h @@ -1,5 +1,5 @@ -#ifndef OMC_OS_DARWIN_H -#define OMC_OS_DARWIN_H +#ifndef STASIS_OS_DARWIN_H +#define STASIS_OS_DARWIN_H #include diff --git a/include/os_linux.h b/include/os_linux.h index 8c3aed7..d418090 100644 --- a/include/os_linux.h +++ b/include/os_linux.h @@ -1,5 +1,5 @@ -#ifndef OMC_OS_LINUX_H -#define OMC_OS_LINUX_H +#ifndef STASIS_OS_LINUX_H +#define STASIS_OS_LINUX_H #include diff --git a/include/recipe.h b/include/recipe.h index f1b4df1..4dea248 100644 --- a/include/recipe.h +++ b/include/recipe.h @@ -1,6 +1,6 @@ //! @file recipe.h -#ifndef OMC_RECIPE_H -#define OMC_RECIPE_H +#ifndef STASIS_RECIPE_H +#define STASIS_RECIPE_H #include "str.h" #include "utils.h" @@ -69,4 +69,4 @@ int recipe_clone(char *recipe_dir, char *url, char *gitref, char **result); */ int recipe_get_type(char *repopath); -#endif //OMC_RECIPE_H +#endif //STASIS_RECIPE_H diff --git a/include/relocation.h b/include/relocation.h index 924f00f..9a1f0f4 100644 --- a/include/relocation.h +++ b/include/relocation.h @@ -1,15 +1,15 @@ /** * @file relocation.h */ -#ifndef OMC_RELOCATION_H -#define OMC_RELOCATION_H +#ifndef STASIS_RELOCATION_H +#define STASIS_RELOCATION_H #include "config.h" #include #include #include -#if defined(OMC_OS_DARWIN) +#if defined(STASIS_OS_DARWIN) #include # else #include @@ -21,4 +21,4 @@ int replace_text(char *original, const char *target, const char *replacement, unsigned flags); int file_replace_text(const char* filename, const char* target, const char* replacement, unsigned flags); -#endif //OMC_RELOCATION_H +#endif //STASIS_RELOCATION_H diff --git a/include/rules.h b/include/rules.h index 63eade7..666d331 100644 --- a/include/rules.h +++ b/include/rules.h @@ -2,10 +2,10 @@ // Created by jhunk on 12/18/23. // -#ifndef OMC_RULES_H -#define OMC_RULES_H +#ifndef STASIS_RULES_H +#define STASIS_RULES_H -#include "omc.h" +#include "core.h" -#endif //OMC_RULES_H +#endif //STASIS_RULES_H diff --git a/include/str.h b/include/str.h index 595a055..4cf221d 100644 --- a/include/str.h +++ b/include/str.h @@ -1,20 +1,20 @@ /** * @file str.h */ -#ifndef OMC_STR_H -#define OMC_STR_H +#ifndef STASIS_STR_H +#define STASIS_STR_H #include #include #include #include #include -#include "omc.h" +#include "core.h" -#define OMC_SORT_ALPHA 1 << 0 -#define OMC_SORT_NUMERIC 1 << 1 -#define OMC_SORT_LEN_ASCENDING 1 << 2 -#define OMC_SORT_LEN_DESCENDING 1 << 3 +#define STASIS_SORT_ALPHA 1 << 0 +#define STASIS_SORT_NUMERIC 1 << 1 +#define STASIS_SORT_LEN_ASCENDING 1 << 2 +#define STASIS_SORT_LEN_DESCENDING 1 << 3 /** * Determine how many times the character `ch` appears in `sptr` string @@ -115,10 +115,10 @@ char *substring_between(char *sptr, const char *delims); * Sort an array of strings * @param arr a NULL terminated array of strings * @param sort_mode - * - OMC_SORT_LEN_DESCENDING - * - OMC_SORT_LEN_ASCENDING - * - OMC_SORT_ALPHA - * - OMC_SORT_NUMERIC + * - STASIS_SORT_LEN_DESCENDING + * - STASIS_SORT_LEN_ASCENDING + * - STASIS_SORT_ALPHA + * - STASIS_SORT_NUMERIC */ void strsort(char **arr, unsigned int sort_mode); @@ -307,4 +307,4 @@ char *tolower_s(char *s); */ char *to_short_version(const char *s); -#endif //OMC_STR_H +#endif //STASIS_STR_H diff --git a/include/strlist.h b/include/strlist.h index 3f35e23..dd22a0a 100644 --- a/include/strlist.h +++ b/include/strlist.h @@ -2,8 +2,8 @@ * String array convenience functions * @file strlist.h */ -#ifndef OMC_STRLIST_H -#define OMC_STRLIST_H +#ifndef STASIS_STRLIST_H +#define STASIS_STRLIST_H #include #include "utils.h" #include "str.h" @@ -52,4 +52,4 @@ extern int strlist_errno; const char *strlist_get_error(int flag); -#endif //OMC_STRLIST_H +#endif //STASIS_STRLIST_H diff --git a/include/system.h b/include/system.h index 94d5a36..7019b92 100644 --- a/include/system.h +++ b/include/system.h @@ -2,8 +2,8 @@ * System functions * @file system.h */ -#ifndef OMC_SYSTEM_H -#define OMC_SYSTEM_H +#ifndef STASIS_SYSTEM_H +#define STASIS_SYSTEM_H #include #include @@ -14,7 +14,7 @@ #include #include -#define OMC_SHELL_SAFE_RESTRICT ";&|()" +#define STASIS_SHELL_SAFE_RESTRICT ";&|()" struct Process { // Write stdout stream to file @@ -31,4 +31,4 @@ int shell(struct Process *proc, char *args); int shell_safe(struct Process *proc, char *args); char *shell_output(const char *command, int *status); -#endif //OMC_SYSTEM_H +#endif //STASIS_SYSTEM_H diff --git a/include/template.h b/include/template.h index 362eb3d..ba62667 100644 --- a/include/template.h +++ b/include/template.h @@ -1,8 +1,8 @@ //! @file template.h -#ifndef OMC_TEMPLATE_H -#define OMC_TEMPLATE_H +#ifndef STASIS_TEMPLATE_H +#define STASIS_TEMPLATE_H -#include "omc.h" +#include "core.h" /** * Map a text value to a pointer in memory @@ -64,4 +64,4 @@ struct tplfunc_frame { }; void tpl_register_func(char *key, struct tplfunc_frame *frame); -#endif //OMC_TEMPLATE_H +#endif //STASIS_TEMPLATE_H diff --git a/include/utils.h b/include/utils.h index 8840a0d..2c80e77 100644 --- a/include/utils.h +++ b/include/utils.h @@ -1,6 +1,6 @@ //! @file utils.h -#ifndef OMC_UTILS_H -#define OMC_UTILS_H +#ifndef STASIS_UTILS_H +#define STASIS_UTILS_H #include #include #include @@ -10,7 +10,7 @@ #include #include "system.h" -#if defined(OMC_OS_WINDOWS) +#if defined(STASIS_OS_WINDOWS) #define PATH_ENV_VAR "path" #define DIR_SEP "\\" #define PATH_SEP ";" @@ -22,8 +22,8 @@ #define LINE_SEP "\n" #endif -#define OMC_XML_PRETTY_PRINT_PROG "xmllint" -#define OMC_XML_PRETTY_PRINT_ARGS "--format" +#define STASIS_XML_PRETTY_PRINT_PROG "xmllint" +#define STASIS_XML_PRETTY_PRINT_ARGS "--format" typedef int (ReaderFn)(size_t line, char **); @@ -167,7 +167,7 @@ char *git_describe(const char *path); char *git_rev_parse(const char *path, char *args); /** - * Helper function to initialize simple OMC internal path strings + * Helper function to initialize simple STASIS internal path strings * * ```c * char *mypath = NULL; @@ -188,43 +188,43 @@ char *git_rev_parse(const char *path, char *args); */ int path_store(char **destptr, size_t maxlen, const char *base, const char *path); -#if defined(OMC_DUMB_TERMINAL) -#define OMC_COLOR_RED "" -#define OMC_COLOR_GREEN "" -#define OMC_COLOR_YELLOW "" -#define OMC_COLOR_BLUE "" -#define OMC_COLOR_WHITE "" -#define OMC_COLOR_RESET "" +#if defined(STASIS_DUMB_TERMINAL) +#define STASIS_COLOR_RED "" +#define STASIS_COLOR_GREEN "" +#define STASIS_COLOR_YELLOW "" +#define STASIS_COLOR_BLUE "" +#define STASIS_COLOR_WHITE "" +#define STASIS_COLOR_RESET "" #else //! Set output color to red -#define OMC_COLOR_RED "\e[1;91m" +#define STASIS_COLOR_RED "\e[1;91m" //! Set output color to green -#define OMC_COLOR_GREEN "\e[1;92m" +#define STASIS_COLOR_GREEN "\e[1;92m" //! Set output color to yellow -#define OMC_COLOR_YELLOW "\e[1;93m" +#define STASIS_COLOR_YELLOW "\e[1;93m" //! Set output color to blue -#define OMC_COLOR_BLUE "\e[1;94m" +#define STASIS_COLOR_BLUE "\e[1;94m" //! Set output color to white -#define OMC_COLOR_WHITE "\e[1;97m" +#define STASIS_COLOR_WHITE "\e[1;97m" //! Reset output color to terminal default -#define OMC_COLOR_RESET "\e[0;37m\e[0m" +#define STASIS_COLOR_RESET "\e[0;37m\e[0m" #endif -#define OMC_MSG_SUCCESS 0 +#define STASIS_MSG_SUCCESS 0 //! Suppress printing of the message text -#define OMC_MSG_NOP 1 << 0 +#define STASIS_MSG_NOP 1 << 0 //! The message is an error -#define OMC_MSG_ERROR 1 << 1 +#define STASIS_MSG_ERROR 1 << 1 //! The message is a warning -#define OMC_MSG_WARN 1 << 2 +#define STASIS_MSG_WARN 1 << 2 //! The message will be indented once -#define OMC_MSG_L1 1 << 3 +#define STASIS_MSG_L1 1 << 3 //! The message will be indented twice -#define OMC_MSG_L2 1 << 4 +#define STASIS_MSG_L2 1 << 4 //! The message will be indented thrice -#define OMC_MSG_L3 1 << 5 +#define STASIS_MSG_L3 1 << 5 //! The message will only be printed in verbose mode -#define OMC_MSG_RESTRICT 1 << 6 +#define STASIS_MSG_RESTRICT 1 << 6 void msg(unsigned type, char *fmt, ...); @@ -278,7 +278,7 @@ int isempty_dir(const char *path); int xml_pretty_print_in_place(const char *filename, const char *pretty_print_prog, const char *pretty_print_args); /** - * Applies OMC fixups to a tox ini config + * Applies STASIS fixups to a tox ini config * @param filename path to tox.ini * @param result path to processed configuration * @return 0 on success, -1 on error @@ -351,4 +351,4 @@ int redact_sensitive(const char **to_redact, size_t to_redact_size, char *src, c */ struct StrList *listdir(const char *path); -#endif //OMC_UTILS_H +#endif //STASIS_UTILS_H diff --git a/include/wheel.h b/include/wheel.h index cca15d4..94cf46a 100644 --- a/include/wheel.h +++ b/include/wheel.h @@ -1,5 +1,5 @@ -#ifndef OMC_WHEEL_H -#define OMC_WHEEL_H +#ifndef STASIS_WHEEL_H +#define STASIS_WHEEL_H #include #include @@ -18,4 +18,4 @@ struct Wheel { }; struct Wheel *get_wheel_file(const char *basepath, const char *name, char *to_match[]); -#endif //OMC_WHEEL_H +#endif //STASIS_WHEEL_H -- cgit