<div dir="ltr">Hi<div><br></div><div>Thank you for the response Panu!</div><div><br></div><div>Actually we solved this by calling a python script to check the version numbers.</div><div><br></div><div>Regards</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 4 November 2014 08:22, Panu Matilainen <span dir="ltr"><<a href="mailto:pmatilai@laiskiainen.org" target="_blank">pmatilai@laiskiainen.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 10/07/2014 11:00 AM, Morgan Cox wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br>
<br>
I am trying to build an RPM that when installed/upgraded checks the<br>
present version of the package and depending on if the present version<br>
is a certain version or higher -> do something if lower -> do something<br>
else.<br>
<br>
i.e if present version is 1.0 or higher -> do something<br>
<br>
else<br>
<br>
if present present version is < 1.0 -> do something else.<br>
<br>
I have been told that I shouldn't use rpm command (i.e 'rpm-qa')  in the<br>
inside the %pre or %prerun  scriptlet as this can cause an RPM - how can<br>
I query the existing version in the rpmbuild/spec file?<br>
</blockquote>
<br></div></div>
Doing rpm queries from inside rpmbuild isn't any more recommended than install-time scriptlets, for similar reasons, and it wouldn't help anyway if you need to do such decisions at install-time.<br>
<br>
What you can do from rpm scriptlets is try figuring out the version by other means, such as testing existence/naming of files of the other package, or executing some test-commands (lot of software has some means of outputting its version via --version or such cli switch)<br>
<br>
        - Panu -<br>
<br>
______________________________<u></u>_________________<br>
Rpm-list mailing list<br>
<a href="mailto:Rpm-list@lists.rpm.org" target="_blank">Rpm-list@lists.rpm.org</a><br>
<a href="http://lists.rpm.org/mailman/listinfo/rpm-list" target="_blank">http://lists.rpm.org/mailman/<u></u>listinfo/rpm-list</a><br>
</blockquote></div><br></div>