From: Duncan Mac-Vicar P Date: Fri, 10 Feb 2006 10:36:19 +0000 (+0000) Subject: work for bug 149869 X-Git-Tag: 6.6.0~5033 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=736a03ed3810af908749a0663f83a1eab0058b26;p=platform%2Fupstream%2Flibzypp.git work for bug 149869 --- diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc index f04743a5e..083b088a9 100644 --- a/zypp/target/TargetImpl.cc +++ b/zypp/target/TargetImpl.cc @@ -59,9 +59,6 @@ namespace zypp : _root(root_r) { _rpm.initDatabase(_root); -#ifndef STORAGE_DISABLED - _storage.init(root_r); -#endif MIL << "Initialized target on " << _root << endl; } @@ -76,6 +73,20 @@ namespace zypp MIL << "Targets closed" << endl; } +#ifndef STORAGE_DISABLED + bool TargetImpl::isStorageEnabled() const + { + return _storage.isInitialized(); + } + + + void TargetImpl::enableStorage(const Pathname &root_r) + { + + _storage.init(root_r); + } +#endif + const ResStore & TargetImpl::resolvables() { _store.clear(); diff --git a/zypp/target/TargetImpl.h b/zypp/target/TargetImpl.h index 2668913e0..5988f2401 100644 --- a/zypp/target/TargetImpl.h +++ b/zypp/target/TargetImpl.h @@ -77,6 +77,12 @@ namespace zypp media > 0 means limit commits to this media */ void commit( ResPool pool_r, unsigned int medianr, PoolItemList & errors_r, PoolItemList & remaining_r, PoolItemList & srcremaining_r ); +#ifndef STORAGE_DISABLED + /** enables the storage target */ + bool isStorageEnabled() const; + void enableStorage(const Pathname &root_r); +#endif + /** Commit ordered changes return uncommitted ones (due to error) */ PoolItemList commit( const PoolItemList & items_r ); diff --git a/zypp/target/store/PersistentStorage.cc b/zypp/target/store/PersistentStorage.cc index 9d9a1f3db..6cd792d86 100644 --- a/zypp/target/store/PersistentStorage.cc +++ b/zypp/target/store/PersistentStorage.cc @@ -58,6 +58,11 @@ void PersistentStorage::init(const Pathname &root) d->backend = new XMLFilesBackend(root); } +bool PersistentStorage::isInitalized() +{ + return ! (d->backend == 0L); +} + /////////////////////////////////////////////////////////////////// // // METHOD NAME : PersistentStorage::~PersistentStorage diff --git a/zypp/target/store/PersistentStorage.h b/zypp/target/store/PersistentStorage.h index c888f569f..228bbc310 100644 --- a/zypp/target/store/PersistentStorage.h +++ b/zypp/target/store/PersistentStorage.h @@ -65,6 +65,12 @@ namespace zypp * root path. THIS MUST BE CALLED BEFORE DOING ANY OPERATION */ void init(const Pathname &root); + + /** + * true is backend was already initialized + */ + bool isInitalized(); + /** * Stores a Resolvable in the active backend. */ @@ -112,9 +118,9 @@ namespace zypp std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj ); ///////////////////////////////////////////////////////////////// - } // namespace devel.dmacvicar + } // namespace storage /////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// -} // namespace devel +} // namespace zypp /////////////////////////////////////////////////////////////////// -#endif // DEVEL_DEVEL_DMACVICAR_PERSISTENTSTORAGE_H +#endif // ZYPP_TARGET_PERSISTENTSTORAGE_H