Author: jkupec Date: Mon Nov 12 17:43:05 2007 New Revision: 7786 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7786&view=rev Log: - dist-upgrade added (experimental) FATE #302460 Modified: trunk/zypper/doc/zypper.8 trunk/zypper/src/zypper-command.cc trunk/zypper/src/zypper-command.h trunk/zypper/src/zypper.cc Modified: trunk/zypper/doc/zypper.8 URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/doc/zypper.8?rev=7786&r1=7785&r2=7786&view=diff ============================================================================== --- trunk/zypper/doc/zypper.8 (original) +++ trunk/zypper/doc/zypper.8 Mon Nov 12 17:43:05 2007 @@ -183,6 +183,23 @@ package\fR which is also the default in rug compatibility mode. .TP +.B dist-upgrade (dup) [options] +Perform a distribution upgrade. This command performs an update of all packages +with a special resolver algorithm which takes care of package splits, pattern +and product updates, etc. + +.TP +\fI\-r, \-\-repo\fR <alias> +Limit updates to repository specified by alias. +.TP +.I \-l, \-\-auto\-agree\-with\-licenses +Automatically say 'yes' to third party license confirmation prompt. By using this option, you choose to agree with licenses of all third-party software this command will install. This option is particularly useful for administators installing the same set of packages on multiple machines (by an automated process) and have the licenses confirmed before. +.TP +.I \-\-debug\-solver +Create solver test case for debugging. See the install command for details. + + +.TP \fBsearch\fR (\fBse\fR) [\fIoptions\fR] [\fBquerystring\fR] ... Search for resolvables matching given strings. * (any substring) and ? (any character) wildcards can also be used within search strings. .IP Modified: trunk/zypper/src/zypper-command.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-command.cc?rev=7786&r1=7785&r2=7786&view=diff ============================================================================== --- trunk/zypper/src/zypper-command.cc (original) +++ trunk/zypper/src/zypper-command.cc Mon Nov 12 17:43:05 2007 @@ -26,6 +26,7 @@ const ZypperCommand ZypperCommand::INSTALL(ZypperCommand::INSTALL_e); const ZypperCommand ZypperCommand::REMOVE(ZypperCommand::REMOVE_e); const ZypperCommand ZypperCommand::UPDATE(ZypperCommand::UPDATE_e); +const ZypperCommand ZypperCommand::DIST_UPGRADE(ZypperCommand::DIST_UPGRADE_e); const ZypperCommand ZypperCommand::SRC_INSTALL(ZypperCommand::SRC_INSTALL_e); const ZypperCommand ZypperCommand::SEARCH(ZypperCommand::SEARCH_e); @@ -64,6 +65,7 @@ _table["install"] = _table["in"] = ZypperCommand::INSTALL_e; _table["remove"] = _table["rm"] = ZypperCommand::REMOVE_e; _table["update"] = _table["up"] = ZypperCommand::UPDATE_e; + _table["dist-upgrade"] = _table["dup"] = ZypperCommand::DIST_UPGRADE_e; _table["source-install"] = _table["si"] = ZypperCommand::SRC_INSTALL_e; _table["search"] = _table["se"] = ZypperCommand::SEARCH_e; Modified: trunk/zypper/src/zypper-command.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-command.h?rev=7786&r1=7785&r2=7786&view=diff ============================================================================== --- trunk/zypper/src/zypper-command.h (original) +++ trunk/zypper/src/zypper-command.h Mon Nov 12 17:43:05 2007 @@ -20,6 +20,7 @@ static const ZypperCommand INSTALL; static const ZypperCommand REMOVE; static const ZypperCommand UPDATE; + static const ZypperCommand DIST_UPGRADE; static const ZypperCommand SRC_INSTALL; static const ZypperCommand SEARCH; @@ -54,6 +55,7 @@ INSTALL_e, REMOVE_e, UPDATE_e, + DIST_UPGRADE_e, SRC_INSTALL_e, SEARCH_e, Modified: trunk/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=7786&r1=7785&r2=7786&view=diff ============================================================================== --- trunk/zypper/src/zypper.cc (original) +++ trunk/zypper/src/zypper.cc Mon Nov 12 17:43:05 2007 @@ -572,6 +572,28 @@ "-R, --force-resolution Force the solver to find a solution (even agressive)\n" ); } + else if (command == ZypperCommand::DIST_UPGRADE) { + static struct option dupdate_options[] = { + {"repo", required_argument, 0, 'r'}, + {"auto-agree-with-licenses", no_argument, 0, 'l'}, + {"debug-solver", no_argument, 0, 0}, + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0} + }; + specific_options = dupdate_options; + specific_help = _( + "dist-upgrade (dup) [options]\n" + "\n" + "Perform a distribution upgrade.\n" + "\n" + " Command options:\n" + "\n" + "-r, --repo <alias> Limit the upgrade to the repository specified by the alias.\n" + "-l, --auto-agree-with-licenses Automatically say 'yes' to third party license confirmation prompt.\n" + " See man zypper for more details.\n" + " --debug-solver Create solver test case for debugging\n" + ); + } else if (command == ZypperCommand::SEARCH) { static struct option search_options[] = { {"installed-only", no_argument, 0, 'i'}, @@ -1518,6 +1540,58 @@ return ZYPPER_EXIT_OK; } + // ----------------------------( dist-upgrade )------------------------------ + + else if (command == ZypperCommand::DIST_UPGRADE) { + if (ghelp) + { + cout << specific_help; + return ZYPPER_EXIT_OK; + } + + // check root user + if (geteuid() != 0) + { + cerr << _("Root privileges are required for performing a distribution upgrade.") << endl; + return ZYPPER_EXIT_ERR_PRIVILEGES; + } + + // too many arguments + if (arguments.size() > 0) + { + report_too_many_arguments(specific_help); + return ZYPPER_EXIT_ERR_INVALID_ARGS; + } + + if (copts.count("auto-agree-with-licenses")) + gSettings.license_auto_agree = true; + + cond_init_target (); + int initret = init_repos(); + if (initret != ZYPPER_EXIT_OK) + return initret; + cond_load_resolvables (); + establish (); + zypp::UpgradeStatistics opt_stats; + God->resolver()->doUpgrade(opt_stats); + + if (copts.count("debug-solver")) + { + cout_n << _("Generating solver test case...") << endl; + if (God->resolver()->createSolverTestcase("/var/log/zypper.solverTestCase")) + cout_n << _("Solver test case generated successfully.") << endl; + else + cerr << _("Error creating the solver test case.") << endl; + } + // commit + // returns ZYPPER_EXIT_OK, ZYPPER_EXIT_ERR_ZYPP, + // ZYPPER_EXIT_INF_REBOOT_NEEDED, or ZYPPER_EXIT_INF_RESTART_NEEDED + else + return solve_and_commit(); + + return ZYPPER_EXIT_OK; + } + // -----------------------------( info )------------------------------------ else if (command == ZypperCommand::INFO || -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org