Bug 1246600 - [RFE] Document rpmcallback API
Summary: [RFE] Document rpmcallback API
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1246631 1406130
TreeView+ depends on / blocked
 
Reported: 2015-07-24 16:58 UTC by Will Woods
Modified: 2018-11-30 21:47 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-11-30 21:47:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Will Woods 2015-07-24 16:58:36 UTC
So, rpm 4.10 added RPMCALLBACK_SCRIPT_START and RPMCALLBACK_SCRIPT_STOP (see bug 606239).

Yum supported them, but DNF doesn't.

I'd like to add support for them to DNF, but the DNF team would rather not use these "new" callbacks unless they are documented as part of the public RPM API.

It turns out the RPM API documentation actually has very little to say about callbacks at all; http://rpm.org/api/4.12.0.1/rpmcallback_8h_source.html is basically the only thing I can find.

So:

1) Is rpmcallback.h part of RPM's public API?

2) If so, would you be willing to clarify that in the code/docs?

3) Would you write (or accept/publish) documentation on RPM's callback API?

Comment 1 Will Woods 2015-07-24 17:23:46 UTC
Also, here's my understanding of how the RPMCALLBACK_SCRIPT_* callbacks work; could you verify this, or correct me if I'm wrong?

Assuming the normal rpmCallbackFunction signature:

(const void *h, 
 const rpmCallbackType what, 
 const rpm_loff_t amount,
 const rpm_loff_t total,
 fnpyKey key,
 rpmCallbackData data)

If "what" is RPMCALLBACK_SCRIPT_{START,STOP,ERROR}:

  "amount" is the scriptlet tag (RPMTAG_PREIN, RPMTAG_POSTTRANS, etc.)
  "total" is the scriptlet exit value (see below)

The ordering is START; STOP; then ERROR if script exit value != RPMRC_OK (0).

For START, total is ignored.

For STOP, RPMRC_OK (0) indicates success, 
          RPMRC_NOTFOUND (1) indicates a non-fatal error (warning),
          any other value indicates a fatal error which prevented install/erase
          (this only happens for PREIN/PREUN/PRETRANS).

For ERROR, RPMRC_OK (0) indicates a non-fatal scriptlet failure,
           any other value indicates a fatal error which prevented install/erase
           (as above)


Is that correct?

Comment 2 Florian Festi 2015-07-27 12:05:48 UTC
BZ is not a support forum. Please ask your question on the rpm-maint list [1] and which you should be subscribed[2] anyway, if you are working on such an endeavour.

The rpm callback is an old, ugly and long to be replaced[3] piece of code. Unfortunately replacement has never happened - to a good degree due a lack of pressure of the API users.

It also is scattered all over the place. While some definitions are in rpmcallback.h the important functions are in rpmts.h: 
rpmtsNotify()
rpmtsSetNotifyCallback()

Here some very rough hints on the signature of the callback...

(const void *h,                /* header or NULL */
 const rpmCallbackType what,   /* one of the RPMCALLBACK_* constants */
 const rpm_loff_t amount,      /* amount of data processed (e.g. for install)
 const rpm_loff_t total,       /* total amount of data to be processed */
 fnpyKey key,                  /* rpmdbkey of package or tag of script or ... */
 rpmCallbackData data)         /* data passed as notifyData to rpmtsSetNotifyCallback */

Florian

[1] rpm-maint.org
[2] http://lists.rpm.org/mailman/listinfo/rpm-maint
[3] http://rpm.org/ticket/183

Comment 3 Radek Holy 2015-07-27 13:36:52 UTC
So, users have to choose whether to use an undocumented feature or wait years for an implementation of an RFE? I don't understand how you can close this as NOTABUG...

Comment 4 Florian Festi 2015-07-27 14:16:13 UTC
I closed this as NOTABUG because BZ is not the best way to get this resolved. This does in no way mean we are not going to address this issue and it does not mean that we will not update the documentation. Keeping this bug open will not get this fixed any faster.

As I already wrote everyone is invited to ask questions on rpm-maint and work with us on improvements of both the documentation and may be even a better callback API.

Comment 5 Florian Festi 2015-07-28 14:42:12 UTC
But if it helps you sleep...

Comment 6 Igor Gnatenko 2017-01-04 17:00:29 UTC
since RHBZ seems to be one of places where users request features... reopening.

Comment 7 Jan Kurik 2018-05-31 09:02:02 UTC
This bug is currently reported against a Fedora version which is already unsuported.
I am changing the version to '27', the latest supported release.

Please check whether this bug is still an issue on the '27' release.
If you find this bug not being applicable on this release, please close it.

Comment 8 Ben Cotton 2018-11-27 15:25:21 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Ben Cotton 2018-11-30 21:47:42 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.