[Rpm-maint] [rpm-software-management/rpm] file trigger quirks (#1370)

Ludwig Nussel notifications at github.com
Wed Sep 23 08:45:40 UTC 2020


Trying to implement file triggers for mandoc to register and unregister man pages in the whatis database I ran into some strange behavior. Note I can't use transfiletrigger as zypp doesn't support that :(

- triggers are executed several times on upgrade and uninstall for the same package (ie the package with the trigger itself)
- the argument is always zero. So the triggers cannot handle upgrades differently.
- the triggers do not know the package a file belongs to. In case of mandoc installation that would be helpful as it could then just rebuild the database to speed things up instead of calling it on single files. Similar on erase it would just do nothing and wait for rpm to remove the database later.

```
tw:/root # rpm -q rpm
rpm-4.15.1-7.2.x86_64
tw:/root # cat filetriggers.spec
Name:           filetriggers
Version:        1.0
Release:        %{?rel}%{!?rel:1}
%define nvr %{name}-%{version}-%{release}
Summary:        Testing file triggers
Group:          testing
License:        GPL
BuildArch:      noarch

%description
%{summary}

%install
install -D -m 644 /dev/null %buildroot/usr/lib/foo/1
install -D -m 644 /dev/null %buildroot/usr/lib/foo/2

%filetriggerin -- /usr/lib/foo
echo "filetriggerin %{nvr}: $@"
cat > /dev/null

%filetriggerun -- /usr/lib/foo
echo "filetriggerun %{nvr}: $@"
cat > /dev/null

%preun
echo "preun %{nvr}: $@"

%files
/usr/lib/foo
/usr/lib/foo/1
/usr/lib/foo/2
tw:/root # for i in 1 2; do rpmbuild -bb filetriggers.spec --define "%rel $i"; done
[...]
tw:/root # cd /usr/src/packages/RPMS/noarch/
tw:/usr/src/packages/RPMS/noarch # rpm -U filetriggers-1.0-1.noarch.rpm 
filetriggerin filetriggers-1.0-1: 0
tw:/usr/src/packages/RPMS/noarch # rpm -U filetriggers-1.0-2.noarch.rpm 
filetriggerin filetriggers-1.0-1: 0
filetriggerin filetriggers-1.0-2: 0
filetriggerin filetriggers-1.0-2: 0
filetriggerun filetriggers-1.0-1: 0
preun filetriggers-1.0-1: 1
tw:/usr/src/packages/RPMS/noarch # rpm -e filetriggers
filetriggerun filetriggers-1.0-2: 0
filetriggerun filetriggers-1.0-2: 0
preun filetriggers-1.0-2: 0
```

-- 
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/1370
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200923/66e34098/attachment.html>


More information about the Rpm-maint mailing list