30 #if defined(WITH_LUA) || defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_GPSEE) || defined(WITH_MRBEMBED) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SEMANAGE) || defined(WITH_SQLITE) || defined(WITH_SQUIRREL) || defined(WITH_TCL)
31 #define _WITH_EMBEDDED
39 #define _RPMDB_INTERNAL
45 #define _RPMFI_INTERNAL
48 #define _RPMSQ_INTERNAL
49 #define _RPMPSM_INTERNAL
51 #define F_ISSET(_psm, _FLAG) ((_psm)->flags & (RPMPSM_FLAGS_##_FLAG))
52 #define F_SET(_psm, _FLAG) { \
53 unsigned ui = (unsigned)(_psm)->flags; ui |= (RPMPSM_FLAGS_##_FLAG); \
54 (_psm)->flags = (rpmpsmFlags) ui; \
56 #define F_CLR(_psm, _FLAG) { \
57 unsigned ui = (unsigned)(_psm)->flags; ui &= ~(RPMPSM_FLAGS_##_FLAG); \
58 (_psm)->flags = (rpmpsmFlags) ui; \
61 #define _RPMEVR_INTERNAL
64 #define _RPMTE_INTERNAL
67 #define _RPMTS_INTERNAL
97 GENfree(const struct stat *)
114 sharedFileInfo replaced = (te ? te->replaced : NULL);
123 if (!(
rpmfiFC(fi) > 0 && replaced != NULL))
127 for (sfi = replaced; sfi->otherPkg; sfi++) {
128 if (prev && prev == sfi->otherPkg)
130 prev = sfi->otherPkg;
136 offsets = (uint32_t *)
alloca(num *
sizeof(*offsets));
139 for (sfi = replaced; sfi->otherPkg; sfi++) {
140 if (prev && prev == sfi->otherPkg)
142 prev = sfi->otherPkg;
143 offsets[num++] = sfi->otherPkg;
164 while (sfi->otherPkg && sfi->otherPkg == prev) {
165 assert(sfi->otherFileNum < he->
c);
193 t[strlen(t)-1] =
'\0';
199 else if (fi &&
Chown(N, fi->uid, fi->gid))
213 const char ** specFilePtr,
const char ** cookie)
254 assert(p->h == NULL);
258 p->fd =
fdLink(fd, __FUNCTION__);
269 fi->fmapflags =
_free(fi->fmapflags);
274 #if defined(RPM_VENDOR_OPENPKG)
286 if ((muid_str =
rpmExpand(
"%{l_muid}", NULL)) != NULL)
287 if ((muid = (uid_t)strtol(muid_str, (
char **)NULL, 10)) > 0)
289 if ((mgid_str =
rpmExpand(
"%{l_mgid}", NULL)) != NULL)
290 if ((mgid = (gid_t)strtol(mgid_str, (
char **)NULL, 10)) > 0)
294 for (i = 0; i < (int)fi->fc; i++)
303 fi->apath = he->
p.
argv;
307 #if defined(RPM_VENDOR_OPENPKG)
308 if (
createDir(ts, fi, NULL,
"%{_topdir}")
309 ||
createDir(ts, fi, NULL,
"%{_builddir}")
311 ||
createDir(ts, fi, NULL,
"%{_srcrpmdir}")
312 ||
createDir(ts, fi, NULL,
"%{_sourcedir}")
313 ||
createDir(ts, fi, NULL,
"%{_specdir}"))
315 if (
createDir(ts, NULL, NULL,
"%{_topdir}")
316 ||
createDir(ts, NULL, NULL,
"%{_builddir}")
317 ||
createDir(ts, NULL, NULL,
"%{_rpmdir}")
318 ||
createDir(ts, NULL, NULL,
"%{_srcrpmdir}")
319 ||
createDir(ts, NULL, NULL,
"%{_sourcedir}")
320 ||
createDir(ts, NULL, NULL,
"%{_specdir}"))
341 if (*specFilePtr == NULL) {
356 if (specFilePtr) *specFilePtr =
_free(*specFilePtr);
357 if (cookie) *cookie =
_free(*cookie);
383 "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin";
412 return "%unknownscript";
458 msecs = psm->sq.op.usecs/1000;
462 D_(
"%s: waitpid(%d) rc %d status %x secs %u.%03u\n"),
463 psm->stepName, (
unsigned)psm->sq.child,
464 (
unsigned)psm->sq.reaped, psm->sq.status,
465 (
unsigned)msecs/1000, (
unsigned)msecs%1000);
467 if (psm->sstates != NULL)
470 *ssp |= (psm->sq.status & 0xffff);
474 return psm->sq.reaped;
490 const char *script,
int arg1,
int arg2)
506 for (i = 0; i < (int)Phe->
c && Phe->
p.
argv[i]; i++) {
526 xx =
snprintf(buf, BUFSIZ,
"%s(%s)", sln, psm->NVRA);
542 #if defined(_WITH_EMBEDDED)
543 static int enterChroot(
rpmpsm psm,
int * pwdFdnop,
int * rootFdnop)
553 (*pwdFdnop) = open(
".", O_RDONLY, 0);
557 (*rootFdnop) = open(
"/", O_RDONLY, 0);
564 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/') {
578 static int exitChroot(
rpmpsm psm,
int inChroot,
int pwdFdno,
int rootFdno)
582 const rpmts ts = psm->ts;
587 xx = fchdir(rootFdno);
589 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/') {
594 xx = fchdir(pwdFdno);
596 xx = fchdir(pwdFdno);
598 xx = close(rootFdno);
616 const char *script,
int arg1,
int arg2)
620 char * av[] = { NULL, NULL, NULL, NULL };
626 int inChroot = enterChroot(psm, &pwdFdno, &rootFdno);
628 if (psm->sstates != NULL)
629 ssp = psm->sstates +
tag2slx(psm->scriptTag);
633 av[0] = (
char *) Phe->
p.
argv[0];
636 av[1] = (
char *)
alloca(32);
637 (void) sprintf(av[1],
"%d", arg1);
640 av[2] = (
char *)
alloca(32);
641 (void) sprintf(av[2],
"%d", arg2);
644 #if defined(WITH_LUA)
645 if (!strcmp(Phe->
p.
argv[0],
"<lua>")) {
646 rc = runLuaScript(psm, sln, Phe, script, arg1, arg2);
649 #if defined(WITH_AUGEAS)
650 if (!strcmp(Phe->
p.
argv[0],
"<augeas>")) {
658 #if defined(WITH_FICL)
659 if (!strcmp(Phe->
p.
argv[0],
"<ficl>")) {
666 #if defined(WITH_JNIEMBED)
667 if (!strcmp(Phe->
p.
argv[0],
"<java>")) {
668 rpmjni jni = rpmjniNew((
char **)av, 0);
669 rc = rpmjniRun(jni, script, NULL) ==
RPMRC_OK
671 jni = rpmjniFree(jni);
674 #if defined(WITH_GPSEE)
675 if (!strcmp(Phe->
p.
argv[0],
"<js>")) {
682 #if defined(WITH_MRBEMBED)
683 if (!strcmp(Phe->
p.
argv[0],
"<mruby>")) {
684 rpmmrb mrb = rpmmrbNew((
char **)av, 0);
685 rc = rpmmrbRun(mrb, script, NULL) ==
RPMRC_OK
687 mrb = rpmmrbFree(mrb);
690 #if defined(WITH_PERLEMBED)
691 if (!strcmp(Phe->
p.
argv[0],
"<perl>")) {
698 #if defined(WITH_PYTHONEMBED)
699 if (!strcmp(Phe->
p.
argv[0],
"<python>")) {
706 #if defined(WITH_RUBYEMBED)
707 if (!strcmp(Phe->
p.
argv[0],
"<ruby>")) {
714 #if defined(WITH_SEMANAGE)
715 if (!strcmp(Phe->
p.
argv[0],
"<spook>")) {
727 #if defined(WITH_SQLITE)
728 if (!strcmp(Phe->
p.
argv[0],
"<sql>")) {
730 const char ** Pav = (
const char **)
xmalloc((Pac + 1) *
sizeof(*Pav));
731 const char * result = NULL;
737 for (i = 0; i < Pac; i++)
748 #if defined(WITH_SQUIRREL)
749 if (!strcmp(Phe->
p.
argv[0],
"<squirrel>")) {
756 #if defined(WITH_TCL)
757 if (!strcmp(Phe->
p.
argv[0],
"<tcl>")) {
768 *ssp |= (xx & 0xffff);
772 xx = exitChroot(psm, inChroot, pwdFdno, rootFdno);
803 const char * script,
int arg1,
int arg2)
809 const rpmts ts = psm->ts;
810 const char * NVRA = psm->NVRA;
811 HE_t IPhe = psm->IPhe;
812 const char ** argv = NULL;
814 const char **
IP = NULL;
816 size_t maxPrefixLength;
818 char * prefixBuf = NULL;
819 const char * fn = NULL;
820 FD_t scriptFd = NULL;
823 const char * body = NULL;
825 int ix =
tag2slx(psm->scriptTag);
832 ssp = psm->sstates + ix;
836 if (Phe->
p.
argv == NULL && script == NULL)
847 assert(he->
p.
str != NULL);
848 psm->NVRA = NVRA = he->
p.
str;
855 if (!strcmp(Phe->
p.
argv[0],
"<lua>")
856 || !strcmp(Phe->
p.
argv[0],
"<augeas>")
857 || !strcmp(Phe->
p.
argv[0],
"<ficl>")
858 || !strcmp(Phe->
p.
argv[0],
"<java>")
859 || !strcmp(Phe->
p.
argv[0],
"<js>")
860 || !strcmp(Phe->
p.
argv[0],
"<mruby>")
861 || !strcmp(Phe->
p.
argv[0],
"<perl>")
862 || !strcmp(Phe->
p.
argv[0],
"<python>")
863 || !strcmp(Phe->
p.
argv[0],
"<ruby>")
864 || !strcmp(Phe->
p.
argv[0],
"<sql>")
865 || !strcmp(Phe->
p.
argv[0],
"<squirrel>")
866 || !strcmp(Phe->
p.
argv[0],
"<tcl>"))
868 #if defined(_WITH_EMBEDDED)
870 D_(
"%s: %s(%s) running %s scriptlet.\n"),
871 psm->stepName,
tag2sln(psm->scriptTag), NVRA, Phe->
p.
argv[0]);
872 rc = runEmbeddedScript(psm, sln, Phe, body, arg1, arg2);
882 if (ldconfig_path && Phe->
p.
argv != NULL &&
F_ISSET(psm, UNORDERED)) {
883 if (ldconfig_done && !strcmp(Phe->
p.
argv[0], ldconfig_path)) {
885 D_(
"%s: %s(%s) skipping redundant \"%s\".\n"),
886 psm->stepName,
tag2sln(psm->scriptTag), NVRA,
894 D_(
"%s: %s(%s) %ssynchronous scriptlet start\n"),
895 psm->stepName,
tag2sln(psm->scriptTag), NVRA,
896 (
F_ISSET(psm, UNORDERED) ?
"a" :
""));
898 if (Phe->
p.
argv == NULL) {
899 argv = (
const char **)
alloca(5 *
sizeof(*argv));
904 argv = (
const char **)
alloca((Phe->
c + 4) *
sizeof(*argv));
905 memcpy(argv, Phe->
p.
argv, Phe->
c *
sizeof(*argv));
907 ldconfig_done = (ldconfig_path && !strcmp(argv[0], ldconfig_path)
912 if (IPhe->
tag == 0) {
920 const char ** av = (
const char **)
922 char * t = (
char *) &av[1];
942 for (i = 0; i < nIP; i++) {
944 if (len > maxPrefixLength) maxPrefixLength =
len;
946 prefixBuf = (
char *)
alloca(maxPrefixLength + 50);
957 (!strcmp(argv[0],
"/bin/sh") || !strcmp(argv[0],
"/bin/bash")))
959 static const char set_x[] =
"set -x\n";
960 nw =
Fwrite(set_x,
sizeof(set_x[0]),
sizeof(set_x)-1, fd);
963 if (ldconfig_path && strstr(body, ldconfig_path) != NULL)
966 nw =
Fwrite(body,
sizeof(body[0]), strlen(body), fd);
969 {
const char * sn = fn;
971 !(rootDir[0] ==
'/' && rootDir[1] ==
'\0'))
973 sn += strlen(rootDir)-1;
979 char *av = (
char *)
alloca(20);
980 sprintf(av,
"%d", arg1);
984 char *av = (
char *)
alloca(20);
985 sprintf(av,
"%d", arg2);
993 switch (psm->scriptTag) {
1011 if (scriptFd != NULL) {
1015 out =
Fopen(
"/dev/null",
"w.fdio");
1021 out =
fdDup(STDOUT_FILENO);
1027 if (psm->sq.child == 0) {
1032 pipes[0] = pipes[1] = 0;
1035 xx = close(pipes[1]);
1036 xx = dup2(pipes[0], STDIN_FILENO);
1037 xx = close(pipes[0]);
1040 for (fdno = 3; fdno < 100; fdno++) {
1041 flag = fcntl(fdno, F_GETFD);
1042 if (flag == -1 || (flag & FD_CLOEXEC))
1045 D_(
"%s: %s(%s)\tfdno(%d) missing FD_CLOEXEC\n"),
1046 psm->stepName, sln, NVRA,
1048 xx = fcntl(fdno, F_SETFD, FD_CLOEXEC);
1052 if (scriptFd != NULL) {
1053 int sfdno =
Fileno(scriptFd);
1055 if (sfdno != STDERR_FILENO)
1056 xx = dup2(sfdno, STDERR_FILENO);
1057 if (ofdno != STDOUT_FILENO)
1058 xx = dup2(ofdno, STDOUT_FILENO);
1060 if (ofdno > STDERR_FILENO && ofdno != sfdno)
1062 if (sfdno > STDERR_FILENO && ofdno != sfdno)
1066 {
const char *ipath =
rpmExpand(
"PATH=%{_install_script_path}", NULL);
1069 if (ipath && ipath[5] !=
'%')
1074 ipath =
_free(ipath);
1079 for (i = 0; i < nIP; i++) {
1080 sprintf(prefixBuf,
"RPM_INSTALL_PREFIX%d=%s", i, IP[i]);
1085 sprintf(prefixBuf,
"RPM_INSTALL_PREFIX=%s", IP[i]);
1092 !(rootDir[0] ==
'/' && rootDir[1] ==
'\0'))
1100 psm->stepName, sln, NVRA,
1101 argv[0], (
unsigned)getpid());
1116 xx = execv(argv[0], (
char *
const *)argv);
1128 if (psm->sq.child == (pid_t)-1) {
1136 if (!(psm->sq.reaped >= 0 && !strcmp(argv[0],
"/usr/sbin/glibc_post_upgrade") && WEXITSTATUS(psm->sq.status) == 110)) {
1138 if (psm->sq.reaped < 0) {
1140 _(
"%s(%s) scriptlet failed, waitpid(%d) rc %d: %s\n"),
1141 sln, NVRA, (
int)psm->sq.child, (
int)psm->sq.reaped,
1145 if (!WIFEXITED(psm->sq.status) || WEXITSTATUS(psm->sq.status)) {
1146 if (WIFSIGNALED(psm->sq.status)) {
1148 psm->scriptTag, WTERMSIG(psm->sq.status));
1150 _(
"%s(%s) scriptlet failed, signal %d\n"),
1151 sln, NVRA, WTERMSIG(psm->sq.status));
1154 psm->scriptTag, WEXITSTATUS(psm->sq.status));
1156 _(
"%s(%s) scriptlet failed, exit status %d\n"),
1157 sln, NVRA, WEXITSTATUS(psm->sq.status));
1167 static unsigned int scale = 1000;
1170 psm->smetrics[ix] += op->
usecs / scale;
1199 const char * argv0 = NULL;
1202 assert(fi->h != NULL);
1203 She->
tag = psm->scriptTag;
1206 Phe->
tag = psm->progTag;
1212 const char * s = Phe->
p.
str;
1214 Phe->
p.
argv = (
const char **)
1216 Phe->
p.
argv[0] = t = (
char *) &Phe->
p.
argv[1];
1223 if (Phe->
p.
argv[0][0] ==
'%')
1227 She->
p.
str, psm->scriptArg, -1);
1230 argv0 =
_free(argv0);
1253 static int scareMem = 0;
1259 const rpmts ts = psm->ts;
1264 const char * sourceName;
1265 const char * triggerName;
1273 sourceName = he->
p.
str;
1277 triggerName = he->
p.
str;
1285 arg1 += psm->countCorrection;
1311 if (!(Flags & psm->sense))
1315 depName = (
char *)
rpmdsN(Tds);
1316 if (depName[0] ==
'/') {
1317 size_t nb = strlen(depName);
1320 if (depName[nb-1] ==
'/') {
1336 const char * N =
rpmdsN(ds);
1349 if (!bingo && depName[nb-1] ==
'/') {
1376 {
int index = Ihe->
p.
ui32p[
i];
1377 const char * s = Phe->
p.
argv[index];
1383 he->
p.
argv = (
const char **)
1389 if (
runScript(psm, triggeredH,
"%trigger", he,
1390 She->
p.
argv[index], arg1, arg2))
1411 triggerName =
_free(triggerName);
1412 sourceName =
_free(sourceName);
1422 const rpmts ts = psm->ts;
1430 for (i = 0; i < nkeys; i++) {
1431 char * t = (
char *) keys[i];
1435 (
miRE *)&psm->Tmires, &psm->nTmires);
1455 static int scareMem = 0;
1456 const rpmts ts = psm->ts;
1459 char * depName = NULL;
1470 const char * Name =
rpmdsN(ds);
1471 size_t nName = strlen(Name);
1472 unsigned prev, instance;
1476 depName =
_free(depName);
1477 if (!strcmp(Name,
"/"))
1480 depName =
xmalloc(nName + 1 + 1);
1481 (void)
stpcpy(depName, Name);
1484 depName[nName+1] =
'\0';
1487 if (depName[0] ==
'/' && psm->Tmires != NULL) {
1492 for (j = 0, mire = (
miRE)psm->Tmires; j < psm->nTmires; j++, mire++) {
1493 const char *
pattern = psm->Tpats[
j];
1494 if (depName[nName-1] !=
'/') {
1495 size_t npattern = strlen(pattern);
1496 depName[nName] = (pattern[npattern-1] ==
'/') ?
'/' :
'\0';
1502 depName =
_free(depName);
1514 xx =
rpmmiPrune(mi, (uint32_t *)vals, nvals, 1);
1517 while((triggeredH =
rpmmiNext(mi)) != NULL) {
1519 if (prev == instance)
1524 xx =
argiAdd(&instances, -1, instance);
1532 depName =
_free(depName);
1550 const rpmts ts = psm->ts;
1557 if (_trigger_tag == 0) {
1558 const char * t =
rpmExpand(
"%{?_trigger_tag}", NULL);
1566 assert(psm->te != NULL);
1567 {
const char * N =
rpmteN(psm->te);
1570 numPackage += psm->countCorrection;
1575 assert(fi->h != NULL);
1578 {
int countCorrection = psm->countCorrection;
1580 psm->countCorrection = 0;
1602 psm->countCorrection = countCorrection;
1620 const rpmts ts = psm->ts;
1622 rpmds triggers = NULL;
1633 assert(fi->h != NULL);
1636 if (_trigger_tag == 0) {
1637 const char * t =
rpmExpand(
"%{?_trigger_tag}", NULL);
1646 triggers =
rpmdsLink(psm->triggers,
"ImmedTriggers");
1648 if (triggers == NULL)
1653 if (!(xx && Ihe->
p.
ui32p && Ihe->
c))
goto exit;
1657 if (triggers != NULL)
1658 while ((i =
rpmdsNext(triggers)) >= 0) {
1660 const char * N =
rpmdsN(triggers);
1661 const char * EVR =
rpmdsEVR(triggers);
1664 if (!(Flags & psm->sense))
1671 tagno = (N[strlen(N)-1] ==
'/')
1685 for (i = 0; (Name = keys[
i]) != NULL; i++) {
1686 unsigned prev, instance;
1694 tagno = (Name[strlen(Name)-1] ==
'/')
1704 xx =
rpmmiPrune(mi, (uint32_t *)vals, nvals, 1);
1707 while((sourceH =
rpmmiNext(mi)) != NULL) {
1711 if (prev == instance)
1719 xx =
argiAdd(&instances, -1, instance);
1769 default:
return "???";
1776 assert(psm != NULL);
1778 psm->unorderedSuccessor = async;
1781 F_SET(psm, UNORDERED);
1783 F_CLR(psm, UNORDERED);
1790 assert(psm != NULL);
1791 psm->scriptTag = scriptTag;
1792 psm->progTag = progTag;
1794 switch (scriptTag) {
1822 psm->IPhe->p.ptr =
_free(psm->IPhe->p.ptr);
1823 psm->IPhe =
_free(psm->IPhe);
1824 psm->NVRA =
_free(psm->NVRA);
1826 psm->triggers = NULL;
1840 if (_psmPool == NULL) {
1846 memset(((
char *)psm)+
sizeof(psm->_item), 0,
sizeof(*psm)-
sizeof(psm->_item));
1852 static const char msg[] =
"rpmpsmNew";
1858 if (te) psm->te = rpmteLink(te, msg);
1861 if (te) psm->te = te;
1867 psm->triggers = NULL;
1869 psm->IPhe = (
HE_t)
xcalloc(1,
sizeof(*psm->IPhe));
1870 memset(psm->sstates, 0,
sizeof(psm->sstates));
1871 memset(psm->smetrics, 0,
sizeof(psm->smetrics));
1941 he->
p.
argv = &chain_end;
1953 he->
p.
argv = &chain_end;
1965 he->
p.
argv = &chain_end;
2000 he->
p.
argv = &chain_end;
2015 he->
p.
argv = &chain_end;
2030 he->
p.
argv = &chain_end;
2059 assert(fi->h != NULL);
2061 {
struct timeval tv;
2062 xx = gettimeofday(&tv, NULL);
2068 he->
p.
ui32p = &installTime[0];
2074 memcpy(originTime, uip,
sizeof(originTime));
2075 if (originTime[0] == 0)
2076 memcpy(originTime, installTime,
sizeof(originTime));
2079 he->
p.
ui32p = originTime;
2084 memcpy(originTid, uip,
sizeof(originTid));
2085 if (originTid[0] == 0)
2086 memcpy(originTid, ts->tid,
sizeof(originTid));
2120 if (digest != NULL) {
2133 if (st->st_mode == 0 && st->st_mtime == 0 && st->st_size == 0)
2136 if (st->st_mode != 0) {
2139 he->
p.
ptr = (
void *)st;
2172 he->
p.
ui32p = psm->sstates;
2177 he->
p.
ui32p = psm->smetrics;
2182 if (fi->fstates != NULL && fc > 0) {
2185 he->
p.
ui8p = fi->fstates;
2193 #if defined(WITH_PTHREADS)
2194 static void * rpmpsmThread(
void * _psm)
2209 psm->nstage = nstage;
2210 #if defined(WITH_PTHREADS)
2225 const rpmts ts = psm->ts;
2234 if (fi->h == NULL && fi->te && ((
rpmte)fi->te)->h != NULL) fi->h =
headerLink(((
rpmte)fi->te)->h);
2251 if (psm->npkgs_installed < 0) {
2257 assert(psm->te != NULL);
2261 if (psm->te->downgrade)
2262 psm->npkgs_installed--;
2272 psm->scriptArg = psm->npkgs_installed + 1;
2274 assert(psm->mi == NULL);
2276 if (hdrid != NULL) {
2287 #ifdef RPM_VENDOR_MANDRIVA
2299 while ((psm->oh =
rpmmiNext(psm->mi)) != NULL) {
2309 if (fi->fstates == NULL && fc > 0) {
2326 fi->striplen = (xx && he->
p.
str ? strlen(he->
p.
str) + 1 : 1);
2336 assert(he->
p.
argv != NULL);
2337 fi->apath = he->
p.
argv;
2339 if (fi->fuser == NULL) {
2342 fi->fuser = he->
p.
argv;
2344 if (fi->fgroup == NULL) {
2347 fi->fgroup = he->
p.
argv;
2352 psm->scriptArg = psm->npkgs_installed - 1;
2372 bfmt =
rpmGetPath(tiddn,
"/",
"%{_repackage_name_fmt}", NULL);
2376 psm->pkgURL =
rpmGenPath(
"%{?_repackage_root}",
2377 "%{?_repackage_dir}",
2379 pkgbn =
_free(pkgbn);
2380 (void)
urlPath(psm->pkgURL, &psm->pkgfn);
2381 pkgdn_buf =
xstrdup(psm->pkgfn);
2383 pkgdn = dirname(pkgdn_buf);
2386 pkgdn_buf =
_free(pkgdn_buf);
2389 psm->fd =
Fopen(psm->pkgfn,
"w.fdio");
2390 if (psm->fd == NULL ||
Ferror(psm->fd)) {
2398 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
2402 {
static int oneshot = 0;
2417 psm->sense = RPMSENSE_TRIGGERPREIN;
2418 psm->countCorrection = 0;
2435 _(
"%s: %s scriptlet failed (%d), skipping %s\n"),
2436 psm->stepName,
tag2sln(psm->scriptTag), rc,
2446 psm->sense = RPMSENSE_TRIGGERUN;
2447 psm->countCorrection = -1;
2463 int noArchiveSize = 0;
2464 const char * origin = NULL;
2465 const char * digest = NULL;
2466 const struct stat * st = NULL;
2467 size_t nstbytes = 0;
2478 if (xx && he->
p.
str != NULL)
2482 if (xx && he->
p.
ptr != NULL && (
size_t)he->
c ==
sizeof(*st)) {
2483 st = (
struct stat *) he->
p.
ptr;
2491 if (xx && uh != NULL) {
2498 if (xx && uh != NULL) {
2532 {
static const char item[] =
"Lead";
2534 const char * msg =
xstrdup(NEVR);
2540 void * l = memset(
alloca(nb), 0, nb);
2554 {
static const char item[] =
"Signature";
2572 if (psm->oh != NULL)
2582 if (origin != NULL) {
2588 origin =
_free(origin);
2590 if (digest != NULL) {
2596 digest =
_free(digest);
2601 he->
p.
ptr = (
void *)st;
2613 assert(psm->te != NULL);
2618 {
const char item[] =
"Header";
2619 const char * msg = NULL;
2623 (msg && *msg ? msg :
"write failed\n"));
2630 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
2655 if (psm->cfd == NULL) {
2663 ts, fi, psm->cfd, NULL, &psm->failedFile);
2683 rpmtxn _txn = (db ? db->db_txn : NULL);
2695 psm->amount = (fi->archiveSize ? fi->archiveSize : 100);
2696 psm->total = psm->amount;
2702 _(
"unpacking of archive failed%s%s: %s\n"),
2703 (psm->failedFile != NULL ?
_(
" on file ") :
""),
2704 (psm->failedFile != NULL ? psm->failedFile :
""),
2726 psm->total = (fc ? fc : 100);
2731 ts, fi, NULL, NULL, &psm->failedFile);
2736 psm->amount = (fc ? fc : 100);
2737 psm->total = (fc ? fc : 100);
2748 if (psm->fd == NULL) {
2756 if (psm->cfd == NULL) {
2762 ts, fi, psm->cfd, NULL, &psm->failedFile);
2778 psm->amount = (fi->archiveSize ? fi->archiveSize : 100);
2779 psm->total = psm->amount;
2782 fi->action = (int) action;
2783 fi->actions = (
int *) actions;
2793 psm->sense = RPMSENSE_TRIGGERIN;
2794 psm->countCorrection = 1;
2827 rc = markReplacedFiles(psm);
2835 psm->sense = RPMSENSE_TRIGGERPOSTUN;
2836 psm->countCorrection = -1;
2868 if (psm->fd != NULL) {
2878 if (!rc && ts && ts->notify == NULL) {
2880 (psm->pkgURL ? psm->pkgURL :
"???"));
2886 if (psm->failedFile)
2888 _(
"%s failed on file %s: %s\n"),
2889 psm->stepName, psm->failedFile, msg);
2892 psm->stepName, msg);
2902 if (psm->te->txn != NULL) {
2904 psm->te->txn = NULL;
2907 if (psm->te->txn != NULL) {
2909 psm->te->txn = NULL;
2914 if (psm->te != NULL)
2916 if (fi->h != NULL) {
2923 psm->pkgURL =
_free(psm->pkgURL);
2924 psm->rpmio_flags =
_free(psm->rpmio_flags);
2925 psm->payload_format =
_free(psm->payload_format);
2926 psm->failedFile =
_free(psm->failedFile);
2928 fi->fgroup =
_free(fi->fgroup);
2929 fi->fuser =
_free(fi->fuser);
2930 fi->apath =
_free(fi->apath);
2931 fi->fstates =
_free(fi->fstates);
2955 ptr =
rpmtsNotify(ts, psm->te, psm->what, psm->amount, psm->total);
2965 ts, fi, NULL, NULL, &psm->failedFile);
2972 if (rootDir != NULL && !(rootDir[0] ==
'/' && rootDir[1] ==
'\0')
2975 static int _pw_loaded = 0;
2976 static int _gr_loaded = 0;
2979 (void)getpwnam(
"root");
2984 (void)getgrnam(
"root");
2991 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/')
2994 F_SET(psm, CHROOTDONE);
3000 if (
F_ISSET(psm, CHROOTDONE)) {
3004 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/')
3007 F_CLR(psm, CHROOTDONE);
3009 if (currDir != NULL)
3010 xx =
Chdir(currDir);
3015 {
rpmtxn _parent = (psm && psm->te ? psm->te->txn : NULL);
3026 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
3031 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
3032 if (!
F_ISSET(psm, GOTTRIGGERS)) {
3034 F_SET(psm, GOTTRIGGERS);
3036 if (psm->triggers != NULL)
3041 {
const char * payload_compressor = NULL;
3042 const char * payload_format = NULL;
3047 payload_compressor = he->
p.
str;
3048 if (payload_compressor == NULL)
3049 payload_compressor =
xstrdup(
"gzip");
3051 psm->rpmio_flags = t = (
char *)
xmalloc(
sizeof(
"w9.gzdio"));
3054 if (!strcmp(payload_compressor,
"gzip"))
3056 if (!strcmp(payload_compressor,
"bzip2"))
3058 if (!strcmp(payload_compressor,
"lzma"))
3060 if (!strcmp(payload_compressor,
"xz"))
3062 payload_compressor =
_free(payload_compressor);
3066 payload_format = he->
p.
str;
3067 if (!xx || payload_format == NULL || !(
3068 !strcmp(payload_format,
"tar") || !strcmp(payload_format,
"ustar")
3069 #
if defined(SUPPORT_AR_PAYLOADS)
3070 || !strcmp(payload_format,
"ar")
3074 payload_format =
_free(payload_format);
3075 payload_format =
xstrdup(
"cpio");
3077 psm->payload_format =
_free(psm->payload_format);
3078 psm->payload_format = payload_format;
3083 assert(psm->mi == NULL);
3085 &fi->record,
sizeof(fi->record));
3093 if (fi->h != NULL) {
3102 if (fi->isSource)
break;
3103 if (fi->h == NULL)
break;
3117 #if defined(HAVE_SYSLOG_H) && defined(RPM_VENDOR_MANDRIVA)
3123 syslog(LOG_NOTICE,
"[RPM] %s installed\n", s);
3138 assert(psm->te != NULL);
3141 psm->te->installed = 1;
3149 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
3157 #if defined(HAVE_SYSLOG_H) && defined(RPM_VENDOR_MANDRIVA)
3163 syslog(LOG_NOTICE,
"[RPM] %s removed\n", s);
3178 if (psm->te != NULL)
3179 psm->te->u.removed.dboffset = 0;
rpmuint32_t rpmfiFFlags(rpmfi fi)
Return current file flags from file info set.
int rpmmiPrune(rpmmi mi, uint32_t *hdrNums, int nHdrNums, int sorted)
Remove items from set of package instances to iterate.
static void rpmpsmFini(void *_psm)
evrFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
FD_t rpmteFd(rpmte te)
Retrieve file handle from transaction element.
static rpmRC createDir(rpmts ts, rpmfi fi, const char **fn, const char *name)
rpmds rpmdsInit(rpmds ds)
Initialize dependency set iterator.
headerTagTableEntry rpmTagTable
Automatically generated table of tag name/value pairs.
rpmsm rpmsmFree(rpmsm sm)
Destroy a semanage wrapper.
int rpmtxnBegin(rpmdb rpmdb, rpmtxn parent, rpmtxn *txnp)
pid_t rpmsqWait(rpmsq sq)
Wait for child process to be reaped.
rpmuint32_t rpmteColor(rpmte te)
Retrieve color bits of transaction element.
miRE mireNew(rpmMireMode mode, int tag)
Create pattern container.
rpmtime_t rpmswExit(rpmop op, ssize_t rc)
Exit timed operation.
pid_t rpmsqFork(rpmsq sq)
Fork a child process.
void * rpmtsNotify(rpmts ts, rpmte te, rpmCallbackType what, rpmuint64_t amount, rpmuint64_t total)
Perform transaction progress notify callback.
const char const char size_t len
const char bson_timestamp_t * ts
rpmte rpmteFree(rpmte te)
Destroy a transaction element.
ARGI_t argiFree(ARGI_t argi)
Destroy an argi array.
void * mireFreeAll(miRE mire, int nmire)
Destroy compiled patterns.
const char * rpmtsRootDir(rpmts ts)
Get transaction rootDir, i.e.
rpmte rpmtsElement(rpmts ts, int ix)
Return (ordered) transaction set element.
void rpmluavSetValueNum(rpmluav var, double value)
rpmRC rpmpkgWrite(const char *fn, FD_t fd, void *ptr, const char **msg)
Write item onto file descriptor.
enum iosmFileAction_e iosmFileAction
File disposition(s) during package install/erase processing.
rpmsquirrel rpmsquirrelFree(rpmsquirrel squirrel)
Destroy a squirrel interpreter.
int Chroot(const char *path)
chroot(2) clone.
uint32_t rpmmiInstance(rpmmi mi)
Return header instance for current position of rpmdb iterator.
Structures used for an "rpmte" transaction element.
int rpmtxnCommit(rpmtxn txn)
size_t Fwrite(const void *buf, size_t size, size_t nmemb, FD_t fd)
fwrite(3) clone.
static const char * tag2sln(rpmTag tag)
Return scriptlet name from tag.
char * xstrdup(const char *str)
void * rpmluavFree(rpmluav var)
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation relocs)
Add package to be installed to transaction set.
rpmjs rpmjsFree(rpmjs js)
Destroy a js interpreter.
char * rpmGetPath(const char *path,...)
Return (malloc'ed) expanded, canonicalized, file path.
Structure(s) used for file info tag sets.
void rpmluavSetListMode(rpmluav var, int flag)
int rpmlioPrein(rpmdb rpmdb, const char **av, const char *body)
int Access(const char *path, int amode)
access(2) clone.
static int populateInstallHeader(const rpmts ts, const rpmte te, rpmfi fi)
Add per-transaction data to an install header.
enum rpmScriptID_e rpmScriptID
Scriptlet identifiers.
int mireRegcomp(miRE mire, const char *pattern)
Compile pattern match.
static int hCopyTag(Header sh, Header th, rpmTag tag)
Copy a tag from a source to a target header.
static rpmTag _trigger_tag
int mireClean(miRE mire)
Deallocate pattern match memory.
rpmtime_t rpmswAdd(rpmop to, rpmop from)
Sum statistic counters.
void * rpmsqThread(void *(*start)(void *arg), void *arg)
Call a function in a thread.
const char * rpmteN(rpmte te)
Retrieve name string of transaction element.
int Stat(const char *path, struct stat *st)
stat(2) clone.
int rpmlioPreun(rpmdb rpmdb, const char **av, const char *body)
struct rpmpsm_s * rpmpsm
Package state machine data.
FD_t fdLink(void *cookie, const char *msg)
rpmficl rpmficlNew(char **av, uint32_t flags)
Create and load a ficl interpreter.
int Fflush(FD_t fd)
fflush(3) clone.
int rpmlioPostin(rpmdb rpmdb, const char **av, const char *body)
#define F_SET(_psm, _FLAG)
rpmfi rpmfiFree(rpmfi fi)
Destroy a file info set.
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
const char * rpmfiFN(rpmfi fi)
Return current file name from file info set.
int rpmtsSetChrootDone(rpmts ts, int chrootDone)
Set chrootDone flag, i.e.
rpmTSType rpmtsType(rpmts ts)
Return the type of a transaction.
static void rpmlog(int code, const char *fmt,...)
const char * rpmteA(rpmte te)
Retrieve arch string of transaction element.
rpmts rpmtsLink(rpmts ts, const char *msg)
Reference a transaction set instance.
int doputenv(const char *str)
Like the libc function, but malloc()'s the space needed.
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
int argiCount(ARGI_t argi)
Return no.
rpmRC rpmaugRun(rpmaug aug, const char *str, const char **resultp)
Run augeas commands from a buffer.
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
char * headerSprintf(Header h, const char *fmt, headerTagTableEntry tags, headerSprintfExtension exts, errmsg_t *errmsg)
Return formatted output string from header tags.
void rpmluaPushTable(rpmlua _lua, const char *key,...)
void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value)
static rpmuint32_t hLoadTID(Header h, rpmTag tag)
Load a transaction id from a header.
int rpmfiFC(rpmfi fi)
Return file count from file info set.
struct rpmte_s * rpmte
An element of a transaction set, i.e.
static rpmop fdstat_op(FD_t fd, fdOpX opx)
const char * rpmteE(rpmte te)
Retrieve epoch string of transaction element.
static int postPopulateInstallHeader(const rpmts ts, const rpmpsm psm, rpmfi fi)
Add fi->states to an install header.
const char * rpmtsCurrDir(rpmts ts)
Get transaction currDir, i.e.
int rpmmiGrow(rpmmi mi, const uint32_t *hdrNums, int nHdrNums)
Append items to set of package instances to iterate.
rpmsql rpmsqlNew(char **av, uint32_t flags)
Create and load a sql interpreter.
void rpmluaPop(rpmlua _lua)
rpmpython rpmpythonFree(rpmpython python)
Destroy a python interpreter.
enum evrFlags_e evrFlags
Dependency Attributes.
int Chown(const char *path, uid_t owner, gid_t group)
chown(2) clone.
miRE mireFree(miRE mire)
Free pattern container.
const char * rpmteV(rpmte te)
Retrieve version string of transaction element.
const char * Fstrerror(FD_t fd)
strerror(3) clone.
const char * rpmteNEVR(rpmte te)
Retrieve name-version-release string from transaction element.
void * xcalloc(size_t nmemb, size_t size)
rpmruby rpmrubyNew(char **av, uint32_t flags)
Creates and initializes a Ruby interpreter.
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
rpmRC rpmpythonRun(rpmpython python, const char *str, const char **resultp)
Execute python string.
rpmfi rpmteFI(rpmte te, rpmTag tag)
Retrieve file info tag set from transaction element.
size_t rpmpkgSizeof(const char *fn, const void *ptr)
Return size of item in bytes.
unsigned char rpmuint8_t
Private int typedefs to avoid C99 portability issues.
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
static int hSaveFlinks(Header h, const struct rpmChainLink_s *flink)
Save forward link(s) of an upgrade chain into a header.
int rpmTempFile(const char *prefix, const char **fnptr, void *fdptr)
Return file handle for a temporaray file.
int argvCount(const ARGV_t argv)
Return no.
int rpmdbRemove(rpmdb db, int rid, uint32_t hdrNum, rpmts ts)
Remove package header from rpm database and indices.
ARGV_t argvData(ARGV_t argv)
Return data from argv array.
rpmRC rpmInstallSourcePackage(rpmts ts, void *_fd, const char **specFilePtr, const char **cookie)
Install source package.
int rpmsqJoin(void *thread)
Wait for thread to terminate.
struct rpmperl_s * rpmperl
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
struct rpmluav_s * rpmluav
rpmRC rpmficlRun(rpmficl ficl, const char *str, const char **resultp)
Execute ficl string.
rpmperl rpmperlNew(char **av, uint32_t flags)
Create and load a perl interpreter.
rpmjs rpmjsNew(char **av, uint32_t flags)
Create and load a js interpreter.
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
struct rpmpython_s * rpmpython
static int rpmdbTriggerGlobs(rpmpsm psm)
rpmRC rpmsmRun(rpmsm sm, char **av, const char **resultp)
Run semanage commands.
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char *fn, Header *hdrp)
Return package header from file handle, verifying digests/signatures.
int Glob_pattern_p(const char *pattern, int quote)
glob_pattern_p(3) clone.
int headerMacrosLoad(Header h)
Define per-header macros.
int rpmdsNext(rpmds ds)
Return next dependency set iterator index.
Structure(s) used for dependency tag sets.
rpmpython rpmpythonNew(char **av, uint32_t flags)
Create and load a python interpreter.
The FD_t File Handle data structure.
rpmmi rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
const char * rpmGenPath(const char *urlroot, const char *urlmdir, const char *urlfile)
Merge 3 args into path, any or all of which may be a url.
const char * rpmteD(rpmte te)
Retrieve distepoch string of transaction element.
struct rpmdb_s * rpmdb
Database of headers and tag value indices.
rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
Create and load a package state machine.
int rpmtsChrootDone(rpmts ts)
Get chrootDone flag, i.e.
int argiSort(ARGI_t argi, int(*compar)(ARGint_t *, ARGint_t *))
Sort an argi array.
int argvAdd(ARGV_t *argvp, ARGstr_t val)
Add a string to an argv array.
int rpmdbMireApply(rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp)
Return array of keys matching a pattern.
Generate and verify rpm package signatures.
int mireRegexec(miRE mire, const char *val, size_t vallen)
Execute pattern match.
Header headerFree(Header h)
Dereference a header instance.
static int hSaveBlinks(Header h, const struct rpmChainLink_s *blink)
Save backward link(s) of an upgrade chain into a header.
int rpmswEnter(rpmop op, ssize_t rc)
Enter timed operation.
rpmRC rpmsquirrelRun(rpmsquirrel squirrel, const char *str, const char **resultp)
Execute squirrel string.
const char const bson const bson * op
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
int Chdir(const char *path)
chdir(2) clone.
static rpmpsm rpmpsmGetPool(rpmioPool pool)
rpmaug rpmaugFree(rpmaug aug)
Destroy a augeas wrapper.
static const char * pkgStageString(pkgStage a)
int rpmsxExec(rpmsx sx, int verified, const char **argv)
Execute a package scriptlet within SELinux context.
int rpmlioPostun(rpmdb rpmdb, const char **av, const char *body)
rpmRC rpmMkdirPath(const char *dpath, const char *dname)
Create directory if it does not exist, and make sure path is writable.
Embedded Ruby interpreter.
void rpmluaDelVar(rpmlua _lua, const char *key,...)
Header headerRegenSigHeader(const Header h, int noArchiveSize)
Regenerate signature header.
rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
Package state machine driver.
void unsetenv(const char *name)
const char * rpmteO(rpmte te)
Retrieve os string of transaction element.
const char * rpmteHdrid(rpmte te)
Retrieve hdrid string from transaction element.
#define F_ISSET(_psm, _FLAG)
Header rpmteSetHeader(rpmte te, Header h)
Save header into transaction element.
const char * rpmdsN(const rpmds ds)
Return current dependency name.
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
int Fclose(FD_t fd)
fclose(3) clone.
static rpmRC runImmedTriggers(rpmpsm psm)
Run triggers from this header that are fired by headers in the database.
Cumulative statistics for an operation.
char * iosmStrerror(int rc)
Return formatted error message on payload handling failure.
int fsmTeardown(void *_fsm)
Clean file state machine.
struct rpmruby_s * rpmruby
rpmuint32_t * rpmteOriginTid(rpmte te)
Retrieve transaction start time that package was first installed.
int rpmfiNext(rpmfi fi)
Return next file iterator index.
static rpmRC runScript(rpmpsm psm, Header h, const char *sln, HE_t Phe, const char *script, int arg1, int arg2)
Run scriptlet with args.
Header headerLink(Header h)
Reference a header instance.
rpmuint32_t * rpmteOriginTime(rpmte te)
Retrieve time that package was first installed.
static const char * SCRIPT_PATH
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
rpmruby rpmrubyFree(rpmruby ruby)
Destroys a Ruby interpreter instance.
struct rpmsquirrel_s * rpmsquirrel
enum rpmRC_e rpmRC
RPM return codes.
int Ferror(FD_t fd)
ferror(3) clone.
int rpmmiAddPattern(rpmmi mi, rpmTag tag, rpmMireMode mode, const char *pattern)
Add pattern to iterator selector.
rpmsql rpmsqlFree(rpmsql sql)
Destroy a sql interpreter.
int rpmmiSetRewrite(rpmmi mi, int rewrite)
Prepare iterator for lazy writes.
rpmfi rpmfiInit(rpmfi fi, int fx)
Initialize file iterator index.
rpmuint32_t rpmtsColor(rpmts ts)
Retrieve color bits of transaction set.
Package state machine to handle a package from a transaction set.
static rpmRC runTriggers(rpmpsm psm)
Run trigger scripts in the database that are fired by this header.
static int rpmpsmNext(rpmpsm psm, pkgStage nstage)
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
static int snprintf(char *buf, int nb, const char *fmt,...)
rpmfi rpmfiLink(rpmfi fi, const char *msg)
Reference a file info set instance.
const char const bson const bson bson * out
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
rpmds rpmdsLink(rpmds ds, const char *msg)
Reference a dependency set instance.
dbiIndex dbiOpen(rpmdb db, rpmTag tag, unsigned int flags)
Methods to handle package elements.
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
int rpmdbCountPackages(rpmdb db, const char *N)
Return number of instances of package in Name index.
char * stpcpy(char *dest, const char *src)
struct rpmts_s * rpmts
The RPM Transaction Set.
void rpmluaSetVar(rpmlua _lua, rpmluav var)
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
int rpmmiSetModified(rpmmi mi, int modified)
Modify iterator to mark header for lazy write on release.
Structures and prototypes used for an "rpmts" transaction set.
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
FD_t Fdopen(FD_t ofd, const char *fmode)
rpmVSFlags rpmtsVSFlags(rpmts ts)
Get verify signatures flag(s).
static rpmScriptID tag2slx(rpmTag tag)
Return scriptlet id from tag.
File state machine to handle a payload within an rpm package.
int argiAdd(ARGI_t *argip, int ix, int val)
Add an int to an argi array.
rpmRC rpmsqlRun(rpmsql sql, const char *str, const char **resultp)
Execute sql from STRING | FILE | STDIN | INTERACTIVE.
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.
static rpmRC handleOneTrigger(const rpmpsm psm, Header sourceH, Header triggeredH, int arg2)
Execute triggers.
rpmtcl rpmtclFree(rpmtcl tcl)
Destroy a tcl interpreter.
int rpmdsMatch(const rpmds A, rpmds B)
Compare A against every member of B, looking for 1st match.
rpmpsm rpmpsmFree(rpmpsm psm, const char *msg)
Destroy a package state machine.
int Fileno(FD_t fd)
fileno(3) clone.
static rpmRC runInstScript(rpmpsm psm)
Retrieve and run scriptlet from header.
struct rpmficl_s * rpmficl
rpmRC rpmrubyRun(rpmruby ruby, const char *str, const char **resultp)
Evaluates Ruby code stored in a string.
int mireAppend(rpmMireMode mode, int tag, const char *pattern, const unsigned char *table, miRE *mirep, int *nmirep)
Append pattern to array.
static const char * ldconfig_path
int rpmdbAdd(rpmdb db, int iid, Header h, rpmts ts)
Add package header to rpm database and indices.
rpmficl rpmficlFree(rpmficl ficl)
Destroy a ficl interpreter.
const char const char * pattern
void rpmteSetDBInstance(rpmte te, unsigned int instance)
Set last instance installed to the database.
int rpmtsSELinuxEnabled(rpmts ts)
Get selinuxEnabled flag, i.e.
static rpmRC runTriggersLoop(rpmpsm psm, rpmTag tagno, int arg2)
Run a dependency set loop against rpmdb triggers.
Database transaction wrappers.
rpmuint32_t rpmtsGetTid(rpmts ts)
Get transaction id, i.e.
rpmRC rpmjsRun(rpmjs js, const char *str, const char **resultp)
Execute js string.
Access RPM indices using Berkeley DB interface(s).
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
Create and load a dependency set.
int rpmdsSetNoPromote(rpmds ds, int nopromote)
Set "Don't promote Epoch:" flag.
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
rpmsquirrel rpmsquirrelNew(char **av, uint32_t flags)
rpmperl rpmperlFree(rpmperl perl)
Destroy a perl interpreter.
rpmtcl rpmtclNew(char **av, uint32_t flags)
Create and load a tcl interpreter.
rpmRC rpmpsmScriptStage(rpmpsm psm, rpmTag scriptTag, rpmTag progTag)
Run rpmpsmStage(PSM_SCRIPT) for scriptTag and progTag.
unsigned int rpmmiCount(rpmmi mi)
Return number of elements in rpm database iterator.
int rpmtxnAbort(rpmtxn txn)
rpmRC rpmperlRun(rpmperl perl, const char *str, const char **resultp)
Execute perl string.
const char * rpmteR(rpmte te)
Retrieve release string of transaction element.
ARGint_t argiData(ARGI_t argi)
Return data from argi array.
In Memoriam: Steve Taylor staylor@redhat.com was here, now he's not.
rpmpsm rpmpsmLink(rpmpsm psm, const char *msg)
Reference a package state machine instance.
#define RPMDBI_PACKAGES
Pseudo-tags used by the rpmdb and rpmgi iterator API's.
FD_t rpmtsScriptFd(rpmts ts)
int rpmdsNegateRC(const rpmds ds, int rc)
Negate return code for negated comparisons.
int rpmluaRunScript(rpmlua _lua, const char *script, const char *name)
void rpmtsClean(rpmts ts)
Free memory needed only for dependency checks and ordering.
static pid_t psmWait(rpmpsm psm)
Wait for child process to be reaped.
rpmRC rpmtclRun(rpmtcl tcl, const char *str, const char **resultp)
Execute tcl string.
#define F_CLR(_psm, _FLAG)
const char const bson int num
unsigned long int rpmtime_t
struct _dbiIndex * dbiIndex
void rpmpsmSetAsync(rpmpsm psm, int async)
int Unlink(const char *path)
unlink(2) clone.