Add macro %isu_package to generate ISU Package
[platform/upstream/rpm.git] / lib / rpmtriggers.h
1 #ifndef _RPMTRIGGERS_H
2 #define _RPMTRIGGERS_H
3
4 #include <rpm/rpmutil.h>
5 #include "lib/rpmscript.h"
6
7 struct triggerInfo_s {
8     unsigned int hdrNum;
9     unsigned int tix;
10     unsigned int priority;
11 };
12
13 typedef struct rpmtriggers_s {
14     struct triggerInfo_s *triggerInfo;
15     int count;
16     int alloced;
17 } *rpmtriggers;
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23
24 RPM_GNUC_INTERNAL
25 rpmtriggers rpmtriggersCreate(unsigned int hint);
26
27 RPM_GNUC_INTERNAL
28 rpmtriggers rpmtriggersFree(rpmtriggers triggers);
29
30 /*
31  * Prepare post trans uninstall file triggers. After transcation uninstalled
32  * files are not saved anywhere. So we need during uninstalation of every
33  * package, in time when the files to uninstall are still available,
34  * to determine and store triggers that should be set off after transaction.
35  */
36 RPM_GNUC_INTERNAL
37 void rpmtriggersPrepPostUnTransFileTrigs(rpmts ts, rpmte te);
38
39 /* Run triggers stored in ts */
40 RPM_GNUC_INTERNAL
41 int runPostUnTransFileTrigs(rpmts ts);
42
43 /*
44  * It runs file triggers in other package(s) this package/transaction sets off.
45  * If tm is RPMSCRIPT_FILETRIGGERSCRIPT then it runs file triggers that are
46  * fired by files in transaction entry. If tm is RPMSCRIPT_TRANSFILETRIGGERSCRIPT
47  * then it runs file triggers that are fired by all files in transaction set.
48  * In that case te can be NULL.
49  *
50  * @param ts            transaction set
51  * @param te            transaction entry
52  * @param sense         defines which triggers should be set off (triggerin,
53  *                      triggerun, triggerpostun)
54  * @param tm            trigger mode, (filetrigger/transfiletrigger)
55  * @param priorityClass 1 to run triggers that should be executed before
56  *                      standard scriptlets
57  *                      2 to run triggers that should be executed after
58  *                      standard scriptlets
59  *                      0 to run all triggers
60  */
61 RPM_GNUC_INTERNAL
62 rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
63                         rpmscriptTriggerModes tm, int priorityClass);
64
65 /* Run file triggers in this te other package(s) set off.
66  * @param ts            transaction set
67  * @param te            transaction entry
68  * @param sense         defines which triggers should be set off (triggerin,
69  *                      triggerun, triggerpostun)
70  * @param tm            trigger mode, (filetrigger/transfiletrigger)
71  * @param priorityClass 1 to run triggers that should be executed before
72  *                      standard scriptlets
73  *                      2 to run triggers that should be executed after
74  *                      standard scriptlets
75  *                      0 to run all triggers
76  */
77 RPM_GNUC_INTERNAL
78 rpmRC runImmedFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
79                             rpmscriptTriggerModes tm, int priorityClass);
80 #ifdef __cplusplus
81 }
82 #endif
83 #endif /* _RPMTRIGGERS_H */
84