Mailinglist Archive: zypp-commit (149 mails)

< Previous Next >
[zypp-commit] r5438 - in /trunk: ./ libzypp/devel/devel.dmacvicar/
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Tue, 24 Apr 2007 12:26:33 -0000
  • Message-id: <20070424122633.E9BA6473FD@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Tue Apr 24 14:26:33 2007
New Revision: 5438

URL: http://svn.opensuse.org/viewcvs/zypp?rev=5438&view=rev
Log: (empty)

Added:
    trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc
      - copied, changed from r5437, trunk/libzypp/devel/devel.dmacvicar/SourceManager.cc
    trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h
      - copied, changed from r5437, trunk/libzypp/devel/devel.dmacvicar/SourceManager.h
    trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc
      - copied, changed from r5437, trunk/libzypp/devel/devel.dmacvicar/SourceManager_tp.cc
Removed:
    trunk/libzypp/devel/devel.dmacvicar/SourceManager.cc
    trunk/libzypp/devel/devel.dmacvicar/SourceManager.h
    trunk/libzypp/devel/devel.dmacvicar/SourceManager_tp.cc
Modified:
    trunk/   (props changed)
    trunk/libzypp/devel/devel.dmacvicar/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=5438&r1=5437&r2=5438&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt Tue Apr 24 14:26:33 2007
@@ -32,6 +32,10 @@
 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)

Copied: trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc (from r5437, trunk/libzypp/devel/devel.dmacvicar/SourceManager.cc)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc?p2=trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc&p1=trunk/libzypp/devel/devel.dmacvicar/SourceManager.cc&r1=5437&r2=5438&rev=5438&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/SourceManager.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc Tue Apr 24 14:26:33 2007
@@ -1,3 +1,70 @@
 
-#include "SourceManager.h"
 
+
+
+
+
+
+#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

Copied: trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h (from r5437, trunk/libzypp/devel/devel.dmacvicar/SourceManager.h)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h?p2=trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h&p1=trunk/libzypp/devel/devel.dmacvicar/SourceManager.h&r1=5437&r2=5438&rev=5438&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/SourceManager.h (original)
+++ trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h Tue Apr 24 14:26:33 2007
@@ -1,17 +1,22 @@
 
-#ifndef ZYPP_NEW_SOURCEMANAGER_H
-#define ZYPP_NEW_SOURCEMANAGER_H
+#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 zypp2
+namespace zypp
 {
   
-  class SourceManager : public base::ReferenceCounted, private base::NonCopyable
+  class RepositoryManager : public base::ReferenceCounted, private base::NonCopyable
   {
-    friend std::ostream & operator<<( std::ostream & str, const SourceManager & obj );
+    friend std::ostream & operator<<( std::ostream & str, const RepositoryManager & obj );
+  public:
+    RepositoryManager();
+    std::list<source::SourceInfo> knownRepositories();
   };
   
   

Copied: trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc (from r5437, trunk/libzypp/devel/devel.dmacvicar/SourceManager_tp.cc)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc?p2=trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc&p1=trunk/libzypp/devel/devel.dmacvicar/SourceManager_tp.cc&r1=5437&r2=5438&rev=5438&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/SourceManager_tp.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc Tue Apr 24 14:26:33 2007
@@ -0,0 +1,44 @@
+
+#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;
+}

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages