4 /** \ingroup rpmtrans payload
6 * Package state machine to handle a package from a transaction set.
23 struct sharedFileInfo {
32 struct transactionFileInfo_s {
33 /* for all packages */
34 enum rpmTransactionType type;
35 fileAction action; /*!< File disposition default. */
36 /*@owned@*/ fileAction * actions; /*!< File disposition(s) */
37 /*@owned@*/ struct fingerPrint_s * fps; /*!< File fingerprint(s) */
38 HGE_t hge; /*!< Vector to headerGetEntry() */
39 HFD_t hfd; /*!< Vector to headerFreeData() */
40 Header h; /*!< Package header */
41 /*@owned@*/ const char * name;
42 /*@owned@*/ const char * version;
43 /*@owned@*/ const char * release;
45 uint_32 flags; /*!< File flag default. */
46 const uint_32 * fflags; /*!< File flag(s) (from header) */
47 const uint_32 * fsizes; /*!< File size(s) (from header) */
48 const uint_32 * fmtimes; /*!< File modification time(s) (from header) */
49 /*@owned@*/ const char ** bnl; /*!< Base name(s) (from header) */
50 /*@owned@*/ const char ** dnl; /*!< Directory name(s) (from header) */
51 int_32 * dil; /*!< Directory indice(s) (from header) */
52 /*@owned@*/ const char ** obnl; /*!< Original base name(s) (from header) */
53 /*@owned@*/ const char ** odnl; /*!< Original directory name(s) (from header) */
54 int_32 * odil; /*!< Original directory indice(s) (from header) */
55 /*@owned@*/ const char ** fmd5s;/*!< File MD5 sum(s) (from header) */
56 /*@owned@*/ const char ** flinks; /*!< File link(s) (from header) */
57 /* XXX setuid/setgid bits are turned off if fuser/fgroup doesn't map. */
58 uint_16 * fmodes; /*!< File mode(s) (from header) */
59 /*@owned@*/ char * fstates; /*!< File state(s) (from header) */
60 /*@owned@*/ const char ** fuser; /*!< File owner(s) */
61 /*@owned@*/ const char ** fgroup; /*!< File group(s) */
62 /*@owned@*/ const char ** flangs; /*!< File lang(s) */
63 int fc; /*!< No. of files. */
64 int dc; /*!< No. of directories. */
65 int bnlmax; /*!< Length (in bytes) of longest base name. */
66 int dnlmax; /*!< Length (in bytes) of longest dir name. */
69 unsigned int archiveSize;
70 mode_t dperms; /*!< Directory perms (0755) if not mapped. */
71 mode_t fperms; /*!< File perms (0644) if not mapped. */
72 /*@owned@*/ const char ** apath;
74 /*@owned@*/ int * fmapflags;
76 /*@owned@*/ /*@null@*/ uid_t * fuids; /*!< File uid(s) */
78 /*@owned@*/ /*@null@*/ gid_t * fgids; /*!< File gid(s) */
80 #define TFIMAGIC 0x09697923
81 /*@owned@*/ FSM_t fsm; /*!< File state machine data. */
83 /* these are for TR_ADDED packages */
84 /*@dependent@*/ struct availablePackage * ap;
85 /*@owned@*/ struct sharedFileInfo * replaced;
86 /*@owned@*/ uint_32 * replacedSizes;
87 /* for TR_REMOVED packages */
93 #define PSM_VERBOSE 0x8000
94 #define PSM_INTERNAL 0x4000
95 #define PSM_SYSCALL 0x2000
96 #define PSM_DEAD 0x1000
97 #define _fv(_a) ((_a) | PSM_VERBOSE)
98 #define _fi(_a) ((_a) | PSM_INTERNAL)
99 #define _fs(_a) ((_a) | (PSM_INTERNAL | PSM_SYSCALL))
100 #define _fd(_a) ((_a) | (PSM_INTERNAL | PSM_DEAD))
101 typedef enum pkgStage_e {
124 PSM_IMMED_TRIGGERS = 55,
125 PSM_RPMIO_FLAGS = 56,
129 PSM_RPMDB_REMOVE = 99,
140 /*@kept@*/ rpmTransactionSet ts;/*!< transaction set */
141 /*@kept@*/ TFI_t fi; /*!< transaction element file info */
142 FD_t cfd; /*!< Payload file handle. */
143 FD_t fd; /*!< Repackage file handle. */
144 Header oh; /*!< Repackage/multilib header. */
145 rpmdbMatchIterator mi;
146 /*@observer@*/ const char * stepName;
147 /*@owned@*/ const char * rpmio_flags;
148 /*@owned@*/ const char * failedFile;
149 /*@owned@*/ const char * pkgURL; /*!< Repackage URL. */
150 /*@dependent@*/ const char * pkgfn; /*!< Repackage file name. */
151 int scriptTag; /*!< Scriptlet data tag. */
152 int progTag; /*!< Scriptlet interpreter tag. */
153 int npkgs_installed; /*!< No. of installed instances. */
154 int scriptArg; /*!< Scriptlet package arg. */
155 int sense; /*!< One of RPMSENSE_TRIGGER{IN,UN,POSTUN}. */
156 int countCorrection; /*!< 0 if installing, -1 if removing. */
157 int chrootDone; /*!< Was chroot(2) done by pkgStage? */
158 rpmCallbackType what; /*!< Callback type. */
159 unsigned long amount; /*!< Callback amount. */
160 unsigned long total; /*!< Callback total. */
171 * Load data from header into transaction file element info.
173 * @param fi transaction element file info
175 void loadFi(Header h, TFI_t fi)
176 /*@modifies h, fi @*/;
179 * Destroy transaction element file info.
180 * @param fi transaction element file info
182 void freeFi(TFI_t fi)
186 * Return formatted string representation of package disposition.
187 * @param a package dispostion
188 * @return formatted string
190 /*@observer@*/ const char *const fiTypeString(TFI_t fi);
193 * Package state machine driver.
194 * @param psm package state machine data
195 * @param stage next stage
196 * @return 0 on success
198 int psmStage(PSM_t psm, pkgStage stage)
205 #endif /* H_ROLLBACK */