Mailinglist Archive: zypp-commit (149 mails)

< Previous Next >
[zypp-commit] r5392 - /trunk/libzypp/devel/devel.dmacvicar/
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Mon, 16 Apr 2007 16:56:18 -0000
  • Message-id: <20070416165618.7EC27236FF@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Mon Apr 16 18:56:18 2007
New Revision: 5392

URL: http://svn.opensuse.org/viewcvs/zypp?rev=5392&view=rev
Log:

Separate the tags parser in 2 files, adapt to new cache store api
to set the catalog


Added:
    trunk/libzypp/devel/devel.dmacvicar/CacheStore_tp.cc
      - copied unchanged from r5382, trunk/libzypp/devel/devel.dmacvicar/CacheStore.cc
    trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.h
    trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser_tp.cc
Removed:
    trunk/libzypp/devel/devel.dmacvicar/CacheStore.cc
    trunk/libzypp/devel/devel.dmacvicar/YUMDownloader.cc
    trunk/libzypp/devel/devel.dmacvicar/YUMDownloader.h
Modified:
    trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
    trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.cc
    trunk/libzypp/devel/devel.dmacvicar/YUMDownloader_tp.cc
    trunk/libzypp/devel/devel.dmacvicar/testbed.cc

Modified: trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt?rev=5392&r1=5391&r2=5392&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt Mon Apr 16 18:56:18 2007
@@ -12,7 +12,7 @@
 ADD_EXECUTABLE(susetags-downloader SUSETagsDownloader_tp.cc)
 TARGET_LINK_LIBRARIES(susetags-downloader  zypp )
 
-ADD_EXECUTABLE(cachestore CacheStore.cc)
+ADD_EXECUTABLE(cachestore CacheStore_tp.cc)
 TARGET_LINK_LIBRARIES(cachestore  zypp )
 TARGET_LINK_LIBRARIES(cachestore  zypp2 )
 
@@ -20,7 +20,7 @@
 TARGET_LINK_LIBRARIES(cachequery  zypp )
 TARGET_LINK_LIBRARIES(cachequery  zypp2 )
 
-ADD_EXECUTABLE(tagsparser SUSETagsParser.cc)
+ADD_EXECUTABLE(tagsparser SUSETagsParser.cc SUSETagsParser_tp.cc)
 TARGET_LINK_LIBRARIES(tagsparser  zypp )
 TARGET_LINK_LIBRARIES(tagsparser  zypp2 )
 
@@ -28,7 +28,7 @@
 TARGET_LINK_LIBRARIES(testbed  zypp )
 TARGET_LINK_LIBRARIES(testbed  zypp2 )
 
-ADD_EXECUTABLE(yum-downloader YUMDownloader.cc YUMDownloader_tp.cc)
+ADD_EXECUTABLE(yum-downloader YUMDownloader_tp.cc)
 TARGET_LINK_LIBRARIES(yum-downloader  zypp )
 TARGET_LINK_LIBRARIES(yum-downloader  zypp2 )
 

Modified: trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.cc?rev=5392&r1=5391&r2=5392&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.cc Mon Apr 16 18:56:18 2007
@@ -14,16 +14,16 @@
 #include "zypp/parser/taggedfile/TagCacheRetrieval.h"
 #include "zypp/parser/taggedfile/TagCacheRetrievalPtr.h"
 
+#include "SUSETagsParser.h"
+
 using namespace zypp;
 using namespace std;
 using zypp::debug::Measure;
 
