<p>I want to put a scriptlet into new package for package downgrading to unapply a new feature in new package, but RPM triggers <code>%triggerin</code> scriptlet in wrong situation.</p>
<p>RPM SPEC for <code>baz-1.0-1.old.noarch.rpm</code>:</p>
<pre><code>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}
</code></pre>
<p>RPM SPEC for <code>baz-1.0-2.new.noarch.rpm</code>:</p>
<pre><code>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}
</code></pre>
<p>I think RPM does NOT trigger <code>%triggerin -- %{name} < 1.0-2.new</code> above on upgrade, but RPM triggers it:</p>
<div class="highlight highlight-text-shell-session"><pre># <span class="pl-s1">rpm -iv baz-1.0-1.old.noarch.rpm</span>
<span class="pl-mo">Preparing packages...</span>
<span class="pl-mo">baz-1.0-1.old.noarch</span>
# <span class="pl-s1">rpm -Uv baz-1.0-2.new.noarch.rpm</span>
<span class="pl-mo">Preparing packages...</span>
<span class="pl-mo">baz-1.0-2.new.noarch</span>
<span class="pl-mo">I'm running %triggerin scriptlet in baz-1-2.new</span></pre></div>
<p>For test purpose, when I rewrite <code>%triggerin -- %{name} < 1.0-2.new</code> to <code>%triggerin -- %{name}</code>, RPM triggers it twice!!:</p>
<div class="highlight highlight-text-shell-session"><pre># <span class="pl-s1">rpm -iv baz-1.0-1.old.noarch.rpm</span>
<span class="pl-mo">Preparing packages...</span>
<span class="pl-mo">baz-1.0-1.old.noarch</span>
# <span class="pl-s1">rpm -Uv baz-1-2.new.noarch.rpm</span>
<span class="pl-mo">Preparing packages...</span>
<span class="pl-mo">baz-1.0-2.new.noarch</span>
<span class="pl-mo">I'm running %triggerin scriptlet in baz-1.0-2.new</span>
<span class="pl-mo">I'm running %triggerin scriptlet in baz-1.0-2.new</span></pre></div>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/rpm-software-management/rpm/issues/209">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ANb802_-i2wHWKo13ErG73J-DK3GM67Lks5r0MvJgaJpZM4NKgmi">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ANb805ZOVrQu92v9CR9u1abxuvaiIECCks5r0MvJgaJpZM4NKgmi.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/rpm-software-management/rpm/issues/209"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/rpm-software-management/rpm","title":"rpm-software-management/rpm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/rpm-software-management/rpm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"`%triggerin -- %{name} \u003c %{version}-%{release}` is always triggered on upgrade (#209)"}],"action":{"name":"View Issue","url":"https://github.com/rpm-software-management/rpm/issues/209"}}}</script>