From: Stanislav Visnovsky Date: Fri, 24 Feb 2006 07:25:35 +0000 (+0000) Subject: Avoid reinitialization of target if the root is the same only X-Git-Tag: 6.6.0~4601 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1087b9ea05791e638187b3bdc5ba0e2948b3443d;p=platform%2Fupstream%2Flibzypp.git Avoid reinitialization of target if the root is the same only --- diff --git a/zypp/Target.cc b/zypp/Target.cc index 18ee0eb66..f32f0f54b 100644 --- a/zypp/Target.cc +++ b/zypp/Target.cc @@ -79,6 +79,9 @@ namespace zypp { _pimpl->enableStorage(root_r); } #endif + Pathname Target::root() const + { return _pimpl->root(); } + int Target::commit(ResPool pool_r, int medianr, PoolItemList & errors_r , PoolItemList & remaining_r, PoolItemList & srcremaining_r) { return _pimpl->commit(pool_r, medianr, errors_r, remaining_r, srcremaining_r); } diff --git a/zypp/Target.h b/zypp/Target.h index 6ba6c30b0..b71947c0d 100644 --- a/zypp/Target.h +++ b/zypp/Target.h @@ -89,6 +89,9 @@ namespace zypp /** Set the log file for target */ bool setInstallationLogfile(const Pathname & path_r); + /** Return the root set for this target */ + Pathname root() const; + public: /** Ctor */ explicit diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc index d239fd026..5204b0b3a 100644 --- a/zypp/target/TargetImpl.cc +++ b/zypp/target/TargetImpl.cc @@ -84,6 +84,11 @@ namespace zypp _storage.init(root_r); _storage_enabled = true; } + + Pathname TargetImpl::root() const + { + return _root; + } const ResStore & TargetImpl::resolvables() { diff --git a/zypp/target/TargetImpl.h b/zypp/target/TargetImpl.h index c49dbec98..86f4b1119 100644 --- a/zypp/target/TargetImpl.h +++ b/zypp/target/TargetImpl.h @@ -80,6 +80,9 @@ namespace zypp /** All resolvables in the target. */ const ResStore & resolvables(); + /** The root set for this target */ + Pathname root() const; + /** Commit changes in the pool media = 0 means any/all medias media > 0 means limit commits to this media */ diff --git a/zypp/zypp_detail/ZYppImpl.cc b/zypp/zypp_detail/ZYppImpl.cc index fa8739c12..6e9b0bf82 100644 --- a/zypp/zypp_detail/ZYppImpl.cc +++ b/zypp/zypp_detail/ZYppImpl.cc @@ -104,8 +104,8 @@ namespace zypp void ZYppImpl::initTarget(const Pathname & root, bool commit_only) { - if (_target) { - WAR << "Repeated call to initTarget()" << endl; + if (_target && _target->root() == root) { + MIL << "Repeated call to initTarget()" << endl; return; }