Re: [Rpm-maint] [rpm-software-management/rpm] RFE: add database change notification API (#1124)

2020-06-17 Thread ニール・ゴンパ
@cgwalters Okay, and how do non-Linux systems do this?

-- 
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/issues/1124#issuecomment-645719125___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: add database change notification API (#1124)

2020-06-17 Thread Colin Walters
Just to echo 
https://github.com/rpm-software-management/rpm/pull/1255#issuecomment-645103007
here - inotify is used today for e.g. `/usr/share/applications` - when you e.g. 
`zypper/apt/yum/whatever install firefox` that's how the desktops pick up the 
change.

As far as portability, there are already a *lot* of cross platform wrappers for 
inotify.  For example, GLib has one.

So I think the simple solution is:

- Add an API to librpm to get a directory file descriptor (or path) to the 
rpmdb directory
- Change the code to whever something is written call `touch()` on that 
directory
- Suggest that higher level libraries use inotify (not rpm itself)


-- 
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/issues/1124#issuecomment-645350098___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: add database change notification API (#1124)

2020-03-26 Thread Panu Matilainen
Yeah, something built around a named pipe puts actually rpm in control of the 
thing, and also has the benefit of being generic.

-- 
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/issues/1124#issuecomment-604436492___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: add database change notification API (#1124)

2020-03-24 Thread Michael Schroeder
A linux specific way would be to offer some functions around inotify().

We can also try something more generic: We could create a named pipe in 
/var/lib/rpm. At the start of the transaction we open the pipe O_WRONLY, at the 
end we simply close the fd.

Some other process that wants to be notified can open the named pipe with 
O_RDONLY|O_NONBLOCK and then use poll/select on the fd. (Reading will not block 
for some reason if there is no writer.) When rpm opens the named pipe for 
writing nothing will happen, but closing it will make all the select/poll users 
get a read event (because of the EOF).

-- 
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/issues/1124#issuecomment-603157916___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: add database change notification API (#1124)

2020-03-19 Thread Panu Matilainen
Hmm, so it seems. Probably memories getting mixed up with BDB which I do think 
supports multi-process notification (which of course is all part of the reason 
its such a weird beeast). Since we can't really expect help from the database 
itself here, so the options are limited.

-- 
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/issues/1124#issuecomment-601154857___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: add database change notification API (#1124)

2020-03-19 Thread Michael Schroeder
I don't think sqlite notification hooks work for different processes.

-- 
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/issues/1124#issuecomment-601139635___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] RFE: add database change notification API (#1124)

2020-03-19 Thread Panu Matilainen
Traditionally rpm-related daemons have been watching for changes in 
/var/lib/rpm/Packages file, but hardcoded paths were always ugly and no longer 
feasible at all because of multiple supported backends with different file 
names and semantics over them.

We recently added rpmdbCookie() API for checking if the database has changed, 
and rpmdbStat() and rpmdbFStat() go to the same direction as well, but none of 
these serve the daemon case particularly well as it should not be necessary to 
poll.

I know sqlite supports notification hooks, and IIRC BDB does too. I think ndb 
doesn't keep track of who has the db open and no idea how easy/hard 
implementing that would be. @mlschroe, thoughts ?

-- 
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/issues/1124___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint