Author: dmacvicar
Date: Fri May 18 17:02:46 2007
New Revision: 5566
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5566&view=rev
Log:
- some iostream -> iosfwd in headers
- Move code to load dynamic types from cache to its own
class so it can be reused in Resolvable Query
- Introduce a PackageImpl that can be created from data::
- Document and polish RepositoryInfo class
Added:
trunk/libzypp/zypp2/cache/CacheTypes.cc
trunk/libzypp/zypp2/cache/CacheTypes.h
trunk/libzypp/zypp2/repository/memory/
trunk/libzypp/zypp2/repository/memory/DataPackageImpl.cc
trunk/libzypp/zypp2/repository/memory/DataPackageImpl.h
Removed:
trunk/libzypp/zypp2/cache/DatabaseTypes.cc
trunk/libzypp/zypp2/cache/DatabaseTypes.h
Modified:
trunk/libzypp/zypp/base/Debug.h
trunk/libzypp/zypp/base/GzStream.h
trunk/libzypp/zypp/data/ResolvableData.h
trunk/libzypp/zypp/data/ResolvableDataConsumer.h
trunk/libzypp/zypp/parser/XMLNodeIterator.h
trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h
trunk/libzypp/zypp2/CMakeLists.txt
trunk/libzypp/zypp2/RepositoryInfo.cc
trunk/libzypp/zypp2/RepositoryInfo.h
trunk/libzypp/zypp2/cache/CacheInitializer.cpp
trunk/libzypp/zypp2/cache/CacheInitializer.h
trunk/libzypp/zypp2/cache/CacheStore.cpp
trunk/libzypp/zypp2/cache/CacheStore.h
trunk/libzypp/zypp2/cache/CapabilityQuery.cc
trunk/libzypp/zypp2/cache/QueryFactory.cc
trunk/libzypp/zypp2/cache/QueryFactory.h
trunk/libzypp/zypp2/cache/ResolvableQuery.cc
trunk/libzypp/zypp2/cache/ResolvableQuery.h
trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.cc
trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.h
trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.cc
trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.h
trunk/libzypp/zypp2/repository/RepositoryImpl.h
trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc
trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h
Modified: trunk/libzypp/zypp/base/Debug.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Debug.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/Debug.h (original)
+++ trunk/libzypp/zypp/base/Debug.h Fri May 18 17:02:46 2007
@@ -14,9 +14,9 @@
#ifndef ZYPP_BASE_DEBUG_H
#define ZYPP_BASE_DEBUG_H
-#include <iostream>
-#include <sstream>
-#include <string>
+#include <iosfwd>
+//#include <sstream>
+//#include <string>
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
#include "zypp/ExternalProgram.h"
Modified: trunk/libzypp/zypp/base/GzStream.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/GzStream.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/GzStream.h (original)
+++ trunk/libzypp/zypp/base/GzStream.h Fri May 18 17:02:46 2007
@@ -21,7 +21,7 @@
#ifndef ZYPP_BASE_GZSTREAM_H
#define ZYPP_BASE_GZSTREAM_H
-#include <iostream>
+#include <iosfwd>
#include <vector>
#include
Modified: trunk/libzypp/zypp/data/ResolvableData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.h (original)
+++ trunk/libzypp/zypp/data/ResolvableData.h Fri May 18 17:02:46 2007
@@ -308,7 +308,7 @@
/** Rpm group.*/
std::string group;
/** PackageDb keywors (tags). */
- std::liststd::string keywords;
+ std::setstd::string keywords;
/** Changelog. */
Changelog changelog;
Modified: trunk/libzypp/zypp/data/ResolvableDataConsumer.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableDataConsumer.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableDataConsumer.h (original)
+++ trunk/libzypp/zypp/data/ResolvableDataConsumer.h Fri May 18 17:02:46 2007
@@ -28,13 +28,13 @@
ResolvableDataConsumer();
virtual ~ResolvableDataConsumer();
- virtual void consumePackage( const data::RecordId &catalog_id, const data::Package &package) = 0;
- virtual void consumePackage( const data::Pattern &package) = 0;
- virtual void consumePackage( const data::Patch &package) = 0;
- virtual void consumePackage( const data::Script &package) = 0;
- virtual void consumePackage( const data::Message &package) = 0;
- virtual void consumePackage( const data::Product &package) = 0;
- virtual void consumePackage( const data::SrcPackage &package) = 0;
+ virtual void consumePackage( const data::RecordId &catalog_id, data::Package_Ptr ) = 0;
+ virtual void consumeProduct( const data::RecordId &catalog_id, data::Product_Ptr ) = 0;
+ virtual void consumePatch( const data::RecordId &catalog_id, data::Patch_Ptr ) = 0;
+ virtual void consumeMessage( const data::RecordId &catalog_id, data::Message_Ptr ) = 0;
+ virtual void consumeScript( const data::RecordId &catalog_id, data::Script_Ptr ) = 0;
+
+ //virtual void consumeSourcePackage( const data::SrcPackage_Ptr ) = 0;
};
} // namespace parser
Modified: trunk/libzypp/zypp/parser/XMLNodeIterator.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/XMLNodeIterator.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/XMLNodeIterator.h (original)
+++ trunk/libzypp/zypp/parser/XMLNodeIterator.h Fri May 18 17:02:46 2007
@@ -14,9 +14,9 @@
#define XMLNodeIterator_h
#include
-#include <iostream>
-#include <ostream>
-#include <sstream>
+#include <iosfwd>
+//#include <ostream>
+//#include <sstream>
#include "zypp/parser/xml_parser_assert.h"
#include "zypp/Pathname.h"
#include "zypp/parser/ParserProgress.h"
Modified: trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h (original)
+++ trunk/libzypp/zypp/parser/xmlstore/XMLParserData.h Fri May 18 17:02:46 2007
@@ -18,7 +18,7 @@
#include "zypp/TranslatedText.h"
#include <string>
#include <list>
-#include <iostream>
+#include <iosfwd>
#include
using namespace zypp::base;
Modified: trunk/libzypp/zypp2/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/CMakeLists.txt?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/CMakeLists.txt (original)
+++ trunk/libzypp/zypp2/CMakeLists.txt Fri May 18 17:02:46 2007
@@ -33,27 +33,27 @@
SET( zypp2_cache_SRCS
cache/CacheInitializer.cpp
- cache/QueryFactory.cc
- cache/CapabilityQuery.cc
+ cache/CacheTypes.cc
+# cache/QueryFactory.cc
+# cache/CapabilityQuery.cc
cache/ResolvableQuery.cc
- cache/CachedResolvableDataProvider.cc
- cache/sqlite_detail/CapabilityQueryImpl.cc
- cache/sqlite_detail/QueryFactoryImpl.cc
+# cache/CachedResolvableDataProvider.cc
+# cache/sqlite_detail/CapabilityQueryImpl.cc
+# cache/sqlite_detail/QueryFactoryImpl.cc
cache/CacheStore.cpp
cache/Utils.cpp
- cache/DatabaseTypes.cc
)
SET( zypp2_cache_HEADERS
cache/CacheCommon.h
+ cache/CacheTypes.h
cache/CacheInitializer.h
cache/CacheStore.h
cache/ResolvableQuery.h
- cache/CapablityQuery.h
- cache/QueryFactory.h
+# cache/CapablityQuery.h
+# cache/QueryFactory.h
cache/Utils.h
- cache/DatabaseTypes.h
- cache/CachedResolvableDataProvider.h
+# cache/CachedResolvableDataProvider.h
)
#INSTALL( FILES
@@ -98,6 +98,15 @@
repository/cached/CachedRepositoryPackageImpl.h
)
+SET( zypp2_repository_data_SRCS
+ repository/memory/DataPackageImpl.cc
+)
+
+SET( zypp2_repository_data_HEADERS
+ repository/memory/DataPackageImpl.h
+)
+
+
#INSTALL( FILES
# ${zypp2_repository_sqlite-repository_HEADERS}
# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/repository/sqlite-repository
@@ -109,6 +118,7 @@
${zypp2_SRCS}
${zypp2_cache_SRCS}
${zypp2_repository_cached_SRCS}
+${zypp2_repository_data_SRCS}
${zypp2_cache_sqlite3x_SRCS}
)
Modified: trunk/libzypp/zypp2/RepositoryInfo.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.cc?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.cc (original)
+++ trunk/libzypp/zypp2/RepositoryInfo.cc Fri May 18 17:02:46 2007
@@ -23,7 +23,6 @@
RepositoryInfo::RepositoryInfo()
: _enabled (indeterminate)
, _autorefresh(indeterminate)
- , _base_repository( indeterminate )
{
}
@@ -34,8 +33,7 @@
tribool autorefresh)
: _enabled (true),
_autorefresh(autorefresh),
- _base_repository( indeterminate ),
- _url(url),
+ _baseurl(url),
_path(path),
_alias(alias)
{
@@ -54,15 +52,9 @@
return *this;
}
- RepositoryInfo & RepositoryInfo::setBaseRepository( bool val_r )
+ RepositoryInfo & RepositoryInfo::setBaseUrl( const Url &url )
{
- _base_repository = val_r;
- return *this;
- }
-
- RepositoryInfo & RepositoryInfo::setUrl( const Url &url )
- {
- _url = url;
+ _baseurl = url;
return *this;
}
@@ -108,9 +100,7 @@
tribool RepositoryInfo::autorefresh() const
{ return _autorefresh; }
- boost::tribool RepositoryInfo::baseRepository() const
- { return _base_repository; }
-
+
Pathname RepositoryInfo::path() const
{ return _path; }
@@ -129,16 +119,24 @@
std::string RepositoryInfo::type() const
{ return _type; }
- Url RepositoryInfo::url() const
- { return _url; }
+ Url RepositoryInfo::baseUrl() const
+ { return _baseurl; }
+ std::set<Url> RepositoryInfo::urls() const
+ { return _urls; }
+
+ RepositoryInfo::urls_const_iterator RepositoryInfo::urlsBegin() const
+ { return _urls.begin(); }
+
+ RepositoryInfo::urls_const_iterator RepositoryInfo::urlsEnd() const
+ { return _urls.end(); }
+
std::ostream & RepositoryInfo::dumpOn( std::ostream & str ) const
{
str << "--------------------------------------" << std::endl;
str << "- alias : " << alias() << std::endl;
- str << "- url : " << url() << std::endl;
+ str << "- url : " << baseUrl() << std::endl;
str << "- type : " << type() << std::endl;
- str << "- baserepository : " << baseRepository() << std::endl;
str << "- enabled : " << enabled() << std::endl;
str << "- autorefresh : " << autorefresh() << std::endl;
str << "- path : " << path() << std::endl;
Modified: trunk/libzypp/zypp2/RepositoryInfo.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.h (original)
+++ trunk/libzypp/zypp2/RepositoryInfo.h Fri May 18 17:02:46 2007
@@ -11,7 +11,7 @@
#define ZYPP_RepositoryInfo_H
#include <list>
-
+#include <set>
#include
#include "zypp/Pathname.h"
#include "zypp/Url.h"
@@ -22,6 +22,10 @@
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ /**
+ * The class RepositoryInfo represents everything that
+ * is known about a software repository.
+ */
class RepositoryInfo
{
public:
@@ -29,41 +33,154 @@
RepositoryInfo();
RepositoryInfo( const Url & url, const Pathname & path, const std::string & alias = "", boost::tribool autorefresh = boost::indeterminate );
-
+
+ /**
+ * unique identifier for this source. If not specified
+ * It should be generated from the base url.
+ */
+ std::string alias() const;
+
+ /**
+ * The base Url is the Url of the repository that generates
+ * the authoritative metadata this repository provides.
+ *
+ * For example for the url http://updates.novell.com/10.2
+ * the base url is http://updates.novell.com/10.2.
+ * For the url http://host.com/mirror/update.novell.com/10.2
+ * the base url is http://updates.novell.com/10.2
+ *
+ * This can't be empty in order the repository to be valid
+ */
+ Url baseUrl() const;
+
+ /**
+ * Urls is a list of Urls where this repository
+ * is located.
+ * If empty, the base url will be used.
+ */
+ std::set<Url> urls() const;
+
+ typedef std::set<Url>::const_iterator urls_const_iterator;
+
+ /**
+ * iterator that points at begin of repository urls
+ */
+ urls_const_iterator urlsBegin() const;
+
+ /**
+ * iterator that points at end of repository urls
+ */
+ urls_const_iterator urlsEnd() const;
+
+ /**
+ * Path on the url where the repository root
+ * is located.
+ */
+ Pathname path() const;
+
+ /**
+ * If enabled is false, then this repository must be ignored as if does
+ * not exists, except when checking for duplicate alias.
+ */
+ boost::tribool enabled() const;
+
+ /**
+ * If true, the repostory must be refreshed before creating resolvables
+ * from it
+ */
+ boost::tribool autorefresh() const;
+
+ /**
+ * Type of repository,
+ * FIXME should be an enum?
+ */
+ std::string type() const;
+
+ /**
+ * Description of the repository, to be used on
+ * the user interface.
+ */
+ std::string description() const;
+
+ /**
+ * Checksum of the repository.
+ * Usually the checksum of the index, but any
+ * checksum that changes when the repository changes
+ * in any way is sufficient.
+ */
+ CheckSum checksum() const;
+
+ /**
+ * timestamp of the repository. If the repository
+ * changes, it has to be updated as well with the
+ * new timestamp.
+ */
+ Date timestamp() const;
+
+ /**
+ * Set the base url. \see baseUrl
+ * \param url The base url for the repository.
+ */
+ RepositoryInfo & setBaseUrl( const Url &url );
+
+ /**
+ * enable or disable the repository \see enabled
+ * \param enabled
+ */
RepositoryInfo & setEnabled( boost::tribool enabled );
+
+ /**
+ * enable or disable autorefresh \see autorefresh
+ * \param enabled
+ */
RepositoryInfo & setAutorefresh( boost::tribool autorefresh );
- RepositoryInfo & setBaseRepository( bool val_r );
- RepositoryInfo & setUrl( const Url &url );
+
+ /**
+ * set the repository path \see path
+ * \param p
+ */
RepositoryInfo & setPath( const Pathname &p );
+
+ /**
+ * set the repository alias \see alias
+ * \param alias
+ */
RepositoryInfo & setAlias( const std::string &alias );
+
+ /**
+ * set the repository type \see type
+ * \param t
+ */
RepositoryInfo & setType( const std::string &t );
- RepositoryInfo & setCacheDir( const Pathname &p );
+
+ /**
+ * set the repository description \see description
+ * \param description
+ */
RepositoryInfo & setDescription( const std::string &description );
+
+ /**
+ * set the repository checksum \see checksum
+ * \param checksum
+ */
RepositoryInfo & setChecksum( const CheckSum &checksum );
+
+ /**
+ * set the repository timestamp \see timestamp
+ * \param timestamp
+ */
RepositoryInfo & setTimestamp( const Date ×tamp );
- boost::tribool enabled() const;
- boost::tribool autorefresh() const;
- boost::tribool baseRepository() const;
- Pathname path() const;
- std::string alias() const;
- std::string type() const;
- std::string description() const;
- CheckSum checksum() const;
- Date timestamp() const;
- Url url() const;
-
-
+
/** Overload to realize stream output. */
std::ostream & dumpOn( std::ostream & str ) const;
-
+
private:
boost::tribool _enabled;
boost::tribool _autorefresh;
- boost::tribool _base_repository;
std::string _type;
- Url _url;
- Pathname _cache_dir;
+ Url _baseurl;
+ std::set<Url> _urls;
Pathname _path;
std::string _alias;
std::string _description;
Modified: trunk/libzypp/zypp2/cache/CacheInitializer.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheInitializer.cpp?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheInitializer.cpp (original)
+++ trunk/libzypp/zypp2/cache/CacheInitializer.cpp Fri May 18 17:02:46 2007
@@ -7,7 +7,6 @@
| |
\---------------------------------------------------------------------*/
-#include <iostream>
#include <vector>
#include <sstream>
#include <fstream>
Modified: trunk/libzypp/zypp2/cache/CacheInitializer.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheInitializer.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheInitializer.h (original)
+++ trunk/libzypp/zypp2/cache/CacheInitializer.h Fri May 18 17:02:46 2007
@@ -16,7 +16,6 @@
#include "zypp/base/PtrTypes.h"
#include "zypp/base/ReferenceCounted.h"
#include "zypp/base/NonCopyable.h"
-#include "zypp/base/PtrTypes.h"
#include "zypp/Pathname.h"
#include "zypp2/cache/sqlite3x/sqlite3x.hpp"
Modified: trunk/libzypp/zypp2/cache/CacheStore.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheStore.cpp?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheStore.cpp (original)
+++ trunk/libzypp/zypp2/cache/CacheStore.cpp Fri May 18 17:02:46 2007
@@ -3,13 +3,13 @@
#include <map>
#include "zypp2/cache/sqlite3x/sqlite3x.hpp"
+#include "zypp/base/Logger.h"
#include "zypp/base/Measure.h"
#include "zypp/ZYppFactory.h"
#include "zypp/ZYpp.h"
#include "zypp2/cache/CacheInitializer.h"
#include "zypp2/cache/CacheStore.h"
-#include "zypp2/cache/DatabaseTypes.h"
using namespace std;
using namespace zypp;
Modified: trunk/libzypp/zypp2/cache/CacheStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheStore.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheStore.h (original)
+++ trunk/libzypp/zypp2/cache/CacheStore.h Fri May 18 17:02:46 2007
@@ -46,7 +46,7 @@
*
* \note Data will not be commited until you explicitely commit.
*/
- class CacheStore
+ class CacheStore : public data::ResolvableDataConsumer
{
public:
Added: trunk/libzypp/zypp2/cache/CacheTypes.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheTypes.cc?rev=5566&view=auto
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheTypes.cc (added)
+++ trunk/libzypp/zypp2/cache/CacheTypes.cc Fri May 18 17:02:46 2007
@@ -0,0 +1,158 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/cache/CacheTypes.cc
+ *
+*/
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp2/cache/sqlite3x/sqlite3x.hpp"
+#include "zypp/CheckSum.h"
+#include "zypp2/cache/CacheTypes.h"
+
+using namespace std;
+using namespace sqlite3x;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace cache
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : CacheTypes
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : CacheTypes::CacheTypes
+ // METHOD TYPE : Ctor
+ //
+ CacheTypes::CacheTypes( const Pathname &dbdir )
+ : _dbdir(dbdir)
+ {
+ refreshCache();
+ }
+
+ void CacheTypes::refreshCache()
+ {
+ try
+ {
+ sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
+ con.executenonquery("PRAGMA cache_size=8000;");
+ con.executenonquery("BEGIN;");
+
+ // get all types
+ sqlite3_command select_types_cmd( con, "select id,class,name from types;");
+ sqlite3_reader reader = select_types_cmd.executereader();
+
+ while(reader.read())
+ {
+ data::RecordId id = reader.getint64(0);
+ string klass = reader.getstring(1);
+ string name = reader.getstring(2);
+ if ( klass == "arch" )
+ _arch_cache[id] = Arch(name);
+ if ( klass == "rel" )
+ _rel_cache[id] = Rel(name);
+ if ( klass == "kind" )
+ _kind_cache[id] = Resolvable::Kind(name);
+ if ( klass == "deptype" )
+ _deptype_cache[id] = name;
+ }
+
+ MIL << "archs: " << _arch_cache.size() << endl;
+ MIL << "rel : " << _rel_cache.size() << endl;
+ MIL << "kind : " << _kind_cache.size() << endl;
+ MIL << "deptype : " << _deptype_cache.size() << endl;
+ }
+ catch ( std::exception &e )
+ {
+ ZYPP_THROW(Exception("Error reading types"));
+ }
+ }
+
+ Rel CacheTypes::relationFor( const data::RecordId &id )
+ {
+ Rel rel;
+ std::map::const_iterator it;
+ if ( (it = _rel_cache.find(id) ) != _rel_cache.end() )
+ rel = it->second;
+ else
+ ZYPP_THROW(Exception("Inconsistent Rel"));
+
+ return rel;
+
+ }
+
+ Resolvable::Kind CacheTypes::kindFor( const data::RecordId &id )
+ {
+ Resolvable::Kind kind;
+ std::map::const_iterator it;
+ if ( (it = _kind_cache.find(id) ) != _kind_cache.end() )
+ kind = it->second;
+ else
+ ZYPP_THROW(Exception("Inconsistent Kind"));
+
+ return kind;
+ }
+
+ Dep CacheTypes::deptypeFor( const data::RecordId &id )
+ {
+ std::map::const_iterator it;
+ if ( (it = _deptype_cache.find(id) ) != _deptype_cache.end() )
+ return Dep(it->second);
+ else
+ {
+ ERR << "deptype: " << id << endl;
+ ZYPP_THROW(Exception("Inconsistent deptype"));
+ }
+ }
+
+ Arch CacheTypes::archFor( const data::RecordId &id )
+ {
+
+ Arch arch;
+ std::map::const_iterator it;
+ if ( (it = _arch_cache.find(id) ) != _arch_cache.end() )
+ arch = it->second;
+ else
+ ZYPP_THROW(Exception("Inconsistent Arch"));
+
+ return arch;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : CacheTypes::~CacheTypes
+ // METHOD TYPE : Dtor
+ //
+ CacheTypes::~CacheTypes()
+ {}
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const CacheTypes & obj )
+ {
+ return str;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace cache
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp2
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/cache/CacheTypes.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheTypes.h?rev=5566&view=auto
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheTypes.h (added)
+++ trunk/libzypp/zypp2/cache/CacheTypes.h Fri May 18 17:02:46 2007
@@ -0,0 +1,118 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/cache/CacheTypes.h
+ *
+*/
+#ifndef ZYPP2_CACHE_CACHETYPES_H
+#define ZYPP2_CACHE_CACHETYPES_H
+
+#include <iosfwd>
+
+#include <map>
+#include <string>
+#include "zypp/Rel.h"
+#include "zypp/Arch.h"
+#include "zypp/ResTraits.h"
+#include "zypp/Dep.h"
+#include "zypp/Resolvable.h"
+#include "zypp/Pathname.h"
+#include "zypp/data/RecordId.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace cache
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : CacheTypes
+ //
+ /**
+ * Cache types is a class that reads the dynamic types
+ * from the cache, and keeps them on memory.
+ * Then it can by asked for the type for an Id.
+ *
+ * \see CacheStore::lookupOrAppendType
+ */
+ class CacheTypes
+ {
+ friend std::ostream & operator<<( std::ostream & str, const CacheTypes & obj );
+ public:
+ /**
+ * Default ctor
+ *
+ * \param dbdir Path where the cache is located.
+ *
+ */
+ CacheTypes( const Pathname &dbdir );
+
+ /** Dtor */
+ ~CacheTypes();
+
+ /**
+ * Relation for a cache record id.
+ *
+ * \param id The id you got in a cache query
+ *
+ * \throws Exception if the id is not a valid type
+ */
+ Rel relationFor( const data::RecordId &id );
+
+ /**
+ * Kind for a cache record id.
+ *
+ * \param id The id you got in a cache query
+ *
+ * \throws Exception if the id is not a valid type
+ */
+ Resolvable::Kind kindFor( const data::RecordId &id );
+
+ /**
+ * Dependency type for a cache record id.
+ *
+ * \param id The id you got in a cache query
+ *
+ * \throws Exception if the id is not a valid type
+ */
+ Dep deptypeFor( const data::RecordId &id );
+
+ /**
+ * Architecture for a cache record id.
+ *
+ * \param id The id you got in a cache query
+ *
+ * \throws Exception if the id is not a valid type
+ */
+ Arch archFor( const data::RecordId &id );
+
+ public:
+
+ private:
+ void refreshCache();
+
+ std::map _rel_cache;
+ std::map _kind_cache;
+ std::map _deptype_cache;
+ std::map _arch_cache;
+ Pathname _dbdir;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates CacheTypes Stream output */
+ std::ostream & operator<<( std::ostream & str, const CacheTypes & obj );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace cache
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp2
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP2_CACHE_CACHETYPES_H
Modified: trunk/libzypp/zypp2/cache/CapabilityQuery.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CapabilityQuery.cc?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/CapabilityQuery.cc (original)
+++ trunk/libzypp/zypp2/cache/CapabilityQuery.cc Fri May 18 17:02:46 2007
@@ -12,7 +12,6 @@
#include "zypp/base/Logger.h"
-#include "zypp2/cache/DatabaseTypes.h"
#include "zypp2/cache/CacheInitializer.h"
#include "zypp2/cache/sqlite_detail/CacheSqlite.h"
#include "zypp2/cache/CapabilityQuery.h"
Modified: trunk/libzypp/zypp2/cache/QueryFactory.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/QueryFactory.cc?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/QueryFactory.cc (original)
+++ trunk/libzypp/zypp2/cache/QueryFactory.cc Fri May 18 17:02:46 2007
@@ -12,7 +12,6 @@
#include "zypp/base/Logger.h"
-#include "zypp2/cache/DatabaseTypes.h"
#include "zypp2/cache/CacheInitializer.h"
#include "zypp2/cache/QueryFactory.h"
Modified: trunk/libzypp/zypp2/cache/QueryFactory.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/QueryFactory.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/QueryFactory.h (original)
+++ trunk/libzypp/zypp2/cache/QueryFactory.h Fri May 18 17:02:46 2007
@@ -20,7 +20,6 @@
#include "zypp/base/PtrTypes.h"
#include "zypp/Pathname.h"
#include "zypp/data/RecordId.h"
-#include "zypp/base/PtrTypes.h"
#include "zypp2/cache/CapabilityQuery.h"
Modified: trunk/libzypp/zypp2/cache/ResolvableQuery.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/ResolvableQuery.cc?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/ResolvableQuery.cc (original)
+++ trunk/libzypp/zypp2/cache/ResolvableQuery.cc Fri May 18 17:02:46 2007
@@ -1,6 +1,6 @@
+#include "zypp2/cache/CacheTypes.h"
#include "zypp2/cache/ResolvableQuery.h"
-#include "zypp2/cache/DatabaseTypes.h"
#include "zypp2/cache/sqlite3x/sqlite3x.hpp"
using namespace sqlite3x;
@@ -11,8 +11,13 @@
struct ResolvableQuery::Impl
{
+ Pathname _dbdir;
+ string _fields;
+ CacheTypes _type_cache;
+
Impl( const Pathname &dbdir)
: _dbdir(dbdir)
+ , _type_cache(dbdir)
{
_fields = "id, name, version, release, epoch, arch, kind, installed_size, archive_size, install_only, build_time, install_time, catalog_id";
}
@@ -27,7 +32,7 @@
ptr->name = reader.getstring(1);
ptr->edition = Edition( reader.getstring(2), reader.getstring(3), reader.getint(4));
- ptr->arch = db_arch2zypp_arch( static_castdb::Arch(reader.getint(5)));
+ ptr->arch = _type_cache.archFor(reader.getint(5));
// TODO get the rest of the data
@@ -52,7 +57,8 @@
void query( const std::string &s,
ProcessResolvable fnc )
- {
+ {
+
sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
//con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
@@ -171,9 +177,6 @@
return cmd.executestring();
}
-
- Pathname _dbdir;
- string _fields;
};
//////////////////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp2/cache/ResolvableQuery.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/ResolvableQuery.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/ResolvableQuery.h (original)
+++ trunk/libzypp/zypp2/cache/ResolvableQuery.h Fri May 18 17:02:46 2007
@@ -15,7 +15,8 @@
{ /////////////////////////////////////////////////////////////////
/**
- *
+ * The resolvable query class allows you to query for resolvable
+ * data and properties from the cache.
*/
struct ResolvableQuery
{
@@ -28,6 +29,11 @@
typedef function ProcessResolvable;
+ /**
+ * Constructor
+ *
+ * \param dbdir Cache location path
+ */
ResolvableQuery( const Pathname &dbdir );
/**
Modified: trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.cc?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.cc (original)
+++ trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.cc Fri May 18 17:02:46 2007
@@ -10,7 +10,6 @@
#include "zypp/base/Logger.h"
-#include "zypp2/cache/DatabaseTypes.h"
#include "zypp2/cache/CacheInitializer.h"
#include "zypp2/cache/sqlite_detail/CapabilityQueryImpl.h"
@@ -30,6 +29,7 @@
: context(p_context)
, _namedcap_read(false), _filecap_read(false)
, _namedcap_done(false), _filecap_done(false)
+ , _
{}
CapabilityQuery::Impl::~Impl()
Modified: trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.h (original)
+++ trunk/libzypp/zypp2/cache/sqlite_detail/CapabilityQueryImpl.h Fri May 18 17:02:46 2007
@@ -21,9 +21,9 @@
#include "zypp/base/PtrTypes.h"
#include "zypp/Pathname.h"
#include "zypp/data/RecordId.h"
-#include "zypp/base/PtrTypes.h"
#include "zypp2/cache/sqlite_detail/CacheSqlite.h"
#include "zypp2/cache/QueryFactory.h"
+#include "zypp2/cache/CacheTypes.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -47,6 +47,9 @@
bool _namedcap_done;
bool _filecap_done;
+
+ CacheTypes _type_cache;
+
};
} //NS cache
Modified: trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.cc?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.cc (original)
+++ trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.cc Fri May 18 17:02:46 2007
@@ -12,7 +12,6 @@
#include "zypp/base/Logger.h"
-#include "zypp2/cache/DatabaseTypes.h"
#include "zypp2/cache/CacheInitializer.h"
#include "zypp2/cache/QueryFactory.h"
Modified: trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.h (original)
+++ trunk/libzypp/zypp2/cache/sqlite_detail/QueryFactoryImpl.h Fri May 18 17:02:46 2007
@@ -19,7 +19,6 @@
#include "zypp/base/PtrTypes.h"
#include "zypp/Pathname.h"
#include "zypp/data/RecordId.h"
-#include "zypp/base/PtrTypes.h"
#include "zypp2/cache/QueryFactory.h"
#include "zypp2/cache/sqlite_detail/CacheSqlite.h"
Modified: trunk/libzypp/zypp2/repository/RepositoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/RepositoryImpl.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/repository/RepositoryImpl.h (original)
+++ trunk/libzypp/zypp2/repository/RepositoryImpl.h Fri May 18 17:02:46 2007
@@ -5,7 +5,6 @@
#ifndef ZYPP_REPOSITORY_IMPL_h
#define ZYPP_REPOSITORY_IMPL_h
-#include <iostream>
#include <iosfwd>
#include <string>
Modified: trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc (original)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc Fri May 18 17:02:46 2007
@@ -16,7 +16,6 @@
#include "zypp2/cache/QueryFactory.h"
#include "zypp2/cache/CapabilityQuery.h"
#include "zypp2/cache/sqlite_detail/CacheSqlite.h"
-#include "zypp2/cache/DatabaseTypes.h"
#include "zypp2/cache/CacheCommon.h"
#include "zypp2/cache/sqlite_detail/QueryFactoryImpl.h"
#include "zypp/detail/ResImplTraits.h"
@@ -43,6 +42,7 @@
CachedRepositoryImpl::CachedRepositoryImpl( const Pathname &dbdir)
: _dbdir(dbdir)
+ , _type_cache(dbdir)
{
}
@@ -60,93 +60,21 @@
void read_capabilities( sqlite3_connection &con, map &nvras );
-Rel CachedRepositoryImpl::relationFor( const data::RecordId &id )
-{
- Rel rel;
- std::map::const_iterator it;
- if ( (it = _rel_cache.find(id) ) != _rel_cache.end() )
- rel = it->second;
- else
- ZYPP_THROW(Exception("Inconsistent Rel"));
-
- return rel;
-
-}
-
-Resolvable::Kind CachedRepositoryImpl::kindFor( const data::RecordId &id )
-{
- Resolvable::Kind kind;
- std::map::const_iterator it;
- if ( (it = _kind_cache.find(id) ) != _kind_cache.end() )
- kind = it->second;
- else
- ZYPP_THROW(Exception("Inconsistent Kind"));
-
- return kind;
-}
-
-Dep CachedRepositoryImpl::deptypeFor( const data::RecordId &id )
-{
- std::map::const_iterator it;
- if ( (it = _deptype_cache.find(id) ) != _deptype_cache.end() )
- return Dep(it->second);
- else
- {
- ERR << "deptype: " << id << endl;
- ZYPP_THROW(Exception("Inconsistent deptype"));
- }
-}
-
-Arch CachedRepositoryImpl::archFor( const data::RecordId &id )
-{
-
- Arch arch;
- std::map::const_iterator it;
- if ( (it = _arch_cache.find(id) ) != _arch_cache.end() )
- arch = it->second;
- else
- ZYPP_THROW(Exception("Inconsistent Arch"));
-
- return arch;
-}
void CachedRepositoryImpl::createResolvables()
{
debug::Measure m("create resolvables");
CapFactory capfactory;
- try {
+ try
+ {
sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
-
- // get all types
- sqlite3_command select_types_cmd( con, "select id,class,name from types;");
- sqlite3_reader reader = select_types_cmd.executereader();
-
- while(reader.read())
- {
- data::RecordId id = reader.getint64(0);
- string klass = reader.getstring(1);
- string name = reader.getstring(2);
- if ( klass == "arch" )
- _arch_cache[id] = Arch(name);
- if ( klass == "rel" )
- _rel_cache[id] = Rel(name);
- if ( klass == "kind" )
- _kind_cache[id] = Resolvable::Kind(name);
- if ( klass == "deptype" )
- _deptype_cache[id] = name;
- }
-
- MIL << "archs: " << _arch_cache.size() << endl;
- MIL << "rel : " << _rel_cache.size() << endl;
- MIL << "kind : " << _kind_cache.size() << endl;
- MIL << "deptype : " << _deptype_cache.size() << endl;
-
+
sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables;");
map nvras;
- reader = cmd.executereader();
+ sqlite3_reader reader = cmd.executereader();
while(reader.read())
{
long long id = reader.getint64(0);
@@ -155,7 +83,7 @@
// Collect basic Resolvable data
nvras[id] = NVRAD( reader.getstring(1),
Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
- archFor(reader.getint(5)),
+ _type_cache.archFor(reader.getint(5)),
deps
);
}
@@ -207,21 +135,21 @@
while ( reader.read() )
{
- Resolvable::Kind refer = kindFor(reader.getint(0));
- Rel rel = relationFor(reader.getint(5));
+ Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
+ Rel rel = _type_cache.relationFor(reader.getint(5));
data::RecordId rid = reader.getint64(7);
if ( rel == zypp::Rel::NONE )
{
capability::NamedCap *ncap = new capability::NamedCap( refer, reader.getstring(1) );
- zypp::Dep deptype = deptypeFor(reader.getint(6));
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) );
}
else
{
capability::VersionedCap *vcap = new capability::VersionedCap( refer, reader.getstring(1), /* rel */ rel, Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ) );
- zypp::Dep deptype = deptypeFor(reader.getint(6));
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
}
}
@@ -232,9 +160,9 @@
sqlite3_reader reader = select_file_cmd.executereader();
while ( reader.read() )
{
- Resolvable::Kind refer = kindFor(reader.getint(0));
+ Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
- zypp::Dep deptype = deptypeFor(reader.getint(3));
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(3));
data::RecordId rid = reader.getint64(4);
nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
}
Modified: trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h?rev=5566&r1=5565&r2=5566&view=diff
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h (original)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h Fri May 18 17:02:46 2007
@@ -22,6 +22,8 @@
#include
#include "zypp2/cache/sqlite3x/sqlite3x.hpp"
+#include "zypp2/cache/CacheTypes.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -84,10 +86,7 @@
void read_capabilities( sqlite3x::sqlite3_connection &con, std::map &nvras );
- std::map _rel_cache;
- std::map _kind_cache;
- std::map _deptype_cache;
- std::map _arch_cache;
+ cache::CacheTypes _type_cache;
};
///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/repository/memory/DataPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/DataPackageImpl.cc?rev=5566&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DataPackageImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/memory/DataPackageImpl.cc Fri May 18 17:02:46 2007
@@ -0,0 +1,221 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+//#include "zypp/source/Data/DataImpl.h"
+#include "zypp2/repository/memory/DataPackageImpl.h"
+
+using namespace std;
+using zypp::data::Package_Ptr;
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repository
+{ /////////////////////////////////////////////////////////////////
+namespace data
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : PackageImpl::PackageImpl
+// METHOD TYPE : Ctor
+//
+DataPackageImpl::DataPackageImpl( zypp::data::Package_Ptr data)
+ : _data(data)
+{}
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : PackageImpl::~PackageImpl
+// METHOD TYPE : Dtor
+//
+DataPackageImpl::~DataPackageImpl()
+{}
+
+TranslatedText DataPackageImpl::summary() const
+{
+ return _data->summary;
+}
+
+TranslatedText DataPackageImpl::description() const
+{
+ return _data->description;
+}
+
+TranslatedText DataPackageImpl::insnotify() const
+{
+ return TranslatedText();
+}
+
+TranslatedText DataPackageImpl::delnotify() const
+{
+ return TranslatedText();
+}
+
+TranslatedText DataPackageImpl::licenseToConfirm() const
+{
+ return TranslatedText();
+}
+
+Source_Ref DataPackageImpl::source() const
+{
+ return Source_Ref::noSource;
+}
+
+unsigned DataPackageImpl::sourceMediaNr() const
+{
+ return _data->repositoryLocation.mediaNr;
+}
+
+CheckSum DataPackageImpl::checksum() const
+{
+ return _data->repositoryLocation.fileChecksum;
+}
+
+Date DataPackageImpl::buildtime() const
+{
+ return Date();
+}
+
+std::string DataPackageImpl::buildhost() const
+{
+ return _data->buildhost;
+}
+
+Date DataPackageImpl::installtime() const
+{
+ return Date();
+} // it was never installed
+
+std::string DataPackageImpl::distribution() const
+{
+ return _data->distribution;
+}
+
+Vendor DataPackageImpl::vendor() const
+{
+ return _data->vendor;
+}
+
+Label DataPackageImpl::license() const
+{
+ return _data->license;
+}
+
+std::string DataPackageImpl::packager() const
+{
+ return std::string();
+}
+
+PackageGroup DataPackageImpl::group() const
+{
+ return _data->group;
+}
+
+DataPackageImpl::Keywords DataPackageImpl::keywords() const
+{
+ return std::set<PackageKeyword>();
+}
+
+Changelog DataPackageImpl::changelog() const
+{
+ return Changelog();
+}
+
+Pathname DataPackageImpl::location() const
+{
+ return _data->repositoryLocation.filePath;
+}
+
+std::string DataPackageImpl::url() const
+{
+ return _data->url;
+}
+
+std::string DataPackageImpl::os() const
+{
+ return _data->operatingSystem;
+}
+
+Text DataPackageImpl::prein() const
+{
+ return _data->prein;
+}
+
+Text DataPackageImpl::postin() const
+{
+ return _data->postin;
+}
+
+Text DataPackageImpl::preun() const
+{
+ return _data->preun;
+}
+
+Text DataPackageImpl::postun() const
+{
+ return _data->postun;
+}
+
+ByteCount DataPackageImpl::size() const
+{
+ return _data->repositoryLocation.fileSize;
+}
+
+ByteCount DataPackageImpl::sourcesize() const
+// FIXME
+{
+ return 0;
+}
+
+ByteCount DataPackageImpl::archivesize() const
+{
+ return 0;
+}
+
+DiskUsage DataPackageImpl::diskusage() const
+{
+ return DiskUsage();
+}
+
+std::liststd::string DataPackageImpl::authors() const
+{
+ return _data->authors;
+}
+
+std::liststd::string DataPackageImpl::filenames() const
+{
+ return std::liststd::string();
+}
+
+std::listdetail::PackageImplIf::DeltaRpm DataPackageImpl::deltaRpms() const
+{
+ return detail::PackageImplIf::deltaRpms();
+}
+
+std::listdetail::PackageImplIf::PatchRpm DataPackageImpl::patchRpms() const
+{
+ return detail::PackageImplIf::patchRpms();
+}
+
+bool DataPackageImpl::installOnly() const
+{
+ return false;
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace Data
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/repository/memory/DataPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/DataPackageImpl.h?rev=5566&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DataPackageImpl.h (added)
+++ trunk/libzypp/zypp2/repository/memory/DataPackageImpl.h Fri May 18 17:02:46 2007
@@ -0,0 +1,87 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_REPO_DataPACKAGEIMPL_H
+#define ZYPP_REPO_DataPACKAGEIMPL_H
+
+#include "zypp/data/ResolvableData.h"
+#include "zypp/detail/PackageImplIf.h"
+#include "zypp/Source.h"
+#include "zypp/DiskUsage.h"
+#include "zypp/CheckSum.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ namespace data
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : DataPackageImpl
+ //
+ struct DataPackageImpl : public zypp::detail::PackageImplIf
+ {
+ DataPackageImpl( zypp::data::Package_Ptr );
+ virtual ~DataPackageImpl();
+
+ /** \name ResObject attributes. */
+ //@{
+ virtual TranslatedText summary() const;
+ virtual TranslatedText description() const;
+ virtual TranslatedText insnotify() const;
+ virtual TranslatedText delnotify() const;
+ virtual TranslatedText licenseToConfirm() const;
+ virtual Source_Ref source() const;
+ virtual unsigned sourceMediaNr() const;
+ //@}
+
+ virtual CheckSum checksum() const;
+ virtual Date buildtime() const;
+ virtual std::string buildhost() const;
+ virtual Date installtime() const;
+ virtual std::string distribution() const;
+ virtual Vendor vendor() const;
+ virtual Label license() const;
+ virtual std::string packager() const;
+ virtual PackageGroup group() const;
+ virtual Keywords keywords() const;
+ virtual Changelog changelog() const;
+ virtual Pathname location() const;
+ virtual std::string url() const;
+ virtual std::string os() const;
+ virtual Text prein() const;
+ virtual Text postin() const;
+ virtual Text preun() const;
+ virtual Text postun() const;
+ virtual ByteCount size() const;
+ virtual ByteCount sourcesize() const;
+ virtual ByteCount archivesize() const;
+ virtual DiskUsage diskusage() const;
+ virtual std::liststd::string authors() const;
+ virtual std::liststd::string filenames() const;
+ virtual std::list<DeltaRpm> deltaRpms() const;
+ virtual std::list<PatchRpm> patchRpms() const;
+ virtual bool installOnly() const;
+ private:
+ zypp::data::Package_Ptr _data;
+ };
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+ } // namespace Data
+ /////////////////////////////////////////////////////////////////
+ } // namespace source
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PACKAGEIMPL_H
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org