On Fri, Sep 19, 2008 at 04:59:35PM +0200, Michael Schroeder wrote:
> On Fri, Sep 19, 2008 at 02:52:21PM +0000, Alexey Tourbin wrote:
> > On Fri, Sep 19, 2008 at 11:07:04AM +0200, Michael Schroeder wrote:
> > > while implementing virtual triggers
> > [...]
> > May I perhaps take a look at where you are?
> > I'm implementing some sort of triggers, too.
>
> Oh, I'm not implementing new triggers, I'm just changing the current
> implementation so that they also trigger on package provides (and
> maybe the file list) and not just package NEVR.
>
> What are you working on?
File triggers for ALT Linux rpm, based on Mandriva patch, but with a few
design decisions different. Main differences are:
1) The list of files is not prefixed with "+" or "-".
When some package is upgraded, the same files are both "added"
and "removed" (in terms of rpm), so the distinction is not relibable
(especially if the triggers are postponed/resumed). We can still
use simple file test like [ -f file ] to see if the files were actually
added/upgraded or removed. This also means we can make the list
of files unique with "sort -u".
2) No separate files with regular expressions (and no internal grep in
librpm) -- file triggers are black boxes. All triggers are run with
full file list attached to stdin.
Here is for example how ldconfig trigger can be implemented.
#!/bin/sh -e
while read -r f; do
case "$f" in
/lib/lib*/* |\
/lib64/lib*/* |\
/usr/lib/lib*/* |\
/usr/lib64/lib*/* )
# false positives
continue ;;
/lib/lib*.so |\
/lib64/lib*.so |\
/usr/lib/lib*.so |\
/usr/lib64/lib*.so )
# maybe soname
if set "$f".* && [ -f "$1" ]; then
continue
fi
;;
/lib/lib*.so.* |\
/lib64/lib*.so.* |\
/usr/lib/lib*.so.* |\
/usr/lib64/lib*.so.* )
# soname
;;
/etc/ld.so.conf.d/*.conf)
;;
*) continue ;;
esac
exec /sbin/ldconfig
done
In "maybe soname" case, I check for something like *-devel packages
installed or removed (they have symbolic links for which ldconfig
should not be invoked).
- application/pgp-signature attachment: stored
Received on Fri Sep 19 17:21:57 2008