Author: jkupec Date: Tue Oct 14 16:13:06 2008 New Revision: 11343 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11343&view=rev Log: - lazy-initialize the RepoManager - services and targetos commands now use the readonly hack (bnc #435184) Modified: trunk/zypper/src/Zypper.cc trunk/zypper/src/Zypper.h Modified: trunk/zypper/src/Zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/Zypper.cc?rev=11343&r1=11342&r2=11343&view=diff ============================================================================== --- trunk/zypper/src/Zypper.cc (original) +++ trunk/zypper/src/Zypper.cc Tue Oct 14 16:13:06 2008 @@ -73,7 +73,6 @@ _command(ZypperCommand::NONE), _exit_code(ZYPPER_EXIT_OK), _running_shell(false), _running_help(false), _exit_requested(false), - _rm_set(false), _sh_argc(0), _sh_argv(NULL) { MIL << "Hi, me zypper " VERSION " built " << __DATE__ << " " << __TIME__ << endl; @@ -735,7 +734,7 @@ _rdata.current_repo = RepoInfo(); // cause the RepoManager to be reinitialized - _rm_set = false; + _rm.reset(); // TODO: // _rdata.repos re-read after repo operations or modify/remove these very repoinfos @@ -2227,7 +2226,9 @@ const char *roh = getenv("ZYPP_READONLY_HACK"); if (roh != NULL && roh[0] == '1') zypp_readonly_hack::IWantIt (); - else if (command() == ZypperCommand::LIST_REPOS) + else if ( command() == ZypperCommand::LIST_REPOS + || command() == ZypperCommand::LIST_SERVICES + || command() == ZypperCommand::TARGET_OS ) zypp_readonly_hack::IWantIt (); // #247001, #302152 God = zypp::getZYpp(); Modified: trunk/zypper/src/Zypper.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/Zypper.h?rev=11343&r1=11342&r2=11343&view=diff ============================================================================== --- trunk/zypper/src/Zypper.h (original) +++ trunk/zypper/src/Zypper.h Tue Oct 14 16:13:06 2008 @@ -142,6 +142,8 @@ bool action_rpm_download; }; +typedef zypp::shared_ptrzypp::RepoManager RepoManager_Ptr; + class Zypper : private zypp::base::NonCopyable { public: @@ -162,7 +164,7 @@ const ArgList & arguments() const { return _arguments; } RuntimeData & runtimeData() { return _rdata; } zypp::RepoManager & repoManager() - { if (!_rm_set) _rm = zypp::RepoManager(_gopts.rm_options); return _rm; } + { if (!_rm) _rm.reset(new zypp::RepoManager(_gopts.rm_options)); return *_rm; } int exitCode() const { return _exit_code; } void setExitCode(int exit) { _exit_code = exit; } bool runningShell() const { return _running_shell; } @@ -192,7 +194,7 @@ void setRunningHelp(bool value = true) { _running_help = value; } void initRepoManager() - { _rm = zypp::RepoManager(_gopts.rm_options); _rm_set = true; } + { _rm.reset(new zypp::RepoManager(_gopts.rm_options)); } private: @@ -214,8 +216,7 @@ RuntimeData _rdata; - zypp::RepoManager _rm; - bool _rm_set; + RepoManager_Ptr _rm; int _sh_argc; char **_sh_argv; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org