Mailinglist Archive: yast-devel (191 mails)

< Previous Next >
Re: [yast-devel] Package-Bindings
  • From: Katarina Machalkova <kmachalkova@xxxxxxx>
  • Date: Wed, 19 Mar 2008 14:28:26 +0100
  • Message-id: <200803191428.33431.kmachalkova@xxxxxxx>
- Update package if and only if newer version available

This doesn't seem to be problem of Pkg-bindings but libzypp. Libzypp
automagically updates already installed packages even in the very same
version.

I don't think it is a problem of libzypp as such, since package selectors
(both, possibly all three?) already offer this functionality - update list of
packages if and only if newer version is available.

In a loop over all packages in current list, it's done like this:

if ( slbPtr->status() == S_KeepInstalled && slbPtr->hasCandidateObj() )
{
if (
slbPtr->installedObj()->edition() < slbPtr->candidateObj()->edition()
)
ok = statusStrategy->keyToStatus( '>', slbPtr, objPtr, newStatus );
}

Translated into normal speech:
- If the package is currently installed and some candidate object exists *),
compare installed and available version
- if available version is greater, mark the package for update
- else do nothing

(*) the existence of candidate obj. exists does not necessarily mean that
candidate has also greater version number (?), hence the second check

It's not probably done in a best possible way ;-) (zypp guys could maybe
provide us with better algorithm), but it works. So I believe similar
algorithm could be incorporated into Pkg-bindings as well

B.
--
\\\\\ Katarina Machalkova
\\\\\\\__o YaST developer
__\\\\\\\'/_ & hedgehog painter
< Previous Next >
Follow Ups