-typedef Exception ParseException;
-
-struct PackageDataProvider;
-
-typedef shared_ptr<PackageDataProvider> PackageDataProviderPtr;
+namespace zypp {
 
+typedef Exception ParseException;
+  
 struct PackageDataProvider
 {
   TagRetrievalPos _attr_SUMMARY;
@@ -42,54 +42,9 @@
   PackageDataProviderPtr _fallback_provider;
 };
 
-struct PackagesParser
-{
-  // tag ids for the TaggedParser
-  enum Tags {
-    PACKAGE,  // name version release arch
-    REQUIRES, // list of requires tags
-    PREREQUIRES,// list of pre-requires tags
-    PROVIDES, // list of provides tags
-    CONFLICTS,  // list of conflicts tags
-    OBSOLETES,  // list of obsoletes tags
-    RECOMMENDS, // list of recommends tags
-    SUGGESTS, // list of suggests tags
-    LOCATION, // file location
-    SIZE, // packed and unpacked size
-    BUILDTIME,  // buildtime
-    SOURCERPM,  // source package
-    GROUP,  // rpm group
-    LICENSE,  // license
-    AUTHORS,  // list of authors
-    SHAREWITH,  // package to share data with
-    KEYWORDS, // list of keywords
-
-      // packages.<locale>
-    SUMMARY,  // short summary (label)
-    DESCRIPTION,// long description
-    INSNOTIFY,  // install notification
-    DELNOTIFY,  // delete notification
-    LICENSETOCONFIRM, // license to confirm upon install
-    // packages.DU
-    DU,   // disk usage data
-    NUM_TAGS
-  };
-
-  // our parser
-  TaggedParser _parser;
-  // our set of tags, initialized in constructor
-  TaggedFile::TagSet _tagset;
-  zypp::Arch _system_arch;
-
-  typedef std::map <std::string, PackageDataProviderPtr> pkgmaptype;
-  pkgmaptype _pkgmap;
-
-  zypp::cache::CacheStore *_consumer;
-
-  std::map<std::string, data::RecordId> _idmap;
 
-  PackagesParser( zypp::cache::CacheStore *consumer )
-    : _consumer(consumer)
+  PackagesParser::PackagesParser( const data::RecordId &catalog_id, zypp::cache::CacheStore consumer )
+    : _consumer(consumer), _catalog_id(catalog_id)
   {
     ZYpp::Ptr z = getZYpp();
     _system_arch = z->architecture();
@@ -141,7 +96,7 @@
     }
   }
 
-  void start( const Pathname &path )
+  void PackagesParser::start( const Pathname &path )
   {
     std::ifstream content_stream((path + "/content").asString().c_str());
     std::string buffer;
@@ -325,7 +280,7 @@
     } // locales iterator
   }
 
-  void fromCache ( TagCacheRetrieval_Ptr pkgcache)
+  void PackagesParser::fromCache ( TagCacheRetrieval_Ptr pkgcache)
   {
     //---------------------------------------------------------------
     // PACKAGE
@@ -369,10 +324,10 @@
     
     NVRA nvra( splitted[0], Edition( splitted[1], splitted[2] ), Arch(arch) );
     
-     // DEPENDENCIES
+    // DEPENDENCIES
     #define GET_TAG(tagname) \
     _tagset.getTagByIndex (tagname)
-     
+    
     data::Dependencies deps;
     
     std::list<std::string> pkglist;
@@ -391,11 +346,11 @@
     //COLLECT_DEPS(SUPPLEMENTS);
     COLLECT_DEPS(RECOMMENDS);
 
-    data::RecordId pkgid = _consumer->appendResolvable( ResTraits<Package>::kind, nvra, deps );
+    data::RecordId pkgid = _consumer.appendResolvable( _catalog_id, ResTraits<Package>::kind, nvra, deps );
     _idmap[single] = pkgid;
   }
 
-  void collectDeps( zypp::Dep deptype, const std::list<std::string> &depstrlist, data::Dependencies &deps )
+  void PackagesParser::collectDeps( zypp::Dep deptype, const std::list<std::string> &depstrlist, data::Dependencies &deps )
   {
     for ( list<string>::const_iterator it = depstrlist.begin(); it != depstrlist.end(); ++it )
     {
@@ -407,12 +362,12 @@
     }
   }
   
