From: Que Quotion <[email protected]>

also restore check for pacman!

Signed-off-by: Que Quotion <[email protected]>
---
 scripts/Makefile.am                          |  2 ++
 scripts/libmakepkg/executable.sh.in          |  7 +++-
 scripts/libmakepkg/executable/ccache.sh.in   |  2 +-
 scripts/libmakepkg/executable/distcc.sh.in   |  2 +-
 scripts/libmakepkg/executable/fakeroot.sh.in |  2 +-
 scripts/libmakepkg/executable/gpg.sh.in      |  2 +-
 scripts/libmakepkg/executable/gzip.sh.in     |  2 +-
 scripts/libmakepkg/executable/meson.build    |  1 +
 scripts/libmakepkg/executable/pacman.sh.in   | 37 ++++++++++++++++++++
 scripts/libmakepkg/executable/strip.sh.in    |  2 +-
 scripts/libmakepkg/executable/vcs.sh.in      | 12 ++++---
 11 files changed, 59 insertions(+), 12 deletions(-)
 create mode 100644 scripts/libmakepkg/executable/pacman.sh.in

diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 02188e9f..6e47c1a1 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -42,6 +42,7 @@ libmakepkgdir = $(datarootdir)/makepkg
 
 LIBMAKEPKGDIRS = \
        buildenv \
+       executable \
        integrity \
        lint_config \
        lint_package \
@@ -58,6 +59,7 @@ LIBMAKEPKG_IN = \
        libmakepkg/executable/fakeroot.sh \
        libmakepkg/executable/gpg.sh \
        libmakepkg/executable/gzip.sh \
+       libmakepkg/executable/pacman.sh \
        libmakepkg/executable/strip.sh \
        libmakepkg/executable/sudo.sh \
        libmakepkg/executable/vcs.sh \
diff --git a/scripts/libmakepkg/executable.sh.in 
b/scripts/libmakepkg/executable.sh.in
index 06ed86e2..57953600 100644
--- a/scripts/libmakepkg/executable.sh.in
+++ b/scripts/libmakepkg/executable.sh.in
@@ -36,9 +36,14 @@ done
 readonly -a executable_functions
 
 check_software() {
-    msg "$(gettext "Checking for needed software...")"
+       msg "$(gettext "Checking for needed software...")"
+
+       local ret=0
 
        for func in ${executable_functions[@]}; do
                $func
        done
+
+       return $ret
+
 }
diff --git a/scripts/libmakepkg/executable/ccache.sh.in 
b/scripts/libmakepkg/executable/ccache.sh.in
index f31a2014..a745be79 100644
--- a/scripts/libmakepkg/executable/ccache.sh.in
+++ b/scripts/libmakepkg/executable/ccache.sh.in
@@ -31,7 +31,7 @@ executable_ccache() {
        if check_buildoption "ccache" "y"; then
                if ! type -p ccache >/dev/null; then
                        error "$(gettext "Cannot find the %s binary required 
for compiler cache usage.")" "ccache"
-                       return 1
+                       ret=1
                fi
        fi
 }
diff --git a/scripts/libmakepkg/executable/distcc.sh.in 
b/scripts/libmakepkg/executable/distcc.sh.in
index e794d51a..b47a8915 100644
--- a/scripts/libmakepkg/executable/distcc.sh.in
+++ b/scripts/libmakepkg/executable/distcc.sh.in
@@ -31,7 +31,7 @@ executable_distcc() {
        if check_buildoption "distcc" "y"; then
                if ! type -p distcc >/dev/null; then
                        error "$(gettext "Cannot find the %s binary required 
for distributed compilation.")" "distcc"
-                       return 1
+                       ret=1
                fi
        fi
 }
diff --git a/scripts/libmakepkg/executable/fakeroot.sh.in 
b/scripts/libmakepkg/executable/fakeroot.sh.in
index 7c03ebeb..83c7a0f6 100644
--- a/scripts/libmakepkg/executable/fakeroot.sh.in
+++ b/scripts/libmakepkg/executable/fakeroot.sh.in
@@ -31,7 +31,7 @@ executable_fakeroot() {
        if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
                if ! type -p fakeroot >/dev/null; then
                        error "$(gettext "Cannot find the %s binary.")" 
"fakeroot"
-                       return 1
+                       ret=1
                fi
        fi
 }
diff --git a/scripts/libmakepkg/executable/gpg.sh.in 
b/scripts/libmakepkg/executable/gpg.sh.in
index 0c198473..f53f186d 100644
--- a/scripts/libmakepkg/executable/gpg.sh.in
+++ b/scripts/libmakepkg/executable/gpg.sh.in
@@ -32,7 +32,7 @@ executable_gpg() {
        { (( ! SKIPPGPCHECK )) && source_has_signatures }; then
                if ! type -p gpg >/dev/null; then
                        error "$(gettext "Cannot find the %s binary required 
for signing packages.")" "gpg"
-                       return 1
+                       ret=1
                fi
        fi
 }
