rpm/verify_p.diff

50 lines
1.5 KiB
Diff

Make 'rpm -Vp <rpm>' work again.
--- ./lib/rpmte.c.orig 2011-05-12 15:22:06.000000000 +0000
+++ ./lib/rpmte.c 2011-05-12 15:23:39.000000000 +0000
@@ -905,15 +905,19 @@ int rpmteProcess(rpmte te, pkgGoal goal)
}
}
- rpmteRunAllCollections(te, PLUGINHOOK_COLL_PRE_REMOVE);
-
- if (rpmteOpen(te, reset_fi)) {
+ if (goal == PKG_VERIFY) {
failed = rpmpsmRun(te->ts, te, goal);
- rpmteClose(te, reset_fi);
- }
+ } else {
+ rpmteRunAllCollections(te, PLUGINHOOK_COLL_PRE_REMOVE);
+
+ if (rpmteOpen(te, reset_fi)) {
+ failed = rpmpsmRun(te->ts, te, goal);
+ rpmteClose(te, reset_fi);
+ }
- rpmteRunAllCollections(te, PLUGINHOOK_COLL_POST_ADD);
- rpmteRunAllCollections(te, PLUGINHOOK_COLL_POST_ANY);
+ rpmteRunAllCollections(te, PLUGINHOOK_COLL_POST_ADD);
+ rpmteRunAllCollections(te, PLUGINHOOK_COLL_POST_ANY);
+ }
/* XXX should %pretrans failure fail the package install? */
if (failed && !scriptstage) {
--- ./lib/verify.c.orig 2011-05-12 15:22:01.000000000 +0000
+++ ./lib/verify.c 2011-05-12 15:22:49.000000000 +0000
@@ -267,11 +267,11 @@ static int rpmVerifyScript(rpmts ts, Hea
if (headerIsEntry(h, RPMTAG_VERIFYSCRIPT)) {
/* fake up a erasure transaction element */
- (void) rpmtsAddEraseElement(ts, h, -1);
-
- rc = (rpmteProcess(rpmtsElement(ts, 0), PKG_VERIFY) != RPMRC_OK);
-
+ rpmte p = rpmteNew(ts, h, TR_REMOVED, NULL, NULL);
+ rpmteSetHeader(p, h);
+ rc = (rpmteProcess(p, PKG_VERIFY) != RPMRC_OK);
/* clean up our fake transaction bits */
+ rpmteFree(p);
rpmtsEmpty(ts);
}