ref: refs/heads/master
commit c7e0caa5317a42b7fa387f77dabaf801c638b8c0
Author: Ján Kupec
Date: Mon Oct 12 10:57:02 2009 +0200
Added '--from' to zypper dup.
---
doc/zypper.8 | 29 +++++++++++++++++++++++++----
src/Zypper.cc | 8 ++++++--
src/solve-commit.cc | 27 +++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/doc/zypper.8 b/doc/zypper.8
index 3ecc1e5..a52c07f 100644
--- a/doc/zypper.8
+++ b/doc/zypper.8
@@ -648,10 +648,31 @@ Test the update, do not actually update.
.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.
-
+Perform a distribution upgrade. This command applies the state of (specified)
+repositories onto the system; upgrades (or even downgrades) installed packages
+to versions found in repositories, removes packages that are no longer in the
+repositories and pose a dependency problem for the upgrade, handles package
+splits and renames, etc.
+
+If no repositories are specified via --from or --repo options, zypper
+will do the upgrade with all defined repositories. This can be a problem
+if the system contains conflicting repositories, like repositories
+for two different distribution releases. This often happens if one
+forgets to remove older release repository after adding a new one, say
+openSUSE 11.1 and openSUSE 11.2.
+
+To avoid the above trouble, you can specify the repositories from
+which to do the upgrade using the --from or --repo options.
+The difference between these two is that when --repo is used, zypper
+acts as if it knew onle the specified repositories, while with --from
+zypper can eventually use also the rest of enabled repositories to
+satisfy package dependencies.
+
+.TP
+\fI\ \ \ \ \-\-from\fR
+Restricts the upgrade to the specified repositories (the option can be used
+multiple times) only, but can satisfy dependencies also from the rest
+of enabled repositories.
.TP
\fI\-r, \-\-repo\fR
Work only with the repository specified by the alias, number or URI. This
diff --git a/src/Zypper.cc b/src/Zypper.cc
index ebe8785..bf8c9ce 100644
--- a/src/Zypper.cc
+++ b/src/Zypper.cc
@@ -1302,6 +1302,7 @@ void Zypper::processCommandOptions()
}
_command_help = _(
+ // FIXME it's 'repos (lr) [options] [repo] ...' now. Fix after 11.2
"repos (lr) [options]\n"
"\n"
"List all defined repositories.\n"
@@ -1317,6 +1318,7 @@ void Zypper::processCommandOptions()
"-N, --sort-by-name Sort the list by name.\n"
) + string(_(
// translators: this option belongs to 'lr' command help
+ // FIXME add this to the rest after 11.2
"-s, --service Show also alias of parent service.\n"
));
break;
@@ -1638,6 +1640,7 @@ void Zypper::processCommandOptions()
{
static struct option dupdate_options[] = {
{"repo", required_argument, 0, 'r'},
+ {"from", required_argument, 0, 0 },
{"no-recommends", no_argument, 0, 0 },
{"recommends", no_argument, 0, 0 },
{"auto-agree-with-licenses", no_argument, 0, 'l'},
@@ -1650,7 +1653,7 @@ void Zypper::processCommandOptions()
{0, 0, 0, 0}
};
specific_options = dupdate_options;
- _command_help = _(
+ _command_help = string(_(
"dist-upgrade (dup) [options]\n"
"\n"
"Perform a distribution upgrade.\n"
@@ -1668,7 +1671,8 @@ void Zypper::processCommandOptions()
" to the required.\n"
"-D, --dry-run Test the upgrade, do not actually upgrade\n"
"-d, --download-only Only download the packages, do not install.\n"
- );
+ )) + // FIXME: add to the rest of the strings after 11.2 release
+ _(" --from Restrict upgrade to specified repository.\n");
break;
}
diff --git a/src/solve-commit.cc b/src/solve-commit.cc
index 0ca28e6..3c9a08b 100755
--- a/src/solve-commit.cc
+++ b/src/solve-commit.cc
@@ -17,6 +17,7 @@
#include "zypp/misc/CheckAccessDeleted.h"
#include "misc.h" // confirm_licenses
+#include "repos.h" // get_repo - used in dist_upgrade
#include "utils/misc.h"
#include "utils/prompt.h" // Continue? and solver problem prompt
#include "utils/pager.h" // to view the summary
@@ -324,6 +325,32 @@ static bool dist_upgrade(Zypper & zypper)
{
dump_pool();
set_solver_flags(zypper);
+
+ // set repositories to upgrade to (--from)
+
+ list<RepoInfo> specified;
+ list<string> not_found;
+ parsed_opts::const_iterator tmp1;
+ if ((tmp1 = copts.find("from")) != copts.end())
+ get_repos(zypper, tmp1->second.begin(), tmp1->second.end(), specified, not_found);
+ report_unknown_repos(zypper.out(), not_found);
+
+ if (!not_found.empty())
+ throw ExitRequestException("Some of specified repositories were not found.");
+
+ set<string> aliases;
+ for_(it, specified.begin(), specified.end())
+ aliases.insert(it->alias());
+
+ for_(it, God->pool().knownRepositoriesBegin(), God->pool().knownRepositoriesEnd())
+ if (aliases.find(it->alias()) != aliases.end())
+ {
+ MIL << "Adding upgrade repository: " << it->alias() << endl;
+ God->resolver()->addUpgradeRepo(*it);
+ }
+
+ // compute the upgrade
+
zypper.out().info(_("Computing upgrade..."), Out::HIGH);
DBG << "Calling the solver doUpgrade()..." << endl;
return God->resolver()->doUpgrade();
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org