Hello pkg community :)

I have a little question related to two functions in the 
pkg.client.image module.

 From the API (pydoc pkg.client.image) I can read:

      |  has_version_installed(self, fmri)
      |      Check that the version given in the FMRI or a successor is
      |      installed in the current image.
      |
      |  is_installed(self, fmri)
      |      Check that the exact version given in the FMRI is installed
      |      in the current image.

So my understanding is that for any fmri the function 
has_version_installed(self, fmri) should return True if *any* version of 
package is installed and is_installed(self, fmri) should return true 
only and only if there is exact given version installed.

I was trying to play with that and here is what I found:
I have small repository (from pkg.opensolaris.org) and if I will do:
bash-3.2$ pkg status -v
FMRI                                                             STATE 
     UFIX
pkg://sun.com/[EMAIL PROTECTED],5.11-0.75:20071031T175830Z 
installed  u---
pkg://sun.com/[EMAIL PROTECTED],5.11-0.75:20071114T203148Z 
installed  ----

so now I have
pkg://sun.com/[EMAIL PROTECTED],5.11-0.75:20071031T175830Z
which is installed, but newer version is available:
bash-3.2$ pkg status -v pkg://sun.com/BRCMbnx
FMRI                                                             STATE 
     UFIX
pkg://sun.com/[EMAIL PROTECTED],5.11-0.75:20071114T203812Z          known 
     ----
pkg://sun.com/[EMAIL PROTECTED],5.11-0.75:20071031T175830Z 
installed  u---

So in that case having:
is_installed(pkg://sun.com/[EMAIL PROTECTED],5.11-0.75:20071031T175830Z) 
should return True and 
is_installed(pkg://sun.com/[EMAIL PROTECTED],5.11-0.75:20071114T203812Z) 
should return False.

When:
has_version_installed(pkg://sun.com/[EMAIL 
PROTECTED],5.11-0.75:20071031T175830Z)
and
has_version_installed(pkg://sun.com/[EMAIL 
PROTECTED],5.11-0.75:20071114T203812Z)
should return True, since there is installed version of 
pkg://sun.com/BRCMbnx

So my point is that has_version_installed returns True *only* when there 
is the newest version installed. In this case when I will call:
has_version_installed(pkg://sun.com/[EMAIL 
PROTECTED],5.11-0.75:20071031T175830Z)
it will return True
and
has_version_installed(pkg://sun.com/[EMAIL 
PROTECTED],5.11-0.75:20071114T203812Z)
will return False

I have the newest known version of pkg://sun.com/SUNWckr installed and 
in both queries it returns True.

Is that a bug or my understanding is wrong?

-- 
best
Michal Pryc
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to