diff --git a/scripts/libmakepkg/executable/gzip.sh.in 
b/scripts/libmakepkg/executable/gzip.sh.in
index 6d90369e..222c5a47 100644
--- a/scripts/libmakepkg/executable/gzip.sh.in
+++ b/scripts/libmakepkg/executable/gzip.sh.in
@@ -31,7 +31,7 @@ executable_gzip() {
        if check_option "zipman" "y"; then
                if ! type -p gzip >/dev/null; then
                        error "$(gettext "Cannot find the %s binary required 
for compressing man and info pages.")" "gzip"
-                       return 1
+                       ret=1
                fi
        fi
 }
diff --git a/scripts/libmakepkg/executable/meson.build 
b/scripts/libmakepkg/executable/meson.build
index f6f86a4d..8536a540 100644
--- a/scripts/libmakepkg/executable/meson.build
+++ b/scripts/libmakepkg/executable/meson.build
@@ -7,6 +7,7 @@ sources = [
   'fakeroot.sh.in',
   'gpg.sh.in',
   'gzip.sh.in',
+  'pacman.sh.in',
   'strip.sh.in',
   'sudo.sh.in',
   'vcs.sh.in',
diff --git a/scripts/libmakepkg/executable/pacman.sh.in 
b/scripts/libmakepkg/executable/pacman.sh.in
new file mode 100644
index 00000000..9af475bd
--- /dev/null
+++ b/scripts/libmakepkg/executable/pacman.sh.in
@@ -0,0 +1,37 @@
+#!/usr/bin/bash
+#
+#   pacman.sh - Check for PACMAN if we need it
+#
+#   Copyright (c) 2018 Pacman Development Team <[email protected]>
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+[[ -n "$LIBMAKEPKG_EXECUTABLE_PACMAN_SH" ]] && return
+LIBMAKEPKG_EXECUTABLE_PACMAN_SH=1
+
+LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
+
+source "$LIBRARY/util/option.sh"
+
+executable_functions+=('executable_pacman')
+
+executable_pacman() {
+    if (( ! NODEPS || DEP_BIN || RMDEPS || INSTALL )); then
+               if [[ -z $PACMAN_PATH ]]; then
+                       error "$(gettext "Cannot find the %s binary required 
for dependency operations.")" "$PACMAN"
+                       ret=1
+               fi
+       fi
+}
diff --git a/scripts/libmakepkg/executable/strip.sh.in 
b/scripts/libmakepkg/executable/strip.sh.in
index 8d66c02a..318e2b97 100644
--- a/scripts/libmakepkg/executable/strip.sh.in
+++ b/scripts/libmakepkg/executable/strip.sh.in
@@ -31,7 +31,7 @@ executable_strip() {
        if check_option "strip" "y"; then
                if ! type -p strip >/dev/null; then
                        error "$(gettext "Cannot find the %s binary required 
for object file stripping.")" "strip"
-                       return 1
+                       ret=1
                fi
        fi
 }
diff --git a/scripts/libmakepkg/executable/vcs.sh.in 
b/scripts/libmakepkg/executable/vcs.sh.in
index 966c3680..728cb78e 100644
--- a/scripts/libmakepkg/executable/vcs.sh.in
+++ b/scripts/libmakepkg/executable/vcs.sh.in
@@ -50,16 +50,16 @@ get_vcsclient() {
 }
 
 check_vcs_software() {
-       local netfile all_sources all_deps deps
+    local netfile all_sources all_deps deps ret=0
 
        if (( SOURCEONLY == 1 )); then
                # we will not download VCS sources
-               return 0
+       return $ret
        fi
 
        if [[ -z $PACMAN_PATH ]]; then
                warning "$(gettext "Cannot find the %s binary needed to check 
VCS source requirements.")" "$PACMAN"
-               return 0
+       return $ret
        fi
 
        # we currently only use global depends/makedepends arrays for --syncdeps
@@ -88,7 +88,7 @@ check_vcs_software() {
                                                if ! in_array "$client" 
${all_deps[@]}; then
                                                        error "$(gettext 
"Cannot find the %s package needed to handle %s sources.")" \
                                                                        
"$client" "${proto%%+*}"
-                                                       return 1
+                                               ret=1
                                                fi
                                        fi
                                fi
@@ -98,10 +98,12 @@ check_vcs_software() {
                                ;;
                esac
     done
+
+    return $ret
 }
 
 executable_vcs() {
        if ! check_vcs_software; then
-               return 1
+               ret=1
        fi
 }
-- 
2.19.1

Reply via email to