Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=4f999b8d6c86504e6f8e7d86e6a150047559ba36

commit 4f999b8d6c86504e6f8e7d86e6a150047559ba36
Author: Michel Hermier <[email protected]>
Date:   Sun Dec 2 09:36:34 2012 +0100

scripts/makepkg

* Various command line options and command exit->return fixes.

diff --git a/scripts/makepkg b/scripts/makepkg
index c6f986a..f602a4d 100755
--- a/scripts/makepkg
+++ b/scripts/makepkg
@@ -2153,7 +2153,7 @@ makepkg_chroot_clean() {
if ! shift "$consumed"; then
consumed=$(($consumed - 1))
error "Option $1 expects $consumed argument(s)"
-                       exit 1
+                       return 1
fi
done

@@ -2185,7 +2185,7 @@ makepkg_chroot_clean() {
/usr/sbin/chroot $CHROOTDIR $PACMAN -Rcn $removelist --noconfirm
if [ "$?" != "0" ]; then
error "Failed to remove packages."
-                               exit 1
+                               return 1
fi
fi
msg "Cleaning chroot."
@@ -2196,7 +2196,7 @@ makepkg_chroot_clean() {

if [ $locked -eq 1 ]; then
# NOTE: arguments are reverse compared to makepkg_chroot_lock on purpose
-                       makepkg_file_lock --parent 
"$CHROOTDIR/$CHROOT_NAME/.lock" "$CHROOTDIR/.lock" makepkg_chroot_clean 
--unlocked "${args[@]}"
+                       makepkg_file_lock --parent 
"$CHROOTDIR/$CHROOT_NAME/.lock" -- "$CHROOTDIR/.lock" makepkg_chroot_clean 
--unlocked "${args[@]}"
return $?
fi
# Try to clean before destroy
@@ -2239,13 +2239,12 @@ makepkg_chroot_create() {
"-$(echo "${split}" | cut -c 3-)" \
"$@"
continue ;;
-               *)                      error "Optional parameter \"$1\" has 
unsupported format"
-                                       exit 1 ;;
+               *)                      break ;; # End of options
esac
if ! shift "$consumed"; then
consumed=$(($consumed - 1))
error "Option $1 expects $consumed argument(s)"
-                       exit 1
+                       return 1
fi
done

@@ -2290,17 +2289,23 @@ makepkg_chroot_list() {
"-$(echo "${split}" | cut -c 3-)" \
"$@"
continue ;;
-               *)                      break ;; # End of options
+               *)                      error "Optional parameter \"$1\" has 
unsupported format"
+                                       return 1 ;;
esac
if ! shift "$consumed"; then
consumed=$(($consumed - 1))
error "Option $1 expects $consumed argument(s)"
-                       exit 1
+                       return 1
fi
done

+       if [ $? -gt 0 ]; then
+               error "Unexpected trailling arguments"
+               return 1
+       fi
+
if [ $locked -eq 1 ]; then
-               makepkg_file_lock "$CHROOTDIR/.lock" makepkg_chroot_list 
--unlocked "${args[@]}"
+               makepkg_file_lock -- "$CHROOTDIR/.lock" makepkg_chroot_list 
--unlocked "${args[@]}"
return $?
fi

@@ -2337,12 +2342,13 @@ makepkg_chroot_lock() {
"-$(echo "${split}" | cut -c 3-)" \
"$@"
continue ;;
-               *)                      break ;; # End of options
+               *)                      error "Optional parameter \"$1\" has 
unsupported format"
+                                       return 1 ;;
esac
if ! shift "$consumed"; then
consumed=$(($consumed - 1))
error "Option $1 expects $consumed argument(s)"
-                       exit 1
+                       return 1
fi
done

@@ -2353,7 +2359,7 @@ makepkg_chroot_lock() {
local CHROOT_NAME="$1"
shift

-       makepkg_file_lock --parent "$CHROOTDIR/.lock" 
"$CHROOTDIR/$CHROOT_NAME/.lock" "$@"
+       makepkg_file_lock --parent "$CHROOTDIR/.lock" -- 
"$CHROOTDIR/$CHROOT_NAME/.lock" "$@"
return $?
}

@@ -2391,7 +2397,7 @@ makepkg_chroot_unlock() {
if ! shift "$consumed"; then
consumed=$(($consumed - 1))
error "Option $1 expects $consumed argument(s)"
-                       exit 1
+                       return 1
fi
done

@@ -2460,8 +2466,7 @@ makepkg_depends() {
"-$(echo "${split}" | cut -c 3-)" \
"$@"
continue ;;
-               *)                      error "Optional parameter \"$1\" has 
unsupported format"
-                                       exit 1 ;;
+               *)                      break ;; # End of options
esac
if ! shift "$consumed"; then
consumed=$(($consumed - 1))
@@ -2505,7 +2510,7 @@ makepkg_depends() {
msg ""
else
error "$PACMAN returned a fatal error."
-                               exit 1
+                               return 1
fi
fi

@@ -2614,8 +2619,7 @@ makepkg_file_lock() {
"-$(echo "${split}" | cut -c 3-)" \
"$@"
continue ;;
-               *)                      error "Optional parameter \"$1\" has 
unsupported format"
-                                       exit 1 ;;
+               *)                      break ;; # End of options
esac
if ! shift "$consumed"; then
consumed=$(($consumed - 1))
@@ -2781,6 +2785,7 @@ _makepkg_loadconfig() {
if [ "$USE_AUTO_MAKEFLAGS" != "n" ]; then
export MAKEFLAGS="-j`grep -c ^processor /proc/cpuinfo`"
fi
+       return 0
}

makepkg_main() {
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to