-  void fromPathLocale (const Pathname& path)
+  void PackagesParser::fromPathLocale (const Pathname& path)
   {
     
   }
 
-  void fromLocale ()
+  void PackagesParser::fromLocale ()
   {
     //---------------------------------------------------------------
     // PACKAGE.<locale>
@@ -465,25 +420,5 @@
 #undef SET_CACHE
   }
 
-};
-
-int main(int argc, char **argv)
-{
-    try
-    {
-      ZYpp::Ptr z = getZYpp();
-      Pathname dbfile = Pathname(getenv("PWD")) + "data.db";
-      zypp::cache::CacheStore store(getenv("PWD"));
-
-      PackagesParser parser(&store);
-      Measure m;
-      parser.start(argv[1]);
-      m.elapsed();
-    }
-    catch ( const Exception &e )
-    {
-      cout << "ups! " << e.msg() << std::endl;
-    }
-    return 0;
-}
 
+} // ns zypp

Added: trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.h?rev=5392&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.h (added)
+++ trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser.h Mon Apr 16 18:56:18 2007
@@ -0,0 +1,82 @@
+
+#ifndef ZYPP_SOURCE_SUSETAGSPARSER_H
+#define ZYPP_SOURCE_SUSETAGSPARSER_H
+// #include <list>
+// #include <string>
+// #include <fstream>
+#include "zypp/base/PtrTypes.h"
+// #include "zypp/base/Measure.h"
+// #include "zypp/Arch.h"
+// #include "zypp/ZYppFactory.h"
+// #include "zypp/ZYpp.h"
+// #include "zypp/capability/CapabilityImpl.h"
+#include "zypp2/cache/CacheStore.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/parser/taggedfile/TaggedParser.h"
+#include "zypp/parser/taggedfile/TaggedFile.h"
+#include "zypp/parser/taggedfile/TagCacheRetrieval.h"
+#include "zypp/parser/taggedfile/TagCacheRetrievalPtr.h"
+
+namespace zypp
+{
+  struct PackageDataProvider;
+  typedef zypp::shared_ptr<PackageDataProvider> PackageDataProviderPtr;
+  struct PackageDataProvider;
+  
+  struct PackagesParser
+  {
+    // tag ids for the TaggedParser
+    enum Tags {
+      PACKAGE,  // name version release arch
+      REQUIRES, // list of requires tags
+      PREREQUIRES,// list of pre-requires tags
+      PROVIDES, // list of provides tags
+      CONFLICTS,  // list of conflicts tags
+      OBSOLETES,  // list of obsoletes tags
+      RECOMMENDS, // list of recommends tags
+      SUGGESTS, // list of suggests tags
+      LOCATION, // file location
+      SIZE, // packed and unpacked size
+      BUILDTIME,  // buildtime
+      SOURCERPM,  // source package
+      GROUP,  // rpm group
+      LICENSE,  // license
+      AUTHORS,  // list of authors
+      SHAREWITH,  // package to share data with
+      KEYWORDS, // list of keywords
+  
+        // packages.<locale>
+      SUMMARY,  // short summary (label)
+      DESCRIPTION,// long description
+      INSNOTIFY,  // install notification
+      DELNOTIFY,  // delete notification
+      LICENSETOCONFIRM, // license to confirm upon install
+      // packages.DU
+      DU,   // disk usage data
+      NUM_TAGS
+    };
+  
+    PackagesParser( const data::RecordId &catalog_id, zypp::cache::CacheStore consumer );
+    void start( const zypp::Pathname &path );
+    void fromCache ( TagCacheRetrieval_Ptr pkgcache);
+    void collectDeps( zypp::Dep deptype, const std::list<std::string> &depstrlist, data::Dependencies &deps );
+    void fromPathLocale (const zypp::Pathname& path);
+    void fromLocale ();
+    
+  private:
+    // our parser
+    TaggedParser _parser;
+    // our set of tags, initialized in constructor
+    TaggedFile::TagSet _tagset;
+    zypp::Arch _system_arch;
+    typedef std::map <std::string, PackageDataProviderPtr> pkgmaptype;
+    pkgmaptype _pkgmap;
+    zypp::cache::CacheStore _consumer;
+    std::map<std::string, data::RecordId> _idmap;
+    data::RecordId _catalog_id;
+  };
+}
+
+#endif
+
+

