ArchiveOrangemail archive

zypp-devel.opensuse.org


(List home) (Recent threads) (97 other OpenSUSE lists)

Subscription Options

  • RSS or Atom: Read-only subscription using a browser or aggregator. This is the recommended way if you don't need to send messages to the list. You can learn more about feed syndication and clients here.
  • Conventional: All messages are delivered to your mail address, and you can reply. To subscribe, send an email to the list's subscribe address with "subscribe" in the subject line, or visit the list's homepage here.
  • Low traffic list: less than 3 messages per day
  • This list contains about 3,144 messages, beginning Mar 2007
  • 0 messages added yesterday
Report the Spam
This button sends a spam report to the moderator. Please use it sparingly. For other removal requests, read this.
Are you sure? yes no

libzypp related queries

Ad
Saurabh Sood 1343388989Fri, 27 Jul 2012 11:36:29 +0000 (UTC)
Hi,
I had some queries regarding some libzypp functions.

1.) I want to retrieve information regarding packages such as size,
version of the package. How can I get this information?

2.) I am using defaultLoadSystem( "/" ) for a particular function. I
am getting the error 'zypp instance already created'. I havent called
getZypp() anywhere before this line. I just loaded some repositories
into the pool using RepoManager, and that was in some other module.
How can I avoid this error?

Regards,.
Saurabh
Michael Andres 1343639614Mon, 30 Jul 2012 09:13:34 +0000 (UTC)
On Friday 27 July 2012 13:36:04 Saurabh Sood wrote:
> Hi,
> I had some queries regarding some libzypp functions.
>
> 1.) I want to retrieve information regarding packages such as size,
> version of the package. How can I get this information?Common attributes are available via class ResObject[Resolvable]. 
To acces if from a PoolItem you can use:

	ResObject::constPtr PooolItem::resolvable() const;
  or    ResObject::constPtr operator->() const;

  Example:
	PooolItem pi;
	pi.resolvable()->size();
  or	pi->size();

  (or from a sat::Solvable:
	sat::Solvable s;
	PooolItem pi( s );
	...)

Attributes specific to packages/patch/pattern/product are available via the 
coresponding classes Package[ResObject[Resolvable]]. To test whether a 
ResObject actually refers to a e.g. Package use 'isKind':

	ResObject::constPtr obj;
	if ( isKind<Package>( obj ) )
  or	if ( obj->isKind<Package>() )
  or	if ( obj->isKind( ResKind::package ) )

	PooolItem pi;
	if ( pi->isKind<Package>() )
  or	if ( pi->isKind( ResKind::package )
	
To convert use 'asKind':

	ResObject::constPtr obj;
	Package::constPtr pkg( asKind<Package>( obj ) );
  or	Package::constPtr pkg( obj->asKind<Package>() );

	PooolItem pi;
	Package::constPtr pkg( asKind<Package>( pi.resolvable() ) );
  or	Package::constPtr pkg( pi->asKind<Package>() );


'asKind' performs a dynamic cast, so it returns a nullptr if the object is not 
of the right type. 'isKind' simply tests whether 'asKinf' returned a nullptr. 
In doubt use asKind and test for a nullptr.

	ResObject::constPtr obj;
	Package::constPtr pkg( asKind<Package>( obj ) );	// one cast
	if ( pkg )
	{
	  ...

	ResObject::constPtr obj;
	if ( isKind<Package>( obj ) )				// 1st cast
	{
	  Package::constPtr pkg( asKind<Package>( obj ) );	// 2nd cast
	  ...> 2.) I am using defaultLoadSystem( "/" ) for a particular function. I
> am getting the error 'zypp instance already created'. I havent called
> getZypp() anywhere before this line. I just loaded some repositories
> into the pool using RepoManager, and that was in some other module.There are a actions which may call getZypp() internally. You should call 
defaultLoadSystem before doing anything else, or do the setup manually.-- 

cu,
    Michael Andres

+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862  27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres   SUSE LINUX Products GmbH, Development,   
GF:Jeff Hawn,Jennifer Guild,Felix Imendörffer, HRB16746(AG Nürnberg) 
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
Home | About | Privacy