From 122c37e9a6fce1b3cf9b1dd5e8d3e270458cdd58 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Mon, 7 Aug 2006 15:58:28 +0000 Subject: [PATCH] rename the new initTarget to initializeTarget, leave the old one as is, but deprecate it. --- zypp/ZYpp.cc | 7 +++++-- zypp/ZYpp.h | 9 ++++++++- zypp/zypp_detail/ZYppImpl.cc | 22 +++++++++++++++++++++- zypp/zypp_detail/ZYppImpl.h | 10 ++++++++-- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/zypp/ZYpp.cc b/zypp/ZYpp.cc index 30af996..c83fb82 100644 --- a/zypp/ZYpp.cc +++ b/zypp/ZYpp.cc @@ -96,8 +96,11 @@ namespace zypp Target_Ptr ZYpp::target() const { return _pimpl->target(); } - void ZYpp::initTarget(const Pathname & root) - { _pimpl->initTarget(root); } + void ZYpp::initTarget(const Pathname & root, bool commit_only ) + { _pimpl->initTarget(root, commit_only); } + + void ZYpp::initializeTarget(const Pathname & root) + { _pimpl->initializeTarget(root); } void ZYpp::finishTarget() { _pimpl->finishTarget(); } diff --git a/zypp/ZYpp.h b/zypp/ZYpp.h index c078da3..db97924 100644 --- a/zypp/ZYpp.h +++ b/zypp/ZYpp.h @@ -87,11 +87,18 @@ namespace zypp /** * \throws Exception + * just init the target, dont populate store or pool */ - void initTarget(const Pathname & root); + void initializeTarget(const Pathname & root); /** * \throws Exception + * if commit_only == true, just init the target, dont populate store or pool + */ + ZYPP_DEPRECATED void initTarget(const Pathname & root, bool commit_only = false); + + /** + * \throws Exception */ void finishTarget(); diff --git a/zypp/zypp_detail/ZYppImpl.cc b/zypp/zypp_detail/ZYppImpl.cc index d5961b2..2388ba5 100644 --- a/zypp/zypp_detail/ZYppImpl.cc +++ b/zypp/zypp_detail/ZYppImpl.cc @@ -193,7 +193,7 @@ namespace zypp return _target; } - void ZYppImpl::initTarget(const Pathname & root) + void ZYppImpl::initializeTarget(const Pathname & root) { MIL << "initTarget( " << root << endl; if (_target) { @@ -206,6 +206,26 @@ namespace zypp _target = new Target( root ); _target->enableStorage( root ); } + + void ZYppImpl::initTarget(const Pathname & root, bool commit_only) + { + MIL << "initTarget( " << root << ", " << commit_only << ")" << endl; + if (_target) { + if (_target->root() == root) { + MIL << "Repeated call to initTarget()" << endl; + return; + } + removeInstalledResolvables( ); + } + _target = new Target( root ); + _target->enableStorage( root ); + if (!commit_only) + { + _target->enableStorage( root ); + addResolvables( _target->resolvables(), true ); + } + } + void ZYppImpl::finishTarget() { diff --git a/zypp/zypp_detail/ZYppImpl.h b/zypp/zypp_detail/ZYppImpl.h index 741ac8d..ffe9216 100644 --- a/zypp/zypp_detail/ZYppImpl.h +++ b/zypp/zypp_detail/ZYppImpl.h @@ -84,10 +84,16 @@ namespace zypp /** * \throws Exception + * true, just init the target, dont populate store or pool + */ + void initializeTarget(const Pathname & root); + + /** + * \throws Exception * if commit_only == true, just init the target, dont populate store or pool */ - void initTarget(const Pathname & root); - + ZYPP_DEPRECATED void initTarget(const Pathname & root, bool commit_only); + /** * \throws Exception */ -- 2.7.4