Author: dmacvicar
Date: Thu Jun 14 18:20:26 2007
New Revision: 5754
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5754&view=rev
Log:
backup, fix cache store exceptions (not all) and reworking of package
download and delta rpm handling
Added:
trunk/libzypp/zypp/cache/CacheStore.cpp
trunk/libzypp/zypp/repo/DeltaCandidates.cc
trunk/libzypp/zypp/repo/DeltaCandidates.h
trunk/libzypp/zypp/repo/RepoProvideFile.cc
trunk/libzypp/zypp/repo/RepoProvideFile.h
Modified:
trunk/libzypp/devel/devel.ma/CMakeLists.txt
trunk/libzypp/devel/devel.ma/Parse.cc
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/Repository.cc
trunk/libzypp/zypp/Repository.h
trunk/libzypp/zypp/cache/CacheStore.h
trunk/libzypp/zypp/repo/PackageProvider.cc
trunk/libzypp/zypp/repo/PackageProvider.h
trunk/libzypp/zypp/repo/RepositoryImpl.cc
trunk/libzypp/zypp/repo/RepositoryImpl.h
Modified: trunk/libzypp/devel/devel.ma/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/CMakeLists.txt?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.ma/CMakeLists.txt Thu Jun 14 18:20:26 2007
@@ -44,7 +44,7 @@
${loop_var}.cc
)
TARGET_LINK_LIBRARIES( ${loop_var}
- zypp zypp2
+ zypp
)
ENDFOREACH( loop_var )
Modified: trunk/libzypp/devel/devel.ma/Parse.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Parse.cc?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Parse.cc (original)
+++ trunk/libzypp/devel/devel.ma/Parse.cc Thu Jun 14 18:20:26 2007
@@ -202,7 +202,7 @@
Pathname reporoot( "lmd" );
cache::CacheStore store( dbdir );
- data::RecordId repositoryId = store.lookupOrAppendRepository( Url("dir:///"), "/" );
+ data::RecordId repositoryId = store.lookupOrAppendRepository("foo");
{
Measure x( "XXXXXXXXXXXXX" );
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Thu Jun 14 18:20:26 2007
@@ -1059,12 +1059,18 @@
repo/RepositoryImpl.cc
repo/RepoException.cc
repo/RepoType.cc
+ repo/PackageProvider.cc
+ repo/RepoProvideFile.cc
+ repo/DeltaCandidates.cc
)
SET( zypp_repo_HEADERS
repo/RepositoryImpl.h
repo/RepoException.h
repo/RepoType.h
+ repo/PackageProvider.h
+ repo/RepoProvideFile.h
+ repo/DeltaCandidates.h
)
INSTALL( FILES
Modified: trunk/libzypp/zypp/Repository.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.cc?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/Repository.cc (original)
+++ trunk/libzypp/zypp/Repository.cc Thu Jun 14 18:20:26 2007
@@ -51,5 +51,18 @@
return _pimpl->info();
}
+ const std::listpackagedelta::PatchRpm &
+ Repository::patchRpms() const
+ {
+ return _pimpl->patchRpms();
+ }
+
+ const std::listpackagedelta::DeltaRpm &
+ Repository::deltaRpms() const
+ {
+ return _pimpl->deltaRpms();
+ }
+
+
}
Modified: trunk/libzypp/zypp/Repository.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Repository.h?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/Repository.h (original)
+++ trunk/libzypp/zypp/Repository.h Thu Jun 14 18:20:26 2007
@@ -31,13 +31,14 @@
public:
- /** Default ctor: noRepository.
+ /**
+ * \short Default ctor: noRepository.
* \see RepoManager::createFromCache.
*/
Repository();
- /** A dummy Repository (Id \c 0) providing nothing, doing nothing.
- * \todo provide a _constRef
+ /**
+ * A dummy Repository (Id \c 0) providing nothing, doing nothing.
*/
static const Repository noRepository;
@@ -52,10 +53,26 @@
/** Runtime unique numeric Repository Id. */
NumericId numericId() const;
+ /**
+ * \short Get the resolvables for repo
+ */
const ResStore & resolvables();
+ /**
+ * \short Repository info used to create this repository
+ */
const RepoInfo info() const;
+ /**
+ * \short Patch RPMs the repository provides
+ */
+ const std::listpackagedelta::PatchRpm & patchRpms() const;
+
+ /**
+ * \short Delta RPMs the repository provides
+ */
+ const std::listpackagedelta::DeltaRpm & deltaRpms() const;
+
private:
friend base::SafeBool<Repository>::operator bool_type() const;
/** \ref SafeBool test. */
Added: trunk/libzypp/zypp/cache/CacheStore.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheStore.cpp?rev=5754&view=auto
==============================================================================
--- trunk/libzypp/zypp/cache/CacheStore.cpp (added)
+++ trunk/libzypp/zypp/cache/CacheStore.cpp Thu Jun 14 18:20:26 2007
@@ -0,0 +1,1048 @@
+
+#include
+#include <map>
+#include "zypp/cache/sqlite3x/sqlite3x.hpp"
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Measure.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/ZYpp.h"
+#include "zypp/Package.h"
+#include "zypp/cache/CacheInitializer.h"
+#include "zypp/cache/CacheStore.h"
+#include "zypp/cache/CacheException.h"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::capability;
+using namespace zypp::cache;
+using zypp::data::RecordId;
+using namespace sqlite3x;
+
+using zypp::debug::Measure;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace cache
+{ /////////////////////////////////////////////////////////////////
+
+typedef shared_ptr sqlite3_command_ptr;
+
+struct CacheStore::Impl
+{
+ Impl( const Pathname &dbdir )
+ : name_cache_hits(0)
+ {
+ cache::CacheInitializer initializer(dbdir, "zypp.db");
+ if ( initializer.justInitialized() )
+ {
+ MIL << "database " << (dbdir + "zypp.db") << " was just created" << endl;
+ }
+
+ try
+ {
+ con.open( (dbdir + "zypp.db").asString().c_str());
+ //_insert_resolvable_cmd = new sqlite3_command( *_con, INSERT_RESOLVABLE_QUERY );
+ //_insert_package_cmd = new sqlite3_command( *_con, INSERT_PACKAGE_QUERY );
+ }
+ catch(exception &ex)
+ {
+ //ZYPP_CAUGHT(ex);
+ ZYPP_THROW(Exception(ex.what()));
+ }
+
+
+ // initialize all pre-compiled statements
+
+ insert_resolvable_in_repository_cmd.reset( new sqlite3_command( con, "insert into resolvables_repositories (resolvable_id, repository_id) values (:resolvable_id, :repository_id);" ));
+
+ update_repository_cmd.reset( new sqlite3_command( con, "update repositories set checksum=:checksum, timestamp=:timestamp where id=:repository_id;" ));
+
+ select_repository_cmd.reset( new sqlite3_command( con, "select id from repositories where alias=:alias;" ));
+ insert_repository_cmd.reset( new sqlite3_command( con, "insert into repositories (alias,timestamp) values (:alias, :timestamp);" ));
+
+ select_name_cmd.reset( new sqlite3_command( con, "select id from names where name=:name;" ));
+ insert_name_cmd.reset( new sqlite3_command( con, "insert into names (name) values (:name);" ));
+
+ select_dirname_cmd.reset( new sqlite3_command( con, "select id from dir_names where name=:name;" ));
+ insert_dirname_cmd.reset( new sqlite3_command( con, "insert into dir_names (name) values (:name);" ));
+
+ select_filename_cmd.reset( new sqlite3_command( con, "select id from file_names where name=:name;" ));
+ insert_filename_cmd.reset( new sqlite3_command( con, "insert into file_names (name) values (:name);" ));
+
+ select_file_cmd.reset( new sqlite3_command( con, "select id from files where dir_name_id=:dir_name_id and file_name_id=:file_name_id;" ));
+ insert_file_cmd.reset( new sqlite3_command( con, "insert into files (dir_name_id,file_name_id) values (:dir_name_id,:file_name_id);" ));
+
+ select_type_cmd.reset( new sqlite3_command( con, "select id from types where class=:class and name=:name;" ));
+ insert_type_cmd.reset( new sqlite3_command( con, "insert into types (class,name) values (:class,:name);" ));
+
+ set_shared_flag_cmd.reset( new sqlite3_command( con, "update resolvables set shared_id=:shared_id where id=:resolvable_id;" ));
+
+ append_text_attribute_cmd.reset( new sqlite3_command( con, "insert into text_attributes ( weak_resolvable_id, lang_id, attr_id, text ) values ( :rid, :lang_id, :attr_id, :text );" ));
+ append_num_attribute_cmd.reset( new sqlite3_command( con, "insert into numeric_attributes ( weak_resolvable_id, attr_id, value ) values ( :rid, :attr_id, :value );" ));
+
+ //insert_dependency_entry_cmd.reset( new sqlite3_command( con, "insert into capabilities ( resolvable_id, dependency_type, refers_kind ) values ( :resolvable_id, :dependency_type, :refers_kind );" ));
+ append_file_dependency_cmd.reset( new sqlite3_command( con, "insert into file_capabilities ( resolvable_id, dependency_type, refers_kind, file_id ) values ( :resolvable_id, :dependency_type, :refers_kind, :file_id );" ));
+ append_named_dependency_cmd.reset( new sqlite3_command( con, "insert into named_capabilities ( resolvable_id, dependency_type, refers_kind, name_id, version, release, epoch, relation ) values ( :resolvable_id, :dependency_type, :refers_kind, :name_id, :version, :release, :epoch, :relation );" ));
+
+ append_modalias_dependency_cmd.reset( new sqlite3_command( con, "insert into modalias_capabilities ( resolvable_id, dependency_type, refers_kind, name, value, relation ) values ( :resolvable_id, :dependency_type, :refers_kind, :name, :value, :relation );" ));
+
+ append_hal_dependency_cmd.reset( new sqlite3_command( con, "insert into hal_capabilities ( resolvable_id, dependency_type, refers_kind, name, value, relation ) values ( :resolvable_id, :dependency_type, :refers_kind, :name, :value, :relation );" ));
+
+ append_other_dependency_cmd.reset( new sqlite3_command( con, "insert into other_capabilities ( resolvable_id, dependency_type, refers_kind, value ) values ( :resolvable_id, :dependency_type, :refers_kind, :value );" ));
+
+ append_resolvable_cmd.reset( new sqlite3_command( con, "insert into resolvables ( name, version, release, epoch, arch, kind, repository_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :repository_id );" ));
+
+ count_shared_cmd.reset( new sqlite3_command( con, "select count(id) from resolvables where shared_id=:rid;" ));
+
+ insert_patchrpm_cmd.reset( new sqlite3_command (con,
+ "insert into patch_packages (media_nr, location, checksum, download_size, build_time) "
+ "values (:media_nr, :location, :checksum, :download_size, :build_time);" ));
+ insert_deltarpm_cmd.reset( new sqlite3_command (con,
+ "insert into delta_packages (media_nr, location, checksum, download_size, build_time, "
+ "baseversion_version, baseversion_release, baseversion_epoch, baseversion_checksum, "
+ "baseversion_build_time, baseversion_sequence_info) "
+ "values (:media_nr, :location, :checksum, :download_size, :build_time, "
+ ":baseversion_version, :baseversion_release, :baseversion_epoch, :baseversion_checksum, "
+ ":baseversion_build_time, :baseversion_sequence_info);" ));
+ append_patch_baseversion_cmd.reset( new sqlite3_command (con,
+ "insert into patch_packages_baseversions (patch_package_id, version, release, epoch) "
+ "values (:patch_package_id, :version, :release, :epoch)" ));
+
+
+ // disable autocommit
+ con.executenonquery("BEGIN;");
+ }
+
+ Impl()
+ {
+ Impl( getZYpp()->homePath() );
+ }
+
+ ~Impl()
+ {
+ MIL << "name cache hits: " << name_cache_hits << " | cache size: " << name_cache.size() << endl;
+ }
+
+ /**
+ * SQL statements
+ * (we precompile them
+ */
+ sqlite3_connection con;
+
+ sqlite3_command_ptr update_repository_cmd;
+ sqlite3_command_ptr insert_resolvable_in_repository_cmd;
+
+ sqlite3_command_ptr select_name_cmd;
+ sqlite3_command_ptr insert_name_cmd;
+
+ sqlite3_command_ptr select_dirname_cmd;
+ sqlite3_command_ptr insert_dirname_cmd;
+
+ sqlite3_command_ptr select_filename_cmd;
+ sqlite3_command_ptr insert_filename_cmd;
+
+ sqlite3_command_ptr select_repository_cmd;
+ sqlite3_command_ptr insert_repository_cmd;
+
+ sqlite3_command_ptr select_file_cmd;
+ sqlite3_command_ptr insert_file_cmd;
+
+ sqlite3_command_ptr select_type_cmd;
+ sqlite3_command_ptr insert_type_cmd;
+
+ //sqlite3_command_ptr insert_dependency_entry_cmd;
+
+ sqlite3_command_ptr append_file_dependency_cmd;
+ sqlite3_command_ptr append_named_dependency_cmd;
+ sqlite3_command_ptr append_modalias_dependency_cmd;
+ sqlite3_command_ptr append_hal_dependency_cmd;
+ sqlite3_command_ptr append_other_dependency_cmd;
+
+ sqlite3_command_ptr append_resolvable_cmd;
+
+ sqlite3_command_ptr append_text_attribute_cmd;
+ sqlite3_command_ptr append_num_attribute_cmd;
+
+ sqlite3_command_ptr set_shared_flag_cmd;
+
+ sqlite3_command_ptr count_shared_cmd;
+
+ sqlite3_command_ptr insert_patchrpm_cmd;
+ sqlite3_command_ptr insert_deltarpm_cmd;
+ sqlite3_command_ptr append_patch_baseversion_cmd;
+
+ map name_cache;
+ map< pair, RecordId> type_cache;
+ int name_cache_hits;
+};
+
+
+CacheStore::CacheStore( const Pathname &dbdir )
+ : _pimpl( new Impl(dbdir) )
+{
+
+}
+
+CacheStore::CacheStore()
+ : _pimpl( new Impl() )
+{
+
+}
+
+CacheStore::~CacheStore()
+{
+
+}
+
+void CacheStore::commit()
+{
+ _pimpl->con.executenonquery("COMMIT;");
+}
+
+void CacheStore::appendResObjectAttributes( const data::RecordId &rid,
+ const data::ResObject_Ptr & res )
+{
+ appendTranslatedStringAttribute( rid, "ResObject", "description", res->description );
+ appendTranslatedStringAttribute( rid, "ResObject", "summary", res->summary );
+ appendNumericAttribute( rid, "ResObject", "installedSize", res->installedSize );
+ appendNumericAttribute( rid, "ResObject", "buildTime", res->buildTime );
+ appendBooleanAttribute( rid, "ResObject", "installOnly", res->installOnly );
+ appendStringAttribute( rid, "ResObject", "vendor", res->vendor );
+ appendTranslatedStringAttribute( rid, "ResObject", "licenseToConfirm", res->licenseToConfirm );
+ appendTranslatedStringAttribute( rid, "ResObject", "insnotify", res->insnotify );
+ appendTranslatedStringAttribute( rid, "ResObject", "delnotify", res->delnotify );
+}
+
+
+void CacheStore::appendPackageBaseAttributes( const RecordId & pkgid,
+ const data::Packagebase_Ptr & package )
+{
+ appendStringAttribute( pkgid, "Package", "checksum", package->repositoryLocation.fileChecksum.checksum() );
+ appendStringAttribute( pkgid, "Package", "checksumType", package->repositoryLocation.fileChecksum.type() );
+ appendStringAttribute( pkgid, "Package", "buildhost", package->buildhost );
+ appendStringAttribute( pkgid, "Package", "distribution", package->distribution );
+ appendStringAttribute( pkgid, "Package", "license", package->license );
+ appendStringAttribute( pkgid, "Package", "group", package->packager );
+ appendStringAttribute( pkgid, "Package", "url", package->url );
+ appendStringAttribute( pkgid, "Package", "operatingSystem", package->operatingSystem );
+ appendStringAttribute( pkgid, "Package", "prein", package->prein );
+ appendStringAttribute( pkgid, "Package", "postin", package->postin );
+ appendStringAttribute( pkgid, "Package", "preun", package->preun );
+ appendStringAttribute( pkgid, "Package", "postun", package->postun );
+ appendStringContainerAttribute( pkgid, "Package", "keywords", package->keywords.begin(), package->keywords.end() );
+ appendStringContainerAttribute( pkgid, "Package", "authors", package->authors.begin(), package->authors.end() );
+ appendStringAttribute( pkgid, "Package", "location", package->repositoryLocation.filePath.asString() );
+}
+
+void CacheStore::consumePackage( const RecordId & repository_id,
+ const data::Package_Ptr & package )
+{
+ RecordId pkgid = appendResolvable( repository_id, ResTraits<Package>::kind,
+ NVRA( package->name, package->edition, package->arch ), package->deps );
+ appendResObjectAttributes( pkgid, package );
+ appendPackageBaseAttributes( pkgid, package );
+}
+
+void CacheStore::consumeSourcePackage( const data::RecordId & repository_id,
+ const data::SrcPackage_Ptr & package )
+{
+ RecordId pkgid = appendResolvable( repository_id, ResTraits<SrcPackage>::kind,
+ NVRA( package->name, package->edition, package->arch ), package->deps );
+ appendResObjectAttributes( pkgid, package );
+ appendPackageBaseAttributes( pkgid, package );
+#warning TBD
+}
+
+void CacheStore::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, "Patch", "timestamp", patch->timestamp );
+ appendStringAttribute( id, "Patch", "category", patch->category );
+ appendBooleanAttribute( id, "Patch", "rebootNeeded", patch->rebootNeeded );
+ appendBooleanAttribute( id, "Patch", "affectsPkgManager", 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;
+}
+
+void CacheStore::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);
+}
+
+void CacheStore::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, "Message", "text", message->text );
+}
+
+void CacheStore::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, "Script", "doScript", script->doScript );
+ appendStringAttribute( id, "Script", "doScriptLocation", script->doScriptLocation.filePath.asString() );
+ appendStringAttribute( id, "Script", "doScriptChecksum", script->doScriptLocation.fileChecksum.checksum() );
+ appendStringAttribute( id, "Script", "doScriptChecksumType", script->doScriptLocation.fileChecksum.type() );
+ appendStringAttribute( id, "Script", "undoScript", script->undoScript );
+ appendStringAttribute( id, "Script", "undoScriptLocation", script->undoScriptLocation.filePath.asString() );
+ appendStringAttribute( id, "Script", "undoScriptChecksum", script->undoScriptLocation.fileChecksum.checksum() );
+ appendStringAttribute( id, "Script", "undoScriptChecksumType", script->undoScriptLocation.fileChecksum.type() );
+}
+
+void CacheStore::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, "Pattern", "isDefault", pattern->isDefault );
+ appendBooleanAttribute( id, "Pattern", "userVisible", pattern->userVisible );
+ appendTranslatedStringAttribute( id, "Pattern", "category", pattern->category );
+ appendStringAttribute( id, "Pattern", "icon", pattern->icon );
+ appendStringAttribute( id, "Pattern", "order", pattern->order );
+}
+
+void CacheStore::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 );
+
+ appendTranslatedStringAttribute( id, "Product", "shortName", product->shortName );
+ appendTranslatedStringAttribute( id, "Product", "longName", product->longName );
+ appendStringContainerAttribute( id, "Product", "flags", product->flags.begin(), product->flags.end() );
+ appendStringAttribute( id, "Pattern", "releasenotesUrl", product->releasenotesUrl.asString() );
+ //! \todo figure out how to store list of Urls. A separate method appendUrlContainerAttribute? Or change it to plain string in ResolvableData.h?
+// appendStringContainerAttribute( id, "Product", "updateUrls", product->updateUrls );
+// appendStringContainerAttribute( id, "Product", "extraUrls", product->extraUrls );
+// appendStringContainerAttribute( id, "Product", "optionalUrls", product->optionalUrls );
+ appendStringAttribute( id, "Pattern", "distributionName", product->distributionName );
+ appendStringAttribute( id, "Pattern", "distributionEdition", product->distributionEdition.asString() );
+}
+
+void CacheStore::consumeChangelog( const data::RecordId & repository_id,
+ const data::Resolvable_Ptr & resolvable,
+ 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)
+}
+
+void CacheStore::consumeFilelist( const data::RecordId & repository_id,
+ const data::Resolvable_Ptr & resolvable,
+ const data::Filenames & filenames )
+{
+ //! \todo maybe consumeFilelist(const data::RecordId & resolvable_id, data::Filenames &) will be needed
+}
+
+RecordId CacheStore::appendResolvable( const RecordId &repository_id,
+ const Resolvable::Kind &kind,
+ const NVRA &nvra,
+ const data::Dependencies &deps )
+{
+ _pimpl->append_resolvable_cmd->bind( ":name", nvra.name );
+ _pimpl->append_resolvable_cmd->bind( ":version", nvra.edition.version() );
+ _pimpl->append_resolvable_cmd->bind( ":release", nvra.edition.release() );
+ _pimpl->append_resolvable_cmd->bind( ":epoch", static_cast<int>( nvra.edition.epoch() ) );
+ _pimpl->append_resolvable_cmd->bind( ":arch", lookupOrAppendType("arch", nvra.arch.asString()) );
+ _pimpl->append_resolvable_cmd->bind( ":kind", lookupOrAppendType("kind", kind.asString()) );
+ _pimpl->append_resolvable_cmd->bind( ":repository_id", repository_id );
+
+ _pimpl->append_resolvable_cmd->executenonquery();
+
+ long long id = _pimpl->con.insertid();
+
+ appendDependencies( id, deps );
+ /*
+ _pimpl->insert_resolvable_in_repository_cmd->bind(":repository_id", repository_id);
+ _pimpl->insert_resolvable_in_repository_cmd->bind(":resolvable_id", id);
+ _pimpl->insert_resolvable_in_repository_cmd->executenonquery();*/
+
+ return static_cast<RecordId>(id);
+ return 1;
+}
+
+void CacheStore::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 CacheStore::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 CacheStore::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
+ {
+ appendUnknownDependency( resolvable_id, deptype, cap );
+ }
+}
+
+// RecordId CacheStore::lookupOrAppendNamedDependencyEntry( const RecordId name_id, const Edition &edition, const zypp::Rel &rel )
+// {
+// _pimpl->select_named_dependency_cmd->bind( ":name_id", name_id);
+// _pimpl->select_named_dependency_cmd->bind( ":version", edition.version() );
+// _pimpl->select_named_dependency_cmd->bind( ":release", edition.release() );
+// _pimpl->select_named_dependency_cmd->bind( ":epoch", static_cast<int>( edition.epoch() ) );
+// _pimpl->select_named_dependency_cmd->bind( ":relation", zypp_rel2db_rel( rel ) );
+// long long id = 0;
+// try {
+// id = _pimpl->select_named_dependency_cmd->executeint64();
+// }
+// catch ( const sqlite3x::database_error &e )
+// {
+// // does not exist
+// _pimpl->append_named_dependency_entry_cmd->bind( ":name_id", name_id);
+// _pimpl->append_named_dependency_entry_cmd->bind( ":version", edition.version() );
+// _pimpl->append_named_dependency_entry_cmd->bind( ":release", edition.release() );
+// _pimpl->append_named_dependency_entry_cmd->bind( ":epoch", static_cast<int>( edition.epoch() ) );
+// _pimpl->append_named_dependency_entry_cmd->bind( ":relation", zypp_rel2db_rel( rel ) );
+// _pimpl->append_named_dependency_entry_cmd->executenonquery();
+// id = _pimpl->con.insertid();
+// return static_cast<RecordId>(id);
+// }
+// return static_cast<RecordId>(id);
+// }
+
+void CacheStore::appendNamedDependency( const RecordId &resolvable_id, zypp::Dep deptype, capability::NamedCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("bad versioned dep"));
+ //DBG << "versioned : " << cap << endl;
+
+ //RecordId capability_id = appendDependencyEntry( resolvable_id, deptype, cap->refers() );
+ RecordId name_id = lookupOrAppendName(cap->name());
+
+ _pimpl->append_named_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_named_dependency_cmd->bind( ":dependency_type", lookupOrAppendType("deptype", deptype.asString()) );
+ _pimpl->append_named_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
+
+ //_pimpl->append_named_dependency_cmd->bind( ":capability_id", capability_id);
+ _pimpl->append_named_dependency_cmd->bind( ":name_id", name_id);
+ _pimpl->append_named_dependency_cmd->bind( ":version", cap->edition().version() );
+ _pimpl->append_named_dependency_cmd->bind( ":release", cap->edition().release() );
+ _pimpl->append_named_dependency_cmd->bind( ":epoch", static_cast<int>( cap->edition().epoch() ) );
+ _pimpl->append_named_dependency_cmd->bind( ":relation", lookupOrAppendType("rel", cap->op().asString()) );
+ _pimpl->append_named_dependency_cmd->executenonquery();
+
+ //delete cmd;
+}
+
+void CacheStore::appendModaliasDependency( const RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::ModaliasCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null modalias capability"));
+
+ _pimpl->append_modalias_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_modalias_dependency_cmd->bind( ":dependency_type", lookupOrAppendType("deptype", deptype.asString()) );
+ _pimpl->append_modalias_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
+
+ //_pimpl->append_modalias_dependency_cmd->bind( ":capability_id", capability_id);
+ _pimpl->append_modalias_dependency_cmd->bind( ":name", cap->name());
+ _pimpl->append_modalias_dependency_cmd->bind( ":value", cap->value());
+ _pimpl->append_modalias_dependency_cmd->bind( ":relation", lookupOrAppendType("rel", cap->op().asString()) );
+
+ _pimpl->append_modalias_dependency_cmd->executenonquery();
+ //delete cmd;
+}
+
+void CacheStore::appendHalDependency( const RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::HalCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null HAL capability"));
+
+ _pimpl->append_hal_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_hal_dependency_cmd->bind( ":dependency_type", lookupOrAppendType("deptype", deptype.asString()) );
+ _pimpl->append_hal_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
+
+ //_pimpl->append_hal_dependency_cmd->bind( ":capability_id", capability_id);
+ _pimpl->append_hal_dependency_cmd->bind( ":name", cap->name());
+ _pimpl->append_hal_dependency_cmd->bind( ":value", cap->value());
+ _pimpl->append_hal_dependency_cmd->bind( ":relation", lookupOrAppendType("rel", cap->op().asString()) );
+
+ _pimpl->append_hal_dependency_cmd->executenonquery();
+ //delete cmd;
+}
+
+void CacheStore::appendFileDependency( const RecordId &resolvable_id, zypp::Dep deptype,
+ capability::FileCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null file capability"));
+
+ //RecordId capability_id = appendDependencyEntry( resolvable_id, deptype, cap->refers() );
+ RecordId file_id = lookupOrAppendFile(cap->filename());
+
+ _pimpl->append_file_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_file_dependency_cmd->bind( ":dependency_type", lookupOrAppendType("deptype", deptype.asString()) );
+ _pimpl->append_file_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
+
+ //_pimpl->append_file_dependency_cmd->bind( ":capability_id", capability_id);
+ _pimpl->append_file_dependency_cmd->bind( ":file_id", file_id);
+
+ _pimpl->append_file_dependency_cmd->executenonquery();
+ //delete cmd;
+}
+
+void CacheStore::appendUnknownDependency( const RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::CapabilityImpl::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null unknown capability"));
+
+ _pimpl->append_other_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_other_dependency_cmd->bind( ":dependency_type", lookupOrAppendType("deptype", deptype.asString()) );
+ _pimpl->append_other_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
+ _pimpl->append_other_dependency_cmd->bind( ":value", cap->encode());
+
+ _pimpl->append_hal_dependency_cmd->executenonquery();
+ //delete cmd;
+}
+
+
+/** \todo lookupOrAppend ? */
+RecordId CacheStore::appendPatchRpm( const data::RecordId &repo_id, const data::PatchRpm_Ptr & prpm)
+{
+ RecordId id;
+
+ //! \todo what's this? _pimpl->insert_patchrpm_cmd->bind(":media_nr", ???);
+ _pimpl->insert_patchrpm_cmd->bind(":repository_id", repo_id);
+ _pimpl->insert_patchrpm_cmd->bind(":location", prpm->location.filePath.asString());
+ _pimpl->insert_patchrpm_cmd->bind(":checksum", prpm->location.fileChecksum.checksum());
+ //! \todo checksum type
+ _pimpl->insert_patchrpm_cmd->bind(":download_size", static_castByteCount::SizeType(prpm->location.fileSize));
+ _pimpl->insert_patchrpm_cmd->bind(":build_time", prpm->buildTime.asSeconds());
+ _pimpl->insert_patchrpm_cmd->executenonquery();
+
+ id = _pimpl->con.insertid();
+
+ for (setdata::BaseVersion_Ptr::const_iterator bv = prpm->baseVersions.begin();
+ bv != prpm->baseVersions.end(); ++bv)
+ {
+ _pimpl->append_patch_baseversion_cmd->bind(":patch_package_id", id);
+ _pimpl->append_patch_baseversion_cmd->bind(":version", (*bv)->edition.version());
+ _pimpl->append_patch_baseversion_cmd->bind(":release", (*bv)->edition.release());
+ _pimpl->append_patch_baseversion_cmd->bind(":epoch", (int) (*bv)->edition.epoch());
+ _pimpl->append_patch_baseversion_cmd->executenonquery();
+ }
+
+ return id;
+}
+
+
+/** \todo lookupOrAppend ? */
+RecordId CacheStore::appendDeltaRpm( const data::RecordId &repo_id, const data::DeltaRpm_Ptr & drpm)
+{
+ RecordId id;
+
+ //! \todo what's this? _pimpl->insert_deltarpm_cmd->bind(":media_nr", ???);
+ _pimpl->insert_deltarpm_cmd->bind(":repository_id", repo_id);
+ _pimpl->insert_deltarpm_cmd->bind(":location", drpm->location.filePath.asString());
+ _pimpl->insert_deltarpm_cmd->bind(":checksum", drpm->location.fileChecksum.checksum());
+ //! \todo checksum type
+ _pimpl->insert_deltarpm_cmd->bind(":download_size", static_castByteCount::SizeType(drpm->location.fileSize));
+ _pimpl->insert_deltarpm_cmd->bind(":build_time", drpm->buildTime.asSeconds());
+
+ _pimpl->insert_deltarpm_cmd->bind(":baseversion_version", drpm->baseVersion.edition.version());
+ _pimpl->insert_deltarpm_cmd->bind(":baseversion_release", drpm->baseVersion.edition.release());
+ _pimpl->insert_deltarpm_cmd->bind(":baseversion_epoch", (int) drpm->baseVersion.edition.epoch());
+ _pimpl->insert_deltarpm_cmd->bind(":baseversion_build_time", drpm->baseVersion.buildTime.asSeconds());
+ _pimpl->insert_deltarpm_cmd->bind(":baseversion_checksum", drpm->baseVersion.checkSum.checksum());
+ _pimpl->insert_deltarpm_cmd->bind(":baseversion_sequence_info", drpm->baseVersion.sequenceInfo);
+
+ _pimpl->insert_deltarpm_cmd->executenonquery();
+ id = _pimpl->con.insertid();
+
+ return id;
+}
+
+
+// RecordId CacheStore::appendDependencyEntry( const RecordId &resolvable_id, zypp::Dep deptype, const Resolvable::Kind &refers )
+// {
+// //DBG << "rid: " << resolvable_id << " deptype: " << deptype << " " << "refers: " << refers << endl;
+// _pimpl->insert_dependency_entry_cmd->bind( ":resolvable_id", resolvable_id );
+//
+// db::DependencyType dt = zypp_deptype2db_deptype(deptype);
+// if ( dt == db::DEP_TYPE_UNKNOWN )
+// {
+// ZYPP_THROW(Exception("Unknown depenency type"));
+// }
+//
+// _pimpl->insert_dependency_entry_cmd->bind( ":dependency_type", zypp_deptype2db_deptype(deptype) );
+// _pimpl->insert_dependency_entry_cmd->bind( ":refers_kind", zypp_kind2db_kind(refers) );
+//
+// _pimpl->insert_dependency_entry_cmd->executenonquery();
+// //delete cmd;
+// long long id = _pimpl->con.insertid();
+// return static_cast<RecordId>(id);
+// }
+
+RecordId CacheStore::lookupOrAppendFile( const Pathname &path )
+{
+ RecordId dir_name_id = lookupOrAppendDirName(path.dirname().asString());
+ RecordId file_name_id = lookupOrAppendFileName(path.basename());
+
+ _pimpl->select_file_cmd->bind(":dir_name_id", dir_name_id);
+ _pimpl->select_file_cmd->bind(":file_name_id", file_name_id);
+ long long id = 0;
+ try {
+ id = _pimpl->select_file_cmd->executeint64();
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ // does not exist
+ _pimpl->insert_file_cmd->bind(":dir_name_id", dir_name_id);
+ _pimpl->insert_file_cmd->bind(":file_name_id", file_name_id);
+ _pimpl->insert_file_cmd->executenonquery();
+ id = _pimpl->con.insertid();
+ return static_cast<RecordId>(id);
+
+ }
+ return static_cast<RecordId>(id);
+}
+
+void CacheStore::updateRepository( const RecordId &id,
+ const string &checksum,
+ const Date ×tamp )
+{
+ _pimpl->update_repository_cmd->bind(":repository_id", id);
+ _pimpl->update_repository_cmd->bind(":checksum", checksum);
+ _pimpl->update_repository_cmd->bind(":timestamp", static_cast<int>((Date::ValueType) timestamp) );
+ _pimpl->insert_repository_cmd->executenonquery();
+}
+
+RecordId CacheStore::lookupOrAppendRepository( const string &alias )
+{
+ _pimpl->select_repository_cmd->bind(":alias", alias);
+
+ long long id = 0;
+ try {
+ id = _pimpl->select_repository_cmd->executeint64();
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ // does not exist
+ _pimpl->insert_repository_cmd->bind(":alias", alias);
+ _pimpl->insert_repository_cmd->bind(":timestamp", static_cast<int>((Date::ValueType) Date::now()) );
+ _pimpl->insert_repository_cmd->executenonquery();
+ id = _pimpl->con.insertid();
+ return static_cast<RecordId>(id);
+
+ }
+ return static_cast<RecordId>(id);
+}
+
+void CacheStore::cleanRepository( const data::RecordId &id )
+{
+ sqlite3_command cmd( _pimpl->con, "delete from repositories where id=:id");
+ cmd.bind(":id", id);
+
+ try
+ {
+ cmd.executenonquery();
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_THROW(CacheRecordNotFoundException());
+ }
+}
+
+void CacheStore::cleanRepository( const std::string &alias )
+{
+ cleanRepository(lookupRepository(alias));
+}
+
+RepoStatus CacheStore::repositoryStatus( const data::RecordId &id )
+{
+ sqlite3_command cmd( _pimpl->con, "select id,alias,checksum,timestamp from repositories where id=:id");
+ cmd.bind(":id", id);
+
+ try
+ {
+ sqlite3_reader reader = cmd.executereader();
+ RepoStatus status;
+ while ( reader.read() )
+ {
+ status.setChecksum( reader.getstring(2) );
+ status.setTimestamp( reader.getstring(3) );
+ }
+ return status;
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_THROW(CacheRecordNotFoundException());
+ }
+}
+
+RepoStatus CacheStore::repositoryStatus( const string &alias )
+{
+ return repositoryStatus(lookupRepository(alias));
+}
+
+bool CacheStore::isCached( const string &alias )
+{
+ try
+ {
+ lookupRepository(alias);
+ }
+ catch( const CacheRecordNotFoundException &e )
+ {
+ return false;
+ }
+
+ return true;
+}
+
+RecordId CacheStore::lookupRepository( const string &alias )
+{
+ sqlite3_command cmd(_pimpl->con, "select id from repositories where alias=:alias;");
+ cmd.bind(":alias", alias);
+
+ long long id = 0;
+ try {
+ id = cmd.executeint64();
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_THROW(CacheRecordNotFoundException());
+ }
+ return id;
+}
+
+RecordId CacheStore::lookupOrAppendType( const string &klass, const string &name )
+{
+ pair thetype = make_pair(klass,name);
+ if ( _pimpl->type_cache.find(thetype) != _pimpl->type_cache.end() )
+ {
+ //_pimpl->name_cache_hits++;
+ return _pimpl->type_cache[thetype];
+ }
+
+ _pimpl->select_type_cmd->bind(":class", klass);
+ _pimpl->select_type_cmd->bind(":name", name);
+ long long id = 0;
+ try
+ {
+ sqlite3_reader reader= _pimpl->select_type_cmd->executereader();
+ if (!reader.read())
+ {
+ // does not exist
+ _pimpl->insert_type_cmd->bind(":class", klass);
+ _pimpl->insert_type_cmd->bind(":name", name);
+ _pimpl->insert_type_cmd->executenonquery();
+ id = _pimpl->con.insertid();
+ _pimpl->type_cache[thetype] = id;
+ return id;
+ }
+ return reader.getint64(0);
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+ return id;
+}
+
+RecordId CacheStore::lookupOrAppendName( const string &name )
+{
+ if ( _pimpl->name_cache.find(name) != _pimpl->name_cache.end() )
+ {
+ _pimpl->name_cache_hits++;
+ return _pimpl->name_cache[name];
+ }
+
+ _pimpl->select_name_cmd->bind(":name", name);
+ long long id = 0;
+
+ try
+ {
+ sqlite3_reader reader= _pimpl->select_name_cmd->executereader();
+ if (!reader.read())
+ {
+ // does not exist
+ _pimpl->insert_name_cmd->bind(":name", name);
+ _pimpl->insert_name_cmd->executenonquery();
+ id = _pimpl->con.insertid();
+ _pimpl->name_cache[name] = id;
+ return id;
+ }
+ return reader.getint64(0);
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+
+ return id;
+}
+
+RecordId CacheStore::lookupOrAppendDirName( const string &name )
+{
+ _pimpl->select_dirname_cmd->bind(":name", name);
+ long long id = 0;
+
+ try
+ {
+ sqlite3_reader reader= _pimpl->select_dirname_cmd->executereader();
+ if (!reader.read())
+ {
+ // does not exist
+ _pimpl->insert_name_cmd->bind(":name", name);
+ _pimpl->insert_name_cmd->executenonquery();
+ id = _pimpl->con.insertid();
+ _pimpl->name_cache[name] = id;
+ return id;
+ }
+ return reader.getint64(0);
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+}
+
+RecordId CacheStore::lookupOrAppendFileName( const string &name )
+{
+ _pimpl->select_filename_cmd->bind(":name", name);
+ long long id = 0;
+
+ try
+ {
+ sqlite3_reader reader= _pimpl->select_filename_cmd->executereader();
+ if (!reader.read())
+ {
+ // does not exist
+ _pimpl->insert_name_cmd->bind(":name", name);
+ _pimpl->insert_name_cmd->executenonquery();
+ id = _pimpl->con.insertid();
+ _pimpl->name_cache[name] = id;
+ return id;
+ }
+ return reader.getint64(0);
+ }
+ catch ( const sqlite3x::database_error &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+}
+
+void CacheStore::setSharedData( const data::RecordId &resolvable_id,
+ const data::RecordId &shared_id )
+{
+ _pimpl->set_shared_flag_cmd->bind(":resolvable_id", resolvable_id);
+
+ if ( shared_id == data::noRecordId )
+ _pimpl->set_shared_flag_cmd->bind(":shared_id");
+ else
+ _pimpl->set_shared_flag_cmd->bind(":shared_id", shared_id);
+
+ _pimpl->set_shared_flag_cmd->executenonquery();
+}
+
+void CacheStore::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 CacheStore::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 CacheStore::appendNumericAttribute( const RecordId &resolvable_id,
+ const RecordId &type_id,
+ int value )
+{
+ // weak resolvable_id
+ _pimpl->append_num_attribute_cmd->bind(":rid", resolvable_id );
+ _pimpl->append_num_attribute_cmd->bind(":attr_id", type_id );
+
+ _pimpl->append_num_attribute_cmd->bind(":value", value );
+
+ _pimpl->append_num_attribute_cmd->executenonquery();
+}
+
+
+void CacheStore::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 CacheStore::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;
+
+ RecordId lang_id = lookupOrAppendType("lang",
+ locale.code().empty() ? "none" : locale.code() );
+ RecordId type_id = lookupOrAppendType( klass, name );
+ appendStringAttribute( resolvable_id, lang_id, type_id, text );
+}
+
+void CacheStore::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;
+
+ RecordId type_id = lookupOrAppendType(klass, name);
+ appendStringAttribute( resolvable_id, type_id, value );
+}
+
+void CacheStore::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;
+
+ RecordId lang_id = lookupOrAppendType("lang", "none");
+ appendStringAttribute( resolvable_id, lang_id, type_id, value );
+}
+
+void CacheStore::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;
+
+ // weak resolvable_id
+ _pimpl->append_text_attribute_cmd->bind(":rid", resolvable_id );
+ _pimpl->append_text_attribute_cmd->bind(":lang_id", lang_id );
+ _pimpl->append_text_attribute_cmd->bind(":attr_id", type_id );
+
+ _pimpl->append_text_attribute_cmd->bind(":text", value );
+
+ _pimpl->append_text_attribute_cmd->executenonquery();
+}
+
+}
+}
+
Modified: trunk/libzypp/zypp/cache/CacheStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheStore.h?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/cache/CacheStore.h (original)
+++ trunk/libzypp/zypp/cache/CacheStore.h Thu Jun 14 18:20:26 2007
@@ -356,7 +356,7 @@
* \param prpm The patch RPM object to insert.
* \return Record ID of the newly inserted record.
*/
- data::RecordId appendPatchRpm( const data::PatchRpm_Ptr & prpm);
+ data::RecordId appendPatchRpm( const data::RecordId &repo_id, const data::PatchRpm_Ptr & prpm);
/**
@@ -365,7 +365,7 @@
* \param drpm The delta RPM object to insert.
* \return Record ID of the newly inserted record.
*/
- data::RecordId appendDeltaRpm( const data::DeltaRpm_Ptr & drpm);
+ data::RecordId appendDeltaRpm( const data::RecordId &repo_id, const data::DeltaRpm_Ptr & drpm);
/**
Added: trunk/libzypp/zypp/repo/DeltaCandidates.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/DeltaCandidates.cc?rev=5754&view=auto
==============================================================================
--- trunk/libzypp/zypp/repo/DeltaCandidates.cc (added)
+++ trunk/libzypp/zypp/repo/DeltaCandidates.cc Thu Jun 14 18:20:26 2007
@@ -0,0 +1,113 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include <iostream>
+#include "zypp/base/Logger.h"
+
+#include "zypp/repo/DeltaCandidates.h"
+
+using std::endl;
+using namespace zypp::packagedelta;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repo
+ { /////////////////////////////////////////////////////////////////
+
+ /** DeltaCandidates implementation. */
+ struct DeltaCandidates::Impl
+ {
+
+ public:
+
+ Impl( const std::set<Repository> & repos )
+ : repos(repos)
+ {
+
+ }
+
+ friend Impl * rwcowClone<Impl>( const Impl * rhs );
+ /** clone for RWCOW_pointer */
+ Impl * clone() const
+ { return new Impl( *this ); }
+
+ std::set<Repository> repos;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates DeltaCandidates::Impl Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const DeltaCandidates::Impl & obj )
+ {
+ return str << "DeltaCandidates::Impl";
+ }
+
+ DeltaCandidates::DeltaCandidates(const std::set<Repository> & repos)
+ : _pimpl( new Impl(repos) )
+ {}
+
+ DeltaCandidates::~DeltaCandidates()
+ {}
+
+ std::list<PatchRpm> DeltaCandidates::patchRpms(const Package::constPtr & package ) const
+ {
+ std::list<PatchRpm> candidates;
+
+ // query all repos
+ for ( std::set<Repository>::const_iterator it = _pimpl->repos.begin();
+ it != _pimpl->repos.end();
+ ++it )
+ {
+ // all delta in repo
+ std::list<PatchRpm> candidates_in_repo = (*it).patchRpms();
+ for ( std::list<PatchRpm>::const_iterator dit = candidates_in_repo.begin();
+ dit != candidates_in_repo.end();
+ ++dit )
+ {
+ PatchRpm delta(*dit);
+ candidates.push_back(delta);
+ }
+ }
+ return candidates;
+ }
+
+ std::list<DeltaRpm> DeltaCandidates::deltaRpms(const Package::constPtr & package) const
+ {
+ std::list<DeltaRpm> candidates;
+
+ // query all repos
+ for ( std::set<Repository>::const_iterator it = _pimpl->repos.begin();
+ it != _pimpl->repos.end();
+ ++it )
+ {
+ // all delta in repo
+ std::list<DeltaRpm> candidates_in_repo = (*it).deltaRpms();
+ for ( std::list<DeltaRpm>::const_iterator dit = candidates_in_repo.begin();
+ dit != candidates_in_repo.end();
+ ++dit )
+ {
+ DeltaRpm delta(*dit);
+ candidates.push_back(delta);
+ }
+ }
+ return candidates;
+ }
+
+ std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj )
+ {
+ return str << *obj._pimpl;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace repo
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/repo/DeltaCandidates.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/DeltaCandidates.h?rev=5754&view=auto
==============================================================================
--- trunk/libzypp/zypp/repo/DeltaCandidates.h (added)
+++ trunk/libzypp/zypp/repo/DeltaCandidates.h Thu Jun 14 18:20:26 2007
@@ -0,0 +1,71 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_REPO_DELTACANDIDATES_H
+#define ZYPP_REPO_DELTACANDIDATES_H
+
+#include <iosfwd>
+#include <set>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/Function.h"
+
+#include "zypp/Repository.h"
+#include "zypp/Package.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repo
+ { /////////////////////////////////////////////////////////////////
+
+ /**
+ * \short Candidate delta and patches for a package
+ */
+ class DeltaCandidates
+ {
+ friend std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj );
+
+ public:
+ /** Implementation */
+ class Impl;
+
+ public:
+ /**
+ * \short Creates a candidate calculator
+ * \param repos Set of repositories providing patch and delta packages
+ * \param installed_callback Will be used to ask if a package is installed or not
+ */
+ DeltaCandidates( const std::set<Repository> & repos );
+ /** Dtor */
+ ~DeltaCandidates();
+
+
+ std::listpackagedelta::PatchRpm patchRpms(const Package::constPtr & package) const;
+ std::listpackagedelta::DeltaRpm deltaRpms(const Package::constPtr & package) const;
+
+ public:
+
+ private:
+ /** Pointer to implementation */
+ RWCOW_pointer<Impl> _pimpl;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates DeltaCandidates Stream output */
+ std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace repo
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_REPO_DELTACANDIDATES_H
Modified: trunk/libzypp/zypp/repo/PackageProvider.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageProvider.cc?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/PackageProvider.cc (original)
+++ trunk/libzypp/zypp/repo/PackageProvider.cc Thu Jun 14 18:20:26 2007
@@ -6,17 +6,18 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/source/PackageProvider.cc
+/** \file zypp/repo/PackageProvider.cc
*
*/
#include <iostream>
#include <sstream>
#include "zypp/base/Logger.h"
#include "zypp/base/Gettext.h"
+#include "zypp/base/UserRequestException.h"
-#include "zypp/Source.h"
-#include "zypp/source/PackageProvider.h"
-#include "zypp/source/SourceProvideFile.h"
+#include "zypp/Repository.h"
+#include "zypp/repo/PackageProvider.h"
+#include "zypp/repo/RepoProvideFile.h"
#include "zypp/source/Applydeltarpm.h"
#include "zypp/source/PackageDelta.h"
#include "zypp/detail/ImplConnect.h"
@@ -32,7 +33,7 @@
namespace zypp
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- namespace source
+ namespace repo
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
@@ -71,10 +72,12 @@
} // namespace source
///////////////////////////////////////////////////////////////////
PackageProvider::PackageProvider( const Package::constPtr & package,
+ const DeltaCandidates & deltas,
const PackageProviderPolicy & policy_r )
: _policy( policy_r )
, _package( package )
, _implPtr( detail::ImplConnect::resimpl( _package ) )
+ , _deltas(deltas)
{}
PackageProvider::~PackageProvider()
@@ -128,8 +131,8 @@
// check whether to process patch/delta rpms
if ( MediaManager::downloads(url) )
{
- std::list<DeltaRpm> deltaRpms( _implPtr->deltaRpms() );
- std::list<PatchRpm> patchRpms( _implPtr->patchRpms() );
+ std::list<DeltaRpm> deltaRpms = _deltas.deltaRpms(_package);
+ std::list<PatchRpm> patchRpms = _deltas.patchRpms(_package);
if ( ! ( deltaRpms.empty() && patchRpms.empty() )
&& queryInstalled() )
@@ -162,7 +165,7 @@
else
{
// allow patch rpm from local source
- std::list<PatchRpm> patchRpms( _implPtr->patchRpms() );
+ std::list<PatchRpm> patchRpms = _deltas.patchRpms(_package);
if ( ! patchRpms.empty() && queryInstalled() )
{
for( std::list<PatchRpm>::const_iterator it = patchRpms.begin();
@@ -188,7 +191,7 @@
policy.progressCB( bind( &PackageProvider::progressPackageDownload, this, _1 ) );
policy.failOnChecksumErrorCB( bind( &PackageProvider::failOnChecksumError, this ) );
- return source::provideFile( url, loc, policy );
+ return repo::provideFile( _package->repository(), loc, policy );
}
ManagedFile PackageProvider::tryDelta( const DeltaRpm & delta_r ) const
@@ -207,7 +210,7 @@
{
ProvideFilePolicy policy;
policy.progressCB( bind( &PackageProvider::progressDeltaDownload, this, _1 ) );
- delta = source::provideFile( Url(), delta_r.location(), policy );
+ delta = repo::provideFile( _package->repository(), delta_r.location(), policy );
}
catch ( const Exception & excpt )
{
@@ -257,7 +260,7 @@
{
ProvideFilePolicy policy;
policy.progressCB( bind( &PackageProvider::progressPatchDownload, this, _1 ) );
- patch = source::provideFile( Url(), patch_r.location(), policy );
+ patch = repo::provideFile( _package->repository(), patch_r.location(), policy );
}
catch ( const Exception & excpt )
{
@@ -305,7 +308,7 @@
_retry = true;
break;
case source::DownloadResolvableReport::IGNORE:
- ZYPP_THROW(source::SkipRequestedException("User requested skip of corrupted file"));
+ ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
break;
default:
break;
Modified: trunk/libzypp/zypp/repo/PackageProvider.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageProvider.h?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/PackageProvider.h (original)
+++ trunk/libzypp/zypp/repo/PackageProvider.h Thu Jun 14 18:20:26 2007
@@ -6,26 +6,28 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/source/PackageProvider.h
+/** \file zypp/repo/PackageProvider.h
*
*/
-#ifndef ZYPP_SOURCE_PACKAGEPROVIDER_H
-#define ZYPP_SOURCE_PACKAGEPROVIDER_H
+#ifndef ZYPP_REPO_PACKAGEPROVIDER_H
+#define ZYPP_REPO_PACKAGEPROVIDER_H
#include <iosfwd>
#include "zypp/base/NonCopyable.h"
#include "zypp/ZYppCallbacks.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/Package.h"
#include "zypp/ManagedFile.h"
+#include "zypp/repo/DeltaCandidates.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- namespace source
+ namespace repo
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
@@ -73,6 +75,7 @@
public:
/** Ctor taking the Package to provide. */
PackageProvider( const Package::constPtr & package,
+ const DeltaCandidates & deltas,
const PackageProviderPolicy & policy_r = PackageProviderPolicy() );
~PackageProvider();
@@ -103,12 +106,12 @@
PackageImpl_constPtr _implPtr;
mutable bool _retry;
mutable shared_ptr<Report> _report;
-
+ DeltaCandidates _deltas;
};
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
- } // namespace source
+ } // namespace repo
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace zypp
Added: trunk/libzypp/zypp/repo/RepoProvideFile.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoProvideFile.cc?rev=5754&view=auto
==============================================================================
--- trunk/libzypp/zypp/repo/RepoProvideFile.cc (added)
+++ trunk/libzypp/zypp/repo/RepoProvideFile.cc Thu Jun 14 18:20:26 2007
@@ -0,0 +1,143 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/source/RepoProvideFile.cc
+ *
+*/
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include "zypp/base/Logger.h"
+
+#include "zypp/repo/RepoProvideFile.h"
+#include "zypp/ZYppCallbacks.h"
+#include "zypp/MediaSetAccess.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repo
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // provideFile
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ namespace
+ { /////////////////////////////////////////////////////////////////
+
+ /** Hack to extract progress information from source::DownloadFileReport.
+ * We redirect the static report triggered from Repository::provideFile
+ * to feed the ProvideFilePolicy callbacks.
+ */
+ struct DownloadFileReportHack : public callback::ReceiveReportsource::SourceReport
+ {
+ virtual bool progress( int value )
+ {
+ if ( _redirect )
+ return _redirect( value );
+ return true;
+ }
+ function _redirect;
+ };
+
+ /** ManagedFile Dispose functor.
+ * The Pathname argument is ignored, as Repository::releaseFile expects the filename
+ * relative to the medias root (i.e. same args as to provideFile).
+ */
+ struct RepoReleaseFile
+ {
+ RepoReleaseFile( Repository repo_r, const Pathname & location_r, unsigned mediaNr_r )
+ : _repo( repo_r ), _location( location_r ), _medianr( mediaNr_r )
+ {}
+
+ void operator()( const Pathname & /*UNUSED*/ )
+ {
+ //_repo.releaseFile( _location, _medianr );
+ }
+
+ Repository _repo;
+ Pathname _location;
+ unsigned _medianr;
+ };
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace
+ ///////////////////////////////////////////////////////////////////
+
+ ManagedFile provideFile( Repository repo_r,
+ const OnMediaLocation & loc_r,
+ const ProvideFilePolicy & policy_r )
+ {
+ MIL << "sourceProvideFile " << loc_r << endl;
+ // Arrange DownloadFileReportHack to recieve the source::DownloadFileReport
+ // and redirect download progress triggers to call the ProvideFilePolicy
+ // callback.
+ DownloadFileReportHack dumb;
+ dumb._redirect = bind( mem_fun_ref( &ProvideFilePolicy::progress ),
+ ref( policy_r ), _1 );
+ callback::TempConnectsource::SourceReport temp( dumb );
+
+ Url url;
+ RepoInfo info = repo_r.info();
+ // FIXME we only support the first url for now.
+ if ( info.baseUrls().empty() )
+ ZYPP_THROW(Exception("No url in repository."));
+ else
+ url = * info.baseUrls().begin();
+
+ MediaSetAccess access(url);
+
+ ManagedFile ret( access.provideFile(loc_r),
+ RepoReleaseFile( repo_r, loc_r.filename(), loc_r.medianr() ) );
+
+ if ( loc_r.checksum().empty() )
+ {
+ // no checksum in metadata
+ WAR << "No checksum in metadata " << loc_r << endl;
+ }
+ else
+ {
+ std::ifstream input( ret->asString().c_str() );
+ CheckSum retChecksum( loc_r.checksum().type(), input );
+ input.close();
+
+ if ( loc_r.checksum() != retChecksum )
+ {
+ // failed integity check
+ std::ostringstream err;
+ err << "File " << ret << " fails integrity check. Expected: [" << loc_r.checksum() << "] Got: [";
+ if ( retChecksum.empty() )
+ err << "Failed to compute checksum";
+ else
+ err << retChecksum;
+ err << "]";
+
+ if ( policy_r.failOnChecksumError() )
+ ZYPP_THROW( Exception( err.str() ) );
+ else
+ WAR << "NO failOnChecksumError: " << err.str() << endl;
+ }
+ }
+
+ MIL << "sourceProvideFile at " << ret << endl;
+ return ret;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace repo
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/repo/RepoProvideFile.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoProvideFile.h?rev=5754&view=auto
==============================================================================
--- trunk/libzypp/zypp/repo/RepoProvideFile.h (added)
+++ trunk/libzypp/zypp/repo/RepoProvideFile.h Thu Jun 14 18:20:26 2007
@@ -0,0 +1,55 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/repo/RepoProvideFile.h
+ *
+*/
+#ifndef ZYPP_REPO_REPOPROVIDEFILE_H
+#define ZYPP_REPO_REPOPROVIDEFILE_H
+
+#include <iosfwd>
+
+#include "zypp/base/Function.h"
+#include "zypp/base/Functional.h"
+#include "zypp/Repository.h"
+#include "zypp/ManagedFile.h"
+#include "zypp/OnMediaLocation.h"
+#include "zypp/ProvideFilePolicy.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repo
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // provideFile
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ /** Provide a file from a Repository.
+ * Let \a source_r provide the file described by \a loc_r. In case
+ * \a loc_r contains a checksum, the file is verified. \a policy_r
+ * provides callback hooks for download progress reporting and behaviour
+ * on failed checksum verification.
+ *
+ * \throws Exception
+ */
+ ManagedFile provideFile( Repository repo_r,
+ const OnMediaLocation & loc_r,
+ const ProvideFilePolicy & policy_r = ProvideFilePolicy() );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace repo
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_REPO_REPOPROVIDEFILE_H
Modified: trunk/libzypp/zypp/repo/RepositoryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepositoryImpl.cc?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepositoryImpl.cc (original)
+++ trunk/libzypp/zypp/repo/RepositoryImpl.cc Thu Jun 14 18:20:26 2007
@@ -31,5 +31,17 @@
return _store;
}
+const std::listpackagedelta::PatchRpm &
+RepositoryImpl::patchRpms() const
+{
+ return _patchRpms;
+}
+
+const std::listpackagedelta::DeltaRpm &
+RepositoryImpl::deltaRpms() const
+{
+ return _deltaRpms;
+}
+
} } // ns
Modified: trunk/libzypp/zypp/repo/RepositoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepositoryImpl.h?rev=5754&r1=5753&r2=5754&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepositoryImpl.h (original)
+++ trunk/libzypp/zypp/repo/RepositoryImpl.h Thu Jun 14 18:20:26 2007
@@ -52,6 +52,10 @@
const ResStore & resolvables() const;
struct null {};
+
+ const std::listpackagedelta::PatchRpm & patchRpms() const;
+ const std::listpackagedelta::DeltaRpm & deltaRpms() const;
+
public:
/** Offer default Impl. */
static RepositoryImpl_Ptr nullimpl()
@@ -68,6 +72,9 @@
RepoInfo _info;
ResStore _store;
+
+ std::listpackagedelta::PatchRpm _patchRpms;
+ std::listpackagedelta::DeltaRpm _deltaRpms;
};
}
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org