commit again
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 25 Jan 2008 15:32:56 +0000 (15:32 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 25 Jan 2008 15:32:56 +0000 (15:32 +0000)
12 files changed:
devel/devel.dmacvicar/CMakeLists.txt
devel/devel.dmacvicar/SolvStore_tp.cc [new file with mode: 0644]
zypp/RepoManager.cc
zypp/cache/SolvStore.cc
zypp/cache/SolvStore.h
zypp/data/ResolvableDataConsumer.h
zypp/parser/plaindir/RepoParser.cc
zypp/parser/plaindir/RepoParser.h
zypp/parser/susetags/RepoParser.cc
zypp/parser/susetags/RepoParser.h
zypp/parser/yum/RepoParser.cc
zypp/parser/yum/RepoParser.h

index c1d52fc6e44172edd12871e8294fda4cad68aef2..d2bea809d03dde3a0385ac4f2aa42cdd4868e454 100644 (file)
@@ -9,8 +9,8 @@ TARGET_LINK_LIBRARIES(mediaaccess  zypp )
 #ADD_EXECUTABLE(susetags-downloader SUSETagsDownloader_tp.cc)
 #TARGET_LINK_LIBRARIES(susetags-downloader  zypp )
 
-ADD_EXECUTABLE(cachestore CacheStore_tp.cc)
-TARGET_LINK_LIBRARIES(cachestore  zypp )
+ADD_EXECUTABLE(solvstore SolvStore_tp.cc)
+TARGET_LINK_LIBRARIES(solvstore zypp )
 
 #ADD_EXECUTABLE(testbed testbed.cc)
 #TARGET_LINK_LIBRARIES(testbed  zypp )
diff --git a/devel/devel.dmacvicar/SolvStore_tp.cc b/devel/devel.dmacvicar/SolvStore_tp.cc
new file mode 100644 (file)
index 0000000..e4bb1a3
--- /dev/null
@@ -0,0 +1,47 @@
+#include <sys/time.h>
+
+#include <iostream>
+#include <fstream>
+
+#include <zypp/base/Measure.h>
+#include <zypp/base/Logger.h>
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+
+#include "zypp/Product.h"
+#include "zypp/Package.h"
+#include "zypp/TmpPath.h"
+//#include "zypp/cache/CacheInitializer.h"
+#include "zypp/cache/SolvStore.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/data/RecordId.h"
+#include "zypp/base/Measure.h"
+#include "zypp/parser/yum/RepoParser.h"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::debug;
+
+
+int main(int argc, char **argv)
+{
+    try
+    {
+      ZYpp::Ptr z = getZYpp();
+      filesystem::TmpDir solvdir;
+      zypp::cache::SolvStore store(solvdir.path());
+      
+      Measure cap_insert_timer("Insert Capabilities");
+      parser::yum::RepoParser parser("foo", store);
+      parser.parse("/mounts/dist/install/stable-x86/suse");
+    }
+    catch ( const Exception &e )
+    {
+      cout << e.msg() << endl;
+    }
+    
+    return 0;
+}
+
+
+
index fa931320e5581262a794233e367e71cda07ef395..d9044d29cedba37dd98547dd95c6580d20f9ac61 100644 (file)
@@ -127,11 +127,10 @@ namespace zypp
       return;
 
     MIL << info.alias() << " cleaning cache..." << endl;
-    data::RecordId id = store.lookupRepository(info.alias());
-
+    
     CombinedProgressData subprogrcv(progress);
 
-    store.cleanRepository(id, subprogrcv);
+    store.cleanRepository(info.alias(), subprogrcv);
   }
 
   ////////////////////////////////////////////////////////////////////////////
index bf567854f19f46d55be5c2fbe32e99a4d0fe0cba..b9a7e88e7d01dbfa777acabb448f9a0e3a4e7759 100644 (file)
@@ -12,7 +12,7 @@
 #include "zypp/cache/CacheAttributes.h"
 
 #include "satsolver/repo.h"
-#include "satsolver/solvable.h"
+#include "satsolver/attr_store.h"
 
 using namespace std;
 using namespace zypp;
@@ -21,6 +21,8 @@ using zypp::data::RecordId;
 
 using zypp::debug::Measure;
 
