[pacman-dev] [PATCH] Added --needed option to makepkg

William Giokas 1007380 at gmail.com
Mon Nov 19 12:30:55 EST 2012


This helps when using scripts to install VCS packages. If using the
--noconfirm and --needed flag, and the package is already up to date,
then pacman does not need to do anything. Without, it re-installs the
packages, using unneded disk i/o.

Signed-off-by: William Giokas <1007380 at gmail.com>
---
 doc/makepkg.8.txt     | 4 ++++
 scripts/makepkg.sh.in | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 9d19e38..d7a434d 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -173,6 +173,10 @@ Options
 	(Passed to pacman) Prevent pacman from waiting for user input before
 	proceeding with operations.
 
+*\--needed*::
+	(Passed to pacman) Do not reinstall the targets that are already up to
+	date (used with -i / --install).
+
 *\--asdeps*::
 	(Passed to pacman) Install packages as non-explicitly installed (used
 	with -i / --install).
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e4bf296..a564a2f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2429,6 +2429,7 @@ usage() {
 	echo
 	printf -- "$(gettext "  --asdeps         Install packages as non-explicitly installed")\n"
 	printf -- "$(gettext "  --noconfirm      Do not ask for confirmation when resolving dependencies")\n"
+	printf -- "$(gettext "  --needed         Do not reinstall the targets that are already up to date")\n"
 	printf -- "$(gettext "  --noprogressbar  Do not show a progress bar when downloading files")\n"
 	echo
 	printf -- "$(gettext "If %s is not specified, %s will look for '%s'")\n" "-p" "makepkg" "$BUILDSCRIPT"
@@ -2464,7 +2465,7 @@ OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'config:' 'force' 'geninteg'
           'source' 'syncdeps' 'version')
 
 # Pacman Options
-OPT_LONG+=('asdeps' 'noconfirm' 'noprogressbar')
+OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar')
 
 if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
 	exit 1 # E_INVALID_OPTION;
@@ -2477,6 +2478,7 @@ while true; do
 		# Pacman Options
 		--asdeps)         ASDEPS=1;;
 		--noconfirm)      PACMAN_OPTS+=" --noconfirm" ;;
+		--needed)         PACMAN_OPTS+=" --needed" ;;
 		--noprogressbar)  PACMAN_OPTS+=" --noprogressbar" ;;
 
 		# Makepkg Options
-- 
1.8.0


More information about the pacman-dev mailing list