TARGET_LINK_LIBRARIES(cachedsource zypp )
TARGET_LINK_LIBRARIES(cachedsource zypp2 )
+ADD_EXECUTABLE(repomanager RepositoryManager_tp.cc RepositoryManager.cc)
+TARGET_LINK_LIBRARIES(repomanager zypp )
+#TARGET_LINK_LIBRARIES(repomanager zypp2 )
+
FIND_PACKAGE(Zsync)
IF(ZSYNC_FOUND)
ADD_EXECUTABLE(zsync zsync.cc)
--- /dev/null
+
+
+
+
+
+
+
+#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"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::filesystem;
+using namespace zypp::source;
+
+namespace zypp {
+
+RepositoryManager::RepositoryManager()
+{
+
+}
+
+static std::list<source::SourceInfo> repositories_in_file( const Pathname &file )
+{
+ dictionary *d = iniparser_new(file.c_str());
+
+ if ( d == NULL )
+ ZYPP_THROW(Exception("Failed creating dictionary"));
+
+ int n = iniparser_getnsec(d);
+ MIL << n << endl;
+
+ for ( int i = 0; i < n; i++ )
+ {
+ MIL << iniparser_getsecname(d, i) << endl;
+
+ }
+ return std::list<source::SourceInfo>();
+}
+
+static std::list<source::SourceInfo> repositories_in_path( const Pathname &dir )
+{
+ std::list<source::SourceInfo> 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<source::SourceInfo> repos_here = repositories_in_file(file);
+ std::copy( repos_here.begin(), repos_here.end(), std::back_inserter(repos));
+ }
+ return repos;
+}
+
+std::list<source::SourceInfo> RepositoryManager::knownRepositories()
+{
+
+
+ return std::list<source::SourceInfo>();
+}
+
+} // ns zypp
\ No newline at end of file
--- /dev/null
+
+#ifndef ZYPP_NEW_REPOMANAGER_H
+#define ZYPP_NEW_REPOMANAGER_H
+
+#include <list>
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/source/SourceInfo.h"
+#include "zypp/Pathname.h"
+
+namespace zypp
+{
+
+ class RepositoryManager : public base::ReferenceCounted, private base::NonCopyable
+ {
+ friend std::ostream & operator<<( std::ostream & str, const RepositoryManager & obj );
+ public:
+ RepositoryManager();
+ std::list<source::SourceInfo> knownRepositories();
+ };
+
+
+}
+#endif
\ No newline at end of file
--- /dev/null
+
+#include <sys/time.h>
+
+#include <iostream>
+#include <fstream>
+
+#include <zypp/base/Logger.h>
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+
+#include "zypp/Product.h"
+#include "zypp/detail/PackageImplIf.h"
+#include "zypp/Package.h"
+#include "zypp/SourceFactory.h"
+
+#include "zypp2/source/cached/CachedSourceImpl.h"
+#include "zypp/data/ResolvableData.h"
+
+#include "RepositoryManager.h"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::source;
+
+
+int main(int argc, char **argv)
+{
+ try
+ {
+ ZYpp::Ptr z = getZYpp();
+
+ Pathname dbpath = Pathname(getenv("PWD"));
+
+ RepositoryManager manager;
+ list<SourceInfo> sources = manager.knownRepositories();
+ }
+ catch ( const Exception &e )
+ {
+ ZYPP_CAUGHT(e);
+ cout << e.msg() << endl;
+ }
+
+ return 0;
+}
+++ /dev/null
-
-#include "SourceManager.h"
-
+++ /dev/null
-
-#ifndef ZYPP_NEW_SOURCEMANAGER_H
-#define ZYPP_NEW_SOURCEMANAGER_H
-
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-#include "zypp/Pathname.h"
-
-namespace zypp2
-{
-
- class SourceManager : public base::ReferenceCounted, private base::NonCopyable
- {
- friend std::ostream & operator<<( std::ostream & str, const SourceManager & obj );
- };
-
-
-}
-#endif
\ No newline at end of file