mirror of
https://github.com/Gator96100/ProxSpace.git
synced 2025-08-19 21:03:25 -07:00
Updated msys2 to msys2-base-x86_64-20200903
This commit is contained in:
parent
5bc8dbdc75
commit
2307d54cb1
18501 changed files with 1684082 additions and 720361 deletions
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# compress.sh - functions to compress archives in a uniform manner
|
||||
#
|
||||
# Copyright (c) 2017-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2017-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
# 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
|
||||
|
@ -29,18 +29,21 @@ source "$LIBRARY/util/message.sh"
|
|||
# Wrapper around many stream compression formats, for use in the middle of a
|
||||
# pipeline. A tar archive is passed on stdin and compressed to stdout.
|
||||
compress_as() {
|
||||
# $1: final archive filename extension for compression type detection
|
||||
# $1: final archive filename extension for compression type detection
|
||||
|
||||
local filename="$1"
|
||||
local ext=".tar${1##*.tar}"
|
||||
|
||||
case "$filename" in
|
||||
*tar.gz) ${COMPRESSGZ[@]:-gzip -c -f -n} ;;
|
||||
*tar.bz2) ${COMPRESSBZ2[@]:-bzip2 -c -f} ;;
|
||||
*tar.xz) ${COMPRESSXZ[@]:-xz -c -z -T0 -} ;;
|
||||
*tar.lrz) ${COMPRESSLRZ[@]:-lrzip -q} ;;
|
||||
*tar.lzo) ${COMPRESSLZO[@]:-lzop -q} ;;
|
||||
*tar.Z) ${COMPRESSZ[@]:-compress -c -f} ;;
|
||||
*tar) cat ;;
|
||||
case "$ext" in
|
||||
*.tar.gz) ${COMPRESSGZ[@]:-gzip -c -f -n} ;;
|
||||
*.tar.bz2) ${COMPRESSBZ2[@]:-bzip2 -c -f} ;;
|
||||
*.tar.xz) ${COMPRESSXZ[@]:-xz -c -z -} ;;
|
||||
*.tar.zst) ${COMPRESSZST[@]:-zstd -c -z -q -} ;;
|
||||
*.tar.lrz) ${COMPRESSLRZ[@]:-lrzip -q} ;;
|
||||
*.tar.lzo) ${COMPRESSLZO[@]:-lzop -q} ;;
|
||||
*.tar.Z) ${COMPRESSZ[@]:-compress -c -f} ;;
|
||||
*.tar.lz4) ${COMPRESSLZ4[@]:-lz4 -q} ;;
|
||||
*.tar.lz) ${COMPRESSLZ[@]:-lzip -c -f} ;;
|
||||
*.tar) cat ;;
|
||||
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
|
||||
"$ext"; cat ;;
|
||||
esac
|
||||
|
|
76
msys2/usr/share/makepkg/util/config.sh
Normal file
76
msys2/usr/share/makepkg/util/config.sh
Normal file
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# config.sh - functions for handling makepkg config files
|
||||
#
|
||||
# Copyright (c) 2006-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
#
|
||||
# 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_UTIL_CONFIG_SH" ]] && return
|
||||
LIBMAKEPKG_UTIL_CONFIG_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/error.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/util.sh"
|
||||
|
||||
# correctly source makepkg.conf, respecting user precedence and the system conf
|
||||
source_makepkg_config() {
|
||||
# $1: override system config file
|
||||
|
||||
local MAKEPKG_CONF=${1:-${MAKEPKG_CONF:-/etc/makepkg.conf}}
|
||||
|
||||
# Source the config file; fail if it is not found
|
||||
if [[ -r $MAKEPKG_CONF ]]; then
|
||||
source_safe "$MAKEPKG_CONF"
|
||||
else
|
||||
error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
|
||||
plainerr "$(gettext "Aborting...")"
|
||||
exit $E_CONFIG_ERROR
|
||||
fi
|
||||
|
||||
# Source user-specific makepkg.conf overrides, but only if no override config
|
||||
# file was specified
|
||||
XDG_PACMAN_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/pacman"
|
||||
if [[ $MAKEPKG_CONF = "/etc/makepkg.conf" ]]; then
|
||||
if [[ -r $XDG_PACMAN_DIR/makepkg.conf ]]; then
|
||||
source_safe "$XDG_PACMAN_DIR/makepkg.conf"
|
||||
elif [[ -r $HOME/.makepkg.conf ]]; then
|
||||
source_safe "$HOME/.makepkg.conf"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# load makepkg.conf by sourcing the configuration files, and preserving
|
||||
# existing environment settings
|
||||
load_makepkg_config() {
|
||||
# $1: override system config file
|
||||
|
||||
local MAKEPKG_CONF=${1:-${MAKEPKG_CONF:-/etc/makepkg.conf}}
|
||||
|
||||
# preserve environment variables to override makepkg.conf
|
||||
local restore_envvars=$(
|
||||
for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR PKGEXT SRCEXT GPGKEY PACKAGER CARCH; do
|
||||
# the output of 'declare -p' results in locally scoped values when used within a function
|
||||
[[ -v $var ]] && printf '%s=%s\n' "$var" "${!var@Q}"
|
||||
done
|
||||
)
|
||||
|
||||
source_makepkg_config "$MAKEPKG_CONF"
|
||||
|
||||
eval "$restore_envvars"
|
||||
}
|
41
msys2/usr/share/makepkg/util/dirsize.sh
Normal file
41
msys2/usr/share/makepkg/util/dirsize.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# dirsize.sh - calculate size of all files in a directory
|
||||
#
|
||||
# Copyright (c) 2019-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
# 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_UTIL_DIRSIZE_SH" ]] && return
|
||||
LIBMAKEPKG_UTIL_DIRSIZE_SH=1
|
||||
|
||||
|
||||
# find the total filesize of all files in the current directory while only
|
||||
# counting multiply hardlinked files once
|
||||
dirsize() {
|
||||
local file inode
|
||||
declare -A files
|
||||
|
||||
{
|
||||
find . -type f -links 1 -exec cat {} + 2>/dev/null
|
||||
while read -rd ' ' inode; do
|
||||
IFS= read -r file
|
||||
if [[ -z ${files[$inode]} ]]; then
|
||||
files[$inode]=found
|
||||
cat "$file"
|
||||
fi
|
||||
done < <(find . -type f -links +1 -exec stat -c '%i %n' {} + 2>/dev/null)
|
||||
} | wc -c
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# error.sh.in - error variable definitions for makepkg
|
||||
#
|
||||
# Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2006-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# message.sh - functions for outputting messages in makepkg
|
||||
#
|
||||
# Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2006-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -43,19 +43,35 @@ colorize() {
|
|||
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
}
|
||||
|
||||
# plainerr/plainerr are primarily used to continue a previous message on a new
|
||||
# line, depending on whether the first line is a regular message or an error
|
||||
# output
|
||||
|
||||
plain() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@"
|
||||
}
|
||||
|
||||
plainerr() {
|
||||
plain "$@" >&2
|
||||
}
|
||||
|
||||
msg() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
|
||||
}
|
||||
|
||||
msg2() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
|
||||
}
|
||||
|
||||
ask() {
|
||||
local mesg=$1; shift
|
||||
printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@"
|
||||
}
|
||||
|
||||
warning() {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# option.sh - functions to test if build/packaging options are enabled
|
||||
#
|
||||
# Copyright (c) 2009-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2009-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
# 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
|
||||
|
@ -48,6 +48,30 @@ in_opt_array() {
|
|||
}
|
||||
|
||||
|
||||
##
|
||||
# usage : check_opt_array( $option, $expected_val, $haystack )
|
||||
# return : 0 - matches expected
|
||||
# 1 - does not match expected
|
||||
# 127 - not found
|
||||
##
|
||||
check_opt_array() {
|
||||
local option=$1 expected=$2; shift 2
|
||||
|
||||
in_opt_array "$option" "$@"
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $expected = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $expected = n ]]
|
||||
return ;;
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Checks to see if options are present in makepkg.conf or PKGBUILD;
|
||||
# PKGBUILD options always take precedence.
|
||||
|
@ -58,29 +82,7 @@ in_opt_array() {
|
|||
# 127 - not found
|
||||
##
|
||||
check_option() {
|
||||
in_opt_array "$1" ${options[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
# fall back to makepkg.conf options
|
||||
in_opt_array "$1" ${OPTIONS[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
check_opt_array "$@" "${OPTIONS[@]}" "${options[@]}"
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,20 +95,10 @@ check_option() {
|
|||
# 127 - not found
|
||||
##
|
||||
check_buildenv() {
|
||||
in_opt_array "$1" ${BUILDENV[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = "y" ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = "n" ]]
|
||||
return ;;
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
check_opt_array "$@" "${BUILDENV[@]}"
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Checks to see if options are present in BUILDENV or PKGBUILD;
|
||||
# PKGBUILD options always take precedence.
|
||||
|
@ -117,26 +109,5 @@ check_buildenv() {
|
|||
# 127 - not found
|
||||
##
|
||||
check_buildoption() {
|
||||
in_opt_array "$1" ${options[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
in_opt_array "$1" ${BUILDENV[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
check_opt_array "$@" "${BUILDENV[@]}" "${options[@]}"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# parseopts.sh - getopt_long-like parser
|
||||
#
|
||||
# Copyright (c) 2012-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2012-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
# 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# pkgbuild.sh - functions to extract information from PKGBUILD files
|
||||
#
|
||||
# Copyright (c) 2009-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2009-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
# 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
|
||||
|
@ -21,6 +21,8 @@
|
|||
[[ -n "$LIBMAKEPKG_UTIL_PKGBUILD_SH" ]] && return
|
||||
LIBMAKEPKG_UTIL_PKGBUILD_SH=1
|
||||
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
|
||||
|
||||
have_function() {
|
||||
declare -f "$1" >/dev/null
|
||||
|
@ -36,7 +38,7 @@ array_build() {
|
|||
# it's an error to try to copy a value which doesn't exist.
|
||||
declare -p "$2" &>/dev/null || return 1
|
||||
|
||||
# Build an array of the indicies of the source array.
|
||||
# Build an array of the indices of the source array.
|
||||
eval "keys=(\"\${!$2[@]}\")"
|
||||
|
||||
# Clear the destination array
|
||||
|
@ -60,7 +62,7 @@ extract_global_variable() {
|
|||
|
||||
if (( isarray )); then
|
||||
array_build ref "$attr"
|
||||
[[ ${ref[@]} ]] && array_build "$outputvar" "$attr"
|
||||
(( ${#ref[@]} )) && array_build "$outputvar" "$attr"
|
||||
else
|
||||
[[ ${!attr} ]] && printf -v "$outputvar" %s "${!attr}"
|
||||
fi
|
||||
|
@ -98,6 +100,15 @@ extract_function_variable() {
|
|||
return $r
|
||||
}
|
||||
|
||||
exists_function_variable() {
|
||||
# $1: function name
|
||||
# $2: variable name
|
||||
|
||||
local funcname=$1 attr=$2 out
|
||||
extract_function_variable "$funcname" "$attr" 0 out ||
|
||||
extract_function_variable "$funcname" "$attr" 1 out
|
||||
}
|
||||
|
||||
get_pkgbuild_attribute() {
|
||||
# $1: package name
|
||||
# $2: attribute name
|
||||
|
@ -144,7 +155,7 @@ get_pkgbuild_all_split_attributes() {
|
|||
done
|
||||
done
|
||||
|
||||
[[ ${all_list[@]} ]] && array_build "$outputvar" all_list
|
||||
(( ${#all_list[@]} )) && array_build "$outputvar" all_list
|
||||
}
|
||||
|
||||
##
|
||||
|
|
49
msys2/usr/share/makepkg/util/schema.sh
Normal file
49
msys2/usr/share/makepkg/util/schema.sh
Normal file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# schema.sh - declare specific groups of pkgbuild variables
|
||||
#
|
||||
# Copyright (c) 2015-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
# 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_SCHEMA_SH" ]] && return
|
||||
LIBMAKEPKG_SCHEMA_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/util.sh"
|
||||
|
||||
|
||||
known_hash_algos=({md5,sha{1,224,256,384,512},b2})
|
||||
|
||||
pkgbuild_schema_arrays=(arch backup checkdepends conflicts depends groups
|
||||
license makedepends noextract optdepends options
|
||||
provides replaces source validpgpkeys
|
||||
"${known_hash_algos[@]/%/sums}")
|
||||
|
||||
pkgbuild_schema_strings=(changelog epoch install pkgbase pkgdesc pkgrel pkgver
|
||||
url)
|
||||
|
||||
pkgbuild_schema_arch_arrays=(checkdepends conflicts depends makedepends
|
||||
optdepends provides replaces source
|
||||
"${known_hash_algos[@]/%/sums}")
|
||||
|
||||
pkgbuild_schema_package_overrides=(pkgdesc arch url license groups depends
|
||||
optdepends provides conflicts replaces
|
||||
backup options install changelog)
|
||||
|
||||
readonly -a known_hash_algos pkgbuild_schema_arrays \
|
||||
pkgbuild_schema_strings pkgbuild_schema_arch_arrays \
|
||||
pkgbuild_schema_package_overrides
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# source.sh - functions to extract information from source URLs
|
||||
#
|
||||
# Copyright (c) 2010-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2010-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
# 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
|
||||
|
@ -41,10 +41,12 @@ get_protocol() {
|
|||
if [[ $1 = *://* ]]; then
|
||||
# strip leading filename
|
||||
local proto="${1#*::}"
|
||||
printf "%s\n" "${proto%%://*}"
|
||||
proto="${proto%%://*}"
|
||||
# strip proto+uri://
|
||||
printf "%s\n" "${proto%%+*}"
|
||||
elif [[ $1 = *lp:* ]]; then
|
||||
local proto="${1#*::}"
|
||||
printf "%s\n" "${proto%%lp:*}"
|
||||
printf "%s\n" "${proto%%+lp:*}"
|
||||
else
|
||||
printf "%s\n" local
|
||||
fi
|
||||
|
@ -63,15 +65,15 @@ get_filename() {
|
|||
local proto=$(get_protocol "$netfile")
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
bzr|git|hg|svn)
|
||||
filename=${netfile%%#*}
|
||||
filename=${filename%%\?*}
|
||||
filename=${filename%/}
|
||||
filename=${filename##*/}
|
||||
if [[ $proto = bzr* ]]; then
|
||||
if [[ $proto = bzr ]]; then
|
||||
filename=${filename#*lp:}
|
||||
fi
|
||||
if [[ $proto = git* ]]; then
|
||||
if [[ $proto = git ]]; then
|
||||
filename=${filename%%.git*}
|
||||
fi
|
||||
;;
|
||||
|
@ -89,7 +91,7 @@ get_filepath() {
|
|||
local proto="$(get_protocol "$1")"
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
bzr|git|hg|svn)
|
||||
if [[ -d "$startdir/$file" ]]; then
|
||||
file="$startdir/$file"
|
||||
elif [[ -d "$SRCDEST/$file" ]]; then
|
||||
|
@ -154,7 +156,7 @@ get_downloadclient() {
|
|||
# if we didn't find an agent, return an error
|
||||
if [[ -z $agent ]]; then
|
||||
error "$(gettext "Unknown download protocol: %s")" "$proto"
|
||||
plain "$(gettext "Aborting...")"
|
||||
plainerr "$(gettext "Aborting...")"
|
||||
exit 1 # $E_CONFIG_ERROR
|
||||
fi
|
||||
|
||||
|
@ -163,7 +165,7 @@ get_downloadclient() {
|
|||
if [[ ! -x $program ]]; then
|
||||
local baseprog="${program##*/}"
|
||||
error "$(gettext "The download program %s is not installed.")" "$baseprog"
|
||||
plain "$(gettext "Aborting...")"
|
||||
plainerr "$(gettext "Aborting...")"
|
||||
exit 1 # $E_MISSING_PROGRAM
|
||||
fi
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# util.sh - general utility functions
|
||||
#
|
||||
# Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2006-2020 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -22,6 +22,10 @@
|
|||
[[ -n "$LIBMAKEPKG_UTIL_UTIL_SH" ]] && return
|
||||
LIBMAKEPKG_UTIL_UTIL_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/error.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
##
|
||||
# usage : in_array( $needle, $haystack )
|
||||
|
@ -42,7 +46,7 @@ is_array() {
|
|||
local v=$1
|
||||
local ret=1
|
||||
|
||||
if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
|
||||
if [[ ${!v@a} = *a* ]]; then
|
||||
ret=0
|
||||
fi
|
||||
|
||||
|
@ -51,7 +55,7 @@ is_array() {
|
|||
|
||||
# Canonicalize a directory path if it exists
|
||||
canonicalize_path() {
|
||||
local path="$1";
|
||||
local path="$1"
|
||||
|
||||
if [[ -d $path ]]; then
|
||||
(
|
||||
|
@ -74,7 +78,7 @@ dir_is_empty() {
|
|||
cd_safe() {
|
||||
if ! cd "$1"; then
|
||||
error "$(gettext "Failed to change to directory %s")" "$1"
|
||||
plain "$(gettext "Aborting...")"
|
||||
plainerr "$(gettext "Aborting...")"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -95,3 +99,16 @@ ensure_writable_dir() {
|
|||
|
||||
return 0
|
||||
}
|
||||
|
||||
# source a file and fail if it does not succeed
|
||||
source_safe() {
|
||||
local shellopts=$(shopt -p extglob)
|
||||
shopt -u extglob
|
||||
|
||||
if ! source "$@"; then
|
||||
error "$(gettext "Failed to source %s")" "$1"
|
||||
exit $E_MISSING_FILE
|
||||
fi
|
||||
|
||||
eval "$shellopts"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue