4 /** \ingroup rpmtrans payload
6 * Package state machine to handle a package from a transaction set.
11 extern int _psm_debug;
13 typedef struct rpmpsm_s * rpmpsm;
17 #define PSM_VERBOSE 0x8000
18 #define PSM_INTERNAL 0x4000
19 #define PSM_SYSCALL 0x2000
20 #define PSM_DEAD 0x1000
21 #define _fv(_a) ((_a) | PSM_VERBOSE)
22 #define _fi(_a) ((_a) | PSM_INTERNAL)
23 #define _fs(_a) ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
24 #define _fd(_a) ((_a) | (PSM_INTERNAL | PSM_DEAD))
25 typedef enum pkgStage_e {
48 PSM_IMMED_TRIGGERS = 55,
64 struct rpmsqElem sq; /*!< Scriptlet/signal queue element. */
66 rpmts ts; /*!< transaction set */
67 rpmte te; /*!< current transaction element */
68 rpmfi fi; /*!< transaction element file info */
69 FD_t cfd; /*!< Payload file handle. */
70 FD_t fd; /*!< Repackage file handle. */
71 Header oh; /*!< Repackage header. */
72 rpmdbMatchIterator mi;
73 const char * stepName;
74 const char * rpmio_flags;
75 const char * failedFile;
76 const char * pkgURL; /*!< Repackage URL. */
77 const char * pkgfn; /*!< Repackage file name. */
78 int scriptTag; /*!< Scriptlet data tag. */
79 int progTag; /*!< Scriptlet interpreter tag. */
80 int npkgs_installed; /*!< No. of installed instances. */
81 int scriptArg; /*!< Scriptlet package arg. */
82 int sense; /*!< One of RPMSENSE_TRIGGER{IN,UN,POSTUN}. */
83 int countCorrection; /*!< 0 if installing, -1 if removing. */
84 int chrootDone; /*!< Was chroot(2) done by pkgStage? */
85 int unorderedSuccessor; /*!< Can the PSM be run asynchronously? */
86 rpmCallbackType what; /*!< Callback type. */
87 unsigned long amount; /*!< Callback amount. */
88 unsigned long total; /*!< Callback total. */
91 pkgStage stage; /*!< Current psm stage. */
92 pkgStage nstage; /*!< Next psm stage. */
94 int nrefs; /*!< Reference count. */
102 * Unreference a package state machine instance.
103 * @param psm package state machine
105 * @return NULL always
107 rpmpsm rpmpsmUnlink (rpmpsm psm,
110 /** @todo Remove debugging entry from the ABI. */
111 rpmpsm XrpmpsmUnlink (rpmpsm psm,
112 const char * msg, const char * fn, unsigned ln);
113 #define rpmpsmUnlink(_psm, _msg) XrpmpsmUnlink(_psm, _msg, __FILE__, __LINE__)
116 * Reference a package state machine instance.
117 * @param psm package state machine
119 * @return new package state machine reference
121 rpmpsm rpmpsmLink (rpmpsm psm, const char * msg);
123 /** @todo Remove debugging entry from the ABI. */
124 rpmpsm XrpmpsmLink (rpmpsm psm, const char * msg,
125 const char * fn, unsigned ln);
126 #define rpmpsmLink(_psm, _msg) XrpmpsmLink(_psm, _msg, __FILE__, __LINE__)
129 * Destroy a package state machine.
130 * @param psm package state machine
131 * @return NULL always
133 rpmpsm rpmpsmFree(rpmpsm psm);
136 * Create and load a package state machine.
137 * @param ts transaction set
138 * @param te transaction set element
139 * @param fi file info set
140 * @return new package state machine
142 rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi);
145 * Package state machine driver.
146 * @param psm package state machine data
147 * @param stage next stage
148 * @return 0 on success
150 rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage);
151 #define rpmpsmUNSAFE rpmpsmSTAGE