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

Reply via email to