Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
trigger: fix typo in regex/regexp
Baptiste Daroussin committed 2 months ago
commit ba68da9dc9670a5c737b0a06239471cdcf313669
parent 8941e67
3 files changed +12 -12
modified libpkg/private/pkg.h
@@ -263,7 +263,7 @@ struct trigger {
	char *name;
	ucl_object_t *path;
	ucl_object_t *path_glob;
-
	ucl_object_t *path_regex;
+
	ucl_object_t *path_regexp;
	struct {
		char *script;
		int type;
modified libpkg/triggers.c
@@ -221,12 +221,12 @@ trigger_load(int dfd, const char *name, bool cleanup_only, ucl_object_t *schema)
	o = ucl_object_find_key(obj, "path_glob");
	if (o != NULL)
		t->path_glob = ucl_object_ref(o);
-
	o = ucl_object_find_key(obj, "path_regex");
+
	o = ucl_object_find_key(obj, "path_regexp");
	if (o != NULL)
-
		t->path_regex = ucl_object_ref(o);
+
		t->path_regexp = ucl_object_ref(o);
	if (t->path == NULL &&
	    t->path_glob == NULL &&
-
	    t->path_regex == NULL) {
+
	    t->path_regexp == NULL) {
		pkg_emit_error("No path* in trigger %s, skipping", name);
		goto err;
	}
@@ -240,8 +240,8 @@ err:
			ucl_object_unref(t->path);
		if (t->path_glob != NULL)
			ucl_object_unref(t->path_glob);
-
		if (t->path_regex != NULL)
-
			ucl_object_unref(t->path_regex);
+
		if (t->path_regexp != NULL)
+
			ucl_object_unref(t->path_regexp);
		if (t->script.script != NULL)
			free(t->script.script);
		if (t->cleanup.script != NULL)
@@ -385,8 +385,8 @@ trigger_free(struct trigger *t)
		ucl_object_unref(t->path);
	if (t->path_glob)
		ucl_object_unref(t->path_glob);
-
	if (t->path_regex)
-
		ucl_object_unref(t->path_regex);
+
	if (t->path_regexp)
+
		ucl_object_unref(t->path_regexp);
	free(t->cleanup.script);
	free(t->script.script);
	free(t);
@@ -552,7 +552,7 @@ trigger_check_match(struct trigger *t, char *dir)
		}
	}

-
	if (match_ucl_lists(dir, t->path_glob, t->path_regex)) {
+
	if (match_ucl_lists(dir, t->path_glob, t->path_regexp)) {
		pkghash_safe_add(t->matched, dir, dir, NULL);
	}
}
modified tests/frontend/triggers.sh
@@ -6,7 +6,7 @@ tests_init \
	cleanup_lua \
	deferred \
	glob_trigger \
-
	regex_trigger \
+
	regexp_trigger \
	path_trigger \
	pkg_exec_sandbox \
	pkg_exec_no_sandbox \
@@ -89,11 +89,11 @@ EOF
	atf_check -o inline:"triggered ${TMPDIR}/trigger_dir\n" pkg -o REPOS_DIR=/dev/null -o PKG_TRIGGERS_DIR="${TMPDIR}/trigger_dir" install -qfy ${TMPDIR}/test-1.pkg
}

-
regex_trigger_body() {
+
regexp_trigger_body() {
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1" "/"
	mkdir trigger_dir/
	cat << EOF >> trigger_dir/trigger.ucl
-
path_regex: [ ".*trigger.*" ]
+
path_regexp: [ ".*trigger.*" ]
trigger: {
	type: lua
	script: <<EOS