Author: jkupec Date: Fri Nov 23 15:33:03 2007 New Revision: 7904 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7904&view=rev Log: - set exit code inside functions instead of returning it Modified: trunk/zypper/src/zypper-repos.cc trunk/zypper/src/zypper-repos.h trunk/zypper/src/zypper.cc Modified: trunk/zypper/src/zypper-repos.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-repos.cc?rev=7904&r1=7903&r2=7904&view=diff ============================================================================== --- trunk/zypper/src/zypper-repos.cc (original) +++ trunk/zypper/src/zypper-repos.cc Fri Nov 23 15:33:03 2007 @@ -205,7 +205,7 @@ // --------------------------------------------------------------------------- -static int do_init_repos(const Zypper & zypper) +static void do_init_repos(Zypper & zypper) { // load gpg keys cond_init_target (); @@ -227,7 +227,8 @@ { cerr << format(_("Repository '%s' not found.")) % specific_repo << endl; ERR << specific_repo << " not found"; - return ZYPPER_EXIT_ERR_INVALID_ARGS; + zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); + return; } catch (const Exception & ex) { @@ -235,7 +236,8 @@ % specific_repo << endl; cerr_v << _("Reason: ") << ex.asUserString() << endl; ZYPP_CAUGHT(ex); - return ZYPPER_EXIT_ERR_ZYPP; + zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); + return; } } else @@ -290,26 +292,23 @@ } } } - - return ZYPPER_EXIT_OK; } // ---------------------------------------------------------------------------- -int init_repos(const Zypper & zypper) +void init_repos(Zypper & zypper) { static bool done = false; //! \todo this has to be done so that it works in zypper shell if (done) - return ZYPPER_EXIT_OK; + return; if ( !gSettings.disable_system_sources ) { - return do_init_repos(zypper); + do_init_repos(zypper); } done = true; - return ZYPPER_EXIT_OK; } // ---------------------------------------------------------------------------- Modified: trunk/zypper/src/zypper-repos.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-repos.h?rev=7904&r1=7903&r2=7904&view=diff ============================================================================== --- trunk/zypper/src/zypper-repos.h (original) +++ trunk/zypper/src/zypper-repos.h Fri Nov 23 15:33:03 2007 @@ -11,10 +11,11 @@ * Reads known enabled repositories and stores them in gData. * This command also refreshes repos with auto-refresh enabled. * - * \return ZYPPER_EXIT_ERR_INVALID_ARGS if --repo does not specify a valid repository, - * ZYPPER_EXIT_ERR_ZYPP on error, ZYPPER_EXIT_OK otherwise. + * sets exit status to + * - ZYPPER_EXIT_ERR_INVALID_ARGS if --repo does not specify a valid repository, + * - ZYPPER_EXIT_ERR_ZYPP on error */ -int init_repos(const Zypper & zypper); +void init_repos(Zypper & zypper); /** * List defined repositories. Modified: trunk/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=7904&r1=7903&r2=7904&view=diff ============================================================================== --- trunk/zypper/src/zypper.cc (original) +++ trunk/zypper/src/zypper.cc Fri Nov 23 15:33:03 2007 @@ -1406,12 +1406,9 @@ return; } - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } //! \todo support temporary additional repos /* @@ -1484,12 +1481,10 @@ return; } - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } + cond_init_target(); // load only repo resolvables, we don't need the installed ones load_repo_resolvables(*this, false /* don't load to pool */); @@ -1549,12 +1544,10 @@ options.resolveConflicts(); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } + cond_init_target(); // calls ZYpp::initializeTarget("/"); establish(); @@ -1603,12 +1596,9 @@ cond_init_target (); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } // TODO additional_sources // TODO warn_no_sources @@ -1653,12 +1643,9 @@ } cond_init_target (); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } cond_load_resolvables(*this); establish (); show_patches (); @@ -1702,12 +1689,9 @@ cerr << _("Running as 'rug', can't do 'best-effort' approach to update.") << endl; } cond_init_target (); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } cond_load_resolvables(*this); establish (); @@ -1729,12 +1713,9 @@ } cond_init_target (); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } cond_load_resolvables(*this); establish (); @@ -1802,12 +1783,9 @@ cerr << _("Running as 'rug', can't do 'best-effort' approach to update.") << endl; } cond_init_target (); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } cond_load_resolvables(*this); establish (); @@ -1866,12 +1844,9 @@ gSettings.license_auto_agree = true; cond_init_target (); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } cond_load_resolvables(*this); establish (); zypp::UpgradeStatistics opt_stats; @@ -1920,12 +1895,9 @@ } cond_init_target (); - int initret = init_repos(*this); - if (initret != ZYPPER_EXIT_OK) - { - setExitCode(initret); + init_repos(*this); + if (exitCode() != ZYPPER_EXIT_OK) return; - } cond_load_resolvables(*this); establish (); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org