EVR comparison and how to sort them?

Farkas Levente lfarkas at lfarkas.org
Tue Dec 23 11:50:31 UTC 2008

i'd like to write an automated upgrade script to our packages and i'd
like to know how to retrieve and order EVR's from rpm. suppose i've got
packages with these EVRs:
from each version to the next there is a given script which should have
to run (eg. update config files, database schemes etc) eg:
and there are many different server which runs different version of the
given packages. some of them 1.2.3 some of them 1.3.1 and 1:1.4 and now
i'd like to upgrade them to 1:1.5. so in 1:1.5's %post script i'd like
to run all upgrade-x.y.z-a.b.c script in the right order.
how can i do that?
- i'd like to know which was the previously installed version?
- i'd like to select those upgrade-x.y.z-a.b.c scripts which has to be run.
- i'd like to run them in the right order. and of course simple sort is
not enough what's more lexicographical order also not too useful.
is there any way how can i do that with rpm?
is there any tool which can help me? anything better then:
rpm -q --qf "%|SERIAL?{%{SERIAL}:}:{}|%{VERSION}-%{RELEASE}\n"
nobody else has the same problem so far? or everybody do this manually?
it can be done on a few server bug how can be done on hundreds of servers?
thank you for your help in advance.

  Levente                               "Si vis pacem para bellum!"

More information about the Rpm-list mailing list