From 1d19f0896ccc1560a7e2f5b93cfe095b4aefe84a Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Date: Thu, 14 May 2009 18:25:16 +0200
Subject: Introduce -Suu

If the user switches from unstable repo to a stable one, it is quite hard to
sync its system with the new repo (the user will see many "Local is newer
than stable" messages, nothing more). That's why I introduced -Suu, which
treats a sync package like an upgrade, iff the package version doesn't match
with the local one's.

I added a new pactest (sync104.py) to test this, and I updated the
documentation of -Su.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: slight doc reword]
Signed-off-by: Dan McGee <dan@archlinux.org>
---
 src/pacman/pacman.c | 4 ++--
 src/pacman/sync.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 48d45ad1..d5e600a5 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -130,7 +130,7 @@ static void usage(int op, const char * const myname)
 			printf(_("  -l, --list <repo>    view a list of packages in a repo\n"));
 			printf(_("  -p, --print-uris     print out URIs for given packages and their dependencies\n"));
 			printf(_("  -s, --search <regex> search remote repositories for matching strings\n"));
-			printf(_("  -u, --sysupgrade     upgrade all packages that are out of date\n"));
+			printf(_("  -u, --sysupgrade     upgrade all outdated packages (-uu enables downgrade)\n"));
 			printf(_("  -w, --downloadonly   download packages but do not install/upgrade anything\n"));
 			printf(_("  -y, --refresh        download fresh package databases from the server\n"));
 			printf(_("      --needed         don't reinstall up to date packages\n"));
@@ -508,7 +508,7 @@ static int parseargs(int argc, char *argv[])
 				config->op_q_unrequired = 1;
 				break;
 			case 'u':
-				config->op_s_upgrade = 1;
+				(config->op_s_upgrade)++;
 				config->op_q_upgrade = 1;
 				config->flags |= PM_TRANS_FLAG_UNNEEDED;
 				break;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index cb0b8b19..4da65400 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -563,7 +563,7 @@ static int sync_trans(alpm_list_t *targets)
 	if(config->op_s_upgrade) {
 		printf(_(":: Starting full system upgrade...\n"));
 		alpm_logaction("starting full system upgrade\n");
-		if(alpm_trans_sysupgrade() == -1) {
+		if(alpm_trans_sysupgrade(config->op_s_upgrade >= 2) == -1) {
 			pm_fprintf(stderr, PM_LOG_ERROR, "%s\n", alpm_strerrorlast());
 			retval = 1;
 			goto cleanup;
-- 
cgit v1.2.3-2-g168b