From 3c69dd72f178c2f1307ce1294f7114c6dc3f078c Mon Sep 17 00:00:00 2001
From: Xavier Chantry <shiningxc@gmail.com>
Date: Tue, 1 Sep 2009 21:24:10 +0200
Subject: [PATCH] use noconfirm with print operations

I lost 1h of my precious time because -Sp is interactive in 1% of the case,
when it is used with groups...

In my opinion, pacman should not be interactive when installing groups, but
that is a different problem. In the meantime we can just set noconfirm when
using -Sp.

For reference, the script who failed in very very weird ways is the
following one, which check invalid (non installable) optdepends:

source /etc/makepkg.conf

find /var/abs/ -name PKGBUILD |
while read pkgbuild
do
	source $pkgbuild
	for opt in "${optdepends[@]}"; do
		pkg=${opt%%:*}
		desc=${opt#*:}
		if ! pacman -Spd $pkg &>/dev/null; then
			echo -n "$pkgname : \"$pkg\""
			echo
		elif [[ $(pacman -Sg $pkg | wc -l) -gt 0 ]] ; then
			echo "$pkgname : \"$pkg\"" is a group ?
		fi
	done
	unset optdepends
done

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
---
 src/pacman/pacman.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 54c9712..3360ba3 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1045,10 +1045,11 @@ int main(int argc, char *argv[])
 
 	/* set up the print operations */
 	if(config->op_s_print) {
-		/* Display only errors */
-		config->logmask &= ~PM_LOG_WARNING;
+		config->noconfirm=1;
 		config->flags |= PM_TRANS_FLAG_NOCONFLICTS;
 		config->flags |= PM_TRANS_FLAG_NOLOCK;
+		/* Display only errors */
+		config->logmask &= ~PM_LOG_WARNING;
 	}
 
 	if(config->noask) {
-- 
1.6.4.2

