[pacman-dev] [PATCH 09/15] Add config option for showing all optdeps again

Benedikt Morbach benedikt.morbach at googlemail.com
Sun Sep 11 15:29:42 EDT 2011


Signed-off-by: Benedikt Morbach <benedikt.morbach at googlemail.com>
---
 doc/pacman.conf.5.txt |    5 +++++
 etc/pacman.conf.in    |    1 +
 src/pacman/conf.c     |    3 +++
 src/pacman/conf.h     |    1 +
 src/pacman/util.c     |    4 ++--
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt
index e793e78..ad7fb40 100644
--- a/doc/pacman.conf.5.txt
+++ b/doc/pacman.conf.5.txt
@@ -178,6 +178,11 @@ Options
 	Performs an approximate check for adequate available disk space before
 	installing packages.
 
+*ShowAllOptdeps*::
+	When installing a package, show installed optional dependencies too.
+	Default behavior is to only show uninstalled ones.
+	If turned on, installed optional dependencies will be marked with '[installed]'
+
 *VerbosePkgLists*::
 	Displays name, version and size of target packages formatted
 	as a table for upgrade, sync and remove operations.
diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in
index b9595ef..73445ac 100644
--- a/etc/pacman.conf.in
+++ b/etc/pacman.conf.in
@@ -35,6 +35,7 @@ Architecture = auto
 #TotalDownload
 #CheckSpace
 #VerbosePkgLists
+#ShowAllOptdeps
 
 # PGP signature checking
 #SigLevel = Optional
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 6587be9..f2982e3 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -376,6 +376,9 @@ static int _parse_options(const char *key, char *value,
 		} else if(strcmp(key, "TotalDownload") == 0) {
 			config->totaldownload = 1;
 			pm_printf(ALPM_LOG_DEBUG, "config: totaldownload\n");
+		} else if(strcmp(key, "ShowAllOptdeps") == 0) {
+			config->showalloptdeps = 1;
+			pm_printf(ALPM_LOG_DEBUG, "config: showalloptdeps\n");
 		} else if(strcmp(key, "CheckSpace") == 0) {
 			config->checkspace = 1;
 		} else {
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 552afad..23008ea 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -33,6 +33,7 @@ typedef struct __config_t {
 	unsigned short logmask;
 	unsigned short print;
 	unsigned short checkspace;
+	unsigned short showalloptdeps;
 	unsigned short usesyslog;
 	unsigned short usedelta;
 	char *arch;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 5318142..afe6840 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1085,7 +1085,7 @@ void display_new_optdepends(alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg)
 	new = alpm_pkg_get_optdepends(newpkg);
 	optdeps = alpm_list_diff(new, old, opt_cmp);
 
-	optstrings = optdep_string_list(optdeps, 0);
+	optstrings = optdep_string_list(optdeps, config->showalloptdeps);
 
 	if(optstrings) {
 		printf(_("New optional dependencies for %s\n"), alpm_pkg_get_name(newpkg));
@@ -1100,7 +1100,7 @@ void display_optdepends(alpm_pkg_t *pkg)
 {
 	alpm_list_t *optstrings;
 
-	optstrings = optdep_string_list(alpm_pkg_get_optdepends(pkg), 0);
+	optstrings = optdep_string_list(alpm_pkg_get_optdepends(pkg), config->showalloptdeps);
 
 	if(optstrings) {
 		printf(_("Optional dependencies for %s\n"), alpm_pkg_get_name(pkg));
-- 
1.7.6.1



More information about the pacman-dev mailing list