[Rpm-maint] [rpm-software-management/rpm] `%triggerin -- %{name} < %{version}-%{release}` is always triggered on upgrade (#209)

SATOH Fumiyasu notifications at github.com
Thu Apr 27 17:09:29 UTC 2017


I want to put a scriptlet into new package for package downgrading to unapply a new feature in new package, but RPM triggers `%triggerin` scriptlet in wrong situation.

RPM SPEC for `baz-1.0-1.old.noarch.rpm`:

```
Summary: Baz
Name: baz
Version: 1.0
Release: 1.old
Group: test group
License: test license
BuildArch: noarch

%description
Baz

%install
mkdir -p %{buildroot}
echo %{version}-%{release} >%{buildroot}/%{name}

%files
/%{name}
```

RPM SPEC for `baz-1.0-2.new.noarch.rpm`:

```
Summary: Baz
Name: baz
Version: 1.0
Release: 2.new
Group: test group
License: test license
BuildArch: noarch

%description
Baz

%post
if [ $1 -eq 2 ]; then
  : ... Apply new feature in 1.0-2.new for upgrade ...
fi

%install
mkdir -p %{buildroot}
echo %{version}-%{release} >%{buildroot}/%{name}

%triggerin -- %{name} < 1.0-2.new
: ... Unapply new feature in 1.0-2.new for downgrade ...
echo "I'm running %%triggerin scriptlet in %{name}-%{version}-%{release}"

%files
/%{name}
```

I think RPM does NOT trigger `%triggerin -- %{name} < 1.0-2.new` above on upgrade, but RPM triggers it:

```console
# rpm -iv baz-1.0-1.old.noarch.rpm
Preparing packages...
baz-1.0-1.old.noarch
# rpm -Uv baz-1.0-2.new.noarch.rpm
Preparing packages...
baz-1.0-2.new.noarch
I'm running %triggerin scriptlet in baz-1-2.new
```

For test purpose, when I rewrite `%triggerin -- %{name} < 1.0-2.new` to `%triggerin -- %{name}`, RPM triggers it twice!!:

```console
# rpm -iv baz-1.0-1.old.noarch.rpm
Preparing packages...
baz-1.0-1.old.noarch
# rpm -Uv baz-1-2.new.noarch.rpm
Preparing packages...
baz-1.0-2.new.noarch
I'm running %triggerin scriptlet in baz-1.0-2.new
I'm running %triggerin scriptlet in baz-1.0-2.new
```


-- 
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/209
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20170427/72850488/attachment.html>


More information about the Rpm-maint mailing list