Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
triggers: make the various triggers a member of the jobs structure
Baptiste Daroussin committed 3 years ago
commit 76cf1238c3d7c55fd4750ac0b4c4813fa9a4b52b
parent 9575f81
2 files changed +7 -3
modified libpkg/pkg_jobs.c
@@ -2064,9 +2064,8 @@ pkg_jobs_execute(struct pkg_jobs *j)
	int flags = 0;
	int retcode = EPKG_FATAL;
	pkg_plugin_hook_t pre, post;
-
	trigger_t *cleanup_triggers;

-
	cleanup_triggers = triggers_load(true);
+
	j->triggers.cleanup = triggers_load(true);
	if (j->type == PKG_JOBS_INSTALL) {
		pre = PKG_PLUGIN_HOOK_PRE_INSTALL;
		post = PKG_PLUGIN_HOOK_POST_INSTALL;
@@ -2161,7 +2160,7 @@ pkg_jobs_execute(struct pkg_jobs *j)
	}

	pkg_plugins_hook_run(post, j, j->db);
-
	triggers_execute(cleanup_triggers);
+
	triggers_execute(j->triggers.cleanup);

cleanup:
	pkgdb_release_lock(j->db, PKGDB_LOCK_EXCLUSIVE);
modified libpkg/private/pkg_jobs.h
@@ -113,6 +113,11 @@ struct pkg_jobs {
	bool conservative;
	bool pinning;
	void		*lockedpkgs;
+
	struct {
+
		trigger_t *cleanup;
+
		trigger_t *post_transaction;
+
		trigger_t *post_install;
+
	} triggers;
};

#define PKG_PATTERN_FLAG_FILE (1 << 0)