19 #include <rpmpython.h>
27 #define _RPMFI_INTERNAL
30 #define _RPMSQ_INTERNAL
32 #define F_ISSET(_psm, _FLAG) ((_psm)->flags & (RPMPSM_FLAGS_##_FLAG))
33 #define F_SET(_psm, _FLAG) ((_psm)->flags |= (RPMPSM_FLAGS_##_FLAG))
34 #define F_CLR(_psm, _FLAG) ((_psm)->flags &= ~(RPMPSM_FLAGS_##_FLAG))
36 #define _RPMEVR_INTERNAL
39 #define _RPMTE_INTERNAL
42 #define _RPMTS_INTERNAL
81 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
85 sharedFileInfo replaced = (te ? te->replaced : NULL);
94 if (!(
rpmfiFC(fi) > 0 && replaced != NULL))
98 for (sfi = replaced; sfi->otherPkg; sfi++) {
99 if (prev && prev == sfi->otherPkg)
101 prev = sfi->otherPkg;
107 offsets =
alloca(num *
sizeof(*offsets));
110 for (sfi = replaced; sfi->otherPkg; sfi++) {
111 if (prev && prev == sfi->otherPkg)
113 prev = sfi->otherPkg;
114 offsets[num++] = sfi->otherPkg;
135 while (sfi->otherPkg && sfi->otherPkg == prev) {
136 assert(sfi->otherFileNum < he->
c);
155 #if defined(RPM_VENDOR_OPENPKG)
167 t[strlen(t)-1] =
'\0';
175 #if defined(RPM_VENDOR_OPENPKG)
177 Chown(N, fi->uid, fi->gid);
185 const char ** specFilePtr,
const char ** cookie)
187 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
191 const char * _sourcedir = NULL;
192 const char * _specdir = NULL;
193 const char * specFile = NULL;
202 memset(psm, 0,
sizeof(*psm));
204 psm->ts =
rpmtsLink(ts,
"InstallSourcePackage");
249 if (fi->te == NULL) {
254 assert(fi->h != NULL);
255 assert(((
rpmte)fi->te)->h == NULL);
259 ((
rpmte)fi->te)->fd =
fdLink(fd,
"installSourcePackage");
278 fi->fmapflags =
_free(fi->fmapflags);
283 #if defined(RPM_VENDOR_OPENPKG)
295 if ((muid_str =
rpmExpand(
"%{l_muid}", NULL)) != NULL)
296 if ((muid = (uid_t)strtol(muid_str, (
char **)NULL, 10)) > 0)
298 if ((mgid_str =
rpmExpand(
"%{l_mgid}", NULL)) != NULL)
299 if ((mgid = (gid_t)strtol(mgid_str, (
char **)NULL, 10)) > 0)
306 for (i = 0; i < (int)fi->fc; i++)
314 fi->apath = he->
p.
argv;
317 for (i = 0; i < (int)fi->fc; i++)
321 if (i == (
int)fi->fc) {
323 for (i = 0; i < (int)fi->fc; i++) {
324 const char * t = fi->apath[i];
325 t += strlen(fi->apath[i]) - 5;
326 if (!strcmp(t,
".spec"))
break;
330 #if defined(RPM_VENDOR_OPENPKG)
331 if(
createDir(fi, ts, NULL,
"%{_topdir}") ||
332 createDir(fi, ts, NULL,
"%{_builddir}") ||
334 createDir(fi, ts, NULL,
"%{_srcrpmdir}") ||
335 createDir(fi, ts, &_sourcedir,
"%{_sourcedir}") ||
336 createDir(fi, ts, &_specdir,
"%{_specdir}"))
342 createDir(ts, &_sourcedir,
"%{_sourcedir}") ||
348 if (i < (
int)fi->fc) {
349 size_t speclen = strlen(_specdir) + 2;
350 size_t sourcelen = strlen(_sourcedir) + 2;
353 fi->dnl =
_free(fi->dnl);
356 fi->dnl =
xmalloc(fi->dc *
sizeof(*fi->dnl)
357 + fi->fc *
sizeof(*fi->dil)
358 + speclen + sourcelen);
360 fi->dil = (
unsigned int *)(fi->dnl + fi->dc);
362 memset(fi->dil, 0, fi->fc *
sizeof(*fi->dil));
365 fi->dnl[0] = t = (
char *)(fi->dil + fi->fc);
366 fi->dnl[1] = t =
stpcpy(
stpcpy(t, _sourcedir),
"/") + 1;
370 t =
xmalloc(speclen + strlen(fi->bnl[i]) + 1);
390 if (specFilePtr && specFile && rpmrc ==
RPMRC_OK)
391 *specFilePtr = specFile;
393 specFile =
_free(specFile);
395 _specdir =
_free(_specdir);
396 _sourcedir =
_free(_sourcedir);
407 if (((
rpmte)fi->te)->fd != NULL)
410 ((
rpmte)fi->te)->fd = NULL;
427 static char *
SCRIPT_PATH =
"PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin";
452 return "%unknownscript";
494 msecs = psm->
sq.op.usecs/1000;
498 D_(
"%s: waitpid(%d) rc %d status %x secs %u.%03u\n"),
500 (
unsigned)psm->
sq.reaped, psm->
sq.status,
501 (
unsigned)msecs/1000, (
unsigned)msecs%1000);
506 *ssp |= (psm->
sq.status & 0xffff);
510 return psm->
sq.reaped;
526 const char *script,
int arg1,
int arg2)
542 for (i = 0; i < (int)Phe->
c && Phe->
p.
argv[i]; i++) {
578 #if defined(WITH_LUA) || defined(WITH_FICL) || defined(WITH_JS) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_TCL)
589 (*fdnop) = open(
".", O_RDONLY, 0);
596 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/') {
610 static int exitChroot(
rpmpsm psm,
int inChroot,
int rootFdno)
619 xx = fchdir(rootFdno);
621 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/') {
627 xx = fchdir(rootFdno);
629 xx = close(rootFdno);
646 const char *script,
int arg1,
int arg2)
650 char * av[] = { NULL, NULL, NULL, NULL };
662 av[0] = (
char *) Phe->
p.
argv[0];
664 (void) sprintf((av[1] =
alloca(32)),
"%d", arg1);
666 (void) sprintf((av[2] =
alloca(32)),
"%d", arg2);
668 #if defined(WITH_LUA)
669 if (!strcmp(Phe->
p.
argv[0],
"<lua>")) {
670 rc = runLuaScript(psm, sln, Phe, script, arg1, arg2);
673 #if defined(WITH_FICL)
674 if (!strcmp(Phe->
p.
argv[0],
"<ficl>")) {
675 rpmficl ficl = rpmficlNew((
const char **)av, 0);
676 rc = rpmficlRun(ficl, script, NULL) ==
RPMRC_OK
678 ficl = rpmficlFree(ficl);
682 if (!strcmp(Phe->
p.
argv[0],
"<js>")) {
683 rpmjs js = rpmjsNew((
const char **)av, 0);
684 rc = rpmjsRun(js, script, NULL) ==
RPMRC_OK
689 #if defined(WITH_PERLEMBED)
690 if (!strcmp(Phe->
p.
argv[0],
"<perl>")) {
691 rpmperl perl = rpmperlNew((
const char **)av, 0);
692 rc = rpmperlRun(perl, script, NULL) ==
RPMRC_OK
694 perl = rpmperlFree(perl);
697 #if defined(WITH_PYTHONEMBED)
698 if (!strcmp(Phe->
p.
argv[0],
"<python>")) {
699 rpmpython python = rpmpythonNew((
const char **)av, 0);
700 rc = rpmpythonRun(python, script, NULL) ==
RPMRC_OK
702 python = rpmpythonFree(python);
705 #if defined(WITH_RUBYEMBED)
706 if (!strcmp(Phe->
p.
argv[0],
"<ruby>")) {
707 rpmruby ruby = rpmrubyNew((
const char **)av, 0);
708 rc = rpmrubyRun(ruby, script, NULL) ==
RPMRC_OK
710 ruby = rpmrubyFree(ruby);
713 #if defined(WITH_TCL)
714 if (!strcmp(Phe->
p.
argv[0],
"<tcl>")) {
715 rpmtcl tcl = rpmtclNew((
const char **)av, 0);
716 rc = rpmtclRun(tcl, script, NULL) ==
RPMRC_OK
718 tcl = rpmtclFree(tcl);
725 *ssp |= (xx & 0xffff);
729 xx = exitChroot(psm, inChroot, rootFdno);
760 const char * script,
int arg1,
int arg2)
769 const char ** argv = NULL;
771 const char **
IP = NULL;
773 size_t maxPrefixLength;
775 char * prefixBuf = NULL;
776 const char * fn = NULL;
777 FD_t scriptFd = NULL;
780 const char * body = NULL;
791 if (Phe->
p.
argv == NULL && script == NULL)
799 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
802 assert(he->
p.
str != NULL);
807 if (!strcmp(Phe->
p.
argv[0],
"<lua>")
808 || !strcmp(Phe->
p.
argv[0],
"<ficl>")
809 || !strcmp(Phe->
p.
argv[0],
"<js>")
810 || !strcmp(Phe->
p.
argv[0],
"<perl>")
811 || !strcmp(Phe->
p.
argv[0],
"<python>")
812 || !strcmp(Phe->
p.
argv[0],
"<ruby>")
813 || !strcmp(Phe->
p.
argv[0],
"<tcl>"))
815 #if defined(WITH_LUA) || defined(WITH_FICL) || defined(WITH_JS) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_TCL)
817 D_(
"%s: %s(%s) running %s scriptlet.\n"),
819 rc = runEmbeddedScript(psm, sln, Phe, body, arg1, arg2);
829 if (ldconfig_path && Phe->
p.
argv != NULL &&
F_ISSET(psm, UNORDERED)) {
830 if (ldconfig_done && !strcmp(Phe->
p.
argv[0], ldconfig_path)) {
832 D_(
"%s: %s(%s) skipping redundant \"%s\".\n"),
841 D_(
"%s: %s(%s) %ssynchronous scriptlet start\n"),
843 (
F_ISSET(psm, UNORDERED) ?
"a" :
""));
845 if (Phe->
p.
argv == NULL) {
846 argv =
alloca(5 *
sizeof(*argv));
851 argv =
alloca((Phe->
c + 4) *
sizeof(*argv));
852 memcpy(argv, Phe->
p.
argv, Phe->
c *
sizeof(*argv));
854 ldconfig_done = (ldconfig_path && !strcmp(argv[0], ldconfig_path)
859 if (IPhe->
tag == 0) {
869 char * t = (
char *) &av[1];
889 for (i = 0; i < nIP; i++) {
891 if (len > maxPrefixLength) maxPrefixLength = len;
893 prefixBuf =
alloca(maxPrefixLength + 50);
904 (!strcmp(argv[0],
"/bin/sh") || !strcmp(argv[0],
"/bin/bash")))
906 static const char set_x[] =
"set -x\n";
907 nw =
Fwrite(set_x,
sizeof(set_x[0]),
sizeof(set_x)-1, fd);
910 if (ldconfig_path && strstr(body, ldconfig_path) != NULL)
913 nw =
Fwrite(body,
sizeof(body[0]), strlen(body), fd);
916 {
const char * sn = fn;
918 !(rootDir[0] ==
'/' && rootDir[1] ==
'\0'))
920 sn += strlen(rootDir)-1;
927 sprintf(av,
"%d", arg1);
932 sprintf(av,
"%d", arg2);
940 if (scriptFd != NULL) {
944 out =
Fopen(
"/dev/null",
"w.fdio");
950 out =
fdDup(STDOUT_FILENO);
956 if (psm->
sq.child == 0) {
961 pipes[0] = pipes[1] = 0;
964 xx = close(pipes[1]);
965 xx = dup2(pipes[0], STDIN_FILENO);
966 xx = close(pipes[0]);
969 for (fdno = 3; fdno < 100; fdno++) {
970 flag = fcntl(fdno, F_GETFD);
971 if (flag == -1 || (flag & FD_CLOEXEC))
974 D_(
"%s: %s(%s)\tfdno(%d) missing FD_CLOEXEC\n"),
977 xx = fcntl(fdno, F_SETFD, FD_CLOEXEC);
981 if (scriptFd != NULL) {
982 int sfdno =
Fileno(scriptFd);
984 if (sfdno != STDERR_FILENO)
985 xx = dup2(sfdno, STDERR_FILENO);
986 if (ofdno != STDOUT_FILENO)
987 xx = dup2(ofdno, STDOUT_FILENO);
989 if (ofdno > STDERR_FILENO && ofdno != sfdno)
991 if (sfdno > STDERR_FILENO && ofdno != sfdno)
995 {
const char *ipath =
rpmExpand(
"PATH=%{_install_script_path}", NULL);
998 if (ipath && ipath[5] !=
'%')
1003 ipath =
_free(ipath);
1008 for (i = 0; i < nIP; i++) {
1009 sprintf(prefixBuf,
"RPM_INSTALL_PREFIX%d=%s", i, IP[i]);
1014 sprintf(prefixBuf,
"RPM_INSTALL_PREFIX=%s", IP[i]);
1021 !(rootDir[0] ==
'/' && rootDir[1] ==
'\0'))
1030 argv[0], (
unsigned)getpid());
1043 xx =
rpm_execcon(0, argv[0], (
char *
const *)argv, environ);
1047 xx = execv(argv[0], (
char *
const *)argv);
1059 if (psm->
sq.child == (pid_t)-1) {
1067 if (!(psm->
sq.reaped >= 0 && !strcmp(argv[0],
"/usr/sbin/glibc_post_upgrade") && WEXITSTATUS(psm->
sq.status) == 110)) {
1069 if (psm->
sq.reaped < 0) {
1071 _(
"%s(%s) scriptlet failed, waitpid(%d) rc %d: %s\n"),
1072 sln, NVRA, (
int)psm->
sq.child, (
int)psm->
sq.reaped,
1076 if (!WIFEXITED(psm->
sq.status) || WEXITSTATUS(psm->
sq.status)) {
1077 if (WIFSIGNALED(psm->
sq.status)) {
1081 _(
"%s(%s) scriptlet failed, signal %d\n"),
1082 sln, NVRA, WTERMSIG(psm->
sq.status));
1087 _(
"%s(%s) scriptlet failed, exit status %d\n"),
1088 sln, NVRA, WEXITSTATUS(psm->
sq.status));
1120 HE_t Phe = memset(
alloca(
sizeof(*Phe)), 0,
sizeof(*Phe));
1121 HE_t She = memset(
alloca(
sizeof(*She)), 0,
sizeof(*She));
1123 const char * argv0 = NULL;
1126 assert(fi->h != NULL);
1137 const char * s = Phe->
p.
str;
1140 Phe->
p.
argv[0] = t = (
char *) &Phe->
p.
argv[1];
1147 if (Phe->
p.
argv[0][0] ==
'%')
1154 argv0 =
_free(argv0);
1177 static int scareMem = 0;
1178 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1179 HE_t Ihe = memset(
alloca(
sizeof(*Ihe)), 0,
sizeof(*Ihe));
1180 HE_t She = memset(
alloca(
sizeof(*She)), 0,
sizeof(*She));
1181 HE_t Phe = memset(
alloca(
sizeof(*Phe)), 0,
sizeof(*Phe));
1188 const char * sourceName;
1189 const char * triggerName;
1197 sourceName = he->
p.
str;
1201 triggerName = he->
p.
str;
1235 if (!(Flags & psm->
sense))
1239 depName = (
char *)
rpmdsN(Tds);
1240 if (depName[0] ==
'/') {
1241 size_t nb = strlen(depName);
1244 if (depName[nb-1] ==
'/') {
1260 const char * N =
rpmdsN(ds);
1273 if (!bingo && depName[nb-1] ==
'/') {
1300 {
int index = Ihe->
p.
ui32p[i];
1301 const char * s = Phe->
p.
argv[index];
1312 rc |=
runScript(psm, triggeredH,
"%trigger", he,
1313 She->
p.
argv[index], arg1, arg2);
1333 triggerName =
_free(triggerName);
1334 sourceName =
_free(sourceName);
1352 for (i = 0; i < nkeys; i++) {
1353 char * t = (
char *) keys[i];
1377 static int scareMem = 0;
1381 char * depName = NULL;
1392 const char * Name =
rpmdsN(ds);
1393 size_t nName = strlen(Name);
1394 unsigned prev, instance;
1398 depName =
_free(depName);
1399 depName =
xmalloc(nName + 1 + 1);
1400 (void)
stpcpy(depName, Name);
1403 depName[nName+1] =
'\0';
1405 if (depName[0] ==
'/' && psm->
Tmires != NULL) {
1410 for (j = 0, mire = psm->
Tmires; j < psm->
nTmires; j++, mire++) {
1411 const char * pattern = psm->
Tpats[j];
1412 if (depName[nName-1] !=
'/') {
1413 size_t npattern = strlen(pattern);
1414 depName[nName] = (pattern[npattern-1] ==
'/') ?
'/' :
'\0';
1420 depName =
_free(depName);
1435 while((triggeredH =
rpmmiNext(mi)) != NULL) {
1437 if (prev == instance)
1441 xx =
argiAdd(&instances, -1, instance);
1449 depName =
_free(depName);
1474 if (_trigger_tag == 0) {
1475 const char * t =
rpmExpand(
"%{?_trigger_tag}", NULL);
1483 assert(psm->
te != NULL);
1484 {
const char * N =
rpmteN(psm->
te);
1492 assert(fi->h != NULL);
1533 HE_t Ihe = memset(
alloca(
sizeof(*Ihe)), 0,
sizeof(*Ihe));
1547 assert(fi->h != NULL);
1550 if (_trigger_tag == 0) {
1551 const char * t =
rpmExpand(
"%{?_trigger_tag}", NULL);
1562 if (triggers == NULL)
1567 if (!(xx && Ihe->
p.
ui32p && Ihe->
c))
goto exit;
1571 if (triggers != NULL)
1572 while ((i =
rpmdsNext(triggers)) >= 0) {
1574 const char * N =
rpmdsN(triggers);
1575 const char * EVR =
rpmdsEVR(triggers);
1578 if (!(Flags & psm->
sense))
1585 tagno = (N[strlen(N)-1] ==
'/')
1599 for (i = 0; (Name = keys[i]) != NULL; i++) {
1600 unsigned prev, instance;
1608 tagno = (Name[strlen(Name)-1] ==
'/')
1621 while((sourceH =
rpmmiNext(mi)) != NULL) {
1625 if (prev == instance)
1632 xx =
argiAdd(&instances, -1, instance);
1682 default:
return "???";
1696 psm->
te = rpmteFree(psm->
te);
1724 if (_psmPool == NULL) {
1734 static const char msg[] =
"rpmpsmNew";
1740 if (te) psm->
te = rpmteLink(te, msg);
1743 if (te) psm->
te =
te;
1767 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1789 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1808 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1822 he->
p.
argv = &chain_end;
1834 he->
p.
argv = &chain_end;
1846 he->
p.
argv = &chain_end;
1863 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1881 he->
p.
argv = &chain_end;
1896 he->
p.
argv = &chain_end;
1911 he->
p.
argv = &chain_end;
1931 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1940 assert(fi->h != NULL);
1942 {
struct timeval tv;
1943 xx = gettimeofday(&tv, NULL);
1949 he->
p.
ui32p = &installTime[0];
1955 memcpy(originTime, uip,
sizeof(originTime));
1956 if (originTime[0] == 0)
1957 memcpy(originTime, installTime,
sizeof(originTime));
1960 he->
p.
ui32p = originTime;
1965 memcpy(originTid, uip,
sizeof(originTid));
1966 if (originTid[0] == 0)
1967 memcpy(originTid, ts->tid,
sizeof(originTid));
2001 if (digest != NULL) {
2014 if (st->st_mode == 0 && st->st_mtime == 0 && st->st_size == 0)
2017 if (st->st_mode != 0) {
2020 he->
p.
ptr = (
void *)st;
2047 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
2051 if (fi->fstates != NULL && fc > 0) {
2054 he->
p.
ui8p = fi->fstates;
2062 #if defined(WITH_PTHREADS)
2063 static void * rpmpsmThread(
void * arg)
2079 #if defined(WITH_PTHREADS)
2093 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
2103 if (fi->h == NULL && fi->te && ((
rpmte)fi->te)->h != NULL) fi->h =
headerLink(((
rpmte)fi->te)->h);
2126 assert(psm->
te != NULL);
2130 if (psm->
te->downgrade)
2143 assert(psm->
mi == NULL);
2145 if (hdrid != NULL) {
2156 #ifdef RPM_VENDOR_MANDRIVA
2178 if (fi->fstates == NULL && fc > 0) {
2179 fi->fstates =
xmalloc(
sizeof(*fi->fstates) * fc);
2193 fi->striplen = (xx && he->
p.
str ? strlen(he->
p.
str) + 1 : 1);
2203 assert(he->
p.
argv != NULL);
2204 fi->apath = he->
p.
argv;
2206 if (fi->fuser == NULL) {
2209 fi->fuser = he->
p.
argv;
2211 if (fi->fgroup == NULL) {
2214 fi->fgroup = he->
p.
argv;
2241 bfmt =
rpmGetPath(tiddn,
"/",
"%{_repackage_name_fmt}", NULL);
2246 "%{?_repackage_dir}",
2248 pkgbn =
_free(pkgbn);
2252 pkgdn = dirname(pkgdn_buf);
2255 pkgdn_buf =
_free(pkgdn_buf);
2267 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
2271 {
static int oneshot = 0;
2286 psm->
sense = RPMSENSE_TRIGGERPREIN;
2304 _(
"%s: %s scriptlet failed (%d), skipping %s\n"),
2315 psm->
sense = RPMSENSE_TRIGGERUN;
2332 int noArchiveSize = 0;
2333 const char * origin = NULL;
2334 const char * digest = NULL;
2335 const struct stat * st = NULL;
2336 size_t nstbytes = 0;
2347 if (xx && he->
p.
str != NULL)
2351 if (xx && he->
p.
ptr != NULL && (
size_t)he->
c ==
sizeof(*st)) {
2360 if (xx && uh != NULL) {
2367 if (xx && uh != NULL) {
2401 {
static const char item[] =
"Lead";
2421 {
static const char item[] =
"Signature";
2439 if (psm->
oh != NULL)
2449 if (origin != NULL) {
2455 origin =
_free(origin);
2457 if (digest != NULL) {
2463 digest =
_free(digest);
2468 he->
p.
ptr = (
void *)st;
2480 assert(psm->
te != NULL);
2485 {
const char item[] =
"Header";
2486 const char * msg = NULL;
2490 (msg && *msg ? msg :
"write failed\n"));
2497 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
2514 if (
rpmteFd(fi->te) == NULL) {
2522 if (psm->
cfd == NULL) {
2547 psm->
amount = (fi->archiveSize ? fi->archiveSize : 100);
2554 _(
"unpacking of archive failed%s%s: %s\n"),
2578 psm->
total = (fc ? fc : 100);
2588 psm->
amount = (fc ? fc : 100);
2589 psm->
total = (fc ? fc : 100);
2600 if (psm->
fd == NULL) {
2608 if (psm->
cfd == NULL) {
2630 psm->
amount = (fi->archiveSize ? fi->archiveSize : 100);
2634 fi->action = (int) action;
2635 fi->actions = (
int *) actions;
2660 psm->
sense = RPMSENSE_TRIGGERIN;
2685 psm->
sense = RPMSENSE_TRIGGERPOSTUN;
2718 if (psm->
fd != NULL) {
2728 if (!rc && ts && ts->notify == NULL) {
2738 _(
"%s failed on file %s: %s\n"),
2756 if (psm->
te != NULL)
2757 if (psm->
te->h != NULL) {
2762 if (psm->
te != NULL)
2765 if (fi->h != NULL) {
2777 fi->fgroup =
_free(fi->fgroup);
2778 fi->fuser =
_free(fi->fuser);
2779 fi->apath =
_free(fi->apath);
2780 fi->fstates =
_free(fi->fstates);
2821 if (rootDir != NULL && !(rootDir[0] ==
'/' && rootDir[1] ==
'\0')
2824 static int _pw_loaded = 0;
2825 static int _gr_loaded = 0;
2828 (void)getpwnam(
"root");
2833 (void)getgrnam(
"root");
2840 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/')
2843 F_SET(psm, CHROOTDONE);
2849 if (
F_ISSET(psm, CHROOTDONE)) {
2853 if (rootDir != NULL && strcmp(rootDir,
"/") && *rootDir ==
'/')
2856 F_CLR(psm, CHROOTDONE);
2858 if (currDir != NULL)
2859 xx =
Chdir(currDir);
2867 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
2872 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
2873 if (!
F_ISSET(psm, GOTTRIGGERS)) {
2875 F_SET(psm, GOTTRIGGERS);
2882 {
const char * payload_compressor = NULL;
2883 const char * payload_format = NULL;
2888 payload_compressor = he->
p.
str;
2889 if (payload_compressor == NULL)
2890 payload_compressor =
xstrdup(
"gzip");
2895 if (!strcmp(payload_compressor,
"gzip"))
2897 if (!strcmp(payload_compressor,
"bzip2"))
2899 if (!strcmp(payload_compressor,
"lzma"))
2901 if (!strcmp(payload_compressor,
"xz"))
2903 payload_compressor =
_free(payload_compressor);
2907 payload_format = he->
p.
str;
2908 if (!xx || payload_format == NULL || !(
2909 !strcmp(payload_format,
"tar") || !strcmp(payload_format,
"ustar")
2910 #
if defined(SUPPORT_AR_PAYLOADS)
2911 || !strcmp(payload_format,
"ar")
2915 payload_format =
_free(payload_format);
2916 payload_format =
xstrdup(
"cpio");
2924 assert(psm->
mi == NULL);
2926 &fi->record,
sizeof(fi->record));
2934 if (fi->h != NULL) {
2943 if (fi->isSource)
break;
2944 if (fi->h == NULL)
break;
2956 #if defined(HAVE_SYSLOG_H) && defined(RPM_VENDOR_MANDRIVA)
2962 syslog(LOG_NOTICE,
"[RPM] %s installed\n", s);
2970 assert(psm->
te != NULL);
2973 psm->
te->installed = 1;
2981 if (
rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
break;
2987 #if defined(HAVE_SYSLOG_H) && defined(RPM_VENDOR_MANDRIVA)
2993 syslog(LOG_NOTICE,
"[RPM] %s removed\n", s);
3001 if (psm->
te != NULL)
3002 psm->
te->u.removed.dboffset = 0;