From 0bb04fa16a82db133dd010478c1256bc8500c5e7 Mon Sep 17 00:00:00 2001 From: Que Quotion Date: Tue, 27 Nov 2018 18:23:00 +0900 Subject: Split check_software() to libmakepkg This opens the door for third parties who provide extensions to libmakepkg to supply scripts that confirm the presence of their dependant executables. Signed-off-by: Que Quotion Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 172 -------------------------------------------------- 1 file changed, 172 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9365801c..d92e4aac 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -897,178 +897,6 @@ install_package() { fi } -get_vcsclient() { - local proto=${1%%+*} - - local i - for i in "${VCSCLIENTS[@]}"; do - local handler="${i%%::*}" - if [[ $proto = "$handler" ]]; then - local client="${i##*::}" - break - fi - done - - # if we didn't find an client, return an error - if [[ -z $client ]]; then - error "$(gettext "Unknown download protocol: %s")" "$proto" - plain "$(gettext "Aborting...")" - exit $E_CONFIG_ERROR - fi - - printf "%s\n" "$client" -} - -check_vcs_software() { - local netfile all_sources all_deps deps ret=0 - - if (( SOURCEONLY == 1 )); then - # we will not download VCS sources - return $ret - fi - - if [[ -z $PACMAN_PATH ]]; then - warning "$(gettext "Cannot find the %s binary needed to check VCS source requirements.")" "$PACMAN" - return $ret - fi - - # we currently only use global depends/makedepends arrays for --syncdeps - for attr in depends makedepends; do - get_pkgbuild_attribute "$pkg" "$attr" 1 'deps' - all_deps+=("${deps[@]}") - - get_pkgbuild_attribute "$pkg" "${attr}_$CARCH" 1 'deps' - all_deps+=("${deps[@]}") - done - - get_all_sources_for_arch 'all_sources' - for netfile in ${all_sources[@]}; do - local proto=$(get_protocol "$netfile") - - case $proto in - bzr*|git*|hg*|svn*) - if ! type -p ${proto%%+*} > /dev/null; then - local client - client=$(get_vcsclient "$proto") || exit $? - # ensure specified program is installed - local uninstalled - uninstalled=$(check_deps "$client") || exit $E_INSTALL_DEPS_FAILED - # if not installed, check presence in depends or makedepends - if [[ -n "$uninstalled" ]] && (( ! NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then - if ! in_array "$client" ${all_deps[@]}; then - error "$(gettext "Cannot find the %s package needed to handle %s sources.")" \ - "$client" "${proto%%+*}" - ret=1 - fi - fi - fi - ;; - *) - # non VCS source - ;; - esac - done - - return $ret -} - -check_software() { - # check for needed software - local ret=0 - - # check for PACMAN if we need it - 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 - - # check for sudo if we will need it during makepkg execution - if (( DEP_BIN || RMDEPS || INSTALL )); then - if ! type -p sudo >/dev/null; then - warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su" - fi - fi - - # fakeroot - correct package file permissions - if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then - if ! type -p fakeroot >/dev/null; then - error "$(gettext "Cannot find the %s binary.")" "fakeroot" - ret=1 - fi - fi - - # gpg - package signing - if [[ $SIGNPKG == 'y' ]] || { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; }; then - if ! type -p gpg >/dev/null; then - error "$(gettext "Cannot find the %s binary required for signing packages.")" "gpg" - ret=1 - fi - fi - - # gpg - source verification - if (( ! SKIPPGPCHECK )) && source_has_signatures; then - if ! type -p gpg >/dev/null; then - error "$(gettext "Cannot find the %s binary required for verifying source files.")" "gpg" - ret=1 - fi - fi - - # checksum operations - if (( GENINTEG || ! SKIPCHECKSUMS )); then - local integlist - IFS=$'\n' read -rd '' -a integlist < <(get_integlist) - - local integ - for integ in "${integlist[@]}"; do - if ! type -p "${integ}sum" >/dev/null; then - error "$(gettext "Cannot find the %s binary required for source file checksums operations.")" "${integ}sum" - ret=1 - fi - done - fi - - # distcc - compilation with 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" - ret=1 - fi - fi - - # ccache - compilation with 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" - ret=1 - fi - fi - - # strip - strip symbols from binaries/libraries - 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" - ret=1 - fi - fi - - # gzip - compressig man and info pages - 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" - ret=1 - fi - fi - - # tools to download vcs sources - if ! check_vcs_software; then - ret=1 - fi - - return $ret -} - check_build_status() { if (( ! SPLITPKG )); then fullver=$(get_full_version) -- cgit v1.2.3-54-g00ecf