+
+
 /** Append OnMediaLocation attributes to resolvable with ID.
  * \code
  * appendOnMediaLocation( pkgid, attrPackageLocation, package->repositoryLocation );
@@ -52,11 +54,30 @@ struct SolvStore::Impl
   Impl( const Pathname &solvdir )
   : name_cache_hits(0)
   , dir_cache_hits(0)
-  , _last_repoid(0)
   , _cachedir(solvdir)
   {
     _pool = pool_create();
-
+    _attr = new_store(_pool);
+    
+    _attr_package_authors = str2id(_pool, "package:authors", 1);
+    _attr_package_description = str2id(_pool, "package:description", 1);
+    _attr_package_diskusage = str2id(_pool, "package:diskusage", 1);
+    _attr_package_downloadsize = str2id(_pool, "package:downloadsize", 1);
+    _attr_package_eula = str2id(_pool, "package:eula", 1);
+    _attr_package_group = str2id(_pool, "package:group", 1);
+    _attr_package_installsize = str2id(_pool, "package:authors", 1);
+    _attr_package_keywords = str2id(_pool, "package:keywords", 1);
+    _attr_package_license = str2id(_pool, "package:license", 1);
+    _attr_package_messagedel = str2id(_pool, "package:messagedel", 1);
+    _attr_package_messageins = str2id(_pool, "package:messageins", 1);
+    _attr_package_mediadir = str2id(_pool, "package:mediadir", 1);
+    _attr_package_mediafile = str2id(_pool, "package:mediafile", 1);
+    _attr_package_medianr = str2id(_pool, "package:medianr", 1);
+    _attr_package_nosource = str2id(_pool, "package:nosource", 1);
+    _attr_package_source = str2id(_pool, "package:source", 1);
+    _attr_package_sourceid = str2id(_pool, "package:sourceid", 1);
+    _attr_package_summary = str2id(_pool, "package:summary", 1);
+    _attr_package_time = str2id(_pool, "package:time", 1);
   }
 
   Impl()
@@ -78,10 +99,30 @@ struct SolvStore::Impl
 
   _Pool *_pool;
 
-  map<RecordId,Repo*> _id2repo;
-  map<string, RecordId> _name2repoid;
-  RecordId _last_repoid;
+  map<string,Repo*> _repoid2repo;
+  
   Pathname _cachedir;
+  Attrstore *_attr;
+
+  Id _attr_package_authors;
+  Id _attr_package_description;
+  Id _attr_package_diskusage;
+  Id _attr_package_downloadsize;
+  Id _attr_package_eula;
+  Id _attr_package_group;
+  Id _attr_package_installsize;
+  Id _attr_package_keywords;
+  Id _attr_package_license;
+  Id _attr_package_messagedel;
+  Id _attr_package_messageins;
+  Id _attr_package_mediadir;
+  Id _attr_package_mediafile;
+  Id _attr_package_medianr;
+  Id _attr_package_nosource;
+  Id _attr_package_source;
+  Id _attr_package_sourceid;
+  Id _attr_package_summary;
+  Id _attr_package_time;
 };
 
 
@@ -110,203 +151,213 @@ void SolvStore::commit()
 void SolvStore::appendResObjectAttributes( const data::RecordId &rid,
                                             const data::ResObject_Ptr & res )
 {
-  appendTranslatedStringAttribute( rid, attrResObjectDescription(), res->description );
-  appendTranslatedStringAttribute( rid, attrResObjectSummary(), res->summary );
-  appendNumericAttribute( rid, attrResObjectInstalledSize(), res->installedSize );
-  appendNumericAttribute( rid, attrResObjectBuildTime(), res->buildTime );
-  appendBooleanAttribute( rid, attrResObjectInstallOnly(), res->installOnly );
-  appendStringAttribute( rid, attrResObjectVendor(), res->vendor );
-  appendTranslatedStringAttribute( rid, attrResObjectLicenseToConfirm(), res->licenseToConfirm );
-  appendTranslatedStringAttribute( rid, attrResObjectInsnotify(), res->insnotify );
-  appendTranslatedStringAttribute( rid, attrResObjectDelnotify(), res->delnotify );
+  
+//   appendTranslatedStringAttribute( rid, attrResObjectDescription(), res->description );
+//   appendTranslatedStringAttribute( rid, attrResObjectSummary(), res->summary );
+//   appendNumericAttribute( rid, attrResObjectInstalledSize(), res->installedSize );
+//   appendNumericAttribute( rid, attrResObjectBuildTime(), res->buildTime );
+//   appendBooleanAttribute( rid, attrResObjectInstallOnly(), res->installOnly );
+//   appendStringAttribute( rid, attrResObjectVendor(), res->vendor );
+//   appendTranslatedStringAttribute( rid, attrResObjectLicenseToConfirm(), res->licenseToConfirm );
+//   appendTranslatedStringAttribute( rid, attrResObjectInsnotify(), res->insnotify );
+//   appendTranslatedStringAttribute( rid, attrResObjectDelnotify(), res->delnotify );
 }
 
 
 void SolvStore::appendPackageBaseAttributes( const RecordId & pkgid,
                                               const data::Packagebase_Ptr & package )
 {
-  appendStringAttribute( pkgid, attrPackageBuildhost(), package->buildhost );
-  appendStringAttribute( pkgid, attrPackageDistribution(), package->distribution );
-  appendStringAttribute( pkgid, attrPackageLicense(), package->license );
-  appendStringAttribute( pkgid, attrPackageGroup(), package->group );
-  appendStringAttribute( pkgid, attrPackagePackager(), package->packager );
-  appendStringAttribute( pkgid, attrPackageUrl(), package->url );
-  appendStringAttribute( pkgid, attrPackageOperatingSystem(), package->operatingSystem );
-  appendStringAttribute( pkgid, attrPackagePrein(), package->prein );
-  appendStringAttribute( pkgid, attrPackagePostin(), package->postin );
-  appendStringAttribute( pkgid, attrPackagePreun(), package->preun );
-  appendStringAttribute( pkgid, attrPackagePostun(), package->postun );
-  appendStringContainerAttribute( pkgid, attrPackageKeywords(), package->keywords.begin(), package->keywords.end() );
-  appendStringContainerAttribute( pkgid, attrPackageAuthors(), package->authors.begin(), package->authors.end() );
-
-  appendOnMediaLocation( pkgid, attrPackageLocation, package->repositoryLocation );
-}
-
-RecordId SolvStore::consumePackage( const RecordId & repository_id,
+    
+//   appendStringAttribute( pkgid, attrPackageBuildhost(), package->buildhost );
+//   appendStringAttribute( pkgid, attrPackageDistribution(), package->distribution );
+//   appendStringAttribute( pkgid, attrPackageLicense(), package->license );
+//   appendStringAttribute( pkgid, attrPackageGroup(), package->group );
+//   appendStringAttribute( pkgid, attrPackagePackager(), package->packager );
+//   appendStringAttribute( pkgid, attrPackageUrl(), package->url );
+//   appendStringAttribute( pkgid, attrPackageOperatingSystem(), package->operatingSystem );
+//   appendStringAttribute( pkgid, attrPackagePrein(), package->prein );
+//   appendStringAttribute( pkgid, attrPackagePostin(), package->postin );
+//   appendStringAttribute( pkgid, attrPackagePreun(), package->preun );
+//   appendStringAttribute( pkgid, attrPackagePostun(), package->postun );
+//   appendStringContainerAttribute( pkgid, attrPackageKeywords(), package->keywords.begin(), package->keywords.end() );
+//   appendStringContainerAttribute( pkgid, attrPackageAuthors(), package->authors.begin(), package->authors.end() );
+// 
+//   appendOnMediaLocation( pkgid, attrPackageLocation, package->repositoryLocation );
+}
+
+RecordId SolvStore::consumePackage( const std::string & repository_id,
                                     const data::Package_Ptr & package )
 {
-  RecordId id = appendResolvable( repository_id, ResTraits<Package>::kind,
-                                  NVRA( package->name, package->edition, package->arch ), package->deps, package->shareDataWith );
-  appendResObjectAttributes( id, package );
-  appendPackageBaseAttributes( id, package );
-
-  if ( ! package->srcPackageIdent.name.empty() )
-  {
-    appendStringAttribute( id, attrPackageSourcePkgName(),    package->srcPackageIdent.name );
-    appendStringAttribute( id, attrPackageSourcePkgEdition(), package->srcPackageIdent.edition.asString() );
-  }
-
-  return id;
+//   RecordId id = appendResolvable( repository_id, ResTraits<Package>::kind,
+//                                   NVRA( package->name, package->edition, package->arch ), package->deps, package->shareDataWith );
+//   appendResObjectAttributes( id, package );
+//   appendPackageBaseAttributes( id, package );
+// 
+//   if ( ! package->srcPackageIdent.name.empty() )
+//   {
+//     appendStringAttribute( id, attrPackageSourcePkgName(),    package->srcPackageIdent.name );
+//     appendStringAttribute( id, attrPackageSourcePkgEdition(), package->srcPackageIdent.edition.asString() );
+//   }
+
+  //return id;
+  return 0;
 }
 
-RecordId SolvStore::consumeSourcePackage( const data::RecordId & repository_id,
+RecordId SolvStore::consumeSourcePackage( const std::string & repository_id,
                                        const data::SrcPackage_Ptr & package )
 {
-  RecordId id = appendResolvable( repository_id, ResTraits<SrcPackage>::kind,
-      NVRA( package->name, package->edition, package->arch ), package->deps, package->shareDataWith );
-  appendResObjectAttributes( id, package );
-
-  appendOnMediaLocation( id, attrSrcPackageLocation, package->repositoryLocation );
-  return id;
+//   RecordId id = appendResolvable( repository_id, ResTraits<SrcPackage>::kind,
+//       NVRA( package->name, package->edition, package->arch ), package->deps, package->shareDataWith );
+//   appendResObjectAttributes( id, package );
+// 
+//   appendOnMediaLocation( id, attrSrcPackageLocation, package->repositoryLocation );
+  //return id;
+  return 0;
 }
 
-RecordId SolvStore::consumePatch( const data::RecordId & repository_id,
+RecordId SolvStore::consumePatch( const std::string & repository_id,
                                const data::Patch_Ptr & patch)
-{
+{/*
   RecordId id = appendResolvable(
       repository_id, ResTraits<Patch>::kind,
-      NVRA( patch->name, patch->edition, patch->arch ), patch->deps );
-
-  appendResObjectAttributes( id, patch );
-
-  // patch attributes
-  appendNumericAttribute( id, attrPatchTimestamp(),         patch->timestamp );
-  appendStringAttribute(  id, attrPatchCategory(),          patch->category );
-  appendStringAttribute(  id, attrPatchId(),                patch->id );
-  appendBooleanAttribute( id, attrPatchRebootNeeded(),      patch->rebootNeeded );
-  appendBooleanAttribute( id, attrPatchAffectsPkgManager(), patch->affectsPkgManager );
-
-
-  DBG << "got patch " << patch->name << ", atoms: ";
-  // cosume atoms
-  for (set<data::ResObject_Ptr>::const_iterator p = patch->atoms.begin();
-       p != patch->atoms.end(); ++p)
-  {
-    data::PackageAtom_Ptr atom = dynamic_pointer_cast<data::PackageAtom>(*p);
-    if (atom)
-    {
-      DBG << atom->name << "(atom) ";
-      consumePackageAtom(repository_id, atom);
-      continue;
-    }
-
-    data::Script_Ptr script = dynamic_pointer_cast<data::Script>(*p);
-    if (script)
-    {
-      DBG << script->name << "(script) ";
-      consumeScript(repository_id, script);
-      continue;
-    }
-
-    data::Message_Ptr message = dynamic_pointer_cast<data::Message>(*p);
-    if (message)
-    {
-      DBG << message->name << "(message) ";
-      consumeMessage(repository_id, message);
-      continue;
-    }
-
-    ERR << " ignoring !badatom! ";
-    if (*p) ERR << (*p)->name;
-    ERR << endl;
-  }
-
-  DBG << endl;
-  return id;
+      NVRA( patch->name, patch->edition, patch->arch ), patch->deps );*/
+
+//   appendResObjectAttributes( id, patch );
+// 
+//   // patch attributes
+//   appendNumericAttribute( id, attrPatchTimestamp(),         patch->timestamp );
+//   appendStringAttribute(  id, attrPatchCategory(),          patch->category );
+//   appendStringAttribute(  id, attrPatchId(),                patch->id );
+//   appendBooleanAttribute( id, attrPatchRebootNeeded(),      patch->rebootNeeded );
+//   appendBooleanAttribute( id, attrPatchAffectsPkgManager(), patch->affectsPkgManager );
+// 
+// 
+//   DBG << "got patch " << patch->name << ", atoms: ";
+//   // cosume atoms
+//   for (set<data::ResObject_Ptr>::const_iterator p = patch->atoms.begin();
+//        p != patch->atoms.end(); ++p)
+//   {
+//     data::PackageAtom_Ptr atom = dynamic_pointer_cast<data::PackageAtom>(*p);
+//     if (atom)
+//     {
+//       DBG << atom->name << "(atom) ";
+//       consumePackageAtom(repository_id, atom);
+//       continue;
+//     }
+// 
+//     data::Script_Ptr script = dynamic_pointer_cast<data::Script>(*p);
+//     if (script)
+//     {
+//       DBG << script->name << "(script) ";
+//       consumeScript(repository_id, script);
+//       continue;
+//     }
+// 
+//     data::Message_Ptr message = dynamic_pointer_cast<data::Message>(*p);
+//     if (message)
+//     {
+//       DBG << message->name << "(message) ";
+//       consumeMessage(repository_id, message);
+//       continue;
+//     }
+// 
+//     ERR << " ignoring !badatom! ";
+//     if (*p) ERR << (*p)->name;
+//     ERR << endl;
+//   }
+// 
+//   DBG << endl;
+  //return id;
+  return 0;
 }
 
-RecordId SolvStore::consumePackageAtom( const data::RecordId & repository_id,
+RecordId SolvStore::consumePackageAtom( const std::string & repository_id,
                                      const data::PackageAtom_Ptr & atom )
 {
-  RecordId id = appendResolvable( repository_id, ResTraits<Atom>::kind,
-      NVRA( atom->name, atom->edition, atom->arch ), atom->deps );
-  appendResObjectAttributes( id, atom );
-  appendPackageBaseAttributes( id, atom );
-
-  for (set<data::PatchRpm_Ptr>::const_iterator p = atom->patchRpms.begin();
-       p != atom->patchRpms.end(); ++p)
-    appendPatchRpm(repository_id, *p);
-
-  for (set<data::DeltaRpm_Ptr>::const_iterator d = atom->deltaRpms.begin();
-       d != atom->deltaRpms.end(); ++d)
-    appendDeltaRpm(repository_id, *d);
-  return id;
+//   RecordId id = appendResolvable( repository_id, ResTraits<Atom>::kind,
+//       NVRA( atom->name, atom->edition, atom->arch ), atom->deps );
+//   appendResObjectAttributes( id, atom );
+//   appendPackageBaseAttributes( id, atom );
+// 
+//   for (set<data::PatchRpm_Ptr>::const_iterator p = atom->patchRpms.begin();
+//        p != atom->patchRpms.end(); ++p)
+//     appendPatchRpm(repository_id, *p);
+// 
+//   for (set<data::DeltaRpm_Ptr>::const_iterator d = atom->deltaRpms.begin();
+//        d != atom->deltaRpms.end(); ++d)
+//     appendDeltaRpm(repository_id, *d);
+  //7return id;
+  return 0;
 }
 
-RecordId SolvStore::consumeMessage( const data::RecordId & repository_id,
+RecordId SolvStore::consumeMessage( const std::string & repository_id,
                                  const data::Message_Ptr & message )
 {
-  RecordId id = appendResolvable( repository_id, ResTraits<Message>::kind,
-      NVRA( message->name, message->edition, message->arch ), message->deps );
-  appendResObjectAttributes( id, message );
-
-  appendTranslatedStringAttribute( id, attrMessageText(), message->text );
-  return id;
+//   RecordId id = appendResolvable( repository_id, ResTraits<Message>::kind,
+//       NVRA( message->name, message->edition, message->arch ), message->deps );
+//   appendResObjectAttributes( id, message );
+// 
+//   appendTranslatedStringAttribute( id, attrMessageText(), message->text );
+  //7return id;
+  return 0;
 }
 
-RecordId SolvStore::consumeScript( const data::RecordId & repository_id,
+RecordId SolvStore::consumeScript( const std::string & repository_id,
                                 const data::Script_Ptr & script )
 {
-  RecordId id = appendResolvable( repository_id, ResTraits<Script>::kind,
-      NVRA( script->name, script->edition, script->arch ), script->deps );
-  appendResObjectAttributes( id, script );
-
-  appendStringAttribute( id, attrScriptDoScript(), script->doScript );
-  appendOnMediaLocation( id, attrScriptDoScriptLocation, script->doScriptLocation );
-  appendStringAttribute( id, attrScriptUndoScript(), script->undoScript );
-  appendOnMediaLocation( id, attrScriptUndoScriptLocation, script->undoScriptLocation );
-  return id;
+  //RecordId id = appendResolvable( repository_id, ResTraits<Script>::kind,
+      //NVRA( script->name, script->edition, script->arch ), script->deps );
+//   appendResObjectAttributes( id, script );
+// 
+//   appendStringAttribute( id, attrScriptDoScript(), script->doScript );
+//   appendOnMediaLocation( id, attrScriptDoScriptLocation, script->doScriptLocation );
+//   appendStringAttribute( id, attrScriptUndoScript(), script->undoScript );
+//   appendOnMediaLocation( id, attrScriptUndoScriptLocation, script->undoScriptLocation );
+  //return id;
+  return 0;
 }
 
-RecordId SolvStore::consumePattern( const data::RecordId & repository_id,
+RecordId SolvStore::consumePattern( const std::string & repository_id,
                                      const data::Pattern_Ptr & pattern )
 {
-  RecordId id = appendResolvable( repository_id, ResTraits<Pattern>::kind,
-      NVRA( pattern->name, pattern->edition, pattern->arch ), pattern->deps );
-  appendResObjectAttributes( id, pattern );
-
-  appendBooleanAttribute( id, attrPatternIsDefault(), pattern->isDefault );
-  appendBooleanAttribute( id, attrPatternUserVisible(), pattern->userVisible );
-  appendTranslatedStringAttribute( id, attrPatternCategory(), pattern->category );
-  appendStringAttribute( id, attrPatternIcon(), pattern->icon );
-  appendStringAttribute( id, attrPatternOrder(), pattern->order );
+//   RecordId id = appendResolvable( repository_id, ResTraits<Pattern>::kind,
+//       NVRA( pattern->name, pattern->edition, pattern->arch ), pattern->deps );
+//   appendResObjectAttributes( id, pattern );
+// 
+//   appendBooleanAttribute( id, attrPatternIsDefault(), pattern->isDefault );
+//   appendBooleanAttribute( id, attrPatternUserVisible(), pattern->userVisible );
+//   appendTranslatedStringAttribute( id, attrPatternCategory(), pattern->category );
+//   appendStringAttribute( id, attrPatternIcon(), pattern->icon );
+//   appendStringAttribute( id, attrPatternOrder(), pattern->order );
 
   // We store them as string. They are
   // (sometimes) evaluated by the YaST UI.
-  appendStringContainerAttribute( id, attrPatternUiIncludes(), pattern->includes.begin(), pattern->includes.end() );
-  appendStringContainerAttribute( id, attrPatternUiExtends(),  pattern->extends.begin(),  pattern->extends.end() );
+//   appendStringContainerAttribute( id, attrPatternUiIncludes(), pattern->includes.begin(), pattern->includes.end() );
+//   appendStringContainerAttribute( id, attrPatternUiExtends(),  pattern->extends.begin(),  pattern->extends.end() );
 
-  return id;
+  //return id;
+  return 0;
 }
 
-RecordId SolvStore::consumeProduct( const data::RecordId & repository_id,
+RecordId SolvStore::consumeProduct( const std::string & repository_id,
                                  const data::Product_Ptr & product )
 {
-  RecordId id = appendResolvable( repository_id, ResTraits<Product>::kind,
-      NVRA( product->name, product->edition, product->arch ), product->deps );
-  appendResObjectAttributes( id, product );
-
-  appendStringAttribute( id, attrProductType(), product->type );
-  appendTranslatedStringAttribute( id, attrProductShortName(), product->shortName );
-  appendTranslatedStringAttribute( id, attrProductLongName(), product->longName );
-  appendStringContainerAttribute( id, attrProductFlags(), product->flags.begin(), product->flags.end() );
-  appendStringAttribute( id, attrProductReleasenotesUrl(), product->releasenotesUrl.asString() );
-  appendStringContainerAttribute( id, attrProductUpdateUrls(), product->updateUrls );
-  appendStringContainerAttribute( id, attrProductExtraUrls(), product->extraUrls );
-  appendStringContainerAttribute( id, attrProductOptionalUrls(), product->optionalUrls );
-  appendStringAttribute( id, attrProductDistributionName(), product->distributionName );
-  appendStringAttribute( id, attrProductDistributionEdition(), product->distributionEdition.asString() );
-  return id;
+//   RecordId id = appendResolvable( repository_id, ResTraits<Product>::kind,
+//       NVRA( product->name, product->edition, product->arch ), product->deps );
+//   appendResObjectAttributes( id, product );
+// 
+//   appendStringAttribute( id, attrProductType(), product->type );
+//   appendTranslatedStringAttribute( id, attrProductShortName(), product->shortName );
+//   appendTranslatedStringAttribute( id, attrProductLongName(), product->longName );
+//   appendStringContainerAttribute( id, attrProductFlags(), product->flags.begin(), product->flags.end() );
+//   appendStringAttribute( id, attrProductReleasenotesUrl(), product->releasenotesUrl.asString() );
+//   appendStringContainerAttribute( id, attrProductUpdateUrls(), product->updateUrls );
+//   appendStringContainerAttribute( id, attrProductExtraUrls(), product->extraUrls );
+//   appendStringContainerAttribute( id, attrProductOptionalUrls(), product->optionalUrls );
+//   appendStringAttribute( id, attrProductDistributionName(), product->distributionName );
+//   appendStringAttribute( id, attrProductDistributionEdition(), product->distributionEdition.asString() );
+  //return id;
+  return 0;
 }
 
 RecordId SolvStore::consumeChangelog( const data::RecordId &resolvable_id,
@@ -341,25 +392,26 @@ void SolvStore::consumeDiskUsage( const data::RecordId &resolvable_id,
 void SolvStore::updatePackageLang( const data::RecordId & resolvable_id,
                                    const data::Packagebase_Ptr & data_r )
 {
-  appendTranslatedStringAttribute( resolvable_id, attrResObjectSummary(),          data_r->summary );
-  appendTranslatedStringAttribute( resolvable_id, attrResObjectDescription(),      data_r->description );
-  appendTranslatedStringAttribute( resolvable_id, attrResObjectLicenseToConfirm(), data_r->licenseToConfirm );
-  appendTranslatedStringAttribute( resolvable_id, attrResObjectInsnotify(),        data_r->insnotify );
-  appendTranslatedStringAttribute( resolvable_id, attrResObjectDelnotify(),        data_r->delnotify );
+//   appendTranslatedStringAttribute( resolvable_id, attrResObjectSummary(),          data_r->summary );
+//   appendTranslatedStringAttribute( resolvable_id, attrResObjectDescription(),      data_r->description );
+//   appendTranslatedStringAttribute( resolvable_id, attrResObjectLicenseToConfirm(), data_r->licenseToConfirm );
+//   appendTranslatedStringAttribute( resolvable_id, attrResObjectInsnotify(),        data_r->insnotify );
+//   appendTranslatedStringAttribute( resolvable_id, attrResObjectDelnotify(),        data_r->delnotify );
 }
 
-::_Solvable* SolvStore::appendResolvable( const data::RecordId &repository_id,
+_Solvable* SolvStore::appendResolvable( const std::string & repository_id,
                                           const data::Resolvable_Ptr &res )
 {
   Repo *repo;
-  map<RecordId, Repo*>::const_iterator it = _pimpl->_id2repo.find(repository_id);
-  if ( it == _pimpl->_id2repo.end() )
+  map<string, Repo*>::const_iterator it = _pimpl->_repoid2repo.find(repository_id);
+  if ( it == _pimpl->_repoid2repo.end() )
   {
     // throw
   }
   repo = it->second;
 
-  Solvable *s = pool_id2solvable(_pimpl->_pool, repo_add_solvable(repo));
+  //Id
+  _Solvable *s = pool_id2solvable(_pimpl->_pool, repo_add_solvable(repo));
   s->evr = str2id(_pimpl->_pool, res->edition.c_str(), 1);
 //   s->provides = adddep(pool, pd, s->provides, atts, 0);
 //
@@ -374,79 +426,8 @@ void SolvStore::updatePackageLang( const data::RecordId & resolvable_id,
 }
 
 
-RecordId SolvStore::appendResolvable( const RecordId &repository_id,
-                                       const Resolvable::Kind &kind,
-                                       const NVRA &nvra,
-                                       const data::Dependencies &deps )
-{
-  return appendResolvable( repository_id,
-                           kind,
-                           nvra,
-                           deps,
-                           data::noRecordId );
-}
-
-data::RecordId
-    SolvStore::appendResolvable( const data::RecordId &repository_id,
-                                  const Resolvable::Kind &kind,
-                                  const NVRA &nvra,
-                                  const data::Dependencies &deps,
-                                  const data::RecordId &shared_id )
-{
-
-//   Solvable *s = pool_id2solvable(pool, repo_add_solvable(pd->repo));
-//   s->evr = makeevr_atts(pool, pd, atts);
-//   s->provides = adddep(pool, pd, s->provides, atts, 0);
-//
-//   s->name = str2id(pool, nvra.name.c_str(), 1);
-//   s->arch = str2id(pool, nvra.arch.c_str(), 1);
-//   s->vendor = str2id(pool, nvra.vendor.c_str(), 1);
-//
-//   if (!s->arch)
-//     s->arch = ARCH_NOARCH;
-//
-//   if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
-//     s->provides = repo_addid_dep(pd->repo, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
-//
-//    s->supplements = repo_fix_legacy(pd->repo, s->provides, s->supplements);
-
-  // file
-  //id = str2id(pool, pd->content, 1);
-  //s->provides = repo_addid(pd->repo, s->provides, id);
-
-
-//   long long id = _pimpl->con.insertid();
-//
-//   appendDependencies( id, deps );
-
-  return 0;
-}
-
-void SolvStore::appendDependencies( const RecordId &resolvable_id, const data::Dependencies &deps )
-{
-  for ( data::Dependencies::const_iterator it = deps.begin(); it != deps.end(); ++it )
-  {
-    appendDependencyList( resolvable_id, it->first, it->second );
-  }
-}
-
-void SolvStore::appendDependencyList( const RecordId &resolvable_id, Dep deptype, const data::DependencyList &caps )
-{
-  for ( data::DependencyList::const_iterator it = caps.begin(); it != caps.end(); ++it )
-  {
-    appendDependency( resolvable_id, deptype, *it );
-  }
-}
-
-void SolvStore::appendDependency( const RecordId &resolvable_id, Dep deptype, Capability cap )
-{
-#warning MIGRATE TO SAT
-  // create capability from data
-}
-
-
 /** \todo lookupOrAppend ? */
-RecordId SolvStore::appendPatchRpm(const zypp::data::RecordId &repository_id, const data::PatchRpm_Ptr & prpm)
+RecordId SolvStore::appendPatchRpm( const std::string & repository_id, const data::PatchRpm_Ptr & prpm)
 {
   RecordId id;
 return id;
@@ -454,43 +435,13 @@ return id;
 
 
 /** \todo lookupOrAppend ? */
-RecordId SolvStore::appendDeltaRpm(const zypp::data::RecordId &repository_id, const data::DeltaRpm_Ptr & drpm)
+RecordId SolvStore::appendDeltaRpm( const std::string & repository_id, const data::DeltaRpm_Ptr & drpm)
 {
   RecordId id;
   return id;
 }
 
 
-RecordId SolvStore::lookupOrAppendFile( const Pathname &path )
-{
-  long long id = 0;
-  return id;
-}
-
-void SolvStore::updateRepositoryStatus( const RecordId &id,
-                                         const RepoStatus &status )
-{
-  // NO OP for now
-}
-
-RecordId SolvStore::lookupOrAppendRepository( const string &alias )
-{
-  map<string,RecordId>::const_iterator it = _pimpl->_name2repoid.find(alias);
-  if (it == _pimpl->_name2repoid.end())
-  {
-    _pimpl->_name2repoid[alias] = ++_pimpl->_last_repoid;
-    //_pimpl->_id2repo[_pimpl->_last_repoid] = ::repo_create(_pimpl->_pool, alias.c_str());
-  }
-  return _pimpl->_name2repoid[alias];
-}
-
-void SolvStore::cleanRepository( const data::RecordId &id,
-                                  const ProgressData::ReceiverFnc & progressrcv )
-{
-  // just delete the solv file
-  //cleanupRepository(lookupRepository(
-}
-
 void SolvStore::cleanRepository( const std::string &alias,
                                   const ProgressData::ReceiverFnc & progressrcv )
 {
@@ -506,120 +457,7 @@ RepoStatus SolvStore::repositoryStatus( const string &alias )
 
 bool SolvStore::isCached( const string &alias )
 {
-  return _pimpl->_name2repoid.find(alias) != _pimpl->_name2repoid.end();
-}
-
-RecordId SolvStore::lookupRepository( const string &alias )
-{
-  map<string,RecordId>::const_iterator it = _pimpl->_name2repoid.find(alias);
-  if (it == _pimpl->_name2repoid.end())
-    ZYPP_THROW(CacheRecordNotFoundException());
-
-  return _pimpl->_name2repoid[alias];
-}
-
-RecordId SolvStore::lookupOrAppendType( const string &klass, const string &name )
-{
-  long long id = 0;
-  return id;
-}
-
-RecordId SolvStore::lookupOrAppendName( const string &name )
-{
-  long long id = 0;
-  return id;
-}
-
-RecordId SolvStore::lookupOrAppendDirName( const string &name )
-{
-  long long id = 0;
-  return id;
-}
-
-RecordId SolvStore::lookupOrAppendFileName( const string &name )
-{
-  long long id = 0;
-  return id;
-}
-
-void SolvStore::setSharedData( const data::RecordId &resolvable_id,
-                                const data::RecordId &shared_id )
-{
-}
-
-void SolvStore::appendBooleanAttribute( const data::RecordId & resolvable_id,
-                                         const std::string & klass,
-                                         const std::string & name,
-                                         bool value)
-{
-  RecordId type_id = lookupOrAppendType( klass, name );
-  appendNumericAttribute( resolvable_id, type_id, value ? 1 : 0 );
-}
-
-void SolvStore::appendNumericAttribute( const data::RecordId &resolvable_id,
-                                         const std::string &klass,
-                                         const std::string &name,
-                                         int value )
-{
-  RecordId type_id = lookupOrAppendType( klass, name );
-  appendNumericAttribute( resolvable_id, type_id, value );
-}
-
-void SolvStore::appendNumericAttribute( const RecordId &resolvable_id,
-                                         const RecordId &type_id,
-                                         int value )
-{
-  // weak resolvable_id
-}
-
-
-void SolvStore::appendTranslatedStringAttribute( const data::RecordId &resolvable_id,
-                                                  const std::string &klass,
-                                                  const std::string &name,
-                                                  const TranslatedText &text )
-{
-  set<Locale> locales = text.locales();
-  for ( set<Locale>::const_iterator it = locales.begin(); it != locales.end(); ++it )
-  {
-    appendStringAttributeTranslation( resolvable_id, *it, klass, name, text.text(*it) );
-  }
-}
-
-
-void SolvStore::appendStringAttributeTranslation( const data::RecordId &resolvable_id,
-                                                   const Locale &locale,
-                                                   const std::string &klass,
-                                                   const std::string &name,
-                                                   const std::string &text )
-{
-  // don't bother with writing if the string is empty
-  if (text.empty()) return;
-}
-
-void SolvStore::appendStringAttribute( const data::RecordId &resolvable_id,
-                                        const std::string &klass,
-                                        const std::string &name,
-                                        const std::string &value )
-{
-  // don't bother with writing if the string is empty
-  if (value.empty()) return;
-}
-
-void SolvStore::appendStringAttribute( const RecordId &resolvable_id,
-                                        const RecordId &type_id,
-                                        const std::string &value )
-{
-  // don't bother with writing if the string is empty
-  if (value.empty()) return;
-}
-
-void SolvStore::appendStringAttribute( const RecordId &resolvable_id,
-                            const RecordId &lang_id,
-                            const RecordId &type_id,
-                            const string &value )
-{
-  // don't bother with writing if the string is empty
-  if (value.empty()) return;
+  return _pimpl->_repoid2repo.find(alias) != _pimpl->_repoid2repo.end();
 }
 
 }
index 555a7e1f2cd4fb723dfe7d2ee971c3e2416697bc..6091a33c3de7747b9abaac899ce7f7f9f975512c 100644 (file)
@@ -25,6 +25,8 @@
 #include "zypp/ProgressData.h"
 #include "zypp/cache/Attribute.h"
 
+#include "satsolver/solvable.h"
+
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
@@ -61,7 +63,7 @@ namespace zypp
        * The data will be saved in the directory specified in
        * \a dbdir. \a dbdir must exist.
        */
-      SolvStore( const Pathname &dbdir );
+      SolvStore( const Pathname &solvdir );
 
       /**
        * Commit the changes.
@@ -77,7 +79,7 @@ namespace zypp
        * \param repository_id ownership.
        * \param package Package data
       */
-      virtual data::RecordId consumePackage(const data::RecordId &repository_id,
+      virtual data::RecordId consumePackage(const std::string &repo_id,
                                            const data::Package_Ptr & package);
 
       /**
@@ -87,7 +89,7 @@ namespace zypp
        * \param catalog_id ownership.
        * \param srcpackage Source package data
       */
-      virtual data::RecordId consumeSourcePackage( const data::RecordId &catalog_id,
+      virtual data::RecordId consumeSourcePackage( const std::string &repo_id,
                                                   const data::SrcPackage_Ptr & srcpackage );
 
       /**
@@ -97,7 +99,7 @@ namespace zypp
        * \param repository_id ownership.
        * \param patch Patch data
       */
-      virtual data::RecordId consumePatch( const data::RecordId &repository_id,
+      virtual data::RecordId consumePatch( const std::string &repo_id,
                                           const data::Patch_Ptr & patch );
 
       /**
@@ -112,7 +114,7 @@ namespace zypp
        * \note this is somewhat specific to current YUM patch metadata design
        *       and may change (to consumeAtom(data::RecordId,data::Atom)).
        */
-      virtual data::RecordId consumePackageAtom( const data::RecordId &repository_id,
+      virtual data::RecordId consumePackageAtom( const std::string &repo_id,
                                                 const data::PackageAtom_Ptr & atom );
 
       /**
@@ -122,7 +124,7 @@ namespace zypp
        * \param repository_id ownership.
        * \param message Message data
       */
-      virtual data::RecordId consumeMessage( const data::RecordId & repository_id,
+      virtual data::RecordId consumeMessage( const std::string &repo_id,
                                             const data::Message_Ptr & message);
 
       /**
@@ -132,7 +134,7 @@ namespace zypp
        * \param repository_id ownership.
        * \param script Script data
       */
-      virtual data::RecordId consumeScript( const data::RecordId & repository_id,
+      virtual data::RecordId consumeScript( const std::string & repo_id,
                                            const data::Script_Ptr & script);
 
       /**
@@ -142,7 +144,7 @@ namespace zypp
        * \param repository_id ownership.
        * \param pattern Pattern data
       */
-      virtual data::RecordId consumePattern( const data::RecordId & repository_id,
+      virtual data::RecordId consumePattern( const std::string & repo_id,
                                             const data::Pattern_Ptr & pattern );
 
       /**
@@ -152,7 +154,7 @@ namespace zypp
        * \param repository_id ownership.
        * \param pattern Pattern data
       */
-      virtual data::RecordId consumeProduct( const data::RecordId &repository_id,
+      virtual data::RecordId consumeProduct( const std::string &repo_id,
                                             const data::Product_Ptr & product );
 
       /**
@@ -232,70 +234,8 @@ namespace zypp
        * other properties.
        *
        */
-      data::RecordId appendResolvable( const data::RecordId &repository_id,
-                                       const Resolvable::Kind &kind,
-                                       const NVRA &nvra,
-                                       const data::Dependencies &deps );
-
-      /**
-       * \short Appends a resolvable, and sets shared data with another one
-       *
-       * \see appendResolvable
-       * \param shared_id Resolvable that provides data in case
-       * this one does not provide an attribute
-       *
-       * \note Not all attributes can be shared. \ref shared_id is just
-       * a hint for the queries.
-       */
-      data::RecordId appendResolvable( const data::RecordId &repository_id,
-                                       const Resolvable::Kind &kind,
-                                       const NVRA &nvra,
-                                       const data::Dependencies &deps,
-                                       const data::RecordId &shared_id );
-      /**
-       * Adds dependencies to the store
-       *
-       * A map of dependency lists has to be specified. The map contains
-       * list of capablities for each dependency type \ref zypp::Dep
-       *
-       * \a resolvable_id is the resolvable Id in the SolvStore
-       * that will own those capabilities.
-       *
-       * FIXME should it \throw if the resolvable does not exist?
-       */
-      void appendDependencies( const data::RecordId &resolvable_id,
-                               const data::Dependencies &dependencies );
-
-      /**
-       * Adds dependencies to the store
-       *
-       * A lists of dependencies \a dlist to be specified. Among
-       * which type of dependencies \ref zypp::Dep it is as
-       * the \a deptype argument.
-       *
-       * \a resolvable_id is the resolvable Id in the SolvStore
-       * that will own those capabilities.
-       *
-       * FIXME should it \throw if the resolvable does not exist?
-       */
-      void appendDependencyList( const data::RecordId &resolvable_id,
-                                 Dep deptype,
-                                 const data::DependencyList &dlist );
-      /**
-       * Adds a dependency to the store.
-       *
-       * A \ref CapabilityImpl::Ptr argument \a cap has to be specified.
-       * Among which type of dependency \ref zypp::Dep it is as
-       * the \a deptype argument.
-       *
-       * \a resolvable_id is the resolvable Id in the SolvStore
-       * that will own the capability
-       *
-       * FIXME should it \throw if the resolvable does not exist?
-       */
-      void appendDependency( const data::RecordId &resolvable_id,
-                             Dep deptype,
-                             Capability cap );
+       _Solvable* appendResolvable( const std::string &repo_id,
+                                       const data::Resolvable_Ptr &res );
 
       /**
        * Insert patch RPM data into <tt>patch_packages</tt> table.
@@ -303,7 +243,7 @@ namespace zypp
        * \param prpm The patch RPM object to insert.
        * \return Record ID of the newly inserted record.
        */
-      data::RecordId appendPatchRpm( const data::RecordId &repo_id,
+      data::RecordId appendPatchRpm( const std::string &repo_id,
                                      const data::PatchRpm_Ptr & prpm);
 
 
@@ -313,28 +253,10 @@ namespace zypp
        * \param drpm The delta RPM object to insert.
        * \return Record ID of the newly inserted record.
        */
-      data::RecordId appendDeltaRpm( const data::RecordId &repo_id,
+      data::RecordId appendDeltaRpm( const std::string &repo_id,
                                      const data::DeltaRpm_Ptr & drpm);
 
 
-      /**
-       * Returns the record id of a type
-       *
-       * Types are mostly used internally. To give concepts
-       * a record id to associate with.
-       * Examples could be arch::i386, lang::en_US
-       * Packages::summary, rel:>, kind::Package
-       *
-       * \note If the type entry does not exist, it will
-       * be created and the new inserted entry's id will
-       * be returned.
-       */
-      data::RecordId lookupOrAppendType( const std::string &klass,
-                                         const std::string &name );
-      /** \overload */
-      data::RecordId lookupOrAppendType( const Attribute &attr )
-      { return lookupOrAppendType( attr.klass, attr.name ); }
-
       /**
        * Returns the record id of a repository (Source)
        *
@@ -346,340 +268,6 @@ namespace zypp
        */
       data::RecordId lookupOrAppendRepository( const std::string &alias );
 
-      /**
-       * Set the resolvable shared data flag pointing to
-       * another resolvable.
-       *
-       * This is a hint for cache readers. If any attribute
-       * of a resolvable is empty, is because it is shared
-       * with another resolvable.
-       *
-       * \param resolvable_id Id of the resolvable. Must exists
-       * \param shared_id The resolvable providing the data
-       * This one is a weak reference, the reader should just
-       * try to look the data there as a hint.
-       * use \ref data::noRecordId to reset the value.
-       *
-       */
-      void setSharedData( const data::RecordId &resolvable_id,
-                          const data::RecordId &shared_id );
-
-      /**
-       * Append a numeric attribute to a resolvable
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param klass Type class i.e "Package" "lang" "kind"
-       * \param name Type name i.e : "size" "media_number"
-       * \param value numeric value
-       */
-      void appendNumericAttribute( const data::RecordId &resolvable_id,
-                                   const std::string &klass,
-                                   const std::string &name,
-                                   int value );
-      /** \overload */
-      void appendNumericAttribute( const data::RecordId &resolvable_id,
-                                   const Attribute& attr,
-                                   int value )
-      { appendNumericAttribute( resolvable_id, attr.klass, attr.name, value ); }
-
-      /**
-       * Append a translated string value to a resolvable
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param klass Type class i.e "Package" "lang" "kind"
-       * \param name Type name i.e : "summary" "none" "Script"
-       * \param text Translated text
-       */
-      void appendTranslatedStringAttribute( const data::RecordId &resolvable_id,
-                                            const std::string &klass,
-                                            const std::string &name,
-                                            const TranslatedText &text );
-      /** \overload */
-      void appendTranslatedStringAttribute( const data::RecordId &resolvable_id,
-                                            const Attribute& attr,
-                                            const TranslatedText &text )
-      { appendTranslatedStringAttribute( resolvable_id, attr.klass, attr.name, text ); }
-
-      /**
-       * Append a string value to a resolvable
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param locale locale of the text language
-       * \param klass Type class i.e "Package" "lang" "kind"
-       * \param name Type name i.e : "summary" "none" "Script"
-       * \param text text
-       */
-      void appendStringAttributeTranslation( const data::RecordId &resolvable_id,
-                                             const Locale &locale,
-                                             const std::string &klass,
-                                             const std::string &name,
-                                             const std::string &text );
-      /** \overload */
-      void appendStringAttributeTranslation( const data::RecordId &resolvable_id,
-                                             const Locale &locale,
-                                             const Attribute& attr,
-                                             const std::string &text )
-      { appendStringAttributeTranslation( resolvable_id, locale, attr.klass, attr.name, text ); }
-
-      /**
-       * Append a string value to a resolvable
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param klass Type class i.e "Package" "lang" "kind"
-       * \param name Type name i.e : "summary" "none" "Script"
-       * \param value string value
-       */
-      void appendStringAttribute( const data::RecordId &resolvable_id,
-                                  const std::string &klass,
-                                  const std::string &name,
-                                  const std::string &value );
-      /** \overload */
-      void appendStringAttribute( const data::RecordId &resolvable_id,
-                                  const Attribute& attr,
-                                  const std::string &value )
-      { appendStringAttribute( resolvable_id, attr.klass, attr.name, value ); }
-
-      /**
-       * Append a string value to a resolvable
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param type_id Type id, \see lookupOrAppendType
-       * \param value string value
-       */
-      void appendStringAttribute( const data::RecordId &resolvable_id,
-                                  const data::RecordId &type_id,
-                                  const std::string &value );
-
-      /**
-       * Append strings from _Iterator to a resolvable.
-       *
-       * Uses \ref zypp::str::split(_Iterator,_Iterator, std::string) with
-       * \ref ZConfig::cacheDBSplitJoinSeparator() as the second argument
-       * (a separator string) of split().
-       *
-       * Any container of any class providing asString() can be used.
-       *
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param klass Type class i.e "Package" "lang" "kind"
-       * \param name Type name i.e : "summary" "none" "Script"
-       * \param begin begin Iterator to the container
-       * \param end end Iterator to the container
-       */
-      template <class _Iterator>
-      void appendStringContainerAttribute( const data::RecordId &resolvable_id,
-                                           const std::string &klass,
-                                           const std::string &name,
-                                           _Iterator begin,
-                                           _Iterator end )
-      {
-        std::string value = str::join(begin, end, ZConfig::instance().cacheDBSplitJoinSeparator());
-        appendStringAttribute( resolvable_id, klass, name, value );
-      }
-      /** \overload */
-      template <class _Iterator>
-      void appendStringContainerAttribute( const data::RecordId &resolvable_id,
-                                           const Attribute& attr,
-                                           _Iterator begin,
-                                           _Iterator end )
-      { appendStringContainerAttribute( resolvable_id, attr.klass, attr.name, begin, end ); }
-
-      /**
-       * Append strings from a _Container to a resolvable.
-       *
-       * Convenience method taking the container instead of it's
-       * begin/end iterators as argument.
-       *
-       * \see appendStringContainerAttribute
-      */
-      template <class _Container>
-      void appendStringContainerAttribute( const data::RecordId &resolvable_id,
-                                           const std::string &klass,
-                                           const std::string &name,
-                                           const _Container & container )
-      {        appendStringContainerAttribute( resolvable_id, klass, name, container.begin(), container.end() ); }
-      /** \overload */
-      template <class _Container>
-      void appendStringContainerAttribute( const data::RecordId &resolvable_id,
-                                           const Attribute& attr,
-                                           const _Container & container )
-      { appendStringContainerAttribute( resolvable_id, attr.klass, attr.name, container ); }
-
-       /**
-       * Update a known repository checksum and timestamp
-       *
-       * \note If you don't provide timestamp it defaults
-       * to now.
-       *
-       * 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 updateRepositoryStatus( const data::RecordId &id,
-                                   const RepoStatus &status );
-
-      /**
-       * \short Clean repository from cache
-       *
-       * \param id repository identifier in cache
-       *
-       * You can check existence using \ref isCached
-       *
-       * \throws CacheRecordNotFoundException if the repository
-       * id does not refer to a valid repository.
-       */
-      void cleanRepository( const data::RecordId &id,
-                            const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
-
-      /**
-       * \short Clean repository from cache
-       *
-       * \param alias Repository unique alias
-       *
-       * You can check existence using \ref isCached
-       *
-       * \throws CacheRecordNotFoundException if the repository
-       * alias does not refer to a valid repository.
-       */
-      void cleanRepository( const std::string &alias,
-                            const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
-
-      /**
-       * 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
-       * be created and the new inserted entry's id will
-       * be returned.
-       */
-      data::RecordId lookupOrAppendFile( const Pathname &path );
-
-      /**
-       * Returns the record id of a name entry \a name
-       *
-       * \note If the name entry does not exist, it will
-       * be created and the new inserted entry's id will
-       * be returned.
-       */
-      data::RecordId lookupOrAppendName( const std::string &name );
-
-      /**
-       * Returns the record id of a directory name  entry \a name
-       *
-       * \note If the directory name entry does not exist, it will
-       * be created and the new inserted entry's id will
-       * be returned.
-       */
-      data::RecordId lookupOrAppendDirName( const std::string &name );
-
-      /**
-       * Returns the record id of a file name entry \a name
-       *
-       * \note If the file name entry does not exist, it will
-       * be created and the new inserted entry's id will
-       * be returned.
-       */
-      data::RecordId lookupOrAppendFileName( const std::string &name );
-
-    protected:
-
-       /**
-       * Appends a solvable to the store.
-       *
-       * You have to specify with \a kind of resolvable are you inserting
-       * and its \c NVRA (name version release and architecture ).
-       * Optionaly you can pass a list of \c CapabilityImpl::Ptr
-       * as dependencies for the resolvable.
-       *
-       * You have to specify the RecordId for the repository owning
-       * this resolvable. Yuu can obtain it with
-       * \ref lookupOrAppendRepository
-       *
-       * You can create those \a deps using \ref capability::parse
-       * functions, or the build methods to create specific types
-       * of capabilities:
-       * \ref capability::buildVersioned for \c VersionedCap
-       * \ref capability::buildNamed for \c NamedCap
-       * etc.
-       *
-       * Once the resolvable is inserted, you will get back the id
-       * if it in the store. Which you can use for later adding
-       * other properties.
-       *
-       */
-      ::_Solvable* appendResolvable( const data::RecordId &repository_id,
-                                     const data::Resolvable_Ptr &res );
-
-    protected:
-      /**
-       * Internally used function that appends a entry in
-       * the capabilities table for a specific capability
-       * entry.
-       */
-//       data::RecordId appendDependencyEntry( const data::RecordId &,
-//                                             zypp::Dep, const Resolvable::Kind & );
-
-      void appendStringAttribute( const data::RecordId &resolvable_id,
-                                  const data::RecordId &lang_id,
-                                  const data::RecordId &type_id,
-                                  const std::string &value );
-
-      /**
-       * Append a numeric attribute to a resolvable
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param type_id attribute id
-       * \param value numeric value
-       */
-      void appendNumericAttribute( const data::RecordId &resolvable_id,
-                                   const data::RecordId &type_id,
-                                   int value );
-
-      /**
-       * Append a bool attribute to a resolvable. Will be stored as
-       * numeric 1 or 0.
-       *
-       * \param resolvable_id Resovable Id, owner of the attribute
-       * \param type_id attribute id
-       * \param value bool value
-       */
-      void appendBooleanAttribute( const data::RecordId & resolvable_id,
-                                   const std::string & klass,
-                                   const std::string & name,
-                                   bool value);
-      /** \overload */
-      void appendBooleanAttribute( const data::RecordId & resolvable_id,
-                                   const Attribute& attr,
-                                   bool value)
-      { appendBooleanAttribute( resolvable_id, attr.klass, attr.name, value ); }
-
-
       /** \name Detail Attributes Inserters
        * These functions are used by ResolvableConsumer interface functions
        * to avoid some duplication across types.
@@ -692,6 +280,12 @@ namespace zypp
                                        const data::Packagebase_Ptr & package);
       //@}
 
+      void cleanRepository( const std::string &alias,
+                            const ProgressData::ReceiverFnc & progressrcv );
+
+      RepoStatus repositoryStatus( const std::string &alias );
+
+      bool isCached( const std::string &alias );
 
     private:
       /** Implementation. */
index 844af577011a3f6a08c1de141764045196c9da8a..29c9cc3044082be80de0dbdc20e9aa235a293471 100644 (file)
@@ -29,14 +29,14 @@ namespace data
     ResolvableDataConsumer();
     virtual ~ResolvableDataConsumer();
 
-    virtual data::RecordId consumePackage      ( const data::RecordId & repository_id, const data::Package_Ptr & ) = 0;
-    virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & ) = 0;
-    virtual data::RecordId consumeProduct      ( const data::RecordId & repository_id, const data::Product_Ptr & ) = 0;
-    virtual data::RecordId consumePatch        ( const data::RecordId & repository_id, const data::Patch_Ptr & ) = 0;
-    virtual data::RecordId consumePackageAtom  ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & ) = 0;
-    virtual data::RecordId consumeMessage      ( const data::RecordId & repository_id, const data::Message_Ptr & ) = 0;
-    virtual data::RecordId consumeScript       ( const data::RecordId & repository_id, const data::Script_Ptr & ) = 0;
-    virtual data::RecordId consumePattern      ( const data::RecordId & repository_id, const data::Pattern_Ptr & ) = 0;
+    virtual data::RecordId consumePackage      ( const std::string & repository_id, const data::Package_Ptr & ) = 0;
+    virtual data::RecordId consumeSourcePackage( const std::string & repository_id, const data::SrcPackage_Ptr & ) = 0;
+    virtual data::RecordId consumeProduct      ( const std::string & repository_id, const data::Product_Ptr & ) = 0;
+    virtual data::RecordId consumePatch        ( const std::string & repository_id, const data::Patch_Ptr & ) = 0;
+    virtual data::RecordId consumePackageAtom  ( const std::string & repository_id, const data::PackageAtom_Ptr & ) = 0;
+    virtual data::RecordId consumeMessage      ( const std::string & repository_id, const data::Message_Ptr & ) = 0;
+    virtual data::RecordId consumeScript       ( const std::string & repository_id, const data::Script_Ptr & ) = 0;
+    virtual data::RecordId consumePattern      ( const std::string & repository_id, const data::Pattern_Ptr & ) = 0;
 
     virtual data::RecordId consumeChangelog    ( const data::RecordId & resolvable_id, const Changelog & ) = 0;
     virtual data::RecordId consumeFilelist     ( const data::RecordId & resolvable_id, const data::Filenames & ) = 0;
index 210f975198b28746b534d40387b7062829ddc31b..b6257927865787cd3a5ef952be5b2b7cbae4520d 100644 (file)
@@ -72,7 +72,7 @@ RepoStatus dirStatus( const Pathname &dir )
 
 data::Package_Ptr makePackageDataFromHeader( const RpmHeader::constPtr header,
                                              set<string> * filerequires,
-                                             const Pathname & location, data::RecordId &repoid )
+                                             const Pathname & location, std::string &repoid )
 {
   if ( ! header )
     return 0;
@@ -130,7 +130,7 @@ data::Package_Ptr makePackageDataFromHeader( const RpmHeader::constPtr header,
 class RepoParser::Impl
 {
   public:
-    Impl( const data::RecordId & repositoryId_r,
+    Impl( const std::string & repositoryId_r,
           data::ResolvableDataConsumer & consumer_r,
           const ProgressData::ReceiverFnc & fnc_r )
     : _repositoryId( repositoryId_r )
@@ -146,7 +146,7 @@ class RepoParser::Impl
   public:
 
   private:
-    data::RecordId                 _repositoryId;
+    std::string                 _repositoryId;
     data::ResolvableDataConsumer & _consumer;
     ProgressData                   _ticks;
     Arch                          _sysarch;
@@ -247,7 +247,7 @@ int RepoParser::Impl::extract_packages_from_directory( const Pathname & path,
 //     METHOD NAME : RepoParser::RepoParser
 //     METHOD TYPE : Ctor
 //
-RepoParser::RepoParser( const data::RecordId & repositoryId_r,
+RepoParser::RepoParser( const std::string & repositoryId_r,
                         data::ResolvableDataConsumer & consumer_r,
                         const ProgressData::ReceiverFnc & fnc_r )
 : _pimpl( new Impl( repositoryId_r, consumer_r, fnc_r ) )
index aa42515660791f2f678a6a715ab7554142c67854..26db6cc86806557bfacdfd50e872c50b5f6ddaf9 100644 (file)
@@ -47,7 +47,7 @@ namespace zypp
         * \param consumer_r consumer of parsed data
         * \param fnc_r progress reporting function
        */
-       RepoParser( const data::RecordId & repositoryId_r,
+       RepoParser( const std::string & repositoryId_r,
                    data::ResolvableDataConsumer & consumer_r,
                    const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
         /** Dtor */
index ec5db04190fc42cfe77cdb5ddddb9756aa5830d7..58b7acdfc2a6bf214b127f8d1cf0a3bc6417c204 100644 (file)
@@ -53,7 +53,7 @@ namespace zypp
       class RepoParser::Impl
       {
        public:
-         Impl( const data::RecordId & repositoryId_r,
+         Impl( const std::string & repositoryId_r,
                data::ResolvableDataConsumer & consumer_r,
                const ProgressData::ReceiverFnc & fnc_r )
          : _repositoryId( repositoryId_r )
@@ -367,7 +367,7 @@ namespace zypp
          }
 
        private:
-         data::RecordId                 _repositoryId;
+         std::string                    _repositoryId;
          data::ResolvableDataConsumer & _consumer;
          ProgressData                   _ticks;
 
@@ -558,7 +558,7 @@ namespace zypp
       //       METHOD NAME : RepoParser::RepoParser
       //       METHOD TYPE : Ctor
       //
-      RepoParser::RepoParser( const data::RecordId & repositoryId_r,
+      RepoParser::RepoParser( const std::string & repositoryId_r,
                              data::ResolvableDataConsumer & consumer_r,
                              const ProgressData::ReceiverFnc & fnc_r )
       : _pimpl( new Impl( repositoryId_r, consumer_r, fnc_r ) )
index 39ec351378da8434edf0ffa9ca56ac212cb30ab5..ea314a950adfd6e327455e57de06f47222d28614 100644 (file)
@@ -71,7 +71,7 @@ namespace zypp
         * \param consumer_r consumer of parsed data
         * \param fnc_r progress reporting function
        */
-       RepoParser( const data::RecordId & repositoryId_r,
+       RepoParser( const std::string &repositoryId_r,
                    data::ResolvableDataConsumer & consumer_r,
                    const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
         /** Dtor */
index d7d0616eead3d1bbfc22ef43c36da3d86fb1fc32..baac158d98987cce7d64208583b4aecf3ee65c1e 100644 (file)
@@ -71,7 +71,7 @@ namespace zypp
   public:
     /** CTOR */
     Impl(
-      const data::RecordId & repository_id,
+      const std::string &repo_id,
       data::ResolvableDataConsumer & consumer,
       const RepoParserOpts & options = RepoParserOpts(),
       const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc()
@@ -158,7 +158,7 @@ namespace zypp
 
   private:
     /** ID of the repository record in the DB (repositories.id) */
-    data::RecordId _repository_id;
+    string _repository_id;
 
     /** Object for processing the read data */
     data::ResolvableDataConsumer & _consumer;
@@ -176,7 +176,7 @@ namespace zypp
 
 
   RepoParser::Impl::Impl(
-      const data::RecordId & repository_id,
+      const std::string & repository_id,
       data::ResolvableDataConsumer & consumer,
       const RepoParserOpts & options,
       const ProgressData::ReceiverFnc & progress)
@@ -460,7 +460,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
 
   RepoParser::RepoParser(
-      const data::RecordId & repository_id,
+      const std::string & repository_id,
       data::ResolvableDataConsumer & consumer,
       const RepoParserOpts & options,
       const ProgressData::ReceiverFnc & progress)
index b68475cea46fde1f6d96e2d8a0029a3837b94cfd..d8b5285af4217e339fbb60f949e7a8f58d5b5de1 100644 (file)
@@ -69,7 +69,7 @@ namespace zypp
      * \param progress progress reporting function
      */
     RepoParser(
-      const data::RecordId & repository_id,
+      const std::string &repo_id,
       data::ResolvableDataConsumer & consumer,
       const RepoParserOpts & options = RepoParserOpts(),
       const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc()