deployd/script/include/stages.h
Arija A. f298495d59
Add extension-path helper, overhaul metadata parsing and integrate stages API
- dirs.c / dirs.h
  - add sh_dirs_get_ext_path() to build extension paths
  - define SH_DIRS_MAX_EXT_PATH for buffer sizing
- metadata.h / metadata.c
  - revamp sh_Metadata_read() to return bool, drop error‑string outparam
  - add SH_METADATA_NEW() and SH_METADATA_FREE()
  - split parsing into helpers (name, extensions, user, groups, target, copy)
  - tighten validation, trimming, uniqueness checks, and error messages
  - rename sh_Metadata_is_full() to sh_Metadata_is_full_script()
- stages.h / stages.c
  - extend sh_find_stages() to take sh_PtrRange* for sysadmin block range
  - refine brace/paren balance, in‑function tracking, EOF error checks
  - improve backtick‑in‑subsidiary parsing error handling
- main.c
  - add sh_load_script() to fread entire script into memory with error checks
  - add sh_read_meta() wrapper to call metadata and stages APIs, free buffer, return proper exit codes
  - include deploy.h and progress printf() calls
- server/main.c
  - insert “TODO: Cron jobs” placeholder

Signed-off-by: Arija A. <ari@ari.lt>
2025-07-27 13:08:39 +03:00

24 lines
809 B
C

#ifndef DEPLOYER_STAGES_H_
#define DEPLOYER_STAGES_H_
#include "conf.h"
#include "def.h"
#define SH_STAGE_PREPARE ((uint8_t)(((uint8_t)1) << ((uint8_t)0)))
#define SH_STAGE_BUILD ((uint8_t)(((uint8_t)1) << ((uint8_t)1)))
#define SH_STAGE_TEST ((uint8_t)(((uint8_t)1) << ((uint8_t)2)))
#define SH_STAGE_CLEANUP ((uint8_t)(((uint8_t)1) << ((uint8_t)3)))
#define SH_STAGE_TEARDOWN ((uint8_t)(((uint8_t)1) << ((uint8_t)4)))
#define SH_STAGE_DEPLOY ((uint8_t)(((uint8_t)1) << ((uint8_t)5)))
#define SH_STAGE_SYSADMIN ((uint8_t)(((uint8_t)1) << ((uint8_t)6)))
#define SH_STAGE_ERROR ((uint8_t)(((uint8_t)1) << ((uint8_t)7)))
typedef struct {
const char *start;
const char *end;
} sh_PtrRange;
uint8_t sh_find_stages(const char *buf, sh_PtrRange *sysadm);
#endif /* DEPLOYER_STAGES_H_ */