[pacman-dev] [PATCH] Allow --needed and --recursive on -U operations

Dan McGee dan at archlinux.org
Thu Aug 11 09:56:50 EDT 2011


Trivial to implement as the same backend machinery is used anyway.
Document it and add it to the accepted options.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 doc/pacman.8.txt    |   11 +++++++++++
 src/pacman/pacman.c |    6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
index a362d2c..bca723d 100644
--- a/doc/pacman.8.txt
+++ b/doc/pacman.8.txt
@@ -229,6 +229,17 @@ Upgrade Options (apply to '-S' and '-U')[[UO]]
 	there is one available. Multiple groups can be specified by
 	separating them with a comma.
 
+*\--needed*::
+	Don't reinstall the targets that are already up to date.
+
+*\--recursive*::
+	Recursively reinstall all dependencies of the targets. This forces upgrades
+	or reinstalls of all dependencies without requiring explicit version
+	requirements. This is most useful in combination with the '\--needed' flag,
+	which will induce a deep dependency upgrade without any unnecessary
+	reinstalls.
+
+
 Query Options[[QO]]
 -------------------
 *-c, \--changelog*::
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 585c8e0..5457698 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -134,6 +134,8 @@ static void usage(int op, const char * const myname)
 			addlist(_("  -u, --unneeded       remove unneeded packages\n"));
 		} else if(op == PM_OP_UPGRADE) {
 			printf("%s:  %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
+			addlist(_("      --needed         don't reinstall up to date packages\n"));
+			addlist(_("      --recursive      reinstall all dependencies of target packages\n"));
 			printf("%s:\n", str_opt);
 		} else if(op == PM_OP_QUERY) {
 			printf("%s:  %s {-Q --query} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
@@ -531,6 +533,8 @@ static int parsearg_upgrade(int opt)
 		case 'f': config->flags |= ALPM_TRANS_FLAG_FORCE; break;
 		case OP_ASDEPS: config->flags |= ALPM_TRANS_FLAG_ALLDEPS; break;
 		case OP_ASEXPLICIT: config->flags |= ALPM_TRANS_FLAG_ALLEXPLICIT; break;
+		case OP_NEEDED: config->flags |= ALPM_TRANS_FLAG_NEEDED; break;
+		case OP_RECURSIVE: config->flags |= ALPM_TRANS_FLAG_RECURSE; break;
 		case OP_IGNORE:
 			parsearg_util_addlist(&(config->ignorepkg));
 			break;
@@ -547,8 +551,6 @@ static int parsearg_sync(int opt)
 	if(parsearg_upgrade(opt) == 0)
 		return 0;
 	switch(opt) {
-		case OP_NEEDED: config->flags |= ALPM_TRANS_FLAG_NEEDED; break;
-		case OP_RECURSIVE: config->flags |= ALPM_TRANS_FLAG_RECURSE; break;
 		case 'c': (config->op_s_clean)++; break;
 		case 'g': (config->group)++; break;
 		case 'i': (config->op_s_info)++; break;
-- 
1.7.6



More information about the pacman-dev mailing list