From: pcarana Date: Wed, 12 Jun 2019 23:59:36 +0000 (-0500) Subject: Use flag ENABLE_STRICT_STRATEGY to allow strict sync strategy X-Git-Tag: v0.0.2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e0324c6044ace522ed94635a9ea961838a8c820;p=thirdparty%2FFORT-validator.git Use flag ENABLE_STRICT_STRATEGY to allow strict sync strategy --- diff --git a/docs/doc/usage.md b/docs/doc/usage.md index 02d9164c..ee92acf7 100644 --- a/docs/doc/usage.md +++ b/docs/doc/usage.md @@ -185,6 +185,10 @@ Skips all rsyncs. (Validate the existing cache repository pointed by `--local-re #### `strict` +> In order to enable this strategy, recompile using the flag: **_ENABLE\_STRICT\_STRATEGY_**. +> +> e.g. `$ make FORT_FLAGS='-DENABLE_STRICT_STRATEGY'` + rsyncs every repository publication point separately. Only skips publication points that have already been downloaded during the current validation cycle. (Assuming each synchronization is recursive.) For example, suppose the validator gets certificates whose caRepository access methods (in their Subject Information Access extensions) point to the following publication points: diff --git a/man/fort.8 b/man/fort.8 index 2cd36475..41d45179 100644 --- a/man/fort.8 +++ b/man/fort.8 @@ -199,6 +199,10 @@ Skip all RSYNCs. (Validate the existing cache repository pointed by .P .I strict .RS 4 +In order to enable this strategy, FORT must be compiled using the flag: +ENABLE\_STRICT\_STRATEGY. e.g. +\fB $ make FORT_FLAGS='-DENABLE_STRICT_STRATEGY'\fR +.P RSYNC every repository publication point separately. Only skip publication points that have already been downloaded during the current validation cycle. (Assuming each synchronization is recursive.) diff --git a/src/Makefile.am b/src/Makefile.am index 0dd25f35..8ebb8d83 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -98,7 +98,7 @@ fort_SOURCES += slurm/slurm_parser.c slurm/slurm_parser.h fort_CFLAGS = -Wall # Feel free to temporarily remove this one if you're not using gcc 7.3.0. #fort_CFLAGS += $(GCC_WARNS) -fort_CFLAGS += -std=gnu11 -O0 -g $(CFLAGS_DEBUG) +fort_CFLAGS += -std=gnu11 -O0 -g $(CFLAGS_DEBUG) $(FORT_FLAGS) fort_LDFLAGS = $(LDFLAGS_DEBUG) fort_LDADD = ${JANSSON_LIBS} diff --git a/src/config/sync_strategy.c b/src/config/sync_strategy.c index e6b13e48..697d7fde 100644 --- a/src/config/sync_strategy.c +++ b/src/config/sync_strategy.c @@ -14,6 +14,16 @@ #define DEREFERENCE(void_value) (*((enum sync_strategy *) void_value)) +#ifdef ENABLE_STRICT_STRATEGY +#define PRINT_STRICT_ARG_DOC "|" SYNC_VALUE_STRICT +#define HANDLE_SYNC_STRICT DEREFERENCE(result) = SYNC_STRICT; +#else +#define PRINT_STRICT_ARG_DOC +#define HANDLE_SYNC_STRICT \ + return pr_err("Unknown synchronization strategy: '%s'. In order to use it, recompile using flag ENABLE_STRICT_STRATEGY.",\ + str); +#endif + static void print_sync_strategy(struct option_field const *field, void *value) { @@ -44,7 +54,7 @@ parse_argv_sync_strategy(struct option_field const *field, char const *str, if (strcmp(str, SYNC_VALUE_OFF) == 0) DEREFERENCE(result) = SYNC_OFF; else if (strcmp(str, SYNC_VALUE_STRICT) == 0) - DEREFERENCE(result) = SYNC_STRICT; + HANDLE_SYNC_STRICT else if (strcmp(str, SYNC_VALUE_ROOT) == 0) DEREFERENCE(result) = SYNC_ROOT; else if (strcmp(str, SYNC_VALUE_ROOT_EXCEPT_TA) == 0) @@ -73,7 +83,7 @@ const struct global_type gt_sync_strategy = { .parse.argv = parse_argv_sync_strategy, .parse.json = parse_json_sync_strategy, .arg_doc = SYNC_VALUE_OFF - "|" SYNC_VALUE_STRICT + PRINT_STRICT_ARG_DOC "|" SYNC_VALUE_ROOT "|" SYNC_VALUE_ROOT_EXCEPT_TA, }; diff --git a/src/config/sync_strategy.h b/src/config/sync_strategy.h index a41ebc06..2ee8b35f 100644 --- a/src/config/sync_strategy.h +++ b/src/config/sync_strategy.h @@ -22,6 +22,9 @@ enum sync_strategy { * * No risk of downloading unneeded files, but otherwise slow, as every * different repository publication point requires a separate sync call. + * + * In order to enable this strategy, compile using the flag: + * ENABLE_STRICT_STRATEGY */ SYNC_STRICT, /**