12 #if defined(SUPPORT_AR_PAYLOADS)
21 #define _RPMDB_INTERNAL
24 #define _RPMFI_INTERNAL
27 #define _IOSM_INTERNAL
29 #define fsmUNSAFE fsmStage
32 #if defined(_USE_RPMTE)
52 GENfree(
unsigned short *)
57 #define alloca_strdup(_s) strcpy((char *)alloca(strlen(_s)+1), (_s))
96 #define SUFFIX_RPMORIG ".rpmorig"
97 #define SUFFIX_RPMSAVE ".rpmsave"
98 #define SUFFIX_RPMNEW ".rpmnew"
110 const struct stat *
st,
116 const char *
s =
NULL;
122 (st && !S_ISDIR(st->st_mode) ? (subdir ? strlen(subdir) : 0) : 0) +
123 (st && !S_ISDIR(st->st_mode) ? (suffix ? strlen(suffix) : 0) : 0) +
127 if (st && !S_ISDIR(st->st_mode))
128 if (subdir) t =
stpcpy(t, subdir);
130 if (st && !S_ISDIR(st->st_mode))
131 if (suffix) t =
stpcpy(t, suffix);
194 if (iter->
i >= 0) i = iter->
i--;
196 if (iter->
i < (
int)fi->fc) i = iter->
i++;
208 const char * aurl = *(
const char **)a;
209 const char * burl = *(
const char **)b;
210 const char * afn =
NULL;
211 const char * bfn =
NULL;
216 #ifdef VERY_OLD_BUGGY_RPM_PACKAGES
218 if (strchr(afn,
'/') ==
NULL)
219 bfn = strrchr(bfn,
'/') + 1;
223 if (afn[0] ==
'.' && afn[1] ==
'/') afn += 2;
224 if (bfn[0] ==
'.' && bfn[1] ==
'/') bfn += 2;
227 if (afn[0] ==
'/') afn += 1;
228 if (bfn[0] ==
'/') bfn += 1;
249 if (fi && fc > 0 && fi->apath && fsmPath && *fsmPath) {
250 const char **
p =
NULL;
252 if (fi->apath !=
NULL)
254 bsearch(&fsmPath, fi->apath, fc,
sizeof(fsmPath),
257 iter->
i = p - fi->apath;
297 return (
int) (dnli ? dnli->
fi->dc : 0);
305 return (dnli ? dnli->
isave : -1);
331 dnli->
i = (
int) (reverse ? fi->dc : 0);
348 if (!S_ISDIR(fi->fmodes[i]))
352 dnlen = strlen(fi->dnl[dil]);
353 bnlen = strlen(fi->bnl[i]);
355 for (j = 0; j < (
int)fi->dc; j++) {
358 if (!dnli->
active[j] || j == (
int)dil)
362 if (jlen != (dnlen+bnlen+1))
364 if (strncmp(dnl, fi->dnl[dil], dnlen))
366 if (strncmp(dnl+dnlen, fi->bnl[i], bnlen))
368 if (dnl[dnlen+bnlen] !=
'/' || dnl[dnlen+bnlen+1] !=
'\0')
379 for (i = 0; i < (
int)fi->dc; i++) {
380 if (!dnli->
active[i])
continue;
384 D_(
"========== Directories not explicitly included in package:\n"));
406 const char * dn =
NULL;
414 i = (!dnli->
reverse ? dnli->
i++ : --dnli->
i);
415 }
while (i >= 0 && i < (
int)fi->dc && !dnli->
active[
i]);
417 if (i >= 0 && i < (
int)fi->dc)
426 #if defined(WITH_PTHREADS)
427 static void * fsmThread(
void * _fsm)
443 #if defined(WITH_PTHREADS)
462 struct stat *
st = &fsm->
sb;
469 if (fsm->
li->
sb.st_ino == st->st_ino && fsm->
li->
sb.st_dev == st->st_dev)
510 if (!(st->st_size || fsm->
li->
linksLeft == (
int) st->st_nlink))
573 #if defined(SUPPORT_AR_PAYLOADS)
587 const char * apath =
NULL;
589 path = apath + fi->striplen;
593 if ((nb = strlen(path)) < 15)
610 const char * apath =
NULL;
612 path = apath + fi->striplen;
616 if ((nb = strlen(path)) < 15)
629 unsigned int * archiveSize,
const char ** failedFile)
636 #if defined(_USE_RPMTE)
652 fprintf(stderr,
"--> fsmSetup(%p, 0x%x, \"%s\", %p, %p, %p, %p, %p)\n", fsm, goal, afmt, (
void *)ts, fi, cfd, archiveSize, failedFile);
659 fprintf(stderr,
"\ttar vectors set\n");
665 #if defined(SUPPORT_AR_PAYLOADS)
668 fprintf(stderr,
"\tar vectors set\n");
679 fprintf(stderr,
"\tcpio vectors set\n");
696 fsm->
iter = mapInitIterator(fi, reverse);
705 #define _tsmask (RPMTRANS_FLAG_PKGCOMMIT | RPMTRANS_FLAG_COMMIT)
736 if (rc && !ec) ec =
rc;
741 if (rc && !ec) ec =
rc;
757 fprintf(stderr,
"--> fsmTeardown(%p)\n", fsm);
794 if (fi && i >= 0 && i < (
int)fi->fc)
805 int teAdding = fsm->
adding;
816 if (i >= 0 && i < (
int)fi->fc) {
819 fsm->
action = (fi->actions ? fi->actions[
i] : fi->action);
820 fsm->
fflags = (fi->fflags ? fi->fflags[
i] : fi->flags);
821 fsm->
mapFlags = (fi->fmapflags ? fi->fmapflags[
i] : fi->mapflags);
841 if (fi->fstates && teAdding)
846 if (fi->fstates && teAdding)
851 if (fi->fstates && teAdding)
885 const struct stat *
st = &fsm->
sb;
896 struct stat *
st = &fsm->
sb;
900 if (fi && i >= 0 && i < (
int) fi->fc) {
901 mode_t perms = (S_ISDIR(st->st_mode) ? fi->dperms : fi->fperms);
902 ino_t finalInode = (fi->finodes ? (ino_t)fi->finodes[i] : 0);
903 mode_t finalMode = (fi->fmodes ? (mode_t)fi->fmodes[i] : perms);
904 dev_t finalRdev = (dev_t)(fi->frdevs ? fi->frdevs[i] : 0);
905 rpmuint32_t finalMtime = (fi->fmtimes ? fi->fmtimes[
i] : 0);
915 if (fi->fuser &&
unameToUid(fi->fuser[i], &uid)) {
919 _(
"user %s does not exist - using root\n"), fi->fuser[i]);
921 finalMode &= ~S_ISUID;
925 if (fi->fgroup &&
gnameToGid(fi->fgroup[i], &gid)) {
929 _(
"group %s does not exist - using root\n"), fi->fgroup[i]);
931 finalMode &= ~S_ISGID;
936 st->st_mode = (st->st_mode & S_IFMT) | (finalMode & ~S_IFMT);
938 st->st_mode = (st->st_mode & ~S_IFMT) | (finalMode & S_IFMT);
939 if ((S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode))
940 && st->st_nlink == 0)
942 st->st_ino = finalInode;
943 st->st_rdev = finalRdev;
944 st->st_mtime = finalMtime;
980 const struct stat *
st = &fsm->
sb;
981 size_t left = (size_t) st->st_size;
985 {
const char *
fn = fsm->
path;
986 mode_t
mode = st->st_mode;
987 uint8_t *
b = (uint8_t *)
"";
989 const uint8_t * d = fsm->
digest;
1040 if (digest ==
NULL) {
1052 digest =
_free(digest);
1074 const char * path = fsm->
path;
1075 const char * opath = fsm->
opath;
1076 struct stat *
st = &fsm->
sb;
1077 struct stat * ost = &fsm->
osb;
1082 st->st_size = (writeData ? ost->st_size : 0);
1084 if (S_ISDIR(st->st_mode)) {
1086 }
else if (
S_ISLNK(st->st_mode)) {
1094 st->st_size = fsm->
rdnb;
1099 size_t nb= strlen(fsm->
dirName) + strlen(fsm->
baseName) +
sizeof(
".");
1100 char * t = (
char *)
alloca(nb);
1109 const char * apath =
NULL;
1111 fsm->
path = apath + fi->striplen;
1113 fsm->
path = fi->bnl[fsm->
ix];
1120 if (writeData && S_ISREG(st->st_mode)) {
1121 #if defined(HAVE_MMAP)
1122 char * rdbuf =
NULL;
1123 void * mapped = (
void *)-1;
1126 int use_mmap = (st->st_size <= 0x07ffffff);
1133 #if defined(HAVE_MMAP)
1135 mapped = mmap(
NULL, st->st_size, PROT_READ, MAP_SHARED,
Fileno(fsm->
rfd), 0);
1136 if (mapped != (
void *)-1) {
1138 fsm->
rdbuf = (
char *) mapped;
1139 fsm->
rdlen = nmapped = st->st_size;
1140 #if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
1141 xx = madvise(mapped, nmapped, MADV_DONTNEED);
1150 #if defined(HAVE_MMAP)
1151 if (mapped != (
void *)-1) {
1152 fsm->
rdnb = nmapped;
1168 #if defined(HAVE_MMAP)
1169 if (mapped != (
void *)-1) {
1171 xx = msync(mapped, nmapped, MS_ASYNC);
1172 #if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
1173 xx = madvise(mapped, nmapped, MADV_DONTNEED);
1175 xx = munmap(mapped, nmapped);
1211 const char * path = fsm->
path;
1212 const char * lpath = fsm->
lpath;
1213 const char * nsuffix = fsm->
nsuffix;
1214 int iterIndex = fsm->
ix;
1218 const char * linkpath =
NULL;
1226 for (i = fsm->
li->
nlink - 1; i >= 0; i--) {
1228 if (fsm->
li->
filex[i] < 0)
continue;
1238 const char * apath =
NULL;
1247 fsm->
lpath = linkpath;
1265 linkpath =
_free(linkpath);
1267 fsm->
ix = iterIndex;
1285 const char * path = fsm->
path;
1286 const char * opath = fsm->
opath;
1287 const char * nsuffix = fsm->
nsuffix;
1288 int iterIndex = fsm->
ix;
1302 for (i = 0; i < fsm->
li->
nlink; i++) {
1303 if (fsm->
li->
filex[i] < 0)
continue;
1327 fsm->
ix = iterIndex;
1347 const char * path = fsm->
path;
1348 const char * nsuffix = fsm->
nsuffix;
1349 int iterIndex = fsm->
ix;
1350 struct stat *
st = &fsm->
sb;
1359 if (fsm->
li->
sb.st_ino == st->st_ino && fsm->
li->
sb.st_dev == st->st_dev)
1364 for (i = 0; i < fsm->
li->
nlink; i++) {
1365 if (fsm->
li->
filex[i] < 0)
continue;
1374 fsm->
ix = iterIndex;
1391 const char * path = fsm->
path;
1393 char * dn = fsm->
rdbuf;
1402 size_t dnlen = strlen(fsm->
path);
1406 if (fsm->
dnlx[dc] < 1 || (
size_t)fsm->
dnlx[dc] >= dnlen)
1426 }
while ((te - fsm->
path) > fsm->
dnlx[dc]);
1448 struct stat *
st = &fsm->
sb;
1449 struct stat * ost = &fsm->
osb;
1450 const char * path = fsm->
path;
1451 mode_t st_mode = st->st_mode;
1453 char * dn = fsm->
rdbuf;
1465 size_t dnlen = strlen(fsm->
path);
1469 if (dc < 0)
continue;
1470 fsm->
dnlx[
dc] = (
unsigned short) dnlen;
1485 for (i = 1, te++; *te !=
'\0'; te++, i++) {
1493 if (i < fsm->ldnlen &&
1494 (fsm->
ldn[i] ==
'/' || fsm->
ldn[i] ==
'\0') &&
1495 !strncmp(fsm->
path, fsm->
ldn, i))
1499 fsm->
dnlx[
dc] = (te - dn);
1509 if (rc == 0 && S_ISDIR(ost->st_mode)) {
1511 fsm->
dnlx[
dc] = (te - dn);
1515 st->st_mode = S_IFDIR | (fi->dperms & 07777);
1528 D_(
"%s directory created with perms %04o, context %s.\n"),
1529 fsm->
path, (
unsigned)(st->st_mode & 07777),
1556 st->st_mode = st_mode;
1568 static int fsmStat(
IOSM_t fsm)
1575 int saveernno =
errno;
1582 }
else if (rc == 0) {
1593 #define IS_DEV_LOG(_x) \
1594 ((_x) != NULL && strlen(_x) >= (sizeof("/dev/log")-1) && \
1595 !strncmp((_x), "/dev/log", sizeof("/dev/log")-1) && \
1596 ((_x)[sizeof("/dev/log")-1] == '\0' || \
1597 (_x)[sizeof("/dev/log")-1] == ';'))
1607 struct stat *
st = &fsm->
sb;
1608 struct stat * ost = &fsm->
osb;
1609 int saveerrno =
errno;
1613 #define _fafilter(_a) \
1614 (!((_a) == FA_CREATE || (_a) == FA_ERASE || (_a) == FA_COPYIN || (_a) == FA_COPYOUT) \
1615 ? iosmFileActionString(_a) : "")
1623 (
unsigned)st->st_mode, (
int)st->st_nlink,
1624 (
int)st->st_uid, (
int)st->st_gid, (
unsigned long)st->st_size,
1628 const char * apath =
NULL;
1635 (
unsigned)st->st_mode, (
int)st->st_nlink,
1636 (
int)st->st_uid, (
int)st->st_gid, (
unsigned long)st->st_size,
1736 for (j = -1, nlink = 0, i = 0; i < fsm->
li->
nlink; i++) {
1747 fsm->
li->
sb.st_nlink = nlink;
1775 fsm->
rdsize = 16 * BUFSIZ;
1777 fsm->
wrsize = 16 * BUFSIZ;
1824 _(
"archive file %s was not found in header file list\n"),
1840 st->st_mode = fi->fmodes[fsm->
ix];
1861 }
else if (rc == 0) {
1883 if (S_ISREG(st->st_mode) && st->st_nlink > 1)
1905 if (S_ISREG(st->st_mode))
1914 if (S_ISREG(st->st_mode) && st->st_nlink > 1) {
1921 for (li = fsm->
links, prev =
NULL; li; prev = li, li = li->
next)
1940 if (S_ISREG(st->st_mode) && fsm->
lpath !=
NULL) {
1941 const char * opath = fsm->
opath;
1954 if (S_ISREG(st->st_mode)) {
1955 const char * path = fsm->
path;
1960 if (rc == 0 && fsm->
osuffix) {
1961 const char * opath = fsm->
opath;
1967 _(
"%s saved as %s\n"),
1979 }
else if (S_ISDIR(st->st_mode)) {
1980 mode_t st_mode = st->st_mode;
1983 st->st_mode &= ~07777;
1984 st->st_mode |= 00700;
1986 st->st_mode = st_mode;
1988 }
else if (
S_ISLNK(st->st_mode)) {
1994 }
else if (S_ISFIFO(st->st_mode)) {
1995 mode_t st_mode = st->st_mode;
2001 st->st_mode = st_mode;
2003 }
else if (S_ISCHR(st->st_mode) ||
2004 S_ISBLK(st->st_mode) ||
2019 if (S_ISREG(st->st_mode) && st->st_nlink > 1) {
2035 if (archivePos > fi->archivePos) {
2036 fi->archivePos = (
unsigned long long) archivePos;
2038 fi->archivePos, fi->archiveSize);
2047 if (fsm->
sufbuf[0] !=
'\0')
2063 rc = ((S_ISREG(st->st_mode) && st->st_nlink > 1)
2073 memset(st, 0,
sizeof(*st));
2074 memset(ost, 0,
sizeof(*ost));
2081 const char * opath = fsm->
opath;
2082 const char * path = fsm->
path;
2101 if (S_ISDIR(st->st_mode)) {
2114 _(
"%s rmdir of %s failed: Directory not empty\n"),
2120 _(
"%s rmdir of %s failed: %s\n"),
2135 _(
" %s: unlink of %s failed: %s\n"),
2150 if (!S_ISDIR(st->st_mode) &&
2161 (opath ? opath :
""),
2163 opath =
_free(opath);
2170 if (!rc && !getuid()) {
2179 if (!rc && !getuid())
2182 if (!rc && !getuid())
2187 time_t mtime = st->st_mtime;
2190 st->st_mtime = fi->fmtimes[fsm->
ix];
2192 st->st_mtime = mtime;
2246 if (S_ISREG(st->st_mode)) {
2247 char * path = (
char *)
alloca(strlen(fsm->
path) +
sizeof(
"-RPMDELETE"));
2264 }
else if (S_ISDIR(st->st_mode)) {
2265 if (S_ISDIR(ost->st_mode))
return 0;
2271 if (S_ISDIR(ost->st_mode))
return 0;
2273 }
else if (
S_ISLNK(st->st_mode)) {
2281 }
else if (S_ISFIFO(st->st_mode)) {
2282 if (S_ISFIFO(ost->st_mode))
return 0;
2283 }
else if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
2284 if ((S_ISCHR(ost->st_mode) || S_ISBLK(ost->st_mode)) &&
2285 (ost->st_rdev == st->st_rdev))
return 0;
2286 }
else if (
S_ISSOCK(st->st_mode)) {
2287 if (
S_ISSOCK(ost->st_mode))
return 0;
2297 {
const char *
fn = fsm->
path;
2298 uint8_t *
b = (uint8_t *)
"";
2307 if (!
Lstat(fn, &sb) && S_ISREG(sb.st_mode)) {
2308 fd =
Fopen(fn,
"r.fdio");
2310 b = mmap(
NULL, blen, PROT_READ, MAP_SHARED,
Fileno(fd), 0);
2316 (
void)munmap(b, blen);
2323 {
const char * ofn = fsm->
opath;
2324 const char *
fn = fsm->
path;
2334 if (!
Lstat(fn, &sb) && S_ISREG(sb.st_mode)) {
2335 fd =
Fopen(fn,
"r.fdio");
2337 b = mmap(
NULL, blen, PROT_READ, MAP_SHARED,
Fileno(fd), 0);
2342 (
void)munmap(b, blen);
2419 if (!(stage & IOSM_INTERNAL)) {
int arHeaderRead(void *_iosm, struct stat *st)
Read ar(1) header.
static void fdInitDigest(FD_t fd, pgpHashAlgo hashalgo, int _flags)
Attach digest to fd.
static const char * suffix[]
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
int tarTrailerWrite(void *_iosm)
Write cpio trailer to payload.
static int writeFile(IOSM_t fsm, int writeData)
Write next item to payload stream.
static rpmts fsmGetTs(const IOSM_t fsm)
Retrieve transaction set from file state machine iterator.
rpmlog(RPMLOG_ERR,"%s\n", buf)
static int mapFind(FSMI_t iter, const char *fsmPath)
Locate archive path in file info.
static void * dnlFreeIterator(const void *_dnli)
Destroy directory name iterator.
rpmtime_t rpmswAdd(rpmop to, rpmop from)
Sum statistic counters.
static unsigned long long fdGetCpioPos(FD_t fd)
Structures used for an "rpmte" transaction element.
char * xstrdup(const char *str)
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
Structure(s) used for file info tag sets.
static char *size_t nb
fgets(3) analogue that reads \ continuations.
struct rpmts_s * rpmts
The RPM Transaction Set.
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
static int fsmMakeLinks(IOSM_t fsm)
Create pending hard links to existing file.
rpmfi rpmfiUnlink(rpmfi fi, const char *msg)
Unreference a file info set instance.
void * rpmsqThread(void *(*start)(void *arg), void *arg)
Call a function in a thread.
FD_t fdLink(void *cookie, const char *msg)
static void fdSetCpioPos(FD_t fd, long int cpioPos)
#define reverse(bot, top)
int Fflush(FD_t fd)
fflush(3) clone.
unsigned int * archiveSize
Structures used for ar(1) archives.
static int fsmMkdirs(IOSM_t fsm)
Create (if necessary) directories not explicitly included in package.
enum iosmFileStage_e iosmFileStage
rpmuint32_t rpmtsGetTid(rpmts ts)
Get transaction id, i.e.
const char * rpmfiBN(rpmfi fi)
Return current base name from file info set.
const unsigned char * digest
Keeps track of the set of all hard links to a file in an archive.
int cpioHeaderWrite(void *_iosm, struct stat *st)
Write cpio header.
Structures used for cpio(1) archives.
int rpmfiFC(rpmfi fi)
Return file count from file info set.
static PyObject *char * mode
int(* headerWrite)(void *_iosm, struct stat *st)
sprintf(t," (%u)",(unsigned) dig->nbytes)
const char * rpmfiTypeString(rpmfi fi)
Return formatted string representation of package disposition.
struct dnli_s * DNLI_t
Directory name iterator.
memset(_r, 0, sizeof(*_r))
rpmts rpmtsLink(rpmts ts, const char *msg)
Reference a transaction set instance.
static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *size_t dlen
void * xcalloc(size_t nmemb, size_t size)
assert(key->size==sizeof(hdrNum))
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
int gnameToGid(const char *thisGname, gid_t *gid)
FD_t fdFree(FD_t fd, const char *msg)
static const char * fsmFsPath(const IOSM_t fsm, const struct stat *st, const char *subdir, const char *suffix)
Build path to file from file info, ornamented with subdir and suffix.
int fsmStage(IOSM_t fsm, iosmFileStage stage)
File state machine driver.
static int extractRegular(IOSM_t fsm)
Create file from payload stream.
int(* _iosmNext)(IOSM_t iosm, iosmFileStage nstage)
Vector to iosmNext.
int Lstat(const char *path, struct stat *st)
lstat(2) clone.
int rpmsqJoin(void *thread)
Wait for thread to terminate.
static void * freeHardLink(struct hardLink_s *li)
Destroy set of hard links.
unsigned long long rpmuint64_t
int iosmFileActionSkipped(iosmFileAction action)
Is the file going to be skipped?
Structures used for tar(1) archives.
int(* trailerWrite)(void *_iosm)
int fsmMapAttrs(IOSM_t fsm)
Map file stat(2) info.
void * rpmtsNotify(rpmts ts, rpmte te, rpmCallbackType what, rpmuint64_t amount, rpmuint64_t total)
Perform transaction progress notify callback.
The FD_t File Handle data structure.
static rpmfi fsmGetFi(const IOSM_t fsm)
Retrieve transaction element file info from file state machine iterator.
int fsmNext(IOSM_t fsm, iosmFileStage nstage)
File state machine driver.
static int dnlCount(const DNLI_t dnli)
static int saveHardLink(IOSM_t fsm)
Save hard link in chain.
int iosmStage(IOSM_t iosm, iosmFileStage stage)
File state machine driver.
static int dnlIndex(const DNLI_t dnli)
Iterator across package file info, forward on install, backward on erase.
struct iosmIterator_s * FSMI_t
Iterator across package file info, forward on install, backward on erase.
int Fclose(FD_t fd)
fclose(3) clone.
static void * dnlInitIterator(const IOSM_t fsm, int reverse)
Create directory name iterator.
int fsmTeardown(void *_fsm)
Clean file state machine.
int rpmfiNext(rpmfi fi)
Return next file iterator index.
int cpioHeaderRead(void *_iosm, struct stat *st)
Read cpio header.
static void * iter
Create file info iterator.
int cpioTrailerWrite(void *_iosm)
Write cpio trailer.
rpmfi rpmfiInit(rpmfi fi, int fx)
Initialize file iterator index.
return strcmp(ame->name, bme->name)
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
rpmfi rpmfiLink(rpmfi fi, const char *msg)
Reference a file info set instance.
int arHeaderWrite(void *_iosm, struct stat *st)
Write ar(1) header.
char * stpcpy(char *dest, const char *src)
IOSM_t newFSM(void)
Create file state machine instance.
struct iosm_s * IOSM_t
File state machine data.
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
const char * iosmFileStageString(iosmFileStage a)
Return formatted string representation of file stages.
struct hardLink_s * links
Structures and prototypes used for an "rpmts" transaction set.
int arTrailerWrite(void *_iosm)
Write ar(1) trailer.
static int writeLinkedFile(IOSM_t fsm)
Write set of linked files to payload stream.
File state machine to handle a payload within an rpm package.
int fsmMapPath(IOSM_t fsm)
Map next file path and action.
rpmElementType rpmteType(rpmte te)
Retrieve type of transaction element.
int fsmSetup(void *_fsm, iosmFileStage goal, const char *afmt, const void *_ts, const void *_fi, FD_t cfd, unsigned int *archiveSize, const char **failedFile)
Load external data into file state machine.
IOSM_t freeFSM(IOSM_t fsm)
Destroy file state machine instance.
static int arSetup(IOSM_t iosm, rpmfi fi)
int Fileno(FD_t fd)
fileno(3) clone.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
static void fdFiniDigest(FD_t fd, pgpHashAlgo hashalgo, void *datap, size_t *lenp, int asAscii)
static int cpioStrCmp(const void *a, const void *b)
int
Save source and expand field into target.
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
static void * mapFreeIterator(void *_iter)
Destroy file info iterator.
Access RPM indices using Berkeley DB interface(s).
int unameToUid(const char *thisUname, uid_t *uid)
int(* headerRead)(void *_iosm, struct stat *st)
const char * rpmsxMatch(rpmsx sx, const char *fn, mode_t mode)
Return security context for a file.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
int tarHeaderRead(void *_iosm, struct stat *st)
Read tar header from payload.
static int fsmCommitLinks(IOSM_t fsm)
Commit hard linked file set atomically.
int tarHeaderWrite(void *_iosm, struct stat *st)
Write tar header to payload.
static const char * dnlNextIterator(DNLI_t dnli)
Return next directory name (from file info).
static int fsmRmdirs(IOSM_t fsm)
Remove (if created) directories not explicitly included in package.
static int fsmMapFContext(IOSM_t fsm)
static int mapNextIterator(void *_iter)
Return next index into file info.
File name and stat information.
const unsigned char * digest
int Unlink(const char *path)
unlink(2) clone.