12 #define _RPMTE_INTERNAL
14 #define _RPMTS_INTERNAL
32 static int IDTintcmp(
const void * a,
const void * b)
45 for (i = 0; i < idtx->
nidt; i++) {
66 if (need < 0)
return NULL;
69 if (need == 0)
return idtx;
83 if (idtx != NULL && idtx->
idt != NULL && idtx->
nidt > 0)
106 if (!hge(h, tag, &type, &tidp, &count) || tidp == NULL)
117 if (idtx == NULL || idtx->
idt == NULL)
145 const char ** av = NULL;
159 for (i = 0; i < ac; i++) {
164 fd =
Fopen(av[i],
"r");
165 if (fd == NULL ||
Ferror(fd)) {
168 if (fd != NULL) (void)
Fclose(fd);
188 assert(origin != NULL);
189 assert(!strcmp(av[i], origin));
192 if (!hge(h, tag, &type, &tidp, &count) || tidp == NULL)
200 if (idtx == NULL || idtx->
idt == NULL)
218 for (i = 0; i < ac; i++)
219 av[i] =
_free(av[i]);
220 av =
_free(av); ac = 0;
241 if (AV != NULL && AC > 0 && B == NULL) {
242 if (!strcmp(lname,
"NEVRA")) {
244 for (i = 0; i < AC && (A = AV[i]) != NULL; i++) {
256 if (AV != NULL && B != NULL)
257 for (i = 0; i < AC && (A = AV[i]) != NULL; i++) {
258 if (*A && *B && !strcmp(A, B))
290 while (ip != NULL && ip->
val.
u32 == thistid) {
297 const char ** flinkPkgid = NULL;
298 const char ** flinkHdrid = NULL;
299 const char ** flinkNEVRA = NULL;
307 if (pn == 1 && flinkPkgid[0] != NULL && !strcmp(flinkPkgid[0],
RPMTE_CHAIN_END)) {
324 bingo =
cmpArgvStr(ts,
"NEVRA", flinkNEVRA, nn, (p ? p->NEVRA : NULL));
326 bingo =
cmpArgvStr(ts,
"Hdrid", flinkHdrid, hn, (p ? p->hdrid : NULL));
328 bingo =
cmpArgvStr(ts,
"Pkgid", flinkPkgid, pn, (p ? p->pkgid : NULL));
351 rpmte q = ts->teErase;
407 unsigned thistid = 0xffffffff;
417 int vsflags, ovsflags;
420 int _unsafe_rollbacks = 0;
425 if (argv != NULL && *argv != NULL) {
459 {
const char * globstr =
rpmExpand(
"%{_repackage_dir}/*/*.rpm", NULL);
460 if (globstr == NULL || *globstr ==
'%') {
461 globstr =
_free(globstr);
474 globstr =
_free(globstr);
477 {
int notifyFlags, xx;
494 if (ip != NULL && ip->
val.
u32 > thistid)
496 if (rp != NULL && rp->
val.
u32 > thistid)
500 if (thistid == 0 || thistid < ia->rbtid)
504 if (_unsafe_rollbacks && thistid <= _unsafe_rollbacks)
515 if (thistid == *excludedTID) {
516 time_t ttid = (time_t)thistid;
518 _(
"Excluding TID from rollback: %-24.24s (0x%08x)\n"),
519 ctime(&ttid), thistid);
526 while (rp != NULL && rp->
val.
u32 == thistid) {
535 while (ip != NULL && ip->
val.
u32 == thistid) {
555 while (rp != NULL && rp->
val.
u32 == thistid) {
558 (rp->
key ? rp->
key :
"???"));
573 rc =
findErases(ts, ts->teInstall, thistid, ip, niids);
591 rc =
findErases(ts, NULL, thistid, ip, niids);
596 while (ip != NULL && ip->
val.
u32 == thistid) {
604 if (_unsafe_rollbacks)
626 tid = (time_t)thistid;
628 _(
"Rollback packages (+%d/-%d) to %-24.24s (0x%08x):\n"),
629 numAdded, numRemoved, ctime(&tid), thistid);
643 xx = rpmtsPrint(ts, stdout);
656 for (i = 0; i < rtids->
nidt; i++) {
658 if (rrp->
val.
u32 != thistid)
662 (void) unlink(rrp->
key);
679 while (ip != NULL && ip->
val.
u32 == thistid) {