Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-26 Thread Panu Matilainen
> > imposes its own signal handling on users when the db is open > > Can turn that off since > [56f49d7](https://github.com/rpm-software-management/rpm/commit/56f49d7f5af7c1c8a3eb478431356195adbfdd25) > right? API users turning off signal handling is not a solution, it's a problem in its own

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-25 Thread Colin Walters
> imposes its own signal handling on users when the db is open Can turn that off since 56f49d7f5af7c1c8a3eb478431356195adbfdd25 right? > and our ABI hasn't been particularly stable historically Maintaining C shared libraries is indeed extremely hard. I've messed up in the past and only just

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-25 Thread Panu Matilainen
One important aspect of dbus vs librpm API is that not everybody wants to link to librpm, which imposes its own signal handling on users when the db is open, and our ABI hasn't been particularly stable historically, dbus library itself is much more stable AIUI. -- You are receiving this

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-17 Thread Michael Schroeder
(Colin, see issue #1124 for a solution using a named pipe) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-17 Thread Panu Matilainen
@cgwalters , the use-case is not dnf itself but a daemon which will need to refresh it's view of rpmdb whenever *someone else* changes the rpmdb. See #1124 for some background. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-16 Thread Colin Walters
> This isn't just for dnf's benefit. It's a mechanism that anybody who needs to > do so is free to listen, and everybody else can ignore. Speaking as a former DBus maintainer upstream here and I have written many DBus APIs... It seems dramatically simpler to me to go with the inotify approach,

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
This isn't just for dnf's benefit. It's a mechanism that anybody who needs to do so is free to listen, and everybody else can ignore. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Colin Walters
> Well, we add this on request of the DNF team that need to be notified if > something else (rpm cli) changes the rpmdb underneath their daemon. Ah, I see. Well, nothing else can/should be changing the rpmdb on rpm-ostree based systems (see also https://github.com/coreos/rpm-ostree/pull/1789

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(); + } + if (state->bus) { + rc = dbus_bus_request_name(state->bus, "org.rpm.announce", +

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > +return RPMRC_OK; +} + +static rpmRC dbus_announce_tsm_pre(rpmPlugin plugin, rpmts ts) +{ +int rc; + +rc = open_dbus(plugin, ts); +if (rc != RPMRC_OK) + return rc; +return send_ts_message(plugin, "StartTransaction", ts,

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > +char * dbcookie; + +if (!state->logging) { + return RPMRC_OK; +} + +msg = dbus_message_new_signal("/org/rpm/Transaction", // object name + "org.rpm.Transaction", // interface name +

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > +char * dbcookie; + +if (!state->logging) { + return RPMRC_OK; +} + +msg = dbus_message_new_signal("/org/rpm/Transaction", // object name + "org.rpm.Transaction", // interface name +

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > + +msg = dbus_message_new_signal("/org/rpm/Transaction", // object name + "org.rpm.Transaction", // interface name + name); // name of the signal +if (NULL == msg) { +

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > +static rpmRC dbus_announce_init(rpmPlugin plugin, rpmts ts) +{ +struct dbus_announce_data * state = rcalloc(1, sizeof(*state)); +rpmPluginSetData(plugin, state); +return RPMRC_OK; +} + +static rpmRC open_dbus(rpmPlugin plugin, rpmts ts)

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > + if (dbus_error_is_set()) { + //fprintf(stderr, "Name Error (%s)\n", err.message); + dbus_error_free(); + } + if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != rc) { +

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > + +/* ...don't log test transactions */ +if (rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS)) + state->logging = 0; + +/* ...don't log chroot transactions */ +if (!rstreq(rpmtsRootDir(ts), "/")) +

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > +/* ...don't log chroot transactions */ +if (!rstreq(rpmtsRootDir(ts), "/")) + state->logging = 0; + +/* Don't open */ +if (!state->logging || state->bus) + return RPMRC_OK; + +if (lstat("/run/systemd/system/", ) == 0)

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-10 Thread Panu Matilainen
@pmatilai commented on this pull request. > +state->logging = 1; + +/* ...don't log test transactions */ +if (rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS)) + state->logging = 0; + +/* ...don't log chroot transactions */ +if (!rstreq(rpmtsRootDir(ts),

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-09 Thread Florian Festi
> Is there any coordination between this and the work to add dbus to libdnf in > [rpm-software-management/libdnf#941](https://github.com/rpm-software-management/libdnf/pull/941) > for example? Well, we add this on request of the DNF team that need to be notified if something else (rpm cli)

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-08 Thread Jonathan Lebon
@jlebon commented on this pull request. > @@ -0,0 +1,25 @@ +'\" t +.TH "RPM-DBUS-ANNOUNCE" "8" "03 Jun 2020" "Red Hat, Inc." +.SH NAME +rpm-plugin-dbus-announce \- DBus plugin for the RPM Package Manager + +.SH Description + +The plugin writes basic information about rpm transactions to the

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-08 Thread Colin Walters
@cgwalters commented on this pull request. > +state->logging = 1; + +/* ...don't log test transactions */ +if (rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS)) + state->logging = 0; + +/* ...don't log chroot transactions */ +if

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-08 Thread Colin Walters
Is there any coordination between this and the work to add dbus to libdnf in https://github.com/rpm-software-management/libdnf/pull/941 for example? For rpm-ostree we are already a DBus daemon, and having multiple other libraries in the stack also going out and talking to DBus is going to be a

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-08 Thread Michael Schroeder
@mlschroe commented on this pull request. > +state->logging = 1; + +/* ...don't log test transactions */ +if (rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS)) + state->logging = 0; + +/* ...don't log chroot transactions */ +if (!rstreq(rpmtsRootDir(ts),

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-05 Thread Florian Festi
Split the package signals into a separate patch as they need some deeper discussion on how the plugin hooks should actually work and what new we need to add (see #1254). -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-05 Thread Panu Matilainen
Having slept over it: the thing is that the packages aren't actually installed/removed and the result code until the transaction is over, we really must not advertise the inconsistent state to others. The syslog plugin gets this wrong too... -- You are receiving this because you are

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-04 Thread Florian Festi
Yeah, I had the package info as a separate patch, but I figured it'd be easier to just delete the functions than splitting all the changes and fixes. Otoh I could imaging some GUI tool to not blocking it's UI completely on an running transaction but instead just changing package by package. --

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-04 Thread Panu Matilainen
...noisy and like you said in the ticket, we don't want people to start building their own triggers outside rpm. Information about the contents of a transaction in progress is probably best limited to the invoking process. -- You are receiving this because you are subscribed to this thread.

Re: [Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-04 Thread Panu Matilainen
I'm starting to think we might actually be better off without sending notifications for individual packages, because this will be noisy, and doubly so since the psm hooks can get called multiple times per package as you noted. Just announce that transaction is in progress and when it ends.

[Rpm-maint] [rpm-software-management/rpm] Add dbus-announce plugin (#1255)

2020-06-04 Thread Florian Festi
The plugin announces start and completion of transactions and the installation and erasure of packages. The patch still needs some polishing: * Names of the DBus enities may need a second thought * Man page is still missing a description of the dbus signal sent * DBus config is not properly