Author: dmacvicar
Date: Fri Jun 1 14:48:35 2007
New Revision: 5656
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5656&view=rev
Log:
- RepoManager updates, like configurable paths
- Some API added to CacheStore to ask about repos
cached
- specific Cache and Repo exceptions
- test case for RepoManager.
- Change CacheStore repo api to use alias instead
of url and path
- compile all code with those changes
Added:
trunk/libzypp/tests/zypp/RepoManager_test.cc
trunk/libzypp/tests/zypp/data/RepoManager/
trunk/libzypp/tests/zypp/data/RepoManager/repos.d/
trunk/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo
trunk/libzypp/tests/zypp/data/RepoManager/repos.d/home:dmacvicar.repo
trunk/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo
trunk/libzypp/zypp2/cache/CacheException.cc
trunk/libzypp/zypp2/cache/CacheException.h
trunk/libzypp/zypp2/repo/RepoException.cc
trunk/libzypp/zypp2/repo/RepoException.h
Modified:
trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc
trunk/libzypp/devel/devel.dmacvicar/testbed.cc
trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc
trunk/libzypp/tests/cache/CMakeLists.txt
trunk/libzypp/tests/cache/CacheQuery_test.cc
trunk/libzypp/tests/cache/CacheStore_test.cc
trunk/libzypp/tests/zypp/CMakeLists.txt
trunk/libzypp/zypp/ZConfig.cc
trunk/libzypp/zypp/ZConfig.h
trunk/libzypp/zypp2/CMakeLists.txt
trunk/libzypp/zypp2/RepoManager.cc
trunk/libzypp/zypp2/RepoManager.h
trunk/libzypp/zypp2/RepoStatus.cc
trunk/libzypp/zypp2/RepoStatus.h
trunk/libzypp/zypp2/cache/CacheStore.cpp
trunk/libzypp/zypp2/cache/CacheStore.h
trunk/libzypp/zypp2/cache/schema/schema.sql
Modified: trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc Fri Jun 1 14:48:35 2007
@@ -7,7 +7,7 @@
#include "zypp/base/Measure.h"
#include "zypp/detail/ResObjectFactory.h"
#include "zypp2/parser/yum/YUMParser.h"
-#include "zypp2/repository/memory/DPackageImpl.h"
+#include "zypp2/repo/memory/PackageImpl.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
@@ -17,7 +17,7 @@
using namespace zypp;
using namespace zypp::parser::yum;
using zypp::debug::Measure;
-using namespace zypp::repository::memory;
+using namespace zypp::repo::memory;
bool progress_function(ProgressData::value_type p)
{
@@ -30,8 +30,8 @@
{
public:
- typedef detail::ResImplTraits<DPackageImpl>::Ptr PkgImplPtr;
- typedef detail::ResImplTraits<DPackageImpl>::Ptr SrcPkgImplPtr;
+ typedef detail::ResImplTraits<PackageImpl>::Ptr PkgImplPtr;
+ typedef detail::ResImplTraits<PackageImpl>::Ptr SrcPkgImplPtr;
ResolvableConsumer()
{
@@ -59,7 +59,7 @@
virtual void consumePackage( const data::RecordId &repository_id, data::Package_Ptr ptr )
{
- PkgImplPtr impl = PkgImplPtr( new DPackageImpl(ptr) );
+ PkgImplPtr impl = PkgImplPtr( new PackageImpl(ptr) );
Dependencies deps;
collectDeps( deps, ptr->deps );
@@ -90,6 +90,16 @@
virtual void consumeFilelist( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & )
{}
+
+ virtual void consumeSourcePackage(const zypp::data::RecordId&, zypp::data::SrcPackage_Ptr)
+ {}
+
+ virtual void consumePackageAtom(const zypp::data::RecordId&, const zypp::data::PackageAtom_Ptr&)
+ {}
+
+ virtual void consumePattern(const zypp::data::RecordId&, zypp::data::Pattern_Ptr)
+ {}
+
//virtual void consumeSourcePackage( const data::SrcPackage_Ptr ) = 0;
ResStore _store;
};
@@ -113,7 +123,7 @@
Measure parse_primary_timer("primary.xml.gz parsing");
ResolvableConsumer store;
parser::yum::YUMParser parser( 0, store, &progress_function);
- parser.start(argv[1]);
+ parser.parse(argv[1]);
parse_primary_timer.stop();
cout << endl;
Modified: trunk/libzypp/devel/devel.dmacvicar/testbed.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/testbed.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/testbed.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/testbed.cc Fri Jun 1 14:48:35 2007
@@ -11,13 +11,13 @@
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
#include "zypp2/RepositoryFactory.h"
-#include "zypp2/repository/cached/CachedRepositoryImpl.h"
+#include "zypp2/repo/cached/RepoImpl.h"
#include "zypp/data/ResolvableData.h"
using namespace std;
using namespace zypp;
-using namespace zypp::repository;
-using namespace zypp::repository::cached;
+using namespace zypp::repo;
+using namespace zypp::repo::cached;
int main(int argc, char **argv)
Modified: trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc (original)
+++ trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc Fri Jun 1 14:48:35 2007
@@ -38,7 +38,7 @@
Measure open_repository_timer("CacheStore: lookupOrAppendRepository");
cache::CacheStore store(getenv("PWD"));
- data::RecordId repository_id = store.lookupOrAppendRepository( Url("http://some.url"), "/");
+ data::RecordId repository_id = store.lookupOrAppendRepository("somealias");
open_repository_timer.stop();
Modified: trunk/libzypp/tests/cache/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CMakeLists.txt?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/tests/cache/CMakeLists.txt (original)
+++ trunk/libzypp/tests/cache/CMakeLists.txt Fri Jun 1 14:48:35 2007
@@ -17,7 +17,7 @@
ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_CURRENT_SOURCE_DIR}/data )
# run this test against a YUM repo
-ADD_TEST(CacheQuery ${CMAKE_CURRENT_BINARY_DIR}/CacheQuery ${CMAKE_SOURCE_DIR}/tests/repository/yum/data/10.2-updates-subset )
+ADD_TEST(CacheQuery ${CMAKE_CURRENT_BINARY_DIR}/CacheQuery ${CMAKE_SOURCE_DIR}/tests/repo/yum/data/10.2-updates-subset )
Modified: trunk/libzypp/tests/cache/CacheQuery_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CacheQuery_test.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/tests/cache/CacheQuery_test.cc (original)
+++ trunk/libzypp/tests/cache/CacheQuery_test.cc Fri Jun 1 14:48:35 2007
@@ -40,7 +40,7 @@
{
cache::CacheStore store(tmpdir.path());
- data::RecordId repository_id = store.lookupOrAppendRepository( Url("http://novell.com"), "/");
+ data::RecordId repository_id = store.lookupOrAppendRepository("novell");
YUMParser parser( repository_id, store );
parser.parse(dir);
Modified: trunk/libzypp/tests/cache/CacheStore_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CacheStore_test.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/tests/cache/CacheStore_test.cc (original)
+++ trunk/libzypp/tests/cache/CacheStore_test.cc Fri Jun 1 14:48:35 2007
@@ -40,7 +40,7 @@
cache::CacheStore store(tmpdir.path());
- repository_id = store.lookupOrAppendRepository( Url("http://novell.com"), "/");
+ repository_id = store.lookupOrAppendRepository("novell.com");
zypp::debug::Measure cap_parse_timer("store resolvables");
for ( list<MiniResolvable>::iterator it = res_list.begin(); it != res_list.end(); it++)
@@ -50,6 +50,7 @@
(*it).nvra,
(*it).deps );
}
+ store.commit();
}
{
MIL << "now read resolvables" << endl;
Modified: trunk/libzypp/tests/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/CMakeLists.txt?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/tests/zypp/CMakeLists.txt Fri Jun 1 14:48:35 2007
@@ -46,6 +46,9 @@
ADD_EXECUTABLE( FileChecker FileChecker_test.cc )
TARGET_LINK_LIBRARIES( FileChecker zypp boost_unit_test_framework )
+ADD_EXECUTABLE( RepoManager RepoManager_test.cc )
+TARGET_LINK_LIBRARIES( RepoManager zypp zypp2 boost_unit_test_framework )
+
ADD_TEST(ArchTest ${CMAKE_CURRENT_BINARY_DIR}/Arch)
ADD_TEST(UrlTest ${CMAKE_CURRENT_BINARY_DIR}/Url)
ADD_TEST(Edition ${CMAKE_CURRENT_BINARY_DIR}/Edition)
@@ -60,4 +63,5 @@
ADD_TEST(KeyRingTest ${CMAKE_CURRENT_BINARY_DIR}/KeyRing)
ADD_TEST(MediaSetAccessTest ${CMAKE_CURRENT_BINARY_DIR}/MediaSetAccess ${CMAKE_CURRENT_SOURCE_DIR}/data/mediasetaccess)
ADD_TEST(FileCheckerTest ${CMAKE_CURRENT_BINARY_DIR}/FileChecker ${CMAKE_CURRENT_SOURCE_DIR}/data/FileChecker)
+ADD_TEST(RepoManagerTest ${CMAKE_CURRENT_BINARY_DIR}/RepoManager ${CMAKE_CURRENT_SOURCE_DIR}/data/RepoManager)
ADD_TEST(FetcherTest ${CMAKE_CURRENT_BINARY_DIR}/Fetcher)
Added: trunk/libzypp/tests/zypp/RepoManager_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/RepoManager_test.cc?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/tests/zypp/RepoManager_test.cc (added)
+++ trunk/libzypp/tests/zypp/RepoManager_test.cc Fri Jun 1 14:48:35 2007
@@ -0,0 +1,71 @@
+
+#include <iostream>
+#include <fstream>
+#include <list>
+#include <string>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp/KeyRing.h"
+#include "zypp/PublicKey.h"
+#include "zypp/TmpPath.h"
+
+#include "zypp2/RepoManager.h"
+
+#include
+#include
+#include
+
+#include "KeyRingTestReceiver.h"
+
+using boost::unit_test::test_suite;
+using boost::unit_test::test_case;
+using namespace boost::unit_test::log;
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::filesystem;
+
+void repomanager_test( const string &dir )
+{
+ RepoManagerOptions opts;
+
+ TmpDir tmpCachePath;
+ TmpDir tmpRawCachePath;
+
+ opts.repoCachePath = tmpCachePath.path();
+ opts.repoRawCachePath = tmpRawCachePath.path();
+ opts.knownReposPath = Pathname(dir) + "/repos.d";
+
+ RepoManager manager(opts);
+
+ list<RepoInfo> repos = manager.knownRepositories();
+
+ BOOST_CHECK_EQUAL(repos.size(), (unsigned) 3);
+}
+
+test_suite*
+init_unit_test_suite( int argc, char* argv[] )
+{
+ string datadir;
+ if (argc < 2)
+ {
+ datadir = TESTS_SRC_DIR;
+ datadir = (Pathname(datadir) + "/zypp/data/RepoManager").asString();
+ cout << "repomanager_test:"
+ " path to directory with test data required as parameter. Using " << datadir << endl;
+ //return (test_suite *)0;
+ }
+ else
+ {
+ datadir = argv[1];
+ }
+
+ std::string const params[] = { datadir };
+ //set_log_stream( std::cout );
+ test_suite* test= BOOST_TEST_SUITE( "RepoManagerTest" );
+ test->add(BOOST_PARAM_TEST_CASE( &repomanager_test,
+ (std::string const*)params, params+1));
+ return test;
+}
+
Added: trunk/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo (added)
+++ trunk/libzypp/tests/zypp/data/RepoManager/repos.d/filesharing.repo Fri Jun 1 14:48:35 2007
@@ -0,0 +1,7 @@
+[filesharing]
+name=Filesharing applications (SUSE_Factory)
+type=rpm-md
+baseurl=http://software.opensuse.org/download/filesharing/SUSE_Factory/
+gpgcheck=1
+gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc
+enabled=1
Added: trunk/libzypp/tests/zypp/data/RepoManager/repos.d/home:dmacvicar.repo
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/RepoManager/repos.d/home%3Admacvicar.repo?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/tests/zypp/data/RepoManager/repos.d/home:dmacvicar.repo (added)
+++ trunk/libzypp/tests/zypp/data/RepoManager/repos.d/home:dmacvicar.repo Fri Jun 1 14:48:35 2007
@@ -0,0 +1,7 @@
+[home:dmacvicar]
+name=Duncan Mac-Vicar SUSE rpms (openSUSE_Factory)
+type=rpm-md
+baseurl=http://software.opensuse.org/download/home:/dmacvicar/openSUSE_Factory/
+gpgcheck=1
+gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc
+enabled=1
Added: trunk/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo (added)
+++ trunk/libzypp/tests/zypp/data/RepoManager/repos.d/ruby.repo Fri Jun 1 14:48:35 2007
@@ -0,0 +1,7 @@
+[ruby]
+name=Ruby is an Interpreted Object-Oriented Scripting Language (openSUSE_Factory)
+type=rpm-md
+baseurl=http://software.opensuse.org/download/ruby/openSUSE_Factory/
+gpgcheck=1
+gpgkey=http://software.opensuse.org/openSUSE-Build-Service.asc
+enabled=1
Modified: trunk/libzypp/zypp/ZConfig.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZConfig.cc (original)
+++ trunk/libzypp/zypp/ZConfig.cc Fri Jun 1 14:48:35 2007
@@ -41,6 +41,21 @@
return getZYpp()->getTextLocale();
}
+ Pathname ZConfig::defaultRepoRawCachePath() const
+ {
+ return Pathname("/var/lib/zypp/cache/raw");
+ }
+
+ Pathname ZConfig::defaultRepoCachePath() const
+ {
+ return Pathname("/var/lib/zypp/cache");
+ }
+
+ Pathname ZConfig::defaultKnownReposPath() const
+ {
+ return Pathname("/etc/zypp/repos.d");
+ }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/ZConfig.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.h?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZConfig.h (original)
+++ trunk/libzypp/zypp/ZConfig.h Fri Jun 1 14:48:35 2007
@@ -40,6 +40,23 @@
* descriptions, etc. passed to the UI.
*/
Locale defaultTextLocale() const;
+
+ /**
+ * Path where the repo metadata is downloaded and kept.
+ */
+ Pathname defaultRepoRawCachePath() const;
+
+ /**
+ * Path where the processed cache is kept
+ * (this is where zypp.db is located.
+ */
+ Pathname defaultRepoCachePath() const;
+
+ /**
+ * Path where the known repositories
+ * .repo files are kept
+ */
+ Pathname defaultKnownReposPath() const;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp2/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/CMakeLists.txt?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/CMakeLists.txt (original)
+++ trunk/libzypp/zypp2/CMakeLists.txt Fri Jun 1 14:48:35 2007
@@ -34,6 +34,7 @@
SET( zypp2_cache_SRCS
${CMAKE_BINARY_DIR}/zypp2/schema.h
cache/CacheInitializer.cpp
+ cache/CacheException.cc
cache/CacheTypes.cc
cache/ResolvableQuery.cc
cache/CacheStore.cpp
@@ -45,6 +46,7 @@
cache/CacheCommon.h
cache/CacheTypes.h
cache/CacheInitializer.h
+ cache/CacheException.h
cache/CacheStore.h
cache/CacheFSCK.h
cache/ResolvableQuery.h
@@ -76,11 +78,13 @@
SET( zypp2_repository_SRCS
repo/dummy.cc
repo/RepositoryImpl.cc
+ repo/RepoException.cc
)
SET( zypp2_repository_HEADERS
repo/dummy.h
repo/RepositoryImpl.h
+ repo/RepoException.h
)
SET( zypp2_repository_cached_SRCS
Modified: trunk/libzypp/zypp2/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepoManager.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/RepoManager.cc (original)
+++ trunk/libzypp/zypp2/RepoManager.cc Fri Jun 1 14:48:35 2007
@@ -1,4 +1,14 @@
-
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/RepoManager.cc
+ *
+*/
#include <iostream>
#include <list>
@@ -11,75 +21,165 @@
#include "zypp2/RepoManager.h"
-
using namespace std;
using namespace zypp;
using namespace zypp::filesystem;
using parser::IniDict;
-namespace zypp {
-
-RepoManager::RepoManager()
-{
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
-}
-
-static std::list<RepoInfo> repositories_in_file( const Pathname &file )
-{
- InputStream is(file);
- IniDict dict(is);
- std::list<RepoInfo> repos;
-
- for ( IniDict::section_const_iterator its = dict.sectionsBegin();
- its != dict.sectionsEnd();
- ++its )
- {
- MIL << (*its) << endl;
-
- RepoInfo info;
- info.setAlias(*its);
-
- for ( IniDict::entry_const_iterator it = dict.entriesBegin(*its);
- it != dict.entriesEnd(*its);
- ++it )
+ RepoManagerOptions::RepoManagerOptions()
+ {
+ ZConfig globalConfig;
+ repoCachePath = globalConfig.defaultRepoCachePath();
+ repoRawCachePath = globalConfig.defaultRepoRawCachePath();
+ knownReposPath = globalConfig.defaultKnownReposPath();
+ }
+
+ /**
+ * \short List of RepoInfo's from a file.
+ * \param file pathname of the file to read.
+ */
+ static std::list<RepoInfo> repositories_in_file( const Pathname &file )
+ {
+ InputStream is(file);
+ IniDict dict(is);
+ std::list<RepoInfo> repos;
+
+ for ( IniDict::section_const_iterator its = dict.sectionsBegin();
+ its != dict.sectionsEnd();
+ ++its )
{
+ MIL << (*its) << endl;
+
+ RepoInfo info;
+ info.setAlias(*its);
+
+ for ( IniDict::entry_const_iterator it = dict.entriesBegin(*its);
+ it != dict.entriesEnd(*its);
+ ++it )
+ {
+
+ //MIL << (*it).first << endl;
+ if (it->first == "name" )
+ info.setName(it-> second);
+ else if ( it->first == "enabled" )
+ info.setEnabled( it->second == "1" );
+ else if ( it->first == "baseurl" )
+ info.addBaseUrl( Url(it->second) );
+ else if ( it->first == "type" )
+ info.setType(it->second);
+ }
- //MIL << (*it).first << endl;
- if (it->first == "name" )
- info.setName(it-> second);
- else if ( it->first == "enabled" )
- info.setEnabled( it->second == "1" );
- else if ( it->first == "baseurl" )
- info.addBaseUrl( Url(it->second) );
+ // add it to the list.
+ repos.push_back(info);
}
- // add it to the list.
- repos.push_back(info);
+ return repos;
}
- return repos;
-}
-
-static std::list<RepoInfo> repositories_in_path( const Pathname &dir )
-{
- std::list<RepoInfo> repos;
- list<Pathname> entries;
- if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
- ZYPP_THROW(Exception("failed to read directory"));
+ /**
+ * \short List of RepoInfo's from a directory
+ *
+ * Goes trough every file in a directory and adds all
+ * RepoInfo's contained in that file.
+ *
+ * \param file pathname of the file to read.
+ */
+ static std::list<RepoInfo> repositories_in_path( const Pathname &dir )
+ {
+ std::list<RepoInfo> repos;
+ list<Pathname> entries;
+ if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
+ ZYPP_THROW(Exception("failed to read directory"));
+
+ for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
+ {
+ Pathname file = *it;
+ std::list<RepoInfo> repos_here = repositories_in_file(file);
+ std::copy( repos_here.begin(), repos_here.end(), std::back_inserter(repos));
+ }
+ return repos;
+ }
- for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
+ std::list<RepoInfo> RepoManager::knownRepositories()
{
- Pathname file = *it;
- std::list<RepoInfo> repos_here = repositories_in_file(file);
- std::copy( repos_here.begin(), repos_here.end(), std::back_inserter(repos));
+ return repositories_in_path("/etc/zypp/repos.d");
}
- return repos;
-}
-std::list<RepoInfo> RepoManager::knownRepositories()
-{
- return repositories_in_path("/etc/zypp/repos.d");
-}
+ /** RepoManager implementation. */
+ struct RepoManager::Impl
+ {
+ Impl( const RepoManagerOptions &opt )
+ : options(opt)
+ {
+
+ }
+
+ Impl()
+ {
+
+ }
+
+ RepoManagerOptions options;
+
+ public:
+ /** Offer default Impl. */
+ static shared_ptr<Impl> nullimpl()
+ {
+ static shared_ptr<Impl> _nullimpl( new Impl );
+ return _nullimpl;
+ }
+
+ private:
+ friend Impl * rwcowClone<Impl>( const Impl * rhs );
+ /** clone for RWCOW_pointer */
+ Impl * clone() const
+ { return new Impl( *this ); }
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates RepoManager::Impl Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const RepoManager::Impl & obj )
+ {
+ return str << "RepoManager::Impl";
+ }
-} // ns zypp
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : RepoManager
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : RepoManager::RepoManager
+ // METHOD TYPE : Ctor
+ //
+ RepoManager::RepoManager( const RepoManagerOptions &opt )
+ : _pimpl( new Impl(opt) )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : RepoManager::~RepoManager
+ // METHOD TYPE : Dtor
+ //
+ RepoManager::~RepoManager()
+ {}
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const RepoManager & obj )
+ {
+ return str << *obj._pimpl;
+ }
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp2
+///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp2/RepoManager.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepoManager.h?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/RepoManager.h (original)
+++ trunk/libzypp/zypp2/RepoManager.h Fri Jun 1 14:48:35 2007
@@ -1,27 +1,86 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/RepoManager.h
+ *
+*/
+#ifndef ZYPP_REPOMANAGER_H
+#define ZYPP_REPOMANAGER_H
-#ifndef ZYPP_NEW_REPOMANAGER_H
-#define ZYPP_NEW_REPOMANAGER_H
-
+#include <iosfwd>
#include <list>
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
+
+#include "zypp/base/PtrTypes.h"
+//#include "zypp/base/ReferenceCounted.h"
+//#include "zypp/base/NonCopyable.h"
#include "zypp/Pathname.h"
+#include "zypp/ZConfig.h"
#include "zypp2/RepoInfo.h"
+#include "zypp2/repo/RepoException.h"
+///////////////////////////////////////////////////////////////////
namespace zypp
-{
-
- class RepoManager : public base::ReferenceCounted, private base::NonCopyable
+{ /////////////////////////////////////////////////////////////////
+
+ /**
+ * Repo manager settings.
+ * Settings default to ZYpp global settings.
+ */
+ struct RepoManagerOptions
+ {
+ RepoManagerOptions();
+
+ Pathname repoCachePath;
+ Pathname repoRawCachePath;
+ Pathname knownReposPath;
+ };
+
+ /**
+ * \short creates and provides information about known sources.
+ *
+ */
+ class RepoManager
{
friend std::ostream & operator<<( std::ostream & str, const RepoManager & obj );
+
+ public:
+ /** Implementation */
+ class Impl;
+
public:
- RepoManager();
- std::list<RepoInfo> knownRepositories();
+ RepoManager( const RepoManagerOptions &options = RepoManagerOptions() );
+
+ /**
+ * \short List known repositories.
+ *
+ * The known repositories are read from
+ * \ref RepoManagerOptions::knownReposPath passed on the Ctor.
+ * Which defaults to ZYpp global settings.
+ *
+ */
+ std::list<RepoInfo> knownRepositories();
+
+ /** Dtor */
+ ~RepoManager();
+
+ public:
+
+ private:
+ /** Pointer to implementation */
+ RWCOW_pointer<Impl> _pimpl;
};
-
-
-}
+ ///////////////////////////////////////////////////////////////////
-#endif
+ /** \relates RepoManager Stream output */
+ std::ostream & operator<<( std::ostream & str, const RepoManager & obj );
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp2
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP2_REPOMANAGER_H
Modified: trunk/libzypp/zypp2/RepoStatus.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepoStatus.cc?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/RepoStatus.cc (original)
+++ trunk/libzypp/zypp2/RepoStatus.cc Fri Jun 1 14:48:35 2007
@@ -14,7 +14,7 @@
#include "zypp2/RepoStatus.h"
-using std::endl;
+using namespace std;
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -30,7 +30,7 @@
public:
- CheckSum checksum;
+ string checksum;
Date timestamp;
/** Offer default Impl. */
@@ -77,7 +77,7 @@
RepoStatus::~RepoStatus()
{}
- RepoStatus & RepoStatus::setChecksum( const CheckSum &checksum )
+ RepoStatus & RepoStatus::setChecksum( const string &checksum )
{
_pimpl->checksum = checksum;
return *this;
@@ -89,7 +89,7 @@
return *this;
}
- CheckSum RepoStatus::checksum() const
+ string RepoStatus::checksum() const
{ return _pimpl->checksum; }
Date RepoStatus::timestamp() const
Modified: trunk/libzypp/zypp2/RepoStatus.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepoStatus.h?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/RepoStatus.h (original)
+++ trunk/libzypp/zypp2/RepoStatus.h Fri Jun 1 14:48:35 2007
@@ -46,7 +46,7 @@
* checksum that changes when the repository changes
* in any way is sufficient.
*/
- CheckSum checksum() const;
+ std::string checksum() const;
/**
* timestamp of the repository. If the repository
@@ -59,7 +59,7 @@
* set the repository checksum \see checksum
* \param checksum
*/
- RepoStatus & setChecksum( const CheckSum &checksum );
+ RepoStatus & setChecksum( const std::string &checksum );
/**
* set the repository timestamp \see timestamp
Added: trunk/libzypp/zypp2/cache/CacheException.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheException.cc?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheException.cc (added)
+++ trunk/libzypp/zypp2/cache/CacheException.cc Fri Jun 1 14:48:35 2007
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/repo/CacheException.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+#include "zypp2/cache/CacheException.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace cache
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : CacheException::CacheException
+ // METHOD TYPE : Ctor
+ //
+ CacheException::CacheException()
+ : Exception( "Cache exception" )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : CacheException::CacheException
+ // METHOD TYPE : Ctor
+ //
+ CacheException::CacheException( const std::string & msg_r )
+ : Exception( msg_r )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : CacheException::~CacheException
+ // METHOD TYPE : Dtor
+ //
+ CacheException::~CacheException() throw()
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : CacheException::dumpOn
+ // METHOD TYPE : std::ostream &
+ //
+ std::ostream & CacheException::dumpOn( std::ostream & str ) const
+ {
+ return Exception::dumpOn( str );
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace repo
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/cache/CacheException.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheException.h?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheException.h (added)
+++ trunk/libzypp/zypp2/cache/CacheException.h Fri Jun 1 14:48:35 2007
@@ -0,0 +1,57 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_REPO_REPOEXCEPTION_H
+#define ZYPP_REPO_REPOEXCEPTION_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/Exception.h"
+#include "zypp/base/UserRequestException.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace cache
+ { /////////////////////////////////////////////////////////////////
+
+ /**
+ * \short Exception for cache errors
+ */
+ class CacheException : public Exception
+ {
+ public:
+ /** Default ctor */
+ CacheException();
+ /** Ctor */
+ CacheException( const std::string & msg_r );
+ /** Dtor */
+ virtual ~CacheException() throw();
+ protected:
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * The record you supplied can't be found
+ */
+ class CacheRecordNotFoundException : public CacheException
+ {
+
+ };
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace cache
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PARSER_TAGFILE_PARSEEXCEPTION_H
Modified: trunk/libzypp/zypp2/cache/CacheStore.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheStore.cpp?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheStore.cpp (original)
+++ trunk/libzypp/zypp2/cache/CacheStore.cpp Fri Jun 1 14:48:35 2007
@@ -10,6 +10,7 @@
#include "zypp2/cache/CacheInitializer.h"
#include "zypp2/cache/CacheStore.h"
+#include "zypp2/cache/CacheException.h"
using namespace std;
using namespace zypp;
@@ -59,8 +60,8 @@
update_repository_cmd.reset( new sqlite3_command( con, "update repositories set checksum=:checksum, timestamp=:timestamp where id=:repository_id;" ));
- select_repository_cmd.reset( new sqlite3_command( con, "select id from repositories where url=:url and path=:path;" ));
- insert_repository_cmd.reset( new sqlite3_command( con, "insert into repositories (url,path,timestamp) values (:url,:path,:timestamp);" ));
+ select_repository_cmd.reset( new sqlite3_command( con, "select id from repositories where alias=:alias;" ));
+ insert_repository_cmd.reset( new sqlite3_command( con, "insert into repositories (alias,timestamp) values (:alias, :timestamp);" ));
select_name_cmd.reset( new sqlite3_command( con, "select id from names where name=:name;" ));
insert_name_cmd.reset( new sqlite3_command( con, "insert into names (name) values (:name);" ));
@@ -561,11 +562,10 @@
_pimpl->insert_repository_cmd->executenonquery();
}
-RecordId CacheStore::lookupOrAppendRepository( const Url &url, const Pathname &path )
+RecordId CacheStore::lookupOrAppendRepository( const string &alias )
{
- _pimpl->select_repository_cmd->bind(":url", url.asString());
- _pimpl->select_repository_cmd->bind(":path", path.asString());
-
+ _pimpl->select_repository_cmd->bind(":alias", alias);
+
long long id = 0;
try {
id = _pimpl->select_repository_cmd->executeint64();
@@ -573,8 +573,7 @@
catch ( const sqlite3x::database_error &e )
{
// does not exist
- _pimpl->insert_repository_cmd->bind(":url", url.asString());
- _pimpl->insert_repository_cmd->bind(":path", path.asString());
+ _pimpl->insert_repository_cmd->bind(":alias", alias);
_pimpl->insert_repository_cmd->bind(":timestamp", static_cast<int>((Date::ValueType) Date::now()) );
_pimpl->insert_repository_cmd->executenonquery();
id = _pimpl->con.insertid();
@@ -584,6 +583,62 @@
return static_cast<RecordId>(id);
}
+RepoStatus CacheStore::repositoryStatus( const data::RecordId &id )
+{
+ sqlite3_command cmd( _pimpl->con, "select id,alias,checksum,timestamp from repositories where id=:id");
+ cmd.bind(":id", id);
+
+ try
+ {
+ sqlite3_reader reader = cmd.executereader();
+ RepoStatus status;
+ while ( reader.read() )
+ {
+ status.setChecksum( reader.getstring(2) );
+ status.setTimestamp( reader.getstring(3) );
+ }
+ return status;
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_THROW(CacheRecordNotFoundException());
+ }
+}
+
+RepoStatus CacheStore::repositoryStatus( const string &alias )
+{
+ return repositoryStatus(lookupRepository(alias));
+}
+
+bool CacheStore::isCached( const string &alias )
+{
+ try
+ {
+ lookupRepository(alias);
+ }
+ catch( const CacheRecordNotFoundException &e )
+ {
+ return false;
+ }
+ return true;
+}
+
+RecordId CacheStore::lookupRepository( const string &alias )
+{
+ sqlite3_command cmd(_pimpl->con, "select id from repositories where alias=:alias;");
+ cmd.bind(":alias", alias);
+
+ long long id = 0;
+ try {
+ id = cmd.executeint64();
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_THROW(CacheRecordNotFoundException());
+ }
+ return id;
+}
+
RecordId CacheStore::lookupOrAppendType( const string &klass, const string &name )
{
pair thetype = make_pair(klass,name);
Modified: trunk/libzypp/zypp2/cache/CacheStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheStore.h?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheStore.h (original)
+++ trunk/libzypp/zypp2/cache/CacheStore.h Fri Jun 1 14:48:35 2007
@@ -25,6 +25,7 @@
#include "zypp/data/RecordId.h"
#include "zypp/base/PtrTypes.h"
+#include "zypp2/RepoStatus.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -39,7 +40,7 @@
* \code
* CacheStore store("/path");
* RecordId repository_id =
- * store.lookupOrAppendRepository("http://updates.novell.com", "/");
+ * store.lookupOrAppendRepository("some-alias");
* store.consumePackage( repository_id, package_ptr );
* store.commit();
* \endcode
@@ -352,15 +353,13 @@
/**
* Returns the record id of a repository (Source)
*
- * \param url Url of the repository
- * \param path path of the repository (relative to url)
+ * \param alias Unique alias for this repo
*
* \note If the repository entry does not exist, it will
* be created and the new inserted entry's id will
* be returned.
*/
- data::RecordId lookupOrAppendRepository( const Url &url,
- const Pathname &path );
+ data::RecordId lookupOrAppendRepository( const std::string &alias );
/**
* Set the resolvable shared data flag pointing to
@@ -450,12 +449,60 @@
* It is responsability of the caller to operate with
* a valid record id. You can get one
* Using \ref lookupOrAppendRepository
+ *
+ * If the repository does not exists, nothing will happen
*/
void updateRepository( const data::RecordId &id,
- const std::string &checksum,
- const Date ×tamp = Date::now() );
+ const std::string &checksum,
+ const Date ×tamp = Date::now() );
+
+ /**
+ * get the status of a cached repository
+ *
+ * It is responsability of the caller to operate with
+ * a valid record id. You can get one
+ * Using \ref lookupOrAppendRepository
+ *
+ * You can check existence using \ref isCached
+ *
+ * \throws CacheRecordNotFoundException if the repository
+ * id is invalid.
+ */
+ RepoStatus repositoryStatus( const data::RecordId &id );
+
+ /**
+ * get the status of a cached repository
+ *
+ * It is responsability of the caller to operate with
+ * a valid alias. You can insert one
+ * Using \ref lookupOrAppendRepository
+ *
+ * You can check existence using \ref isCached
+ *
+ * \throws CacheRecordNotFoundException if the repository
+ * alias is unknown
+ */
+ RepoStatus repositoryStatus( const std::string &alias );
/**
+ * \short Does a repository exists in cache?
+ *
+ * True if the repository is cached
+ */
+ bool isCached( const std::string &alias );
+
+ /**
+ * \short looks the id for a repository in cache
+ *
+ * \param alias Repository unique alias
+ *
+ * \throws CacheRecordNotFoundException if the repository
+ * alias is unknown
+ */
+ data::RecordId lookupRepository( const std::string &alias );
+
+
+ /**
* Returns the record id of a file entry \a path
*
* \note If the file entry does not exist, it will
Modified: trunk/libzypp/zypp2/cache/schema/schema.sql
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/schema/schema.sql?rev=5656&r1=5655&r2=5656&view=diff
==============================================================================
--- trunk/libzypp/zypp2/cache/schema/schema.sql (original)
+++ trunk/libzypp/zypp2/cache/schema/schema.sql Fri Jun 1 14:48:35 2007
@@ -58,11 +58,11 @@
CREATE TABLE repositories (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
- , url TEXT NOT NULL
- , path TEXT NOT NULL
+ , alias TEXT NOT NULL UNIQUE
, checksum TEXT DEFAULT NULL
, timestamp INTEGER NOT NULL
);
+CREATE INDEX repo_alias_index ON repositories(alias);
------------------------------------------------
-- Resolvable names
Added: trunk/libzypp/zypp2/repo/RepoException.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repo/RepoException.cc?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repo/RepoException.cc (added)
+++ trunk/libzypp/zypp2/repo/RepoException.cc Fri Jun 1 14:48:35 2007
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/repo/RepoException.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+#include "zypp2/repo/RepoException.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repo
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : RepoException::RepoException
+ // METHOD TYPE : Ctor
+ //
+ RepoException::RepoException()
+ : Exception( "Repo exception" )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : RepoException::RepoException
+ // METHOD TYPE : Ctor
+ //
+ RepoException::RepoException( const std::string & msg_r )
+ : Exception( msg_r )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : RepoException::~RepoException
+ // METHOD TYPE : Dtor
+ //
+ RepoException::~RepoException() throw()
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : RepoException::dumpOn
+ // METHOD TYPE : std::ostream &
+ //
+ std::ostream & RepoException::dumpOn( std::ostream & str ) const
+ {
+ return Exception::dumpOn( str );
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace repo
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/repo/RepoException.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repo/RepoException.h?rev=5656&view=auto
==============================================================================
--- trunk/libzypp/zypp2/repo/RepoException.h (added)
+++ trunk/libzypp/zypp2/repo/RepoException.h Fri Jun 1 14:48:35 2007
@@ -0,0 +1,79 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/parser/tagfile/RepoException.h
+ *
+*/
+#ifndef ZYPP_REPO_REPOEXCEPTION_H
+#define ZYPP_REPO_REPOEXCEPTION_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/Exception.h"
+#include "zypp/base/UserRequestException.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repo
+ { /////////////////////////////////////////////////////////////////
+
+ /**
+ * \short Exception for repository handling.
+ */
+ class RepoException : public Exception
+ {
+ public:
+ /** Default ctor */
+ RepoException();
+ /** Ctor */
+ RepoException( const std::string & msg_r );
+ /** Dtor */
+ virtual ~RepoException() throw();
+ protected:
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * The repository cache is not built yet
+ * so you can't create the repostories from
+ * the cache.
+ */
+ class RepoNotCachedException : public RepoException
+ {
+
+ };
+
+ /**
+ * thrown when it was impossible to
+ * determine one url for this repo.
+ */
+ class RepoNoUrl : public RepoException
+ {
+
+ };
+
+ /**
+ * thrown when it was impossible to
+ * determine an alias for this repo.
+ */
+ class RepoNoAlias : public RepoException
+ {
+
+ };
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace parser
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PARSER_TAGFILE_PARSEEXCEPTION_H
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org