simple functions

seth vidal <skvidal-c/MNwgJ9CEH2fBVCVOL8/[email protected]> Mon, 19 Jan 2004 22:56:10 -0500
Newsgroups gmane.linux.redhat.rpm.python
Message-ID <1074570970.3593.145.camel@binkley>
Hi everyone,
 I've been working on new functions and what not for yum work I have to
do and I was thinking - why not see if I can solicit some input for some
more generic functions that might be handy.

some things I was thinking of:
A) a function to check to see if the versioned 
provides/requires/obsoletes/conflicts occur in a given rpm/header.

B) a function or a class to take two lists of package 'nevra' and return
  a list of updates from those lists: ie:
  list1 = [(n, a, e, v ,r), (n2, a2, e2, v2, r2)]
  list2 = [(n, a, e++, v++, r++), (n2, a2, e2, v2, r2)]
  list3 = findupdates(list1, list2)
     and list3 would be [(n, a, e++, v++, r++)]

 I was thinking of making this class take some other settings too:
  1. exact arch updates (meaning  do not consider other archs when
figuring out what is newer) so foo-1.1-1.i386 can never be an update for
foo-1.0-1.noarch

  2. a function you pass in to 'rate' multiple arch resolutions - so
let's say you have foo-1.1-1.i386 installed and foo-1.2-1.i386,
foo-1.2-1.i686 and foo-1.2-1.athlon available. All of the available
packages are updates. If you have exact-arch set then it's easy -
foo-1.1-1.i386. But if you don't have it set then you need some way to
figure out the best arch. So it's like passing in a __cmp__ function.

Can y'all think of other options a function/class like this needs?
Better suggestions on how to hand back the list of updates or how to add
in the lists to be compared?


So that's what I was thinking about. Other ideas for functions that
might prove handy for general use?

-sv