summaryrefslogtreecommitdiff
path: root/lib/rpmtriggers.h
blob: 2f8f369bebf81f96ce1f437f73aa533deda6eae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef _RPMTRIGGERS_H
#define _RPMTRIGGERS_H

#include <rpm/rpmutil.h>
#include "lib/rpmscript.h"

struct triggerInfo_s {
    unsigned int hdrNum;
    unsigned int tix;
    unsigned int priority;
};

typedef struct rpmtriggers_s {
    struct triggerInfo_s *triggerInfo;
    int count;
    int alloced;
} *rpmtriggers;

#ifdef __cplusplus
extern "C" {
#endif


RPM_GNUC_INTERNAL
rpmtriggers rpmtriggersCreate(unsigned int hint);

RPM_GNUC_INTERNAL
rpmtriggers rpmtriggersFree(rpmtriggers triggers);

/*
 * Prepare post trans uninstall file triggers. After transcation uninstalled
 * files are not saved anywhere. So we need during uninstalation of every
 * package, in time when the files to uninstall are still available,
 * to determine and store triggers that should be set off after transaction.
 */
RPM_GNUC_INTERNAL
void rpmtriggersPrepPostUnTransFileTrigs(rpmts ts, rpmte te);

/* Run triggers stored in ts */
RPM_GNUC_INTERNAL
int runPostUnTransFileTrigs(rpmts ts);

/*
 * It runs file triggers in other package(s) this package/transaction sets off.
 * If tm is RPMSCRIPT_FILETRIGGERSCRIPT then it runs file triggers that are
 * fired by files in transaction entry. If tm is RPMSCRIPT_TRANSFILETRIGGERSCRIPT
 * then it runs file triggers that are fired by all files in transaction set.
 * In that case te can be NULL.
 *
 * @param ts		transaction set
 * @param te		transaction entry
 * @param sense		defines which triggers should be set off (triggerin,
 *			triggerun, triggerpostun)
 * @param tm		trigger mode, (filetrigger/transfiletrigger)
 * @param priorityClass	1 to run triggers that should be executed before
 *			standard scriptlets
 *			2 to run triggers that should be executed after
 *			standard scriptlets
 *			0 to run all triggers
 */
RPM_GNUC_INTERNAL
rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
			rpmscriptTriggerModes tm, int priorityClass);

/* Run file triggers in this te other package(s) set off.
 * @param ts		transaction set
 * @param te		transaction entry
 * @param sense		defines which triggers should be set off (triggerin,
 *			triggerun, triggerpostun)
 * @param tm		trigger mode, (filetrigger/transfiletrigger)
 * @param priorityClass	1 to run triggers that should be executed before
 *			standard scriptlets
 *			2 to run triggers that should be executed after
 *			standard scriptlets
 *			0 to run all triggers
 */
rpmRC runImmedFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
			    rpmscriptTriggerModes tm, int priorityClass);
#ifdef __cplusplus
}
#endif
#endif /* _RPMTRIGGERS_H */