Added: trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser_tp.cc?rev=5392&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser_tp.cc (added)
+++ trunk/libzypp/devel/devel.dmacvicar/SUSETagsParser_tp.cc Mon Apr 16 18:56:18 2007
@@ -0,0 +1,33 @@
+
+#include <iostream>
+#include "zypp/base/Measure.h"
+#include "zypp/base/Logger.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/ZYpp.h"
+
+#include "SUSETagsParser.h"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::debug;
+
+int main(int argc, char **argv)
+{
+    try
+    {
+      ZYpp::Ptr z = getZYpp();
+      Pathname dbfile = Pathname(getenv("PWD")) + "data.db";
+      zypp::cache::CacheStore store(getenv("PWD"));
+      data::RecordId catalog_id = store.lookupOrAppendCatalog( Url(argv[1]), "/");
+      PackagesParser parser( catalog_id, store);
+      Measure m;
+      parser.start(argv[1]);
+      m.elapsed();
+    }
+    catch ( const Exception &e )
+    {
+      cout << "ups! " << e.msg() << std::endl;
+    }
+    return 0;
+}
+

Modified: trunk/libzypp/devel/devel.dmacvicar/YUMDownloader_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/YUMDownloader_tp.cc?rev=5392&r1=5391&r2=5392&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/YUMDownloader_tp.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/YUMDownloader_tp.cc Mon Apr 16 18:56:18 2007
@@ -6,17 +6,17 @@
 #include <list>
 #include <set>
 
-#include <zypp/base/Logger.h>
-#include <zypp/base/String.h>
-#include <zypp/ZYpp.h>
-#include <zypp/ZYppFactory.h>
-#include <zypp/media/MediaAccess.h>
-#include <zypp/media/MediaManager.h>
-#include <zypp/MediaSetAccess.h>
-#include <zypp/source/SUSEMediaVerifier.h>
-#include <zypp/OnMediaLocation.h>
-#include <YUMDownloader.h>
-#include <zypp/Fetcher.h>
+#include "zypp/base/Logger.h"
+#include "zypp/base/String.h"
+#include "zypp/ZYpp.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/media/MediaAccess.h"
+#include "zypp/media/MediaManager.h"
+#include "zypp/MediaSetAccess.h"
+#include "zypp/source/SUSEMediaVerifier.h"
+#include "zypp/OnMediaLocation.h"
+#include "zypp/source/yum/YUMDownloader.h"
+#include "zypp/Fetcher.h"
 
 #include "zypp/Product.h"
 #include "zypp/Package.h"

Modified: trunk/libzypp/devel/devel.dmacvicar/testbed.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/testbed.cc?rev=5392&r1=5391&r2=5392&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/testbed.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/testbed.cc Mon Apr 16 18:56:18 2007
@@ -10,7 +10,7 @@
 #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"
 
@@ -28,8 +28,12 @@
     
       Pathname dbpath = Pathname(getenv("PWD"));
       
-      CachedSourceImpl source(dbpath);
-      //ResStore dbres = src.resolvables();
+      SourceImpl_Ptr sourceImpl(new CachedSourceImpl(dbpath));
+      SourceFactory factory;
+      Source_Ref source = factory.createFrom(sourceImpl);
+      ResStore dbres = source.resolvables();
+      
+      MIL << dbres.size() << " resolvables" << endl;
 
     }
     catch ( const Exception &e )

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

< Previous Next >
This Thread
  • No further messages