rpmvercmp (was: dovecot imap available for testing, latest upstream release 0.99.10.6)
James Olin Oden
joden at lee.k12.nc.us
Fri Jul 2 12:34:17 UTC 2004
On Thu, 1 Jul 2004, Michal Jaegermann wrote:
> On Thu, Jul 01, 2004 at 02:23:53PM -0400, John Dennis wrote:
> >
> > No assumptions should be made about the format of the release string
> > other than it collate correctly when presented to rpmvercmp (the
> > comparison function in rpm which has specific well defined semantics).
>
> How you are using rpmvercmp, say, in a shell script? AFAIK there is
> no interface which would make that available. Or this is one of
> those undocumented mysteries of rpm?
>
Hi Michal, look back through the messages about a month and you will
see a message concerning rpm package versions that I answered that pretty
muchh answers your question. In short its pretty easy to use the python
bindings or perl (RPM2) bindings to librpm to access rpmvercmp(). In my
original post, I think I gave a short inline perl example (i.e. a tiny
script using perl -e option to pass the script from the command line).
I definately do this at my work in various shell scripts.
Cheers..james
> > Unfortunately we are pretty much stuck with n-v-r for historical
> > reasons.
>
Yep and you cannot forget epoch.
> This I can reliably pick apart using --queryformat but now what?
>
> In case you wonder if I need that in shell scripts and similar then
> the answer is that indeed I do (and many others too). A comparison
> utility which would compare (or even collate but that I can do
> myself) according to rpmvercmp would be really useful.
>
Again search back through the archives and you will see code to that
effect. Really what would be quite handy though for shell scripts is
a utility that could be called in the following ways:
rpmvercmp -v 1.1.1 -v 1.1.2
rpmvercmp -p x-1.1.1-2.0.i386.rpm -d
rpmvercmp -p x-1.1.1-2.0.i386.rpm -p x-1.1.2-1.1.i386.rpm
rpmvercmp -p x-1.1.1-2.0.i386.rpm -v 1.1.2
rpmvercmp -n x -v 1.1.2 -d
So basically, allow you to compare a:
- E:V-R string to an E:V-R string,
- package to the package in the db
- package to another package.
- package to an E:V-R string
- E:V:R string for a specific N to the database.
Would not be too hard to create such a script from RPM2 (and I suspect
easy to do so with the python bindings). Unfortunately, I am tied up in
non-rpm endevours at the moment, or I would gladly wip it up and send it
to the list. Maybe tonight I will have time, but no promises.
Cheers...james
> Michal
>
>
>
More information about the fedora-test-list
mailing list