From 563f7c0dad5a748e1861f92087044d780787c766 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 25 May 2011 14:26:51 +0300 Subject: [PATCH] Permit %verifyscript from non-installed packages - Verification from non-installed packages can be useful sometimes: http://lists.rpm.org/pipermail/rpm-maint/2011-May/003015.html - %verifyscript is unlike all other scriptlets so might as well take some shortcuts and bypass rpmteProcess() & all, just create a lone rpmte, force the header we got and call rpmpsmRun() directly on it, bypassing rpmteProcess() which is only an unnecessary complication here (based on patch by Michael Schroeder) --- lib/verify.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/verify.c b/lib/verify.c index 8c8d102..28a0311 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -262,12 +262,13 @@ static int rpmVerifyScript(rpmts ts, Header h) if (headerIsEntry(h, RPMTAG_VERIFYSCRIPT)) { /* fake up a erasure transaction element */ - (void) rpmtsAddEraseElement(ts, h, -1); + rpmte p = rpmteNew(ts, h, TR_REMOVED, NULL, NULL); + rpmteSetHeader(p, h); - rc = (rpmteProcess(rpmtsElement(ts, 0), PKG_VERIFY) != RPMRC_OK); + rc = (rpmpsmRun(ts, p, PKG_VERIFY) != RPMRC_OK); /* clean up our fake transaction bits */ - rpmtsEmpty(ts); + rpmteFree(p); } return rc; -- 2.7.4