[Rpm-maint] [rpm-software-management/rpm] New transaction callback mode based around transaction elements (#1363)
Jaroslav Rohel
notifications at github.com
Mon Sep 21 06:02:05 UTC 2020
@pmatilai Thanks for PR. Passing user data was missing for long time.
I have a note on setting up user data. We have a new API function `void rpmteSetPriv(rpmte te, void * priv)`. But when an user creates a new transaction element (using `rpmtsAddInstallElement`/`rpmtsAddReinstallElement`/`rpmtsAddEraseElement`) he don't get a pointer to it. Pointer to it (rpmte value) is needed to use the new API function `rpmteSetPriv`.
In the `tests/rpmpython.at` all transaction elements are created. Then transaction set is iterated. Transaction elements are modified (user private data added). It is not user friendly API. Ideally we want set it during transaction element creating time.
>From your example I assume:
- transaction elements are in the transaction set in the order in which the user created them
- no transaction elements are automatically added/removed
And user can do something like this:
```
ret = rpmtsAddReinstallElement(ts, h, key);
int lastAddedTElementIdx = rpmtsNElements(ts) - 1;
rpmte lastAddedTElement = rpmtsElement(ts, lastAddedTElementIdx);
rpmteSetPriv(lastAddedTElement, user_data);
```
Am I right?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1363#issuecomment-695916627
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200920/5a1a93bd/attachment.html>
More information about the Rpm-maint
mailing list