[Rpm-maint] [rpm-software-management/rpm] Add support for %preuntrans and %postuntrans scriptlets (PR #2177)
Michal Domonkos
notifications at github.com
Tue Sep 20 15:09:50 UTC 2022
@dmnks requested changes on this pull request.
So I went nuts and found more typos. Nobody can blame you, this is out of anybody's control, it's just impossible to keep track of all those crazy pre/post/untrans combinations :smile:
> @@ -37,7 +37,9 @@ enum rpmtransFlags_e {
RPMTRANS_FLAG_NOCONTEXTS = (1 << 8), /*!< from --nocontexts */
RPMTRANS_FLAG_NOCAPS = (1 << 9), /*!< from --nocaps */
RPMTRANS_FLAG_NODB = (1 << 10), /*!< from --nodb */
- /* bits 11-15 unused */
+ /* bits 11-13 unused */
+ RPMTRANS_FLAG_NOPREUNTRANS = (1 << 14), /*!< from --preuntrans */
The comment seems wrong, shouldn't it be `from --nopreuntrans`?
> @@ -37,7 +37,9 @@ enum rpmtransFlags_e {
RPMTRANS_FLAG_NOCONTEXTS = (1 << 8), /*!< from --nocontexts */
RPMTRANS_FLAG_NOCAPS = (1 << 9), /*!< from --nocaps */
RPMTRANS_FLAG_NODB = (1 << 10), /*!< from --nodb */
- /* bits 11-15 unused */
+ /* bits 11-13 unused */
+ RPMTRANS_FLAG_NOPREUNTRANS = (1 << 14), /*!< from --preuntrans */
+ RPMTRANS_FLAG_NOPOSTUNTRANS = (1 << 15), /*!< from --postuntrans */
Same as above
> @@ -67,6 +67,12 @@ static const struct scriptInfo_s scriptInfo[] = {
{ RPMSCRIPT_POSTTRANS, "posttrans", 0,
RPMTAG_POSTTRANS, RPMTAG_POSTTRANSPROG, RPMTAG_POSTTRANSFLAGS,
0, },
+ { RPMSCRIPT_PREUNTRANS, "preuntrans", 0,
+ RPMTAG_PREUNTRANS, RPMTAG_PREUNTRANSPROG, RPMTAG_PREUNTRANSFLAGS,
+ RPMSCRIPT_FLAG_CRITICAL, },
+ { RPMSCRIPT_POSTTRANS, "postuntrans", 0,
Heh, this is a typo - it should be `RPMSCRIPT_POSTUNTRANS` :smile:
> @@ -17,6 +17,8 @@ enum rpmscriptTypes_e {
RPMSCRIPT_TRIGGERPOSTUN = (1 << 7),
RPMSCRIPT_PRETRANS = (1 << 8),
RPMSCRIPT_POSTTRANS = (1 << 9),
+ RPMSCRIPT_PREUNTRANS = (1 << 10),
+ RPMSCRIPT_POSUNTTRANS = (1 << 11),
:smile: Typo here!
> @@ -1844,6 +1853,11 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS)))
tsmem->pool = rpmstrPoolFree(tsmem->pool);
+ /* Run %preuntrans scripts unless disabled */
+ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPRETRANS)) {
How about `RPMTRANS_FLAG_NOPREUNTRANS`, now that we've defined it above? :smile:
> runTransScripts(ts, PKG_POSTTRANS);
}
+ /* Run %postuntrans scripts unless disabled */
+ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOSTTRANS)) {
How about `RPMTRANS_FLAG_NOPOSTUNTRANS`, now that we've defined it above? :smile:
> @@ -469,6 +469,17 @@ static rpmpsm rpmpsmNew(rpmts ts, rpmte te, pkgGoal goal)
psm->scriptArg = npkgs_installed + 1;
psm->countCorrection = 0;
break;
+ case PKG_PREUNTRANS:
+ if (rpmteDependsOn(psm->te))
Can't we just use `isUpdate()` here, just like under `case PKG_POSTTRANS`?
> @@ -469,6 +469,17 @@ static rpmpsm rpmpsmNew(rpmts ts, rpmte te, pkgGoal goal)
psm->scriptArg = npkgs_installed + 1;
psm->countCorrection = 0;
break;
+ case PKG_PREUNTRANS:
+ if (rpmteDependsOn(psm->te))
+ psm->scriptArg = npkgs_installed;
+ else
+ psm->scriptArg = npkgs_installed - 1;
+ psm->countCorrection = -1;
+ break;
+ case PKG_POSTUNTRANS:
+ psm->scriptArg = npkgs_installed;
Shouldn't this be `npkgs_installed - 1` as it's a removal? (Maybe I'm just understanding this wrong)
> @@ -17,6 +17,8 @@ enum rpmscriptTypes_e {
RPMSCRIPT_TRIGGERPOSTUN = (1 << 7),
RPMSCRIPT_PRETRANS = (1 << 8),
RPMSCRIPT_POSTTRANS = (1 << 9),
+ RPMSCRIPT_PREUNTRANS = (1 << 10),
+ RPMSCRIPT_POSUNTTRANS = (1 << 11),
Funny thing is, this compiled fine because it wasn't used :smile:
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2177#pullrequestreview-1113937478
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/2177/review/1113937478 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220920/cce42bf6/attachment-0001.html>
More information about the Rpm-maint
mailing list