Updated msys2

This commit is contained in:
gator96100 2019-08-16 02:06:21 +02:00
commit f0dc1ea8b0
13308 changed files with 689276 additions and 46605 deletions

View file

@ -0,0 +1,47 @@
#!/usr/bin/bash
#
# compress.sh - functions to compress archives in a uniform manner
#
# Copyright (c) 2017-2018 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_COMPRESS_SH" ]] && return
LIBMAKEPKG_UTIL_COMPRESS_SH=1
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
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
local filename="$1"
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 ;;
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$ext"; cat ;;
esac
}

View file

@ -0,0 +1,41 @@
#!/usr/bin/bash
#
# error.sh.in - error variable definitions for makepkg
#
# Copyright (c) 2006-2018 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_ERROR_SH" ]] && return
LIBMAKEPKG_UTIL_ERROR_SH=1
E_OK=0
E_FAIL=1 # Generic error
E_CONFIG_ERROR=2
E_INVALID_OPTION=3
E_USER_FUNCTION_FAILED=4
E_PACKAGE_FAILED=5
E_MISSING_FILE=6
E_MISSING_PKGDIR=7
E_INSTALL_DEPS_FAILED=8
E_REMOVE_DEPS_FAILED=9
E_ROOT=10
E_FS_PERMISSIONS=11
E_PKGBUILD_ERROR=12
E_ALREADY_BUILT=13
E_INSTALL_FAILED=14
E_MISSING_MAKEPKG_DEPS=15
E_PRETTY_BAD_PRIVACY=16

View file

@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/bash
#
# message.sh - functions for outputting messages in makepkg
#
# Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2006-2018 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

View file

@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/bash
#
# option.sh - functions to test if build/packaging options are enabled
#
# Copyright (c) 2009-2016 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2009-2018 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

View file

@ -0,0 +1,173 @@
#!/usr/bin/bash
#
# parseopts.sh - getopt_long-like parser
#
# Copyright (c) 2012-2018 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/>.
#
# A getopt_long-like parser which portably supports longopts and
# shortopts with some GNU extensions. It does not allow for options
# with optional arguments. For both short and long opts, options
# requiring an argument should be suffixed with a colon. After the
# first argument containing the short opts, any number of valid long
# opts may be be passed. The end of the options delimiter must then be
# added, followed by the user arguments to the calling program.
#
# Recommended Usage:
# OPT_SHORT='fb:z'
# OPT_LONG=('foo' 'bar:' 'baz')
# if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
# exit 1
# fi
# set -- "${OPTRET[@]}"
# Returns:
# 0: parse success
# 1: parse failure (error message supplied)
parseopts() {
local opt= optarg= i= shortopts=$1
local -a longopts=() unused_argv=()
shift
while [[ $1 && $1 != '--' ]]; do
longopts+=("$1")
shift
done
shift
longoptmatch() {
local o longmatch=()
for o in "${longopts[@]}"; do
if [[ ${o%:} = "$1" ]]; then
longmatch=("$o")
break
fi
[[ ${o%:} = "$1"* ]] && longmatch+=("$o")
done
case ${#longmatch[*]} in
1)
# success, override with opt and return arg req (0 == none, 1 == required)
opt=${longmatch%:}
if [[ $longmatch = *: ]]; then
return 1
else
return 0
fi ;;
0)
# fail, no match found
return 255 ;;
*)
# fail, ambiguous match
printf "${0##*/}: $(gettext "option '%s' is ambiguous; possibilities:")" "--$1"
printf " '%s'" "${longmatch[@]%:}"
printf '\n'
return 254 ;;
esac >&2
}
while (( $# )); do
case $1 in
--) # explicit end of options
shift
break
;;
-[!-]*) # short option
for (( i = 1; i < ${#1}; i++ )); do
opt=${1:i:1}
# option doesn't exist
if [[ $shortopts != *$opt* ]]; then
printf "${0##*/}: $(gettext "invalid option") -- '%s'\n" "$opt" >&2
OPTRET=(--)
return 1
fi
OPTRET+=("-$opt")
# option requires optarg
if [[ $shortopts = *$opt:* ]]; then
# if we're not at the end of the option chunk, the rest is the optarg
if (( i < ${#1} - 1 )); then
OPTRET+=("${1:i+1}")
break
# if we're at the end, grab the the next positional, if it exists
elif (( i == ${#1} - 1 )) && [[ $2 ]]; then
OPTRET+=("$2")
shift
break
# parse failure
else
printf "${0##*/}: $(gettext "option requires an argument") -- '%s'\n" "$opt" >&2
OPTRET=(--)
return 1
fi
fi
done
;;
--?*=*|--?*) # long option
IFS='=' read -r opt optarg <<< "${1#--}"
longoptmatch "$opt"
case $? in
0)
# parse failure
if [[ $optarg ]]; then
printf "${0##*/}: $(gettext "option '%s' does not allow an argument")\n" "--$opt" >&2
OPTRET=(--)
return 1
# --longopt
else
OPTRET+=("--$opt")
fi
;;
1)
# --longopt=optarg
if [[ $optarg ]]; then
OPTRET+=("--$opt" "$optarg")
# --longopt optarg
elif [[ $2 ]]; then
OPTRET+=("--$opt" "$2" )
shift
# parse failure
else
printf "${0##*/}: $(gettext "option '%s' requires an argument")\n" "--$opt" >&2
OPTRET=(--)
return 1
fi
;;
254)
# ambiguous option -- error was reported for us by longoptmatch()
OPTRET=(--)
return 1
;;
255)
# parse failure
printf "${0##*/}: $(gettext "invalid option") '--%s'\n" "$opt" >&2
OPTRET=(--)
return 1
;;
esac
;;
*) # non-option arg encountered, add it as a parameter
unused_argv+=("$1")
;;
esac
shift
done
# add end-of-opt terminator and any leftover positional parameters
OPTRET+=('--' "${unused_argv[@]}" "$@")
unset longoptmatch
return 0
}

View file

@ -2,7 +2,7 @@
#
# pkgbuild.sh - functions to extract information from PKGBUILD files
#
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2009-2018 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
@ -80,6 +80,10 @@ extract_function_variable() {
printf -v attr_regex '^[[:space:]]* %s\+?=[^(]' "$2"
fi
# this function requires extglob - save current status to restore later
local shellopts=$(shopt -p extglob)
shopt -s extglob
while read -r; do
# strip leading whitespace and any usage of declare
decl=${REPLY##*([[:space:]])}
@ -89,6 +93,8 @@ extract_function_variable() {
r=0
done < <(grep_function "$funcname" "$attr_regex")
eval "$shellopts"
return $r
}
@ -100,7 +106,11 @@ get_pkgbuild_attribute() {
local pkgname=$1 attrname=$2 isarray=$3 outputvar=$4
printf -v "$outputvar" %s ''
if (( isarray )); then
eval "$outputvar=()"
else
printf -v "$outputvar" %s ''
fi
if [[ $pkgname ]]; then
extract_global_variable "$attrname" "$isarray" "$outputvar"
@ -110,6 +120,33 @@ get_pkgbuild_attribute() {
fi
}
get_pkgbuild_all_split_attributes() {
local attrname=$1 outputvar=$2 all_list list
if extract_global_variable "$attrname" 1 list; then
all_list+=("${list[@]}")
fi
for a in "${arch[@]}"; do
if extract_global_variable "${attrname}_$a" 1 list; then
all_list+=("${list[@]}")
fi
done
for name in "${pkgname[@]}"; do
if extract_function_variable "package_$name" "$attrname" 1 list; then
all_list+=("${list[@]}")
fi
for a in "${arch[@]}"; do
if extract_function_variable "package_$name" "${attrname}_$a" 1 list; then
all_list+=("${list[@]}")
fi
done
done
[[ ${all_list[@]} ]] && array_build "$outputvar" all_list
}
##
# usage : get_full_version()
# return : full version spec, including epoch (if necessary), pkgver, pkgrel
@ -153,15 +190,13 @@ print_all_package_names() {
local version=$(get_full_version)
local architecture pkg opts a
for pkg in ${pkgname[@]}; do
get_pkgbuild_attribute "$pkg" 'arch' 1 architecture
get_pkgbuild_attribute "$pkg" 'options' 1 opts
for a in ${architecture[@]}; do
printf "%s-%s-%s\n" "$pkg" "$version" "$a"
if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then
printf "%s-%s-%s-%s\n" "$pkg" "debug" "$version" "$a"
fi
done
architecture=$(get_pkg_arch $pkg)
printf "%s/%s-%s-%s%s\n" "$PKGDEST" "$pkg" "$version" "$architecture" "$PKGEXT"
done
if check_option "debug" "y" && check_option "strip" "y"; then
architecture=$(get_pkg_arch)
printf "%s/%s-%s-%s-%s%s\n" "$PKGDEST" "$pkgbase" "debug" "$version" "$architecture" "$PKGEXT"
fi
}
get_all_sources() {
@ -193,3 +228,32 @@ get_all_sources_for_arch() {
array_build "$1" "aggregate"
}
get_integlist() {
local integ
local integlist=()
for integ in "${known_hash_algos[@]}"; do
# check for e.g. "sha256sums"
local sumname="${integ}sums[@]"
if [[ -n ${!sumname} ]]; then
integlist+=("$integ")
continue
fi
# check for e.g. "sha256sums_x86_64"
for a in "${arch[@]}"; do
local sumname="${integ}sums_${a}[@]"
if [[ -n ${!sumname} ]]; then
integlist+=("$integ")
break
fi
done
done
if (( ${#integlist[@]} > 0 )); then
printf "%s\n" "${integlist[@]}"
else
printf "%s\n" "${INTEGRITY_CHECK[@]}"
fi
}

View file

@ -2,7 +2,7 @@
#
# source.sh - functions to extract information from source URLs
#
# Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2010-2018 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
@ -65,6 +65,7 @@ get_filename() {
case $proto in
bzr*|git*|hg*|svn*)
filename=${netfile%%#*}
filename=${filename%%\?*}
filename=${filename%/}
filename=${filename##*/}
if [[ $proto = bzr* ]]; then
@ -111,6 +112,32 @@ get_filepath() {
printf "%s\n" "$file"
}
# extract the VCS revision/branch specifier from a source entry
get_uri_fragment() {
local netfile=$1
local fragment=${netfile#*#}
if [[ $fragment = "$netfile" ]]; then
unset fragment
fi
fragment=${fragment%\?*}
printf "%s\n" "$fragment"
}
# extract the VCS "signed" status from a source entry
get_uri_query() {
local netfile=$1
local query=${netfile#*\?}
if [[ $query = "$netfile" ]]; then
unset query
fi
query=${query%#*}
printf "%s\n" "$query"
}
get_downloadclient() {
local proto=$1

View file

@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/bash
#
# util.sh - general utility functions
#
# Copyright (c) 2006-2016 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2006-2018 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
@ -42,15 +42,10 @@ is_array() {
local v=$1
local ret=1
# this function requires extglob - save current options to restore later
local shellopts=$(shopt -p)
shopt -s extglob
if [[ $(declare -p "$i") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
ret=0
fi
eval "$shellopts"
return $ret
}
@ -83,3 +78,20 @@ cd_safe() {
exit 1
fi
}
# Try to create directory if one does not yet exist. Fails if the directory
# exists but has no write permissions, or if there is an existing file with
# the same name.
ensure_writable_dir() {
local dirtype="$1" dirpath="$2"
if ! mkdir -p "$dirpath" 2>/dev/null; then
error "$(gettext "Failed to create the directory \$%s (%s).")" "$dirtype" "$dirpath"
return 1
elif [[ ! -w $dirpath ]]; then
error "$(gettext "You do not have write permission for the directory \$%s (%s).")" "$dirtype" "$dirpath"
return 1
fi
return 0
}