From 04b429d064fb2954e768abc8066013ad0faf2729 Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Fri, 5 Jan 2024 14:39:43 -0600 Subject: launch info all in one place TODO: build class path --- src/version.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src/version.c') diff --git a/src/version.c b/src/version.c index af7b56e..e7e064d 100644 --- a/src/version.c +++ b/src/version.c @@ -566,7 +566,7 @@ cleanup: return res; } -unsigned l2_version__collect_libraries(json_t *jlibs, l2_subst_t *subst, struct l2_version_library **libs, l2_version_feature_match_proc_t *feature_matcher); +unsigned l2_version__collect_libraries(json_t *jlibs, l2_subst_t *subst, struct l2_version_library **libs, l2_version_feature_match_proc_t *feature_matcher, void *muser); void l2_version_free_libraries(struct l2_version_library *libs); int l2_version__get_library_artifact_path(json_t *lib, l2_subst_t *subst, const char *classifier, char **path); @@ -901,7 +901,7 @@ cleanup: return res; } -unsigned l2_version_collect_libraries(json_t *version, struct l2_version_library **libs, l2_version_feature_match_proc_t *feature_matcher) +unsigned l2_version_collect_libraries(json_t *version, struct l2_version_library **libs, l2_version_feature_match_proc_t *feature_matcher, void *muser) { json_t *jlibs; unsigned res; @@ -921,7 +921,7 @@ unsigned l2_version_collect_libraries(json_t *version, struct l2_version_library goto cleanup; } - res = l2_version__collect_libraries(jlibs, subst, libs, feature_matcher); + res = l2_version__collect_libraries(jlibs, subst, libs, feature_matcher, muser); cleanup: if (subst) l2_subst_free(subst); @@ -1084,7 +1084,7 @@ cleanup: return res; } -unsigned l2_version__collect_libraries(json_t *jlibs, l2_subst_t *subst, struct l2_version_library **libs, l2_version_feature_match_proc_t *feature_matcher) +unsigned l2_version__collect_libraries(json_t *jlibs, l2_subst_t *subst, struct l2_version_library **libs, l2_version_feature_match_proc_t *feature_matcher, void *muser) { struct l2_version_library *libraries = NULL, *tail = NULL; struct l2_version_library *curlib = NULL; @@ -1104,7 +1104,7 @@ unsigned l2_version__collect_libraries(json_t *jlibs, l2_subst_t *subst, struct json_t *rules = json_object_get(val, "rules"); if (rules) { - applies = l2_version_check_rules(rules, feature_matcher); + applies = l2_version_check_rules(rules, feature_matcher, muser); if (applies == RULE_CHECK_ERROR) { ret = VERSION_EJSON; goto cleanup; @@ -1235,7 +1235,7 @@ int l2_version__whole_string_matches(const char *pattern, const char *subject) return errcode >= 0 ? 1 : -1; } -enum l2_version_check_result l2_version__check_one_rule(json_t *rule, l2_version_feature_match_proc_t *feature_matcher) +enum l2_version_check_result l2_version__check_one_rule(json_t *rule, l2_version_feature_match_proc_t *feature_matcher, void *muser) { if (!json_is_object(rule)) return RULE_CHECK_ERROR; @@ -1289,7 +1289,7 @@ enum l2_version_check_result l2_version__check_one_rule(json_t *rule, l2_version const char *fname; json_object_foreach(val, fname, feat) { - if (!(*feature_matcher)(fname, feat)) { + if (!(*feature_matcher)(fname, feat, muser)) { return RULE_CHECK_DEFAULT; } } @@ -1300,7 +1300,7 @@ enum l2_version_check_result l2_version__check_one_rule(json_t *rule, l2_version return myaction; } -enum l2_version_check_result l2_version_check_rules(json_t *rules, l2_version_feature_match_proc_t *feature_matcher) +enum l2_version_check_result l2_version_check_rules(json_t *rules, l2_version_feature_match_proc_t *feature_matcher, void *muser) { size_t idx; json_t *val; @@ -1312,7 +1312,7 @@ enum l2_version_check_result l2_version_check_rules(json_t *rules, l2_version_fe json_array_foreach(rules, idx, val) { /* first, check if the rule actually matches us */ - switch (l2_version__check_one_rule(val, feature_matcher)) { + switch (l2_version__check_one_rule(val, feature_matcher, muser)) { case RULE_CHECK_ERROR: return RULE_CHECK_ERROR; case RULE_CHECK_ALLOW: @@ -1466,15 +1466,6 @@ unsigned l2_version_extract_natives(struct l2_version_library *libs, char **out_ char template[] = "/tmp/l2su-natives-XXXXXX"; /* TODO: make portable */ char *nativesdir; - for (struct l2_version_library *cur = libs; cur; cur = cur->next) { - if (cur->extract.extract) goto found; - } - - CMD_INFO0("Not extracting natives, there are no libraries that require it."); - return 0; - -found: - if (!mkdtemp(template)) { CMD_WARN("Failed to create directory for extracted natives: %s", strerror(errno)); return VERSION_ERRNO; -- cgit v1.2.3-70-g09d2