[pacman-dev] [PATCH] makepkg: remove unneeded "|| true"
makepkg only aborts on errors during PKGBUILD functions so the remaining "|| true" statements are unneeded. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index ce6c9da..b69c071 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1094,16 +1094,16 @@ remove_deps() { # check for packages removed during dependency install (e.g. due to conflicts) # removing all installed packages is risky in this case if [[ -n $(grep -xvFf <(printf '%s\n' "${current_pkglist[@]}") \ - <(printf '%s\n' "${original_pkglist[@]}") || true) ]]; then + <(printf '%s\n' "${original_pkglist[@]}")) ]]; then warning "$(gettext "Failed to remove installed dependencies.")" return 0 fi local deplist deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \ - <(printf "%s\n" "${current_pkglist[@]}") || true)) + <(printf "%s\n" "${current_pkglist[@]}"))) if [[ -z $deplist ]]; then - return + return 0 fi msg "Removing installed dependencies..." @@ -2674,7 +2674,7 @@ fi # set pacman command if not already defined PACMAN=${PACMAN:-pacman} # save full path to command as PATH may change when sourcing /etc/profile -PACMAN_PATH=$(type -P $PACMAN) || true +PACMAN_PATH=$(type -P $PACMAN) # check if messages are to be printed using color unset ALL_OFF BOLD BLUE GREEN RED YELLOW -- 1.8.5.3
On Sun, Feb 02, 2014 at 05:39:18PM +1000, Allan McRae wrote:
makepkg only aborts on errors during PKGBUILD functions so the remaining "|| true" statements are unneeded.
I think this probably extends to a lot of places we've used something like '|| ret=$?' to get around this historical limitation.
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index ce6c9da..b69c071 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1094,16 +1094,16 @@ remove_deps() { # check for packages removed during dependency install (e.g. due to conflicts) # removing all installed packages is risky in this case if [[ -n $(grep -xvFf <(printf '%s\n' "${current_pkglist[@]}") \ - <(printf '%s\n' "${original_pkglist[@]}") || true) ]]; then + <(printf '%s\n' "${original_pkglist[@]}")) ]]; then warning "$(gettext "Failed to remove installed dependencies.")" return 0 fi
local deplist deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \ - <(printf "%s\n" "${current_pkglist[@]}") || true)) + <(printf "%s\n" "${current_pkglist[@]}"))) if [[ -z $deplist ]]; then - return + return 0 fi
msg "Removing installed dependencies..." @@ -2674,7 +2674,7 @@ fi # set pacman command if not already defined PACMAN=${PACMAN:-pacman} # save full path to command as PATH may change when sourcing /etc/profile -PACMAN_PATH=$(type -P $PACMAN) || true +PACMAN_PATH=$(type -P $PACMAN)
# check if messages are to be printed using color unset ALL_OFF BOLD BLUE GREEN RED YELLOW -- 1.8.5.3
participants (2)
-
Allan McRae
-
Dave Reisner