SET(LIBZYPP_MAJOR "4")
SET(LIBZYPP_MINOR "21")
SET(LIBZYPP_COMPATMINOR "21")
-SET(LIBZYPP_PATCH "0")
+SET(LIBZYPP_PATCH "1")
{
}
-bool PCDC( const parser::ProductConfData & d )
-{
- SEC << d << endl;
- return true;
-}
-
/******************************************************************
**
** FUNCTION NAME : main
INT << "===[START]==========================================" << endl;
ZConfig::instance();
- parser::ProductConfReader::scanDir( &PCDC, ZConfig::instance().productsPath() );
- ///////////////////////////////////////////////////////////////////
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-
ResPool pool( ResPool::instance() );
sat::Pool satpool( sat::Pool::instance() );
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
+ for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
+ {
+ Product::constPtr p( asKind<Product>( *it ) );
+ USR << p << endl;
+ MIL << p->type() << endl;
+ MIL << p->releaseNotesUrl() << endl;
+ MIL << p->updateUrls() << endl;
+ MIL << p->extraUrls() << endl;
+ MIL << p->optionalUrls() << endl;
+ MIL << p->flags() << endl;
+ MIL << p->shortName() << endl;
+ MIL << p->distributionName() << endl;
+ MIL << p->distributionEdition() << endl;
+ }
+
///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
-------------------------------------------------------------------
+Fri May 9 23:15:53 CEST 2008 - ma@suse.de
+
+- Product now retrieves all attributes from the solv file.
+- version 4.21.1
+- revision 10031
+
+-------------------------------------------------------------------
Fri May 9 21:28:42 CEST 2008 - ma@suse.de
- Add zypp.conf option configdir (/etc/zypp) and arrange
/** \file zypp/Product.cc
*
*/
+#include <iostream>
+#include "zypp/base/LogTools.h"
+
#include "zypp/Product.h"
#include "zypp/Url.h"
+#include "zypp/sat/LookupAttr.h"
+
+using std::endl;
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
IMPL_PTR_TYPE(Product);
+ namespace
+ {
+ void fillList( std::list<Url> & ret_r, sat::Solvable solv_r, sat::SolvAttr attr_r )
+ {
+ sat::LookupAttr query( attr_r, solv_r );
+ for_( it, query.begin(), query.end() )
+ {
+ try // ignore malformed urls
+ {
+ ret_r.push_back( Url( it.asString() ) );
+ }
+ catch( const url::UrlException & )
+ {}
+ }
+ }
+
+ void fillList( std::list<std::string> & ret_r, sat::Solvable solv_r, sat::SolvAttr attr_r )
+ {
+ sat::LookupAttr query( attr_r, solv_r );
+ for_( it, query.begin(), query.end() )
+ {
+ ret_r.push_back( it.asString() );
+ }
+ }
+ }
+
///////////////////////////////////////////////////////////////////
//
// METHOD NAME : Product::Product
// Package interface forwarded to implementation
//
///////////////////////////////////////////////////////////////////
-#warning DUMMY type
+
std::string Product::type() const
- { return std::string(); }
+ { return lookupStrAttribute( sat::SolvAttr::productType ); }
-#warning DUMMY releaseNotesUrl
Url Product::releaseNotesUrl() const
- { return Url(); }
+ {
+ std::list<Url> ret;
+ fillList( ret, satSolvable(), sat::SolvAttr::productRelnotesurl );
+ if ( ! ret.empty() )
+ return ret.front();
+ return Url();
+ }
-#warning DUMMY updateUrls
std::list<Url> Product::updateUrls() const
- { return std::list<Url>(); }
+ {
+ std::list<Url> ret;
+ fillList( ret, satSolvable(), sat::SolvAttr::productUpdateurls );
+ return ret;
+ }
-#warning DUMMY extraUrls
std::list<Url> Product::extraUrls() const
- { return std::list<Url>(); }
+ {
+ std::list<Url> ret;
+ fillList( ret, satSolvable(), sat::SolvAttr::productExtraurls );
+ return ret;
+ }
-#warning DUMMY optionalUrls
std::list<Url> Product::optionalUrls() const
- { return std::list<Url>(); }
+ {
+ std::list<Url> ret;
+ fillList( ret, satSolvable(), sat::SolvAttr::productOptionalurls );
+ return ret;
+ }
-#warning DUMMY flags
std::list<std::string> Product::flags() const
- { return std::list<std::string>(); }
+ {
+ std::list<std::string> ret;
+ fillList( ret, satSolvable(), sat::SolvAttr::productFlags );
+ return ret;
+ }
-#warning DUMMY shortName
std::string Product::shortName() const
- { return std::string(); }
+ { return lookupStrAttribute( sat::SolvAttr::productShortlabel ); }
std::string Product::longName( const Locale & lang_r ) const
{ return summary( lang_r ); }
-#warning DUMMY distributionName
std::string Product::distributionName() const
- { return std::string(); }
+ { return lookupStrAttribute( sat::SolvAttr::productDistproduct ); }
-#warning DUMMY distributionEdition
Edition Product::distributionEdition() const
- { return Edition(); }
+ { return Edition( lookupStrAttribute( sat::SolvAttr::productDistversion ) ); }
/////////////////////////////////////////////////////////////////
// patch
const SolvAttr SolvAttr::patchcategory ( SOLVABLE_PATCHCATEGORY );
const SolvAttr SolvAttr::rebootSuggested ( UPDATE_REBOOT );
- const SolvAttr SolvAttr::restartSuggested ( UPDATE_RESTART );
+ const SolvAttr SolvAttr::restartSuggested ( UPDATE_RESTART );
const SolvAttr SolvAttr::updateCollectionName ( UPDATE_COLLECTION_NAME );
const SolvAttr SolvAttr::updateCollectionEvr ( UPDATE_COLLECTION_EVR );
const SolvAttr SolvAttr::updateCollectionArch ( UPDATE_COLLECTION_ARCH );
const SolvAttr SolvAttr::includes ( SOLVABLE_INCLUDES );
const SolvAttr SolvAttr::extends ( SOLVABLE_EXTENDS );
+ // product
+ const SolvAttr SolvAttr::productShortlabel ( PRODUCT_SHORTLABEL );
+ const SolvAttr SolvAttr::productDistproduct ( PRODUCT_DISTPRODUCT );
+ const SolvAttr SolvAttr::productDistversion ( PRODUCT_DISTVERSION );
+ const SolvAttr SolvAttr::productType ( PRODUCT_TYPE );
+ const SolvAttr SolvAttr::productRelnotesurl ( PRODUCT_RELNOTESURL );
+ const SolvAttr SolvAttr::productUpdateurls ( PRODUCT_UPDATEURLS );
+ const SolvAttr SolvAttr::productExtraurls ( PRODUCT_EXTRAURLS );
+ const SolvAttr SolvAttr::productOptionalurls ( PRODUCT_OPTIONALURLS );
+ const SolvAttr SolvAttr::productFlags ( PRODUCT_FLAGS );
+
} // namespace sat
/////////////////////////////////////////////////////////////////
} // namespace zypp
/** Value representing \c noAttr (<tt>""</tt>)*/
static const SolvAttr noAttr;
+ /** \name common */
+ //@{
static const SolvAttr name;
static const SolvAttr summary;
static const SolvAttr description;
static const SolvAttr installsize;
static const SolvAttr downloadsize;
static const SolvAttr diskusage;
+ //@}
- //package
+ /** \name package */
+ //@{
static const SolvAttr checksum;
static const SolvAttr mediadir;
static const SolvAttr medianr;
static const SolvAttr sourcename;
static const SolvAttr sourceevr;
static const SolvAttr headerend;
+ //@}
- // patch
+ /** \name patch */
+ //@{
static const SolvAttr patchcategory;
static const SolvAttr rebootSuggested;
static const SolvAttr restartSuggested;
static const SolvAttr updateReferenceHref;
static const SolvAttr updateReferenceId;
static const SolvAttr updateReferenceTitle;
-
- // pattern
+ //@}
+
+ /** \name pattern */
+ //@{
static const SolvAttr isvisible;
static const SolvAttr icon;
static const SolvAttr order;
static const SolvAttr script;
static const SolvAttr includes;
static const SolvAttr extends;
+ //@}
+ /** \name product */
+ //@{
+ static const SolvAttr productShortlabel;
+ static const SolvAttr productDistproduct;
+ static const SolvAttr productDistversion;
+ static const SolvAttr productType;
+ static const SolvAttr productRelnotesurl;
+ static const SolvAttr productUpdateurls;
+ static const SolvAttr productExtraurls;
+ static const SolvAttr productOptionalurls;
+ static const SolvAttr productFlags;
//@}
+ //@}
public:
/** Default ctor: \ref noAttr */
SolvAttr() {}