#include "system.h"
-#include <rpm/header.h>
#include "lib/rpmfs.h"
#include "debug.h"
int allocatedReplaced;
};
-rpmfs rpmfsNew(Header h, rpmElementType type)
+rpmfs rpmfsNew(rpm_count_t fc, int initState)
{
- struct rpmtd_s bnames;
rpmfs fs = xcalloc(1, sizeof(*fs));
-
- headerGet(h, RPMTAG_BASENAMES, &bnames, HEADERGET_MINMEM);
- fs->fc = rpmtdCount(&bnames);
- rpmtdFreeData(&bnames);
-
+ fs->fc = fc;
fs->actions = xmalloc(fs->fc * sizeof(*fs->actions));
memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions));
- if (type == TR_ADDED) {
+ if (initState) {
fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
}
#define _RPMFS_H
#include <rpm/rpmfi.h>
-#include <rpm/rpmte.h>
/** \ingroup rpmfs
* Transaction element file states.
#endif
RPM_GNUC_INTERNAL
-rpmfs rpmfsNew(Header h, rpmElementType type);
+rpmfs rpmfsNew(rpm_count_t fc, int initState);
RPM_GNUC_INTERNAL
rpmfs rpmfsFree(rpmfs fs);
*/
static int addTE(rpmte p, Header h, fnpyKey key, rpmRelocation * relocs)
{
- struct rpmtd_s colls;
+ struct rpmtd_s colls, bnames;
int rc = 1; /* assume failure */
p->name = headerGetAsString(h, RPMTAG_NAME);
p->obsoletes = rpmdsNew(h, RPMTAG_OBSOLETENAME, 0);
p->order = rpmdsNew(h, RPMTAG_ORDERNAME, 0);
- p->fs = rpmfsNew(h, p->type);
+ /* Relocation needs to know file count before rpmfiNew() */
+ headerGet(h, RPMTAG_BASENAMES, &bnames, HEADERGET_MINMEM);
+ p->fs = rpmfsNew(rpmtdCount(&bnames), (p->type == TR_ADDED));
+ rpmtdFreeData(&bnames);
+
p->fi = getFI(p, h);
/* Packages with no files return an empty file info set, NULL is an error */