Author: dmacvicar
Date: Fri Apr 27 18:06:37 2007
New Revision: 5459
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5459&view=rev
Log:
r5166@piscola: dmacvicar | 2007-04-27 13:32:22 +0200
source -> repo
r5167@piscola: dmacvicar | 2007-04-27 13:34:02 +0200
source -> repo
r5168@piscola: dmacvicar | 2007-04-27 17:59:33 +0200
end of line
r5171@piscola: dmacvicar | 2007-04-27 18:04:39 +0200
put new classes in piece and make everything compile again.
Added:
trunk/libzypp/zypp2/Repository.cc
trunk/libzypp/zypp2/Repository.h
trunk/libzypp/zypp2/RepositoryFactory.cc
trunk/libzypp/zypp2/RepositoryFactory.h
trunk/libzypp/zypp2/RepositoryInfo.cc
trunk/libzypp/zypp2/RepositoryInfo.h
trunk/libzypp/zypp2/RepositoryManager.cc
- copied, changed from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc
trunk/libzypp/zypp2/RepositoryManager.h
- copied, changed from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h
trunk/libzypp/zypp2/repository/
- copied from r5451, trunk/libzypp/zypp2/source/
trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc
trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h
trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc
trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h
Removed:
trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc
trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h
trunk/libzypp/zypp2/source/
Modified:
trunk/ (props changed)
trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
trunk/libzypp/zypp/Edition.cc
trunk/libzypp/zypp2/CMakeLists.txt
Modified: trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt?rev=5459&r1=5458&r2=5459&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt Fri Apr 27 18:06:37 2007
@@ -32,9 +32,9 @@
TARGET_LINK_LIBRARIES(cachedsource zypp )
TARGET_LINK_LIBRARIES(cachedsource zypp2 )
-ADD_EXECUTABLE(repomanager RepositoryManager_tp.cc RepositoryManager.cc)
+ADD_EXECUTABLE(repomanager RepositoryManager_tp.cc)
TARGET_LINK_LIBRARIES(repomanager zypp )
-#TARGET_LINK_LIBRARIES(repomanager zypp2 )
+TARGET_LINK_LIBRARIES(repomanager zypp2 )
FIND_PACKAGE(Zsync)
IF(ZSYNC_FOUND)
Modified: trunk/libzypp/zypp/Edition.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Edition.cc?rev=5459&r1=5458&r2=5459&view=diff
==============================================================================
--- trunk/libzypp/zypp/Edition.cc (original)
+++ trunk/libzypp/zypp/Edition.cc Fri Apr 27 18:06:37 2007
@@ -321,3 +321,5 @@
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
+
+
Modified: trunk/libzypp/zypp2/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/CMakeLists.txt?rev=5459&r1=5458&r2=5459&view=diff
==============================================================================
--- trunk/libzypp/zypp2/CMakeLists.txt (original)
+++ trunk/libzypp/zypp2/CMakeLists.txt Fri Apr 27 18:06:37 2007
@@ -10,11 +10,19 @@
SET( zypp2_SRCS
+ Repository.cc
+ RepositoryInfo.cc
+ RepositoryManager.cc
+ RepositoryFactory.cc
Lazy.cc
dummy.cc
)
SET( zypp2_HEADERS
+ Repository.h
+ RepositoryInfo.h
+ RepositoryManager.h
+ RepositoryFactory.h
CommiterIface.h
Lazy.h
)
@@ -70,36 +78,42 @@
# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/cache/sqlite3x
#)
-SET( zypp2_source_SRCS
- source/dummy.cc
+SET( zypp2_repository_SRCS
+ repository/dummy.cc
+ repository/RepositoryImpl.cc
)
-SET( zypp2_source_cached_SRCS
- source/cached/CachedSourceImpl.cc
- source/cached/CachedSourcePackageImpl.cc
+SET( zypp2_repository_HEADERS
+ repository/dummy.h
+ repository/RepositoryImpl.h
)
-SET( zypp2_source_cached_HEADERS
- source/cached/CachedSourceImpl.h
- source/cached/CachedSourcePackageImpl.h
+SET( zypp2_repository_cached_SRCS
+ repository/cached/CachedRepositoryImpl.cc
+ repository/cached/CachedRepositoryPackageImpl.cc
+)
+
+SET( zypp2_repository_cached_HEADERS
+ repository/cached/CachedRepositoryImpl.h
+ repository/cached/CachedRepositoryPackageImpl.h
)
#INSTALL( FILES
-# ${zypp2_source_sqlite-source_HEADERS}
-# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/source/sqlite-source
+# ${zypp2_repository_sqlite-repository_HEADERS}
+# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/repository/sqlite-repository
#)
SET( zypp2_lib_SRCS
-${zypp2_source_SRCS}
+${zypp2_repository_SRCS}
${zypp2_SRCS}
${zypp2_cache_SRCS}
-${zypp2_source_cached_SRCS}
+${zypp2_repository_cached_SRCS}
${zypp2_cache_sqlite3x_SRCS}
)
SET( zypp2_lib_HEADERS
-${zypp2_source_HEADERS}
+${zypp2_repository_HEADERS}
${zypp2_HEADERS}
${zypp2_cache_HEADERS}
${zypp2_cache_sqlite3x_HEADERS}
Added: trunk/libzypp/zypp2/Repository.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/Repository.cc?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/Repository.cc (added)
+++ trunk/libzypp/zypp2/Repository.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,45 @@
+#include <cassert>
+#include <iostream>
+
+#include "zypp2/Repository.h"
+#include "zypp2/repository/RepositoryImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ const Repository Repository::noRepository;
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Repository::Repository
+ // METHOD TYPE : Ctor
+ //
+ Repository::Repository()
+ : _pimpl( Impl::nullimpl() )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Repository::Repository
+ // METHOD TYPE : Ctor
+ //
+ Repository::Repository( const Impl_Ptr & impl_r )
+ : _pimpl( impl_r )
+ {
+ assert( impl_r );
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // Forward to RepositoryImpl:
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ Repository::NumericId Repository::numericId() const
+ { return _pimpl->numericId(); }
+
+}
+
Added: trunk/libzypp/zypp2/Repository.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/Repository.h?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/Repository.h (added)
+++ trunk/libzypp/zypp2/Repository.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,77 @@
+
+#ifndef ZYPP_REPOSITORY_H
+#define ZYPP_REPOSITORY_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/SafeBool.h"
+
+namespace zypp
+{
+ namespace repository
+ {
+ DEFINE_PTR_TYPE(RepositoryImpl);
+ class RepositoryImpl;
+ }
+
+ class Repository : protected base::SafeBool<Repository> /* private, but gcc refuses */
+ {
+ public:
+ friend std::ostream & operator<<( std::ostream & str, const Repository & obj );
+ friend bool operator==( const Repository & lhs, const Repository & rhs );
+ friend bool operator<( const Repository & lhs, const Repository & rhs );
+
+ public:
+ typedef repository::RepositoryImpl Impl;
+ typedef repository::RepositoryImpl_Ptr Impl_Ptr;
+
+ public:
+
+ /** Default ctor: noRepository.
+ * Real Repositorys are to be created via RepositoryFactory.
+ */
+ Repository();
+
+ /** A dummy Repository (Id \c 0) providing nothing, doing nothing.
+ * \todo provide a _constRef
+ */
+ static const Repository noRepository;
+
+ /** Validate Repository in a boolean context.
+ * \c FALSE iff == noRepository.
+ */
+ using base::SafeBool<Repository>::operator bool_type;
+
+ public:
+ typedef unsigned long NumericId;
+
+ /** Runtime unique numeric Repository Id. */
+ NumericId numericId() const;
+ private:
+ friend base::SafeBool<Repository>::operator bool_type() const;
+ /** \ref SafeBool test. */
+ bool boolTest() const
+ { return _pimpl != noRepository._pimpl; }
+
+ private:
+ /** Factory */
+ friend class RepositoryFactory;
+ friend class repository::RepositoryImpl;
+
+ private:
+ /** Factory ctor */
+ explicit
+ Repository( const Impl_Ptr & impl_r );
+
+ private:
+ /** Pointer to implementation */
+ Impl_Ptr _pimpl;
+ };
+
+}
+
+#endif
+
+
Added: trunk/libzypp/zypp2/RepositoryFactory.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryFactory.cc?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/RepositoryFactory.cc (added)
+++ trunk/libzypp/zypp2/RepositoryFactory.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,23 @@
+
+#include "zypp2/RepositoryFactory.h"
+
+namespace zypp {
+
+RepositoryFactory::RepositoryFactory()
+{
+}
+
+RepositoryFactory::~RepositoryFactory()
+{
+
+}
+
+
+Repository RepositoryFactory::createFrom( const RepositoryInfo & context )
+{
+
+}
+
+} // ns zypp
+
+
Added: trunk/libzypp/zypp2/RepositoryFactory.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryFactory.h?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/RepositoryFactory.h (added)
+++ trunk/libzypp/zypp2/RepositoryFactory.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,30 @@
+
+#ifndef ZYPP_REPOSITORY_FACTORY_H
+#define ZYPP_REPOSITORY_FACTORY_H
+
+#include "zypp2/Repository.h"
+#include "zypp2/RepositoryInfo.h"
+
+namespace zypp
+{
+ class RepositoryFactory
+ {
+ friend std::ostream & operator<<( std::ostream & str, const RepositoryFactory & obj );
+
+ public:
+ /** Default ctor */
+ RepositoryFactory();
+ /** Dtor */
+ ~RepositoryFactory();
+
+ public:
+ /** Construct source.
+ * \throw EXCEPTION on fail
+ */
+ Repository createFrom( const RepositoryInfo & context );
+ };
+}
+
+#endif
+
+
Added: trunk/libzypp/zypp2/RepositoryInfo.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.cc?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.cc (added)
+++ trunk/libzypp/zypp2/RepositoryInfo.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,163 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/repository/RepositoryInfo.cc
+ *
+*/
+
+#include <string>
+#include <iostream>
+#include "zypp2/RepositoryInfo.h"
+
+using namespace boost;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ RepositoryInfo::RepositoryInfo()
+ : _enabled (indeterminate)
+ , _autorefresh(indeterminate)
+ , _base_repository( indeterminate )
+ {
+
+ }
+
+ RepositoryInfo::RepositoryInfo( const Url & url,
+ const Pathname & path,
+ const std::string & alias,
+ const Pathname & cache_dir,
+ tribool autorefresh)
+ : _enabled (true),
+ _autorefresh(autorefresh),
+ _base_repository( indeterminate ),
+ _url(url),
+ _cache_dir(cache_dir),
+ _path(path),
+ _alias(alias)
+ {
+
+ }
+
+ RepositoryInfo & RepositoryInfo::setEnabled( boost::tribool enabled )
+ {
+ _enabled = enabled;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setAutorefresh( boost::tribool autorefresh )
+ {
+ _autorefresh = autorefresh;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setBaseRepository( bool val_r )
+ {
+ _base_repository = val_r;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setUrl( const Url &url )
+ {
+ _url = url;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setPath( const Pathname &p )
+ {
+ _path = p;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setAlias( const std::string &alias )
+ {
+ _alias = alias;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setType( const std::string &t )
+ {
+ _type = t;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setCacheDir( const Pathname &p )
+ {
+ _cache_dir = p;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setDescription( const std::string &description )
+ {
+ _description = description;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setChecksum( const CheckSum &checksum )
+ {
+ _checksum = checksum;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setTimestamp( const Date ×tamp )
+ {
+ _timestamp = timestamp;
+ return *this;
+ }
+
+ tribool RepositoryInfo::enabled() const
+ { return _enabled; }
+
+ tribool RepositoryInfo::autorefresh() const
+ { return _autorefresh; }
+
+ boost::tribool RepositoryInfo::baseRepository() const
+ { return _base_repository; }
+
+ Pathname RepositoryInfo::cacheDir() const
+ { return _cache_dir; }
+
+ Pathname RepositoryInfo::path() const
+ { return _path; }
+
+ std::string RepositoryInfo::alias() const
+ { return _alias; }
+
+ std::string RepositoryInfo::description() const
+ { return _description; }
+
+ CheckSum RepositoryInfo::checksum() const
+ { return _checksum; }
+
+ Date RepositoryInfo::timestamp() const
+ { return _timestamp; }
+
+ std::string RepositoryInfo::type() const
+ { return _type; }
+
+ Url RepositoryInfo::url() const
+ { return _url; }
+
+ std::ostream & RepositoryInfo::dumpOn( std::ostream & str ) const
+ {
+ str << "--------------------------------------" << std::endl;
+ str << "- alias : " << alias() << std::endl;
+ str << "- url : " << url() << 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;
+ str << "- cache_dir : " << cacheDir() << std::endl;
+ return str;
+ }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
Added: trunk/libzypp/zypp2/RepositoryInfo.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.h?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.h (added)
+++ trunk/libzypp/zypp2/RepositoryInfo.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,85 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_RepositoryInfo_H
+#define ZYPP_RepositoryInfo_H
+
+#include <list>
+
+#include
+#include "zypp/Pathname.h"
+#include "zypp/Url.h"
+#include "zypp/CheckSum.h"
+#include "zypp/Date.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ class RepositoryInfo
+ {
+ public:
+
+ RepositoryInfo();
+
+ RepositoryInfo( const Url & url, const Pathname & path, const std::string & alias = "", const Pathname & cache_dir = "", boost::tribool autorefresh = boost::indeterminate );
+
+ RepositoryInfo & setEnabled( boost::tribool enabled );
+ RepositoryInfo & setAutorefresh( boost::tribool autorefresh );
+ RepositoryInfo & setBaseRepository( bool val_r );
+ RepositoryInfo & setUrl( const Url &url );
+ RepositoryInfo & setPath( const Pathname &p );
+ RepositoryInfo & setAlias( const std::string &alias );
+ RepositoryInfo & setType( const std::string &t );
+ RepositoryInfo & setCacheDir( const Pathname &p );
+ RepositoryInfo & setDescription( const std::string &description );
+ RepositoryInfo & setChecksum( const CheckSum &checksum );
+ RepositoryInfo & setTimestamp( const Date ×tamp );
+ boost::tribool enabled() const;
+ boost::tribool autorefresh() const;
+ boost::tribool baseRepository() const;
+ Pathname cacheDir() 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;
+ Pathname _path;
+ std::string _alias;
+ std::string _description;
+ CheckSum _checksum;
+ Date _timestamp;
+ };
+
+ /** \relates RepositoryInfo Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const RepositoryInfo & obj )
+ { return obj.dumpOn( str ); }
+
+ typedef std::list<RepositoryInfo> RepositoryInfoList;
+
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RepositoryInfo_H
+
+
Copied: trunk/libzypp/zypp2/RepositoryManager.cc (from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryManager.cc?p2=trunk/libzypp/zypp2/RepositoryManager.cc&p1=trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc&r1=5456&r2=5459&rev=5459&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc (original)
+++ trunk/libzypp/zypp2/RepositoryManager.cc Fri Apr 27 18:06:37 2007
@@ -1,23 +1,19 @@
-
-
-
-
-
#include <iostream>
#include <list>
#include <algorithm>
-#include "RepositoryManager.h"
#include "zypp/base/Exception.h"
#include "zypp/base/Logger.h"
#include "zypp/PathInfo.h"
#include "zypp/parser/inifile/iniparser.h"
+#include "zypp2/RepositoryManager.h"
+
+
using namespace std;
using namespace zypp;
using namespace zypp::filesystem;
-using namespace zypp::source;
namespace zypp {
@@ -26,7 +22,7 @@
}
-static std::listsource::SourceInfo repositories_in_file( const Pathname &file )
+static std::list<RepositoryInfo> repositories_in_file( const Pathname &file )
{
dictionary *d = iniparser_new(file.c_str());
@@ -41,12 +37,12 @@
MIL << iniparser_getsecname(d, i) << endl;
}
- return std::listsource::SourceInfo();
+ return std::list<RepositoryInfo>();
}
-static std::listsource::SourceInfo repositories_in_path( const Pathname &dir )
+static std::list<RepositoryInfo> repositories_in_path( const Pathname &dir )
{
- std::listsource::SourceInfo repos;
+ std::list<RepositoryInfo> repos;
list<Pathname> entries;
if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
ZYPP_THROW(Exception("failed to read directory"));
@@ -54,17 +50,18 @@
for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
{
Pathname file = *it;
- std::listsource::SourceInfo repos_here = repositories_in_file(file);
+ std::list<RepositoryInfo> repos_here = repositories_in_file(file);
std::copy( repos_here.begin(), repos_here.end(), std::back_inserter(repos));
}
return repos;
}
-std::listsource::SourceInfo RepositoryManager::knownRepositories()
+std::list<RepositoryInfo> RepositoryManager::knownRepositories()
{
- return std::listsource::SourceInfo();
+ return std::list<RepositoryInfo>();
}
-} // ns zypp
\ No newline at end of file
+} // ns zypp
+
Copied: trunk/libzypp/zypp2/RepositoryManager.h (from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryManager.h?p2=trunk/libzypp/zypp2/RepositoryManager.h&p1=trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h&r1=5456&r2=5459&rev=5459&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h (original)
+++ trunk/libzypp/zypp2/RepositoryManager.h Fri Apr 27 18:06:37 2007
@@ -5,9 +5,10 @@
#include <list>
#include "zypp/base/ReferenceCounted.h"
#include "zypp/base/NonCopyable.h"
-#include "zypp/source/SourceInfo.h"
#include "zypp/Pathname.h"
+#include "zypp2/RepositoryInfo.h"
+
namespace zypp
{
@@ -16,9 +17,11 @@
friend std::ostream & operator<<( std::ostream & str, const RepositoryManager & obj );
public:
RepositoryManager();
- std::listsource::SourceInfo knownRepositories();
+ std::list<RepositoryInfo> knownRepositories();
};
}
-#endif
\ No newline at end of file
+
+#endif
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,184 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/base/Measure.h"
+#include
+#include "zypp2/cache/sqlite3x/sqlite3x.hpp"
+#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"
+#include "zypp/CapFactory.h"
+
+#include "zypp2/repository/cached/CachedRepositoryImpl.h"
+#include "zypp2/repository/cached/CachedRepositoryPackageImpl.h"
+
+
+using namespace zypp::detail;
+using namespace zypp::cache;
+using std::endl;
+using namespace std;
+using namespace sqlite3x;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repository
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+namespace cached
+{ /////////////////////////////////////////////////////////////////
+
+CachedRepositoryImpl::CachedRepositoryImpl( const Pathname &dbdir)
+ : _dbdir(dbdir)
+{
+
+}
+
+CachedRepositoryImpl::~CachedRepositoryImpl()
+{
+
+}
+
+
+void CachedRepositoryImpl::factoryInit()
+{
+ MIL << "Plaindir repository initialized." << std::endl;
+}
+
+void read_capabilities( sqlite3_connection &con, map &nvras );
+
+void CachedRepositoryImpl::createResolvables()
+{
+ debug::Measure m("create resolvables");
+ CapFactory capfactory;
+ try {
+ sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
+ con.executenonquery("PRAGMA cache_size=8000;");
+ con.executenonquery("BEGIN;");
+ sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables;");
+ map nvras;
+
+ sqlite3_reader reader = cmd.executereader();
+ while(reader.read())
+ {
+ long long id = reader.getint64(0);
+ Dependencies deps;
+
+ Arch arch = db_arch2zypp_arch( static_castdb::Arch(reader.getint(5)));
+
+ // Collect basic Resolvable data
+ nvras[id] = NVRAD( reader.getstring(1),
+ Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
+ arch,
+ deps
+ );
+ }
+
+ MIL << "Done reading resolvables nvra" << endl;
+
+ read_capabilities( con, nvras);
+
+ for ( map::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
+ {
+ ResImplTraits<CachedRepositoryPackageImpl>::Ptr impl = new CachedRepositoryPackageImpl(selfRepository());
+ Package::Ptr package = detail::makeResolvableFromImpl( it->second, impl );
+ _store.insert (package);
+ }
+ con.executenonquery("COMMIT;");
+ }
+ catch(exception &ex) {
+ cerr << "Exception Occured: " << ex.what() << endl;
+ }
+ //extract_packages_from_directory( _store, thePath, selfRepositoryRef(), true );
+
+}
+
+void read_capabilities( sqlite3_connection &con, map &nvras )
+{
+ CapFactory capfactory;
+ // precompile statements
+
+// map named_caps;
+// sqlite3_command select_named_cmd( con, "select v.id, c.refers_kind, n.name, v.version, v.release, v.epoch, v.relation named_capabilities v, capabilities c, names n where v.name_id=n.id and c.id=ncc.capability_id and ncc.named_capability_id=v.id;");
+// {
+// debug::Measure mnc("read named capabilities");
+// sqlite3_reader reader = select_named_cmd.executereader();
+// while ( reader.read() )
+// {
+//
+// }
+// }
+ sqlite3_command select_named_cmd( con, "select v.refers_kind, n.name, v.version, v.release, v.epoch, v.relation, v.dependency_type, v.resolvable_id from named_capabilities v, names n where v.name_id=n.id;");
+ sqlite3_command select_file_cmd( con, "select fc.refers_kind, dn.name, fn.name, fc.dependency_type, fc.resolvable_id from file_capabilities fc, files f, dir_names dn, file_names fn where f.id=fc.file_id and f.dir_name_id=dn.id and f.file_name_id=fn.id;");
+
+ {
+ debug::Measure mnc("read named capabilities");
+ sqlite3_reader reader = select_named_cmd.executereader();
+ while ( reader.read() )
+ {
+ Resolvable::Kind refer = db_kind2zypp_kind( static_castdb::Kind(reader.getint(0)) );
+ zypp::Rel rel = db_rel2zypp_rel( static_castdb::Rel(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 = db_deptype2zypp_deptype( static_castdb::DependencyType(reader.getint(5)) );
+
+ 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 = db_deptype2zypp_deptype( static_castdb::DependencyType(reader.getint(5)) );
+ nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
+ }
+ }
+ }
+
+ {
+ debug::Measure mnf("read file capabilities");
+ sqlite3_reader reader = select_file_cmd.executereader();
+ while ( reader.read() )
+ {
+ Resolvable::Kind refer = db_kind2zypp_kind( static_castdb::Kind(reader.getint(0)) );
+ capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
+ zypp::Dep deptype = db_deptype2zypp_deptype( static_castdb::DependencyType(reader.getint(3)) );
+ data::RecordId rid = reader.getint64(4);
+ nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
+ }
+ }
+
+ MIL << nvras.size() << " capabilities" << endl;
+}
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////
+} // namespace plaindir
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace repository
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,80 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_CachedRepositoryImpl_H
+#define ZYPP_CachedRepositoryImpl_H
+
+#include <iosfwd>
+#include "zypp/Pathname.h"
+#include "zypp2/repository/RepositoryImpl.h"
+#include "zypp/ResStore.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace cached
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : CachedRepositoryImpl
+ //
+ /** */
+ class CachedRepositoryImpl : public repository::RepositoryImpl
+ {
+ public:
+ typedef intrusive_ptr<CachedRepositoryImpl> Ptr;
+ typedef intrusive_ptr<const CachedRepositoryImpl> constPtr;
+
+ public:
+ /** Default ctor */
+ CachedRepositoryImpl( const zypp::Pathname &dbdir );
+ /** Dtor */
+ ~CachedRepositoryImpl();
+
+ public:
+ /** String identifying the type of the source. */
+ static std::string typeString()
+ { return "CachedSource"; }
+
+ /** String identifying the type of the source. */
+ virtual std::string type() const
+ { return typeString(); }
+
+ private:
+ /** Ctor substitute.
+ * Actually get the metadata.
+ * \throw EXCEPTION on fail
+ */
+ virtual void factoryInit();
+ virtual void createResolvables();
+
+ zypp::Pathname _dbdir;
+ ResStore _store;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace cached
+ ///////////////////////////////////////////////////////////////////
+
+ using cached::CachedRepositoryImpl;
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace source
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_PLAINDIR_PLAINDIRIMPL_H
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,101 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zmd/backend/dbrepository/CachedRepositoryPackageImpl.h
+ *
+*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp2/cache/CachedResolvableDataProvider.h"
+#include "zypp2/repository/RepositoryImpl.h"
+#include "CachedRepositoryPackageImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : CachedRepositoryPackageImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+CachedRepositoryPackageImpl::CachedRepositoryPackageImpl (Repository repository_r)
+ : _repository (repository_r)
+ , _install_only(false)
+ , _size_installed(0)
+ , _size_archive(0)
+ , _data_loaded(false)
+{}
+
+Repository
+CachedRepositoryPackageImpl::repository() const
+{
+ return _repository;
+}
+
+/** Package summary */
+TranslatedText CachedRepositoryPackageImpl::summary() const
+{
+ return _summary;
+}
+
+/** Package description */
+TranslatedText CachedRepositoryPackageImpl::description() const
+{
+ return _description;
+}
+
+PackageGroup CachedRepositoryPackageImpl::group() const
+{
+ return _group;
+}
+
+Pathname CachedRepositoryPackageImpl::location() const
+{
+ return _location;
+}
+
+ByteCount CachedRepositoryPackageImpl::size() const
+{
+ return _size_installed;
+}
+
+/** */
+ByteCount CachedRepositoryPackageImpl::archivesize() const
+{
+ return _size_archive;
+}
+
+bool CachedRepositoryPackageImpl::installOnly() const
+{
+ return _install_only;
+}
+
+unsigned CachedRepositoryPackageImpl::repositoryMediaNr() const
+{
+ return _media_nr;
+}
+
+Vendor CachedRepositoryPackageImpl::vendor() const
+{
+ return "suse";
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h?rev=5459&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,62 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zmd/backend/dbrepository/CachedRepositoryPackageImpl.h
+ *
+*/
+#ifndef CachedRepositoryPackageImpl_H
+#define CachedRepositoryPackageImpl_H
+
+#include "zypp/detail/PackageImpl.h"
+#include "zypp2/Repository.h"
+//#include
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : CachedRepositoryPackageImpl
+ //
+ class CachedRepositoryPackageImpl : public detail::PackageImplIf
+ {
+ public:
+
+ CachedRepositoryPackageImpl( Repository repository_r );
+
+ virtual TranslatedText summary() const;
+ virtual TranslatedText description() const;
+ virtual ByteCount size() const;
+ virtual PackageGroup group() const;
+ virtual ByteCount archivesize() const;
+ virtual Pathname location() const;
+ virtual bool installOnly() const;
+ virtual Repository repository() const;
+ virtual unsigned repositoryMediaNr() const;
+ virtual Vendor vendor() const;
+
+ protected:
+ Repository _repository;
+ TranslatedText _summary;
+ TranslatedText _description;
+ PackageGroup _group;
+ Pathname _location;
+ bool _install_only;
+ unsigned _media_nr;
+
+ ByteCount _size_installed;
+ ByteCount _size_archive;
+
+ bool _data_loaded;
+ };
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org