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