Author: dmacvicar
Date: Tue Jan 15 12:08:05 2008
New Revision: 8286
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8286&view=rev
Log:
- create solv store
- start porting repo manager
- change data classes to use plain strings
- make everything compile again
Added:
branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.cc
branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.h
Modified:
branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt
branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc
branches/tmp/ma/jump_sat/libzypp/zypp/cache/ResolvableQuery.cc
branches/tmp/ma/jump_sat/libzypp/zypp/data/ResolvableData.h
branches/tmp/ma/jump_sat/libzypp/zypp/parser/plaindir/RepoParser.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/ContentFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h
branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PatternFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/RepoParser.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.h
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.h
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.h
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PatchFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PrimaryFileReader.cc
branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/ProductFileReader.cc
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt Tue Jan 15 12:08:05 2008
@@ -917,7 +917,8 @@
cache/Attribute.cc
cache/CacheTypes.cc
cache/ResolvableQuery.cc
- cache/CacheStore.cc
+ #cache/CacheStore.cc
+ cache/SolvStore.cc
cache/CacheFSCK.cc
cache/Utils.cc
)
@@ -928,7 +929,8 @@
cache/CacheTypes.h
cache/CacheInitializer.h
cache/CacheException.h
- cache/CacheStore.h
+ #cache/CacheStore.h
+ cache/SolvStore.h
cache/CacheFSCK.h
cache/ResolvableQuery.h
cache/Utils.h
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc Tue Jan 15 12:08:05 2008
@@ -10,8 +10,10 @@
*
*/
+#include <cstdlib>
#include <iostream>
#include <fstream>
+#include <sstream>
#include <list>
#include <algorithm>
#include "zypp/base/InputStream.h"
@@ -25,7 +27,7 @@
#include "zypp/repo/RepoException.h"
#include "zypp/RepoManager.h"
-#include "zypp/cache/CacheStore.h"
+#include "zypp/cache/SolvStore.h"
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/media/MediaManager.h"
#include "zypp/MediaSetAccess.h"
@@ -33,12 +35,15 @@
#include "zypp/parser/RepoFileReader.h"
#include "zypp/repo/yum/Downloader.h"
#include "zypp/parser/yum/RepoParser.h"
-#include "zypp/parser/plaindir/RepoParser.h"
+//#include "zypp/parser/plaindir/RepoParser.h"
#include "zypp/repo/susetags/Downloader.h"
#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/ZYppCallbacks.h"
+#include "satsolver/pool.h"
+#include "satsolver/repo_solv.h"
+
using namespace std;
using namespace zypp;
using namespace zypp::repo;
@@ -103,10 +108,10 @@
/**
* \short Internal version of clean cache
*
- * Takes an extra CacheStore reference, so we avoid internally
- * having 2 CacheStores writing to the same database.
+ * Takes an extra SolvStore reference, so we avoid internally
+ * having 2 SolvStores writing to the same database.
*/
- static void cleanCacheInternal( cache::CacheStore &store,
+ static void cleanCacheInternal( cache::SolvStore &store,
const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() )
{
@@ -117,17 +122,17 @@
if ( !store.isCached(info.alias()) )
return;
-
+
MIL << info.alias() << " cleaning cache..." << endl;
data::RecordId id = store.lookupRepository(info.alias());
-
+
CombinedProgressData subprogrcv(progress);
-
+
store.cleanRepository(id, subprogrcv);
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Reads RepoInfo's from a repo file.
*
@@ -256,6 +261,7 @@
Impl * clone() const
{ return new Impl( *this ); }
};
+
///////////////////////////////////////////////////////////////////
/** \relates RepoManager::Impl Stream output */
@@ -312,7 +318,7 @@
}
////////////////////////////////////////////////////////////////////////////
-
+
RepoStatus RepoManager::metadataStatus( const RepoInfo &info ) const
{
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
@@ -484,6 +490,7 @@
return refresh;
}
+#if 0
else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
{
RepoStatus newstatus = parser::plaindir::dirStatus(url.getPathName());
@@ -508,6 +515,7 @@
return refresh;
}
+#endif
else
{
ZYPP_THROW(RepoUnknownTypeException());
@@ -519,7 +527,7 @@
ERR << "refresh check failed for " << url << endl;
ZYPP_RETHROW(e);
}
-
+
return true; // default
}
@@ -593,6 +601,7 @@
downloader_ptr->download( media, tmpdir.path());
}
+#if 0
else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
{
RepoStatus newstatus = parser::plaindir::dirStatus(url.getPathName());
@@ -606,6 +615,7 @@
file.close();
}
+#endif
else
{
ZYPP_THROW(RepoUnknownTypeException());
@@ -624,7 +634,7 @@
{
ZYPP_CAUGHT(e);
ERR << "Trying another url..." << endl;
-
+
// remember the exception caught for the *first URL*
// if all other URLs fail, the rexception will be thrown with the
// cause of the problem of the first URL remembered
@@ -655,7 +665,7 @@
assert_alias(info);
Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
- cache::CacheStore store(_pimpl->options.repoCachePath);
+ cache::SolvStore store(_pimpl->options.repoCachePath);
RepoStatus raw_metadata_status = metadataStatus(info);
if ( raw_metadata_status.empty() )
@@ -668,7 +678,7 @@
{
MIL << info.alias() << " is already cached." << endl;
data::RecordId id = store.lookupRepository(info.alias());
- RepoStatus cache_status = store.repositoryStatus(id);
+ RepoStatus cache_status = store.repositoryStatus(info.alias());
if ( cache_status.checksum() == raw_metadata_status.checksum() )
{
@@ -680,7 +690,7 @@
MIL << info.alias() << " cache rebuild is forced" << endl;
}
}
-
+
needs_cleaning = true;
}
@@ -691,7 +701,15 @@
progress.toMin();
if (needs_cleaning)
+ {
+ Pathname name = _pimpl->options.repoCachePath;
+ data::RecordId id = store.lookupRepository(info.alias());
+ ostringstream os;
+ os << id.get();
+ name += os.str() + ".solv";
+ unlink (name);
cleanCacheInternal( store, info);
+ }
MIL << info.alias() << " building cache..." << endl;
data::RecordId id = store.lookupOrAppendRepository(info.alias());
@@ -709,10 +727,31 @@
break;
}
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
+ case RepoType::YAST2_e :
+ {
+ Pathname name = _pimpl->options.repoCachePath;
+ ostringstream os;
+ os << id.get();
+ name += os.str() + ".solv";
+ string cmd = "repo2solv.sh \"";
+ cmd += rawpath.asString() + "\" > " + name.asString();
+ int ret = system (cmd.c_str());
+ if (WIFEXITED (ret) && WEXITSTATUS (ret) != 0)
+ ZYPP_THROW(RepoUnknownTypeException());
+ }
+ break;
+ default:
+ break;
+ }
+
+ switch ( repokind.toEnum() )
+ {
+ case RepoType::RPMMD_e :
+ if (0)
{
CombinedProgressData subprogrcv( progress, 100);
parser::yum::RepoParser parser(id, store, parser::yum::RepoParserOpts(), subprogrcv);
@@ -721,6 +760,7 @@
}
break;
case RepoType::YAST2_e :
+ if (0)
{
CombinedProgressData subprogrcv( progress, 100);
parser::susetags::RepoParser parser(id, store, subprogrcv);
@@ -728,6 +768,7 @@
// no error
}
break;
+#if 0
case RepoType::RPMPLAINDIR_e :
{
CombinedProgressData subprogrcv( progress, 100);
@@ -739,6 +780,7 @@
parser.parse(url.getPathName());
}
break;
+#endif
default:
ZYPP_THROW(RepoUnknownTypeException());
}
@@ -769,7 +811,7 @@
return repo::RepoType::RPMMD;
if ( access.doesFileExist("/content") )
return repo::RepoType::YAST2;
-
+
// if it is a local url of type dir
if ( (! media::MediaManager::downloads(url)) && ( url.getScheme() == "dir" ) )
{
@@ -798,33 +840,33 @@
return repo::RepoType::NONE;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
- cache::CacheStore store(_pimpl->options.repoCachePath);
- cleanCacheInternal( store, info, progressrcv );
- store.commit();
+ Pathname name = _pimpl->options.repoCachePath;
+ name += info.alias() + ".solv";
+ unlink (name);
}
////////////////////////////////////////////////////////////////////////////
bool RepoManager::isCached( const RepoInfo &info ) const
{
- cache::CacheStore store(_pimpl->options.repoCachePath);
- return store.isCached(info.alias());
+ Pathname name = _pimpl->options.repoCachePath;
+ return PathInfo(name + Pathname(info.alias()).extend(".solv")).isExist();
}
RepoStatus RepoManager::cacheStatus( const RepoInfo &info ) const
{
- cache::CacheStore store(_pimpl->options.repoCachePath);
- data::RecordId id = store.lookupRepository(info.alias());
- RepoStatus cache_status = store.repositoryStatus(id);
- return cache_status;
+ Pathname name = _pimpl->options.repoCachePath;
+ return RepoStatus(name + Pathname(info.alias()).extend(".solv"));
}
+ map repo2solv;
+
Repository RepoManager::createFromCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
@@ -833,26 +875,37 @@
progress.sendTo(ProgressReportAdaptor( progressrcv, report ));
//progress.sendTo( progressrcv );
progress.name(str::form(_("Reading repository '%s' cache"), info.name().c_str()));
-
- cache::CacheStore store(_pimpl->options.repoCachePath);
-
- if ( ! store.isCached( info.alias() ) )
+
+ //_pimpl->options.repoCachePath
+ if ( ! isCached( info ) )
ZYPP_THROW(RepoNotCachedException());
MIL << "Repository " << info.alias() << " is cached" << endl;
- data::RecordId id = store.lookupRepository(info.alias());
+ //sat::Pool satpool( sat::Pool::instance() );
+ //Pathname name = _pimpl->options.repoCachePath + Pathname(info.alias()).extend(".solv");
+
+ try
+ {
+ //satpool.addRepoSolv(name);
+ }
+ catch ( const Exception &e )
+ {
+
+ }
+
CombinedProgressData subprogrcv(progress);
-
- repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
- opts.readingResolvablesProgress = subprogrcv;
- repo::cached::RepoImpl::Ptr repoimpl =
- new repo::cached::RepoImpl( opts );
-
- repoimpl->resolvables();
+
+// repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
+// opts.readingResolvablesProgress = subprogrcv;
+// //opts.repo = repo;
+// repo::cached::RepoImpl::Ptr repoimpl =
+// new repo::cached::RepoImpl( opts );
+//
+// repoimpl->resolvables();
// read the resolvables from cache
- return Repository(repoimpl);
+ return Repository::noRepository;
}
////////////////////////////////////////////////////////////////////////////
@@ -1031,7 +1084,7 @@
callback::SendReport<ProgressReport> report;
progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
progress.name(str::form(_("Removing repository '%s'"), info.name().c_str()));
-
+
MIL << "Going to delete repo " << info.alias() << endl;
std::list<RepoInfo> repos = knownRepositories();
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/cache/ResolvableQuery.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/cache/ResolvableQuery.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/cache/ResolvableQuery.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/cache/ResolvableQuery.cc Tue Jan 15 12:08:05 2008
@@ -78,8 +78,8 @@
// see _fields definition above for the getXXX() numbers
ptr->name = reader.getstring(1);
- ptr->edition = Edition( reader.getstring(2), reader.getstring(3), reader.getint(4));
- ptr->arch = _type_cache.archFor(reader.getint(5));
+ //ptr->edition = reader.getstring(2) reader.getstring(3), );
+ ptr->arch = _type_cache.archFor(reader.getint(5)).asString();
ptr->kind = _type_cache.kindFor( reader.getint(6) );
ptr->repository = reader.getint( 12 );
Added: branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.cc?rev=8286&view=auto
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.cc (added)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.cc Tue Jan 15 12:08:05 2008
@@ -0,0 +1,691 @@
+#include <map>
+
+#include "zypp/base/Easy.h"
+#include "zypp/base/LogTools.h"
+#include "zypp/base/Measure.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/ZYpp.h"
+#include "zypp/Package.h"
+#include "zypp/PathInfo.h"
+#include "zypp/cache/SolvStore.h"
+#include "zypp/cache/CacheException.h"
+#include "zypp/cache/CacheAttributes.h"
+
+#include "satsolver/repo.h"
+#include "satsolver/solvable.h"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::capability;
+using namespace zypp::cache;
+using zypp::data::RecordId;
+
+using zypp::debug::Measure;
+
+/** Append OnMediaLocation attributes to resolvable with ID.
+ * \code
+ * appendOnMediaLocation( pkgid, attrPackageLocation, package->repositoryLocation );
+ * \endcode
+ * Pass the OnMediaLocation attributes common prefix as 2nd arg, the OnMediaLocation
+ * object as third arg. This macro assumes that the attribute names follow this schema:
+*/
+#define appendOnMediaLocation(ID,OMLATTRPREFIX,OML) \
+do { \
+ appendNumericAttribute( ID, OMLATTRPREFIX##MediaNr(), OML.medianr() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##Filename(), OML.filename().asString() ); \
+ appendNumericAttribute( ID, OMLATTRPREFIX##DownloadSize(), OML.downloadSize() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##ChecksumType(), OML.checksum().type() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##Checksum(), OML.checksum().checksum() ); \
+ appendNumericAttribute( ID, OMLATTRPREFIX##OpenSize(), OML.openSize() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##OpenChecksumType(), OML.openChecksum().type() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##OpenChecksum(), OML.openChecksum().checksum() );\
+} while(false)
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace cache
+{ /////////////////////////////////////////////////////////////////
+
+struct SolvStore::Impl
+{
+ Impl( const Pathname &solvdir )
+ : name_cache_hits(0)
+ , dir_cache_hits(0)
+ , _last_repoid(0)
+ , _cachedir(solvdir)
+ {
+ _pool = pool_create();
+
+ }
+
+ Impl()
+ {
+ Impl( getZYpp()->homePath() );
+ }
+
+ ~Impl()
+ {
+ MIL << "name cache hits: " << name_cache_hits << " | cache size: " << name_cache.size() << endl;
+ pool_free(_pool);
+ }
+
+ map name_cache;
+ map< pair, RecordId> type_cache;
+ map dir_cache;
+ int name_cache_hits;
+ int dir_cache_hits;
+
+ _Pool *_pool;
+
+ map _id2repo;
+ map _name2repoid;
+ RecordId _last_repoid;
+ Pathname _cachedir;
+};
+
+
+SolvStore::SolvStore( const Pathname &solvdir )
+ : _pimpl( new Impl(solvdir) )
+{
+
+}
+
+SolvStore::SolvStore()
+ : _pimpl( new Impl() )
+{
+
+}
+
+SolvStore::~SolvStore()
+{
+
+}
+
+void SolvStore::commit()
+{
+ // NOOP
+}
+
+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 );
+}
+
+
+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,
+ 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 SolvStore::consumeSourcePackage( const data::RecordId & 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 SolvStore::consumePatch( const data::RecordId & 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 (setdata::ResObject_Ptr::const_iterator p = patch->atoms.begin();
+ p != patch->atoms.end(); ++p)
+ {
+ data::PackageAtom_Ptr atom = dynamic_pointer_castdata::PackageAtom(*p);
+ if (atom)
+ {
+ DBG << atom->name << "(atom) ";
+ consumePackageAtom(repository_id, atom);
+ continue;
+ }
+
+ data::Script_Ptr script = dynamic_pointer_castdata::Script(*p);
+ if (script)
+ {
+ DBG << script->name << "(script) ";
+ consumeScript(repository_id, script);
+ continue;
+ }
+
+ data::Message_Ptr message = dynamic_pointer_castdata::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;
+}
+
+RecordId SolvStore::consumePackageAtom( const data::RecordId & 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 (setdata::PatchRpm_Ptr::const_iterator p = atom->patchRpms.begin();
+ p != atom->patchRpms.end(); ++p)
+ appendPatchRpm(repository_id, *p);
+
+ for (setdata::DeltaRpm_Ptr::const_iterator d = atom->deltaRpms.begin();
+ d != atom->deltaRpms.end(); ++d)
+ appendDeltaRpm(repository_id, *d);
+ return id;
+}
+
+RecordId SolvStore::consumeMessage( const data::RecordId & 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 SolvStore::consumeScript( const data::RecordId & 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 SolvStore::consumePattern( const data::RecordId & 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 );
+
+ // 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() );
+
+ return id;
+}
+
+RecordId SolvStore::consumeProduct( const data::RecordId & 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 SolvStore::consumeChangelog( const data::RecordId &resolvable_id,
+ const Changelog & changelog )
+{
+ //! \todo maybe appendChangelog(const data::RecordId & resolvable_id, Changelog changelog) will be needed
+ //! for inserting the changelog using in-memory record id of corresponding resolvable.
+ //! (first, we'll see how fast is the inserting without remembering those ids)
+ return data::noRecordId;
+}
+
+RecordId SolvStore::consumeFilelist( const data::RecordId &resolvable_id,
+ const data::Filenames & filenames )
+{
+ //! \todo maybe consumeFilelist(const data::RecordId & resolvable_id, data::Filenames &) will be needed
+ return data::noRecordId;
+}
+
+void SolvStore::consumeDiskUsage( const data::RecordId &resolvable_id,
+ const DiskUsage &disk )
+{
+ // iterate over entries
+ for ( DiskUsage::const_iterator it = disk.begin();
+ it != disk.end();
+ ++it )
+ {
+
+ }
+ //MIL << "disk usage for " << resolvable_id << " consumed" << endl;
+}
+
+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 );
+}
+
+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, zypp::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, zypp::Dep deptype, capability::CapabilityImpl::Ptr cap )
+{
+ if ( cap == 0 )
+ {
+ DBG << "invalid capability" << endl;
+ return;
+ }
+
+ if ( capability::isKind<NamedCap>(cap) )
+ {
+ appendNamedDependency( resolvable_id, deptype, capability::asKind<NamedCap>(cap) );
+ }
+ else if ( capability::isKind<FileCap>(cap) )
+ {
+ appendFileDependency( resolvable_id, deptype, capability::asKind<FileCap>(cap) );
+ return;
+ }
+ else if ( capability::isKind<ModaliasCap>(cap) )
+ {
+ appendModaliasDependency( resolvable_id, deptype, capability::asKind<ModaliasCap>(cap) );
+ }
+ else if ( capability::isKind<HalCap>(cap) )
+ {
+ appendHalDependency( resolvable_id, deptype, capability::asKind<HalCap>(cap) );
+ }
+ else if ( capability::isKind<FilesystemCap>(cap) )
+ {
+ appendFilesystemDependency( resolvable_id, deptype, capability::asKind<FilesystemCap>(cap) );
+ }
+ else if ( capability::isKind<SplitCap>(cap) )
+ {
+ appendSplitDependency( resolvable_id, deptype, capability::asKind<SplitCap>(cap) );
+ }
+ else
+ {
+ appendUnknownDependency( resolvable_id, deptype, cap );
+ }
+}
+
+
+void SolvStore::appendNamedDependency( const RecordId &resolvable_id, zypp::Dep deptype, capability::NamedCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("bad versioned dep"));
+
+}
+
+void SolvStore::appendModaliasDependency( const RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::ModaliasCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null modalias capability"));
+}
+
+void SolvStore::appendHalDependency( const RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::HalCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null HAL capability"));
+}
+
+void SolvStore::appendFileDependency( const RecordId &resolvable_id, zypp::Dep deptype,
+ capability::FileCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null file capability"));
+}
+
+void SolvStore::appendFilesystemDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::FilesystemCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("bad versioned dep"));
+}
+
+
+void SolvStore::appendSplitDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::SplitCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("bad versioned dep"));
+ //DBG << "versioned : " << cap << endl;
+}
+
+void SolvStore::appendUnknownDependency( const RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::CapabilityImpl::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null unknown capability"));
+}
+
+
+/** \todo lookupOrAppend ? */
+RecordId SolvStore::appendPatchRpm(const zypp::data::RecordId &repository_id, const data::PatchRpm_Ptr & prpm)
+{
+ RecordId id;
+return id;
+}
+
+
+/** \todo lookupOrAppend ? */
+RecordId SolvStore::appendDeltaRpm(const zypp::data::RecordId &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::const_iterator it = _pimpl->_name2repoid.find(alias);
+ if (it == _pimpl->_name2repoid.end())
+ {
+ _pimpl->_name2repoid[alias] = ++_pimpl->_last_repoid;
+ }
+ 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 )
+{
+ // just delete the solv file
+ Pathname file( (_pimpl->_cachedir + alias).extend(".solv") );
+ filesystem::unlink(file);
+}
+
+RepoStatus SolvStore::repositoryStatus( const string &alias )
+{
+ return RepoStatus();
+}
+
+bool SolvStore::isCached( const string &alias )
+{
+ return _pimpl->_name2repoid.find(alias) != _pimpl->_name2repoid.end();
+}
+
+RecordId SolvStore::lookupRepository( const string &alias )
+{
+ map::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;
+}
+
+}
+}
+
Added: branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.h?rev=8286&view=auto
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.h (added)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.h Tue Jan 15 12:08:05 2008
@@ -0,0 +1,826 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_SolvStore_H
+#define ZYPP_SolvStore_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/Pathname.h"
+#include "zypp/ZConfig.h"
+#include "zypp/capability/CapabilityImpl.h"
+#include "zypp/capability/Capabilities.h"
+
+#include "zypp/data/ResolvableDataConsumer.h"
+#include "zypp/data/RecordId.h"
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/RepoStatus.h"
+#include "zypp/ProgressData.h"
+#include "zypp/cache/Attribute.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace cache
+ { /////////////////////////////////////////////////////////////////
+
+ struct _NVRA
+ {
+ _NVRA( const std::string p_name = std::string(),
+ const std::string p_version = std::string(),
+ const std::string p_release = std::string(),
+ const std::string p_arch = std::string() )
+ : name(p_name), version(p_version), release(p_release), arch(p_arch)
+ {}
+ std::string name;
+ std::string version;
+ std::string release;
+ std::string arch;
+ };
+
+ /**
+ * The cache store caches resolvable data.
+ *
+ * \code
+ * SolvStore store("/path");
+ * RecordId repository_id =
+ * store.lookupOrAppendRepository("some-alias");
+ * store.consumePackage( repository_id, package_ptr );
+ * store.commit();
+ * \endcode
+ *
+ * \note Data will not be commited until you explicitely commit.
+ */
+ class SolvStore : public data::ResolvableDataConsumer
+ {
+ public:
+
+ SolvStore();
+ virtual ~SolvStore();
+
+ /**
+ * Constructor for the SolvStore
+ *
+ * \note a transaction will be started from the moment the
+ * SolvStore is instanciated.
+ *
+ * The data will be saved in the directory specified in
+ * \a dbdir. \a dbdir must exist.
+ */
+ SolvStore( const Pathname &dbdir );
+
+ /**
+ * Commit the changes.
+ */
+ void commit();
+
+ /** \name Implementation of the \ref ResolvableDataConsumer interface. */
+ //@{
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume a package, inserting it in the cache, under
+ * \param repository_id ownership.
+ * \param package Package data
+ */
+ virtual data::RecordId consumePackage(const data::RecordId &repository_id,
+ const data::Package_Ptr & package);
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume a source package, inserting it in the cache, under
+ * \param catalog_id ownership.
+ * \param srcpackage Source package data
+ */
+ virtual data::RecordId consumeSourcePackage( const data::RecordId &catalog_id,
+ const data::SrcPackage_Ptr & srcpackage );
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume a patch, inserting it in the cache, under
+ * \param repository_id ownership.
+ * \param patch Patch data
+ */
+ virtual data::RecordId consumePatch( const data::RecordId &repository_id,
+ const data::Patch_Ptr & patch );
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface.
+ *
+ * Consume a package atom, inserting it in the cache, under
+ * \a repository_id ownership.
+ *
+ * \param repository_id record id of repository to which to append the resolvable.
+ * \param atom package atom data
+ *
+ * \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,
+ const data::PackageAtom_Ptr & atom );
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume a message, inserting it in the cache, under
+ * \param repository_id ownership.
+ * \param message Message data
+ */
+ virtual data::RecordId consumeMessage( const data::RecordId & repository_id,
+ const data::Message_Ptr & message);
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume a script, inserting it in the cache, under
+ * \param repository_id ownership.
+ * \param script Script data
+ */
+ virtual data::RecordId consumeScript( const data::RecordId & repository_id,
+ const data::Script_Ptr & script);
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume a pattern, inserting it in the cache, under
+ * \param repository_id ownership.
+ * \param pattern Pattern data
+ */
+ virtual data::RecordId consumePattern( const data::RecordId & repository_id,
+ const data::Pattern_Ptr & pattern );
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume a product, inserting it in the cache, under
+ * \param repository_id ownership.
+ * \param pattern Pattern data
+ */
+ virtual data::RecordId consumeProduct( const data::RecordId &repository_id,
+ const data::Product_Ptr & product );
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume changelog of a resolvable, inserting it in the cache.
+ * \param repository_id ownership.
+ * \param resolvable resolvable for which the changelog data are to be saved
+ * \param changelog the changelog
+ * \todo see implementation
+ */
+ virtual data::RecordId consumeChangelog( const data::RecordId & resolvable_id,
+ const Changelog & changelog );
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume filelist of a resolvable, inserting it in the cache.
+ * \param repository_id ownership.
+ * \param resolvable resolvable for which the filelist is to be saved
+ * \param filenames list of filenames the resolvable contains
+ * \todo see implementation
+ */
+ virtual data::RecordId consumeFilelist( const data::RecordId & resolvable_id,
+ const data::Filenames & filenames );
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Consume disk usage of a resolvable, inserting it in the cache.
+ *
+ * Repeated entries are updated (replaced)
+ *
+ * \param repository_id ownership.
+ * \param resolvable resolvable for which the filelist is to be saved
+ * \param disk Disk usage object
+ * \todo see implementation
+ */
+ virtual void consumeDiskUsage( const data::RecordId &resolvable_id,
+ const DiskUsage &disk );
+
+
+ /**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Update a packages language specific data (summary, description,
+ * EULA, ins/delnotify).
+ * \param resolvable_id resolvable to be updated
+ * \param data_r Package data
+ */
+ virtual void updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r );
+ //@}
+ public:
+ /**
+ * Appends a resolvable 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.
+ *
+ */
+ 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,
+ zypp::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,
+ zypp::Dep deptype,
+ capability::CapabilityImpl::Ptr cap );
+
+ /**
+ * Adds a Named dependency to the store.
+ *
+ * A \ref NamedCap::Ptr \a dlist 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
+ *
+ * You can create the named capability using either
+ * \ref capability::parse or \ref capability::buildNamed
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendNamedDependency( const data::RecordId &, zypp::Dep,
+ capability::NamedCap::Ptr);
+
+ /**
+ * Adds a file dependency to the store.
+ *
+ * A \ref FileCap::Ptr \a dlist 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
+ *
+ * You can create the file capability using either
+ * \ref capability::parse or \ref capability::buildFile
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendFileDependency( const data::RecordId &, zypp::Dep,
+ capability::FileCap::Ptr);
+
+ /**
+ * Adds a Modalias dependency to the store.
+ *
+ * A \ref ModaliasCap::Ptr \a cap 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
+ *
+ * You can create the modalias capability using either
+ * \ref capability::parse or \ref capability::buildModalias
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendModaliasDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::ModaliasCap::Ptr cap);
+
+ /**
+ * Adds a Hal dependency to the store.
+ *
+ * A \ref HalCap::Ptr \a cap 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
+ *
+ * You can create the modalias capability using either
+ * \ref capability::parse or \ref capability::buildHal
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendHalDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::HalCap::Ptr cap );
+
+ /**
+ * Adds a Filesystem dependency to the store.
+ *
+ * A \ref FilesystemCap::Ptr \a cap 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
+ *
+ * You can create the filesystem capability using either
+ * \ref capability::parse or \ref capability::buildFilesystem
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendFilesystemDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::FilesystemCap::Ptr cap );
+
+ /**
+ * Adds a split dependency to the store.
+ *
+ * A \ref SplitCap::Ptr \a cap 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
+ *
+ * You can create the filesystem capability using either
+ * \ref capability::parse or \ref capability::buildSplit
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendSplitDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::SplitCap::Ptr cap );
+
+ /**
+ * Adds a unknown dependency to the store.
+ *
+ * A \ref Capability::Ptr \a cap 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
+ *
+ * You can create the capability using either
+ * \ref capability::parse
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendUnknownDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::CapabilityImpl::Ptr cap );
+
+ /**
+ * Insert patch RPM data into <tt>patch_packages</tt> table.
+ *
+ * \param prpm The patch RPM object to insert.
+ * \return Record ID of the newly inserted record.
+ */
+ data::RecordId appendPatchRpm( const data::RecordId &repo_id,
+ const data::PatchRpm_Ptr & prpm);
+
+
+ /**
+ * Insert delta RPM data into <tt>delta_packages</tt> table.
+ *
+ * \param drpm The delta RPM object to insert.
+ * \return Record ID of the newly inserted record.
+ */
+ data::RecordId appendDeltaRpm( const data::RecordId &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)
+ *
+ * \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 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:
+ /**
+ * 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.
+ */
+ //@{
+ void appendResObjectAttributes( const data::RecordId &rid,
+ const data::ResObject_Ptr & res );
+
+ void appendPackageBaseAttributes(const data::RecordId & pkgid,
+ const data::Packagebase_Ptr & package);
+ //@}
+
+
+ private:
+ /** Implementation. */
+ class Impl;
+ /** Pointer to implementation. */
+ RW_pointer<Impl> _pimpl;
+ };
+ }
+}
+
+#endif
+
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/data/ResolvableData.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/data/ResolvableData.h?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/data/ResolvableData.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/data/ResolvableData.h Tue Jan 15 12:08:05 2008
@@ -64,9 +64,9 @@
/** Name */
std::string name;
/** Edition */
- Edition edition;
+ std::string edition;
/** Architecture */
- Arch arch;
+ std::string arch;
/** Dependencies */
Dependencies deps;
};
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/plaindir/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/plaindir/RepoParser.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/plaindir/RepoParser.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/plaindir/RepoParser.cc Tue Jan 15 12:08:05 2008
@@ -87,9 +87,7 @@
pkg->name = header->tag_name();
try {
- pkg->edition = Edition( header->tag_version(),
- header->tag_release(),
- header->tag_epoch());
+ pkg->edition = header->tag_epoch() + ":" + header->tag_version() + "-" + header->tag_release();
}
catch (Exception & excpt_r) {
ZYPP_CAUGHT( excpt_r );
@@ -102,7 +100,7 @@
Arch arch;
try {
- pkg->arch = Arch( header->tag_arch() );
+ pkg->arch = header->tag_arch();
}
catch (Exception & excpt_r) {
ZYPP_CAUGHT( excpt_r );
@@ -248,7 +246,7 @@
#warning FIX creation of Package from src.rpm header
data::Package_Ptr package = makePackageDataFromHeader( header, NULL, *it, _repositoryId );
if (package != NULL) {
- if (package->arch.compatibleWith(_sysarch))
+ if (Arch(package->arch).compatibleWith(_sysarch))
{
DBG << "Adding package " << *package << endl;
_consumer.consumePackage( _repositoryId, package );
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/ContentFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/ContentFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/ContentFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/ContentFileReader.cc Tue Jan 15 12:08:05 2008
@@ -346,10 +346,10 @@
// ARCH.xxx tag is better than the current product arch
// and still compatible with the sysarch.
Arch carch( modifier );
- if ( Arch::compare( _pimpl->product().arch, carch ) < 0
+ if ( Arch::compare( Arch(_pimpl->product().arch), carch ) < 0
&& carch.compatibleWith( sysarch ) )
{
- _pimpl->product().arch = carch;
+ _pimpl->product().arch = modifier;
}
}
else if ( key == "DISTPRODUCT" )
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/FileReaderBaseImpl.h Tue Jan 15 12:08:05 2008
@@ -36,16 +36,16 @@
inline std::string makeSharedIdent( ResKind kind_r,
const std::string & name_r,
- const Edition & edition_r,
- const Arch & arch_r )
+ const std::string & edition_r,
+ const std::string & arch_r )
{
std::string ret( kind_r.asString() );
ret += ":";
ret += name_r;
ret += "-";
- ret += edition_r.asString();
+ ret += edition_r;
ret += ".";
- ret += arch_r.asString();
+ ret += arch_r;
return ret;
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc Tue Jan 15 12:08:05 2008
@@ -109,10 +109,10 @@
++_c_pkg;
_data = _pkgData = new data::Package;
_srcpkgData = 0;
- _data->arch = Arch( words[3] );
+ _data->arch = words[3];
}
_data->name = words[0];
- _data->edition = Edition( words[1],words[2] );
+ _data->edition = words[1] + "-" + words[2];
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesFileReader.cc Tue Jan 15 12:08:05 2008
@@ -60,7 +60,7 @@
_data = 0;
// Filter unwanted stuff
if ( ret
- && ! ret->arch.compatibleWith( _sysarch ) )
+ && ! Arch(ret->arch).compatibleWith( _sysarch ) )
{
return 0;
}
@@ -102,10 +102,10 @@
++_c_pkg;
_data = _pkgData = new data::Package;
_srcpkgData = 0;
- _data->arch = Arch( words[3] );
+ _data->arch = words[3];
}
_data->name = words[0];
- _data->edition = Edition( words[1],words[2] );
+ _data->edition = words[1] + "-" + words[2];
}
/** Consume =Cks:. */
@@ -167,7 +167,7 @@
switch ( str::split( tag_r->value, std::back_inserter(words) ) )
{
case 2: // [medianr filename]
- _data->repositoryLocation.setLocation( Pathname(_data->arch.asString()) / words[1],
+ _data->repositoryLocation.setLocation( Pathname(_data->arch) / words[1],
str::strtonum<unsigned>(words[0]) );
break;
@@ -210,15 +210,15 @@
{
_data->sharedDataTag = makeSharedIdent( ResTraits<SrcPackage>::kind,
words[0],
- Edition( words[1], words[2] ),
- Arch() );
+ words[1] + "-" + words[2],
+ "" );
}
else
{
_data->sharedDataTag = makeSharedIdent( ResTraits<Package>::kind,
words[0],
- Edition( words[1], words[2] ),
- Arch( words[3] ) );
+ words[1] + "-" + words[2],
+ words[3] );
}
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc Tue Jan 15 12:08:05 2008
@@ -96,10 +96,10 @@
++_c_pkg;
_data = _pkgData = new data::Package;
_srcpkgData = 0;
- _data->arch = Arch( words[3] );
+ _data->arch = words[3];
}
_data->name = words[0];
- _data->edition = Edition( words[1],words[2] );
+ _data->edition = words[1] + "-" + words[2];
}
/** Consume =Sum:. */
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PatternFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PatternFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PatternFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/PatternFileReader.cc Tue Jan 15 12:08:05 2008
@@ -70,8 +70,8 @@
_data = new data::Pattern;
_data->name = words[0];
- _data->edition = Edition( words[1],words[2] );
- _data->arch = Arch( words[3] );
+ _data->edition = words[1] + "-" + words[2];
+ _data->arch = words[3];
}
/** Consume =Sum:. */
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/RepoParser.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/RepoParser.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/susetags/RepoParser.cc Tue Jan 15 12:08:05 2008
@@ -116,7 +116,7 @@
idMapAdd( makeSharedIdent( ResTraits<SrcPackage>::kind,
data_r->name,
data_r->edition,
- data_r->arch ),
+ data_r->arch),
newid );
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc Tue Jan 15 12:08:05 2008
@@ -81,16 +81,17 @@
// package_ptr will point to a SrcPackage from now on
package_ptr.swap(srcpkg);
}
- package_ptr->arch = Arch(arch);
+ package_ptr->arch.swap(arch);
return true;
}
// xpath: //package/version
if (reader_r->name() == "version")
{
- package_ptr->edition = Edition(reader_r->getAttribute("ver").asString(),
- reader_r->getAttribute("rel").asString(),
- reader_r->getAttribute("epoch").asString());
+ if (reader_r->getAttribute("epoch").asString().empty());
+ package_ptr->edition += (reader_r->getAttribute("epoch").asString()+":");
+
+ package_ptr->edition += ( reader_r->getAttribute("ver").asString() + "-" + reader_r->getAttribute("rel").asString() );
return true;
}
@@ -188,6 +189,17 @@
return true;
}
+ bool FileReaderBase::BaseImpl::editionStringFromAttrs( xml::Reader & reader_r, string &edition )
+ {
+ string result;
+ if ( ! reader_r->getAttribute("epoch").asString().empty() )
+ result += (reader_r->getAttribute("epoch").asString() + ":");
+
+ result += reader_r->getAttribute("ver").asString();
+ result += ( "-" + reader_r->getAttribute("ver").asString());
+ result.swap(edition);
+ return true;
+ }
// --------------( consume <format> tag )------------------------------------
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.h?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FileReaderBaseImpl.h Tue Jan 15 12:08:05 2008
@@ -120,6 +120,8 @@
bool consumeDependency(xml::Reader & reader_r, data::Dependencies & deps_r);
+ bool editionStringFromAttrs( xml::Reader & reader_r, std::string &edition );
+
public:
/** Appends \a tag to \ref _tagpath. */
void tag(const Tag tag) { _tagpath.append(tag); }
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.cc Tue Jan 15 12:08:05 2008
@@ -14,6 +14,7 @@
#include "zypp/base/UserRequestException.h"
#include "zypp/parser/yum/FilelistsFileReader.h"
+#include "zypp/parser/yum/FileReaderBaseImpl.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "parser::yum"
@@ -33,7 +34,7 @@
//
// CLASS NAME : FilelistsFileReader::Impl
//
- class FilelistsFileReader::Impl : private base::NonCopyable
+ class FilelistsFileReader::Impl : public BaseImpl
{
public:
Impl(
@@ -130,7 +131,7 @@
_filenames.clear();
_resolvable->name = reader_r->getAttribute("name").asString();
- _resolvable->arch = Arch(reader_r->getAttribute("arch").asString());
+ _resolvable->arch = reader_r->getAttribute("arch").asString();
return true;
}
@@ -138,9 +139,7 @@
// xpath: /filelists/package/version
if (reader_r->name() == "version")
{
- _resolvable->edition = Edition(reader_r->getAttribute("ver").asString(),
- reader_r->getAttribute("rel").asString(),
- reader_r->getAttribute("epoch").asString());
+ editionStringFromAttrs( reader_r, _resolvable->edition );
return true;
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.h?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/FilelistsFileReader.h Tue Jan 15 12:08:05 2008
@@ -19,6 +19,8 @@
#include "zypp/ProgressData.h"
+#include "zypp/parser/yum/FileReaderBase.h"
+
namespace zypp
{
namespace parser
@@ -42,7 +44,7 @@
* bind(&SomeClass::callbackfunc, &SomeClassInstance, _1, _2));
* \endcode
*/
- class FilelistsFileReader : private base::NonCopyable
+ class FilelistsFileReader : FileReaderBase
{
public:
/**
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.cc Tue Jan 15 12:08:05 2008
@@ -16,6 +16,7 @@
#include "zypp/base/UserRequestException.h"
#include "zypp/parser/yum/OtherFileReader.h"
+#include "zypp/parser/yum/FileReaderBaseImpl.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "parser::yum"
@@ -35,7 +36,7 @@
//
// CLASS NAME : OtherFileReader::Impl
//
- class OtherFileReader::Impl : private base::NonCopyable
+ class OtherFileReader::Impl : public BaseImpl
{
public:
Impl(
@@ -131,7 +132,7 @@
_changelog.clear();
_resolvable->name = reader_r->getAttribute("name").asString();
- _resolvable->arch = Arch(reader_r->getAttribute("arch").asString());
+ _resolvable->arch = reader_r->getAttribute("arch").asString();
return true;
}
@@ -139,9 +140,7 @@
// xpath: /otherdata/package/version
if (reader_r->name() == "version")
{
- _resolvable->edition = Edition(reader_r->getAttribute("ver").asString(),
- reader_r->getAttribute("rel").asString(),
- reader_r->getAttribute("epoch").asString());
+ editionStringFromAttrs( reader_r, _resolvable->edition );
return true;
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.h?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/OtherFileReader.h Tue Jan 15 12:08:05 2008
@@ -16,9 +16,11 @@
#include "zypp/base/NonCopyable.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/base/Function.h"
-
#include "zypp/ProgressData.h"
+#include "zypp/parser/yum/FileReaderBase.h"
+
+
namespace zypp
{
namespace parser
@@ -42,7 +44,7 @@
* bind(&SomeClass::callbackfunc, &SomeClassInstance, _1, _2));
* \endcode
*/
- class OtherFileReader : private base::NonCopyable
+ class OtherFileReader : FileReaderBase
{
public:
/**
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PatchFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PatchFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PatchFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PatchFileReader.cc Tue Jan 15 12:08:05 2008
@@ -235,9 +235,7 @@
// xpath: /patch/yum:version
if (reader_r->name() == "yum:version")
{
- _patch->edition = Edition(reader_r->getAttribute("ver").asString(),
- reader_r->getAttribute("rel").asString(),
- reader_r->getAttribute("epoch").asString());
+ editionStringFromAttrs( reader_r, _patch->edition );
return true;
}
@@ -482,14 +480,14 @@
data::PatchRpm_Ptr tmp;
tmp.swap(_patchrpm);
data::PackageAtom_Ptr patom_ptr = zypp::dynamic_pointer_castdata::PackageAtom(_tmpResObj);
- if (patom_ptr && patom_ptr->arch.compatibleWith( ZConfig::instance().systemArchitecture() ))
+ if (patom_ptr && Arch(patom_ptr->arch).compatibleWith( ZConfig::instance().systemArchitecture() ))
{
// Patch and delta rpms are standalone objects.
// We must store the target packages NVRA.
// We don't store incompatible archs.
tmp->name = patom_ptr->name;
- tmp->edition = patom_ptr->edition;
- tmp->arch = patom_ptr->arch;
+ tmp->edition = Edition(patom_ptr->edition);
+ tmp->arch = Arch(patom_ptr->arch);
patom_ptr->patchRpms.insert(tmp);
}
toParentTag();
@@ -502,14 +500,14 @@
data::DeltaRpm_Ptr tmp;
tmp.swap(_deltarpm);
data::PackageAtom_Ptr patom_ptr = zypp::dynamic_pointer_castdata::PackageAtom(_tmpResObj);
- if (patom_ptr && patom_ptr->arch.compatibleWith( ZConfig::instance().systemArchitecture() ))
+ if (patom_ptr && Arch(patom_ptr->arch).compatibleWith( ZConfig::instance().systemArchitecture() ))
{
// Patch and delta rpms are standalone objects.
// We must store the target packages NVRA.
// We don't store incompatible archs.
tmp->name = patom_ptr->name;
- tmp->edition = patom_ptr->edition;
- tmp->arch = patom_ptr->arch;
+ tmp->edition = Edition(patom_ptr->edition);
+ tmp->arch = Arch(patom_ptr->arch);
patom_ptr->deltaRpms.insert(tmp);
}
toParentTag();
@@ -713,9 +711,7 @@
// xpath: /patch/atoms/message/yum:name
if (reader_r->name() == "yum:version")
{
- _tmpResObj->edition = Edition(reader_r->getAttribute("ver").asString(),
- reader_r->getAttribute("rel").asString(),
- reader_r->getAttribute("epoch").asString());
+ editionStringFromAttrs( reader_r, _tmpResObj->edition );
return true;
}
@@ -769,9 +765,7 @@
// xpath: /patch/atoms/script/yum:version
if (reader_r->name() == "yum:version")
{
- _tmpResObj->edition = Edition(reader_r->getAttribute("ver").asString(),
- reader_r->getAttribute("rel").asString(),
- reader_r->getAttribute("epoch").asString());
+ editionStringFromAttrs( reader_r, _tmpResObj->edition );
return true;
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PrimaryFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PrimaryFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PrimaryFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/PrimaryFileReader.cc Tue Jan 15 12:08:05 2008
@@ -150,7 +150,7 @@
if (reader_r->name() == "package")
{
if (_package && _callback
- && _package->arch.compatibleWith( _sysarch ))
+ && Arch(_package->arch).compatibleWith( _sysarch ))
{
_callback(handoutPackage());
}
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/ProductFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/ProductFileReader.cc?rev=8286&r1=8285&r2=8286&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/ProductFileReader.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/parser/yum/ProductFileReader.cc Tue Jan 15 12:08:05 2008
@@ -128,9 +128,7 @@
// xpath: /products/product/version
if (reader_r->name() == "version")
{
- _product->edition = Edition(reader_r->getAttribute("ver").asString(),
- reader_r->getAttribute("rel").asString(),
- reader_r->getAttribute("epoch").asString());
+ editionStringFromAttrs( reader_r, _product->edition );
}
// xpath: /products/product/displayname (+)
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org