On Fri, Sep 19, 2008 at 12:40:55PM -0400, Jeff Johnson wrote: > >On Fri, Sep 19, 2008 at 04:21:50PM +0000, Alexey Tourbin wrote: > >>Technically there's no piping, only a file duplicated on stdin. And > >>"filetriggers" are run only once, at the end of transaction (they're > >>actually "posttrans filetriggers"), which saves consecutive ldconfig, > >>gtk-update-icon-cache, or whatever calls. > > > >Uh, but can that work? A Prereq to another package basically says > >that the package must be fully configured before installation, > >so all triggers must be run. Post-transaction is a bit late... > > > > There's need for a IMMEDIATE as well as a ONETIME (as in delayed) > trigger attribute. > > The ONETIME mechanism can be handled by appending to existing > %posttrans, the IMMEDIATE attribute is essentially the existing trigger > mechanism(s).
Okay, with DIRNAMES patterns and "posttrans" trigger flag, you can implement something like "posttrans filetriggers" on behalf of specfile/rpmdb. There are still issues. 1) %triggerin --posttrans -- /usr/share/icons/hicolor/*/*/ gtk-update-icon-cache /usr/share/icons/hicolor This trigger can be triggered/folded/called either by dirname or by glob pattern itself. Since there is no way to pass the matching dirname, which is limitation by itself, the only sane possibility is that DIRNAMES triggers are triggered/folded/called by glob patterns. 2) %triggerin --posttrans -- /usr/share/icons/hicolor/*/*/ gtk-update-icon-cache /usr/share/icons/hicolor %triggerun --posttrans -- /usr/share/icons/hicolor/*/*/ gtk-update-icon-cache /usr/share/icons/hicolor How do you pass "$2" argument to these triggers? What is "$2"? If you pass different "$2" for in/un, you can no longer fold basically the same in/un triggers (and they run twice). Or you do not pass "$2" at all. Anway, doing just something about "$2" is weired. And this is still not enough. 3) There's a dozen of icon themes, and their gtk2 icon cache is specific to gtk2. The above triggers imply that I process "hicolor" theme specially. However, I do not. I want gtk2 to update caches for all its themes as needed. Here is gtk-icon-cache.filtrigger for gtk2 pacakge as (presumably) implemented for ALT Linux: #!/bin/sh egrep -o '^/usr/share/icons/[^/]+/' |sort -u | # doing /usr/share/icons/*/ directories while read -r dir; do if [ -f "$dir"/index.theme ]; then # something changed for this theme gtk-update-icon-cache "$dir" elif [ -f "$dir"/icon-theme.cache ]; then # theme was removed, nuke stale cache rm -f "$dir"/icon-theme.cache rmdir --ignore-fail-on-non-empty "$dir" fi done Now you cannot implement this with glob-dirname triggers, because you need to know the name of icon theme dir. gtk2.spec: %triggerin -- /usr/share/icons/*/*/*/ # cannot deduce /usr/share/icons/hicolor/ prefix
pgpG1KIHvjhqR.pgp
Description: PGP signature