mirror of
https://github.com/Gator96100/ProxSpace.git
synced 2025-08-20 05:13:25 -07:00
Updated msys2
This commit is contained in:
parent
6a85995508
commit
f0dc1ea8b0
13308 changed files with 689276 additions and 46605 deletions
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# upx.sh - Compress package binaries with UPX
|
||||
# integrity.sh - functions relating to source integrity checking
|
||||
#
|
||||
# Copyright (c) 2011-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2011-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
|
||||
|
@ -18,29 +18,28 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ -n "$LIBMAKEPKG_TIDY_UPX_SH" ]] && return
|
||||
LIBMAKEPKG_TIDY_UPX_SH=1
|
||||
[[ -n "$LIBMAKEPKG_INTEGRITY_SH" ]] && return
|
||||
LIBMAKEPKG_INTEGRITY_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
for lib in "$LIBRARY/integrity/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
packaging_options+=('upx')
|
||||
tidy_modify+=('tidy_upx')
|
||||
|
||||
tidy_upx() {
|
||||
if check_option "upx" "y"; then
|
||||
msg2 "$(gettext "Compressing binaries with %s...")" "UPX"
|
||||
local binary
|
||||
find . -type f -perm -u+w 2>/dev/null | while read -r binary ; do
|
||||
case "$(file --brief --mime-type "$binary")" in
|
||||
'application/x-executable' | 'application/x-dosexec')
|
||||
upx "${UPXFLAGS[@]}" "$binary" &>/dev/null ||
|
||||
warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
check_source_integrity() {
|
||||
if (( SKIPCHECKSUMS && SKIPPGPCHECK )); then
|
||||
warning "$(gettext "Skipping all source file integrity checks.")"
|
||||
elif (( SKIPCHECKSUMS )); then
|
||||
warning "$(gettext "Skipping verification of source file checksums.")"
|
||||
check_pgpsigs "$@"
|
||||
elif (( SKIPPGPCHECK )); then
|
||||
warning "$(gettext "Skipping verification of source file PGP signatures.")"
|
||||
check_checksums "$@"
|
||||
else
|
||||
check_checksums "$@"
|
||||
check_pgpsigs "$@"
|
||||
fi
|
||||
}
|
102
msys2/usr/share/makepkg/integrity/generate_checksum.sh
Normal file
102
msys2/usr/share/makepkg/integrity/generate_checksum.sh
Normal file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# generate_checksum.sh - functions for generating source checksums
|
||||
#
|
||||
# Copyright (c) 2014-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_INTEGRITY_GENERATE_CHECKSUM_SH" ]] && return
|
||||
LIBMAKEPKG_INTEGRITY_GENERATE_CHECKSUM_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
generate_one_checksum() {
|
||||
local integ=$1 arch=$2 sources numsrc indentsz idx
|
||||
|
||||
if [[ $arch ]]; then
|
||||
array_build sources "source_$arch"
|
||||
else
|
||||
array_build sources 'source'
|
||||
fi
|
||||
|
||||
numsrc=${#sources[*]}
|
||||
if (( numsrc == 0 )); then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $arch ]]; then
|
||||
printf "%ssums_%s=(%n" "$integ" "$arch" indentsz
|
||||
else
|
||||
printf "%ssums=(%n" "$integ" indentsz
|
||||
fi
|
||||
|
||||
for (( idx = 0; idx < numsrc; ++idx )); do
|
||||
local netfile=${sources[idx]}
|
||||
local proto sum
|
||||
proto="$(get_protocol "$netfile")"
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
sum="SKIP"
|
||||
;;
|
||||
*)
|
||||
if [[ ${netfile%%::*} != *.@(sig?(n)|asc) ]]; then
|
||||
local file
|
||||
file="$(get_filepath "$netfile")" || missing_source_file "$netfile"
|
||||
sum="$("${integ}sum" "$file")"
|
||||
sum=${sum%% *}
|
||||
else
|
||||
sum="SKIP"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# indent checksum on lines after the first
|
||||
printf "%*s%s" $(( idx ? indentsz : 0 )) '' "'$sum'"
|
||||
|
||||
# print a newline on lines before the last
|
||||
(( idx < (numsrc - 1) )) && echo
|
||||
done
|
||||
|
||||
echo ")"
|
||||
}
|
||||
|
||||
generate_checksums() {
|
||||
msg "$(gettext "Generating checksums for source files...")"
|
||||
|
||||
local integlist
|
||||
if (( $# == 0 )); then
|
||||
IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
|
||||
else
|
||||
integlist=("$@")
|
||||
fi
|
||||
|
||||
local integ
|
||||
for integ in "${integlist[@]}"; do
|
||||
if ! in_array "$integ" "${known_hash_algos[@]}"; then
|
||||
error "$(gettext "Invalid integrity algorithm '%s' specified.")" "$integ"
|
||||
exit 1 # $E_CONFIG_ERROR
|
||||
fi
|
||||
|
||||
generate_one_checksum "$integ"
|
||||
for a in "${arch[@]}"; do
|
||||
generate_one_checksum "$integ" "$a"
|
||||
done
|
||||
done
|
||||
}
|
74
msys2/usr/share/makepkg/integrity/generate_signature.sh
Normal file
74
msys2/usr/share/makepkg/integrity/generate_signature.sh
Normal file
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# generate_signature.sh - functions for generating PGP signatures
|
||||
#
|
||||
# Copyright (c) 2008-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_INTEGRITY_GENERATE_SIGNATURE_SH" ]] && return
|
||||
LIBMAKEPKG_INTEGRITY_GENERATE_SIGNATURE_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
create_signature() {
|
||||
local ret=0
|
||||
local filename="$1"
|
||||
|
||||
local SIGNWITHKEY=""
|
||||
if [[ -n $GPGKEY ]]; then
|
||||
SIGNWITHKEY="-u ${GPGKEY}"
|
||||
fi
|
||||
|
||||
gpg --detach-sign --use-agent ${SIGNWITHKEY} --no-armor "$filename" &>/dev/null || ret=$?
|
||||
|
||||
|
||||
if (( ! ret )); then
|
||||
msg2 "$(gettext "Created signature file %s.")" "${filename##*/}.sig"
|
||||
else
|
||||
warning "$(gettext "Failed to sign package file.")"
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
create_package_signatures() {
|
||||
if [[ $SIGNPKG != 'y' ]]; then
|
||||
return 0
|
||||
fi
|
||||
local pkg pkgarch pkg_file
|
||||
local fullver=$(get_full_version)
|
||||
|
||||
msg "$(gettext "Signing package(s)...")"
|
||||
|
||||
for pkg in "${pkgname[@]}"; do
|
||||
pkgarch=$(get_pkg_arch $pkg)
|
||||
pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
|
||||
|
||||
create_signature "$pkg_file"
|
||||
done
|
||||
|
||||
# check if debug package needs a signature
|
||||
if check_option "debug" "y" && check_option "strip" "y"; then
|
||||
pkg=$pkgbase-debug
|
||||
pkgarch=$(get_pkg_arch)
|
||||
pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
|
||||
if [[ -f $pkg_file ]]; then
|
||||
create_signature "$pkg_file"
|
||||
fi
|
||||
fi
|
||||
}
|
130
msys2/usr/share/makepkg/integrity/verify_checksum.sh
Normal file
130
msys2/usr/share/makepkg/integrity/verify_checksum.sh
Normal file
|
@ -0,0 +1,130 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# verify_checksum.sh - functions for checking source checksums
|
||||
#
|
||||
# Copyright (c) 2014-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_INTEGRITY_VERIFY_CHECKSUM_SH" ]] && return
|
||||
LIBMAKEPKG_INTEGRITY_CHECKSUM_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
check_checksums() {
|
||||
local integ a
|
||||
declare -A correlation
|
||||
(( SKIPCHECKSUMS )) && return 0
|
||||
|
||||
# Initialize a map which we'll use to verify that every source array has at
|
||||
# least some kind of checksum array associated with it.
|
||||
(( ${#source[*]} )) && correlation['source']=1
|
||||
case $1 in
|
||||
all)
|
||||
for a in "${arch[@]}"; do
|
||||
array_build _ source_"$a" && correlation["source_$a"]=1
|
||||
done
|
||||
;;
|
||||
*)
|
||||
array_build _ source_"$CARCH" && correlation["source_$CARCH"]=1
|
||||
;;
|
||||
esac
|
||||
|
||||
for integ in "${known_hash_algos[@]}"; do
|
||||
verify_integrity_sums "$integ" && unset "correlation[source]"
|
||||
|
||||
case $1 in
|
||||
all)
|
||||
for a in "${arch[@]}"; do
|
||||
verify_integrity_sums "$integ" "$a" && unset "correlation[source_$a]"
|
||||
done
|
||||
;;
|
||||
*)
|
||||
verify_integrity_sums "$integ" "$CARCH" && unset "correlation[source_$CARCH]"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if (( ${#correlation[*]} )); then
|
||||
error "$(gettext "Integrity checks are missing for: %s")" "${!correlation[*]}"
|
||||
exit 1 # TODO: error code
|
||||
fi
|
||||
}
|
||||
|
||||
verify_integrity_one() {
|
||||
local source_name=$1 integ=$2 expectedsum=$3
|
||||
|
||||
local file="$(get_filename "$source_name")"
|
||||
printf ' %s ... ' "$file" >&2
|
||||
|
||||
if [[ $expectedsum = 'SKIP' ]]; then
|
||||
printf '%s\n' "$(gettext "Skipped")" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
if ! file="$(get_filepath "$file")"; then
|
||||
printf '%s\n' "$(gettext "NOT FOUND")" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local realsum="$("${integ}sum" "$file")"
|
||||
realsum="${realsum%% *}"
|
||||
if [[ ${expectedsum,,} = "$realsum" ]]; then
|
||||
printf '%s\n' "$(gettext "Passed")" >&2
|
||||
else
|
||||
printf '%s\n' "$(gettext "FAILED")" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
verify_integrity_sums() {
|
||||
local integ=$1 arch=$2 integrity_sums=() sources=() srcname
|
||||
|
||||
if [[ $arch ]]; then
|
||||
array_build integrity_sums "${integ}sums_$arch"
|
||||
srcname=source_$arch
|
||||
else
|
||||
array_build integrity_sums "${integ}sums"
|
||||
srcname=source
|
||||
fi
|
||||
|
||||
array_build sources "$srcname"
|
||||
if (( ${#integrity_sums[@]} == 0 && ${#sources[@]} == 0 )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if (( ${#integrity_sums[@]} == ${#sources[@]} )); then
|
||||
msg "$(gettext "Validating %s files with %s...")" "$srcname" "${integ}sums"
|
||||
local idx errors=0
|
||||
for (( idx = 0; idx < ${#sources[*]}; idx++ )); do
|
||||
verify_integrity_one "${sources[idx]}" "$integ" "${integrity_sums[idx]}" || errors=1
|
||||
done
|
||||
|
||||
if (( errors )); then
|
||||
error "$(gettext "One or more files did not pass the validity check!")"
|
||||
exit 1 # TODO: error code
|
||||
fi
|
||||
elif (( ${#integrity_sums[@]} )); then
|
||||
error "$(gettext "Integrity checks (%s) differ in size from the source array.")" "$integ"
|
||||
exit 1 # TODO: error code
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
271
msys2/usr/share/makepkg/integrity/verify_signature.sh
Normal file
271
msys2/usr/share/makepkg/integrity/verify_signature.sh
Normal file
|
@ -0,0 +1,271 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# verify_signature.sh - functions for checking PGP signatures
|
||||
#
|
||||
# Copyright (c) 2011-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_INTEGRITY_VERIFY_SIGNATURE_SH" ]] && return
|
||||
LIBMAKEPKG_INTEGRITY_VERIFY_SIGNATURE_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
check_pgpsigs() {
|
||||
(( SKIPPGPCHECK )) && return 0
|
||||
! source_has_signatures && return 0
|
||||
|
||||
msg "$(gettext "Verifying source file signatures with %s...")" "gpg"
|
||||
|
||||
local netfile proto pubkey success status fingerprint trusted
|
||||
local warnings=0
|
||||
local errors=0
|
||||
local statusfile=$(mktemp)
|
||||
local all_sources
|
||||
|
||||
case $1 in
|
||||
all)
|
||||
get_all_sources 'all_sources'
|
||||
;;
|
||||
*)
|
||||
get_all_sources_for_arch 'all_sources'
|
||||
;;
|
||||
esac
|
||||
for netfile in "${all_sources[@]}"; do
|
||||
proto="$(get_protocol "$netfile")"
|
||||
|
||||
if [[ $proto = git* ]]; then
|
||||
verify_git_signature "$netfile" "$statusfile" || continue
|
||||
else
|
||||
verify_file_signature "$netfile" "$statusfile" || continue
|
||||
fi
|
||||
|
||||
# these variables are assigned values in parse_gpg_statusfile
|
||||
success=0
|
||||
status=
|
||||
pubkey=
|
||||
fingerprint=
|
||||
trusted=
|
||||
parse_gpg_statusfile "$statusfile"
|
||||
if (( ! $success )); then
|
||||
printf '%s' "$(gettext "FAILED")" >&2
|
||||
case "$status" in
|
||||
"missingkey")
|
||||
printf ' (%s)' "$(gettext "unknown public key") $pubkey" >&2
|
||||
;;
|
||||
"revokedkey")
|
||||
printf " ($(gettext "public key %s has been revoked"))" "$pubkey" >&2
|
||||
;;
|
||||
"bad")
|
||||
printf ' (%s)' "$(gettext "bad signature from public key") $pubkey" >&2
|
||||
;;
|
||||
"error")
|
||||
printf ' (%s)' "$(gettext "error during signature verification")" >&2
|
||||
;;
|
||||
esac
|
||||
errors=1
|
||||
else
|
||||
if (( ${#validpgpkeys[@]} == 0 && !trusted )); then
|
||||
printf "%s ($(gettext "the public key %s is not trusted"))" $(gettext "FAILED") "$fingerprint" >&2
|
||||
errors=1
|
||||
elif (( ${#validpgpkeys[@]} > 0 )) && ! in_array "$fingerprint" "${validpgpkeys[@]}"; then
|
||||
printf "%s (%s %s)" "$(gettext "FAILED")" "$(gettext "invalid public key")" "$fingerprint" >&2
|
||||
errors=1
|
||||
else
|
||||
printf '%s' "$(gettext "Passed")" >&2
|
||||
case "$status" in
|
||||
"expired")
|
||||
printf ' (%s)' "$(gettext "WARNING:") $(gettext "the signature has expired.")" >&2
|
||||
warnings=1
|
||||
;;
|
||||
"expiredkey")
|
||||
printf ' (%s)' "$(gettext "WARNING:") $(gettext "the key has expired.")" >&2
|
||||
warnings=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
printf '\n' >&2
|
||||
done
|
||||
|
||||
rm -f "$statusfile"
|
||||
|
||||
if (( errors )); then
|
||||
error "$(gettext "One or more PGP signatures could not be verified!")"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( warnings )); then
|
||||
warning "$(gettext "Warnings have occurred while verifying the signatures.")"
|
||||
plain "$(gettext "Please make sure you really trust them.")"
|
||||
fi
|
||||
}
|
||||
|
||||
verify_file_signature() {
|
||||
local netfile="$1" statusfile="$2"
|
||||
local file ext decompress found sourcefile
|
||||
|
||||
file="$(get_filename "$netfile")"
|
||||
if [[ $file != *.@(sig?(n)|asc) ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf " %s ... " "${file%.*}" >&2
|
||||
|
||||
if ! file="$(get_filepath "$netfile")"; then
|
||||
printf '%s\n' "$(gettext "SIGNATURE NOT FOUND")" >&2
|
||||
errors=1
|
||||
return 1
|
||||
fi
|
||||
|
||||
found=0
|
||||
for ext in "" gz bz2 xz lrz lzo Z; do
|
||||
if sourcefile="$(get_filepath "${file%.*}${ext:+.$ext}")"; then
|
||||
found=1
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if (( ! found )); then
|
||||
printf '%s\n' "$(gettext "SOURCE FILE NOT FOUND")" >&2
|
||||
errors=1
|
||||
return 1
|
||||
fi
|
||||
|
||||
case "$ext" in
|
||||
gz) decompress="gzip -c -d -f" ;;
|
||||
bz2) decompress="bzip2 -c -d -f" ;;
|
||||
xz) decompress="xz -c -d" ;;
|
||||
lrz) decompress="lrzip -q -d" ;;
|
||||
lzo) decompress="lzop -c -d -q" ;;
|
||||
Z) decompress="uncompress -c -f" ;;
|
||||
"") decompress="cat" ;;
|
||||
esac
|
||||
|
||||
$decompress < "$sourcefile" | gpg --quiet --batch --status-file "$statusfile" --verify "$file" - 2> /dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
verify_git_signature() {
|
||||
local netfile=$1 statusfile=$2
|
||||
local dir fragment query fragtype fragval
|
||||
|
||||
dir=$(get_filepath "$netfile")
|
||||
fragment=$(get_uri_fragment "$netfile")
|
||||
query=$(get_uri_query "$netfile")
|
||||
|
||||
if [[ $query != signed ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
case ${fragment%%=*} in
|
||||
tag)
|
||||
fragtype=tag
|
||||
fragval=${fragment##*=}
|
||||
;;
|
||||
commit|branch)
|
||||
fragtype=commit
|
||||
fragval=${fragment##*=}
|
||||
;;
|
||||
'')
|
||||
fragtype=commit
|
||||
fragval=HEAD
|
||||
esac
|
||||
|
||||
printf " %s git repo ... " "${dir##*/}" >&2
|
||||
|
||||
git -C "$dir" verify-$fragtype --raw "$fragval" > "$statusfile" 2>&1
|
||||
if ! grep -qs NEWSIG "$statusfile"; then
|
||||
printf '%s\n' "$(gettext "SIGNATURE NOT FOUND")" >&2
|
||||
errors=1
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
parse_gpg_statusfile() {
|
||||
local type arg1 arg6 arg10
|
||||
|
||||
while read -r _ type arg1 _ _ _ _ arg6 _ _ _ arg10 _; do
|
||||
case "$type" in
|
||||
GOODSIG)
|
||||
pubkey=$arg1
|
||||
success=1
|
||||
status="good"
|
||||
;;
|
||||
EXPSIG)
|
||||
pubkey=$arg1
|
||||
success=1
|
||||
status="expired"
|
||||
;;
|
||||
EXPKEYSIG)
|
||||
pubkey=$arg1
|
||||
success=1
|
||||
status="expiredkey"
|
||||
;;
|
||||
REVKEYSIG)
|
||||
pubkey=$arg1
|
||||
success=0
|
||||
status="revokedkey"
|
||||
;;
|
||||
BADSIG)
|
||||
pubkey=$arg1
|
||||
success=0
|
||||
status="bad"
|
||||
;;
|
||||
ERRSIG)
|
||||
pubkey=$arg1
|
||||
success=0
|
||||
if [[ $arg6 == 9 ]]; then
|
||||
status="missingkey"
|
||||
else
|
||||
status="error"
|
||||
fi
|
||||
;;
|
||||
VALIDSIG)
|
||||
if [[ $arg10 ]]; then
|
||||
# If the file was signed with a subkey, arg10 contains
|
||||
# the fingerprint of the primary key
|
||||
fingerprint=$arg10
|
||||
else
|
||||
fingerprint=$arg1
|
||||
fi
|
||||
;;
|
||||
TRUST_UNDEFINED|TRUST_NEVER)
|
||||
trusted=0
|
||||
;;
|
||||
TRUST_MARGINAL|TRUST_FULLY|TRUST_ULTIMATE)
|
||||
trusted=1
|
||||
;;
|
||||
esac
|
||||
done < "$1"
|
||||
}
|
||||
|
||||
source_has_signatures() {
|
||||
local netfile all_sources proto
|
||||
|
||||
get_all_sources_for_arch 'all_sources'
|
||||
for netfile in "${all_sources[@]}"; do
|
||||
proto="$(get_protocol "$netfile")"
|
||||
query=$(get_uri_query "$netfile")
|
||||
|
||||
if [[ ${netfile%%::*} = *.@(sig?(n)|asc) || ( $proto = git* && $query = signed ) ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
46
msys2/usr/share/makepkg/lint_config.sh
Normal file
46
msys2/usr/share/makepkg/lint_config.sh
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# lint_config.sh - functions for checking for makepkg.conf errors
|
||||
#
|
||||
# Copyright (c) 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_LINT_CONFIG_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_CONFIG_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/util.sh"
|
||||
|
||||
|
||||
declare -a lint_config_functions
|
||||
|
||||
for lib in "$LIBRARY/lint_config/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
readonly -a lint_config_functions
|
||||
|
||||
|
||||
lint_config() {
|
||||
local ret=0
|
||||
|
||||
for func in ${lint_config_functions[@]}; do
|
||||
$func || ret=1
|
||||
done
|
||||
return $ret
|
||||
}
|
46
msys2/usr/share/makepkg/lint_config/paths.sh
Normal file
46
msys2/usr/share/makepkg/lint_config/paths.sh
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# paths.sh - Check that pathname components do not contain odd characters
|
||||
#
|
||||
# Copyright (c) 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_LINT_CONFIG_PATHS_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_CONFIG_PATHS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
lint_config_functions+=('lint_paths')
|
||||
|
||||
|
||||
lint_paths() {
|
||||
local pathvars=(BUILDDIR PKGDEST SRCDEST SRCPKGDEST LOGDEST PKGEXT SRCEXT)
|
||||
|
||||
local i ret=0
|
||||
|
||||
for i in ${pathvars[@]}; do
|
||||
if [[ ${!i} = *$'\n'* ]]; then
|
||||
error "$(gettext "%s contains invalid characters: '%s'")" \
|
||||
"$i" "${!i//[^$'\n']}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
64
msys2/usr/share/makepkg/lint_config/variable.sh
Normal file
64
msys2/usr/share/makepkg/lint_config/variable.sh
Normal file
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# variable.sh - Check that variables are or are not arrays as appropriate
|
||||
#
|
||||
# Copyright (c) 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_LINT_CONFIG_VARIABLE_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
lint_config_functions+=('lint_config_variables')
|
||||
|
||||
|
||||
lint_config_variables() {
|
||||
local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
|
||||
DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
|
||||
COMPRESSLRZ COMPRESSLZO COMPRESSZ)
|
||||
local string=(CARCH CHOST CPPFLAGS CFLAGS CXXFLAGS LDFLAGS DEBUG_CFLAGS
|
||||
DEBUG_CXXFLAGS DISTCC_HOSTS BUILDDIR STRIP_BINARIES STRIP_SHARED
|
||||
STRIP_STATIC PKGDEST SRCDEST SRCPKGDEST LOGDEST PACKAGER GPGKEY
|
||||
PKGEXT SRCEXT)
|
||||
|
||||
local i keys ret=0
|
||||
|
||||
# global variables
|
||||
for i in ${array[@]}; do
|
||||
eval "keys=(\"\${!$i[@]}\")"
|
||||
if (( ${#keys[*]} > 0 )); then
|
||||
if ! is_array $i; then
|
||||
error "$(gettext "%s should be an array")" "$i"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for i in ${string[@]}; do
|
||||
eval "keys=(\"\${!$i[@]}\")"
|
||||
if (( ${#keys[*]} > 0 )); then
|
||||
if is_array $i; then
|
||||
error "$(gettext "%s should not be an array")" "$i"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# lint_package.sh - functions for checking for packaging errors
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
@ -38,9 +38,11 @@ readonly -a lint_package_functions
|
|||
|
||||
lint_package() {
|
||||
cd_safe "$pkgdir"
|
||||
msg "$(gettext "Checking for packaging issue...")"
|
||||
msg "$(gettext "Checking for packaging issues...")"
|
||||
|
||||
local ret=0
|
||||
for func in ${lint_package_functions[@]}; do
|
||||
$func
|
||||
$func || ret=1
|
||||
done
|
||||
return $ret
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# build_references.sh - Warn about files containing references to build directories
|
||||
#
|
||||
# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2013-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
|
||||
|
@ -25,16 +25,18 @@ LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
|||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
|
||||
lint_package_functions+=('warn_build_references')
|
||||
|
||||
warn_build_references() {
|
||||
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${srcdir}" ; then
|
||||
warning "$(gettext "Package contains reference to %s")" "\$srcdir"
|
||||
fi
|
||||
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${pkgdirbase}" ; then
|
||||
warning "$(gettext "Package contains reference to %s")" "\$pkgdir"
|
||||
fi
|
||||
local refs
|
||||
|
||||
for var in srcdir pkgdir; do
|
||||
mapfile -t refs < <(find "$pkgdir" -type f -exec grep -l "${!var}" {} +)
|
||||
if (( ${#refs} > 0 )); then
|
||||
warning "$(gettext 'Package contains reference to %s')" "\$$var"
|
||||
printf '%s\n' "${refs[@]#"$pkgdir/"}" >&2
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for Windows-style MSYS2 root path
|
||||
if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -m /)" ; then
|
||||
|
@ -43,4 +45,5 @@ warn_build_references() {
|
|||
if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -w /)" ; then
|
||||
warning "$(gettext "Package contains reference to %s")" "\$(cygpath -w /)"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
|
38
msys2/usr/share/makepkg/lint_package/dotfiles.sh
Normal file
38
msys2/usr/share/makepkg/lint_package/dotfiles.sh
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# dotfiles.sh - check for dotfiles in the package root
|
||||
#
|
||||
# Copyright (c) 2016-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_LINT_PACKAGE_DOTFILES_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
lint_package_functions+=('check_dotfiles')
|
||||
|
||||
check_dotfiles() {
|
||||
local ret=0
|
||||
for f in "$pkgdir"/.*; do
|
||||
[[ ${f##*/} == . || ${f##*/} == .. ]] && continue
|
||||
error "$(gettext "Dotfile found in package root '%s'")" "$f"
|
||||
ret=1
|
||||
done
|
||||
return $ret
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# optipng.sh - Compress PNG files using optpng
|
||||
# file_names.sh - check package file names
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2016-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
|
||||
|
@ -18,27 +18,25 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ -n "$LIBMAKEPKG_TIDY_OPTIPNG_SH" ]] && return
|
||||
LIBMAKEPKG_TIDY_OPTIPNG_SH=1
|
||||
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
lint_package_functions+=('lint_file_names')
|
||||
|
||||
packaging_options+=('optipng')
|
||||
tidy_modify+=('tidy_optipng')
|
||||
lint_file_names() {
|
||||
local ret=0 paths
|
||||
|
||||
tidy_optipng() {
|
||||
if check_option "optipng" "y"; then
|
||||
msg2 "$(gettext "Optimizing PNG images...")"
|
||||
local png
|
||||
find . -type f -iname "*.png" 2>/dev/null | while read -r png ; do
|
||||
if [[ $(file --brief --mime-type "$png") = 'image/png' ]]; then
|
||||
optipng "${OPTIPNGFLAGS[@]}" "$png" &>/dev/null ||
|
||||
warning "$(gettext "Could not optimize PNG image : %s")" "${png/$pkgdir\//}"
|
||||
fi
|
||||
done
|
||||
# alpm's local database format does not support newlines in paths
|
||||
mapfile -t paths < <(find "$pkgdir" -name \*$'\n'\*)
|
||||
if (( ${#paths} > 0 )); then
|
||||
error "$(gettext 'Package contains paths with newlines')"
|
||||
printf '%s\n' "${paths[@]}" >&2
|
||||
ret=1
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# missing_backup.sh - Warn about missing files in the backup array
|
||||
#
|
||||
# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2013-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
|
||||
|
@ -35,4 +35,5 @@ warn_missing_backup() {
|
|||
warning "$(gettext "%s entry file not in package : %s")" "backup" "$file"
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# lint_pkgbuild.sh - functions for detecting PKGBUILD errors
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# arch.sh - Check the 'arch' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# backup.sh - Check the 'backup' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# changelog.sh - Check the files in the 'changelog' array exist.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
58
msys2/usr/share/makepkg/lint_pkgbuild/checkdepends.sh
Normal file
58
msys2/usr/share/makepkg/lint_pkgbuild/checkdepends.sh
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# checkdepends.sh - Check the 'checkdepends' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-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_LINT_PKGBUILD_CHECKDEPENDS_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
lint_pkgbuild_functions+=('lint_checkdepends')
|
||||
|
||||
|
||||
lint_checkdepends() {
|
||||
local checkdepends_list checkdepend name ver ret=0
|
||||
|
||||
get_pkgbuild_all_split_attributes checkdepends checkdepends_list
|
||||
|
||||
# this function requires extglob - save current status to restore later
|
||||
local shellopts=$(shopt -p extglob)
|
||||
shopt -s extglob
|
||||
|
||||
for checkdepend in "${checkdepends_list[@]}"; do
|
||||
name=${checkdepend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${checkdepend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname checkdepends "$name" || ret=1
|
||||
if [[ $ver != $checkdepend ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" checkdepends || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
eval "$shellopts"
|
||||
|
||||
return $ret
|
||||
}
|
58
msys2/usr/share/makepkg/lint_pkgbuild/conflicts.sh
Normal file
58
msys2/usr/share/makepkg/lint_pkgbuild/conflicts.sh
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# conflicts.sh - Check the 'conflicts' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-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_LINT_PKGBUILD_CONFLICTS_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
lint_pkgbuild_functions+=('lint_conflicts')
|
||||
|
||||
|
||||
lint_conflicts() {
|
||||
local conflicts_list conflict name ver ret=0
|
||||
|
||||
get_pkgbuild_all_split_attributes conflicts conflicts_list
|
||||
|
||||
# this function requires extglob - save current status to restore later
|
||||
local shellopts=$(shopt -p extglob)
|
||||
shopt -s extglob
|
||||
|
||||
for conflict in "${conflicts_list[@]}"; do
|
||||
name=${conflict%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${conflict##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname conflicts "$name" || ret=1
|
||||
if [[ $ver != $conflict ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" conflicts || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
eval "$shellopts"
|
||||
|
||||
return $ret
|
||||
}
|
59
msys2/usr/share/makepkg/lint_pkgbuild/depends.sh
Normal file
59
msys2/usr/share/makepkg/lint_pkgbuild/depends.sh
Normal file
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# depends.sh - Check the 'depends' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-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_LINT_PKGBUILD_DEPENDS_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
lint_pkgbuild_functions+=('lint_depends')
|
||||
|
||||
|
||||
lint_depends() {
|
||||
local depends_list depend name ver ret=0
|
||||
|
||||
get_pkgbuild_all_split_attributes depends depends_list
|
||||
|
||||
# this function requires extglob - save current status to restore later
|
||||
local shellopts=$(shopt -p extglob)
|
||||
shopt -s extglob
|
||||
|
||||
for depend in "${depends_list[@]}"; do
|
||||
name=${depend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${depend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname depends "$name" || ret=1
|
||||
# Don't validate empty version because of https://bugs.archlinux.org/task/58776
|
||||
if [[ $ver != $depend && -n $ver ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" depends || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
eval "$shellopts"
|
||||
|
||||
return $ret
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# epoch.sh - Check the 'epoch' variable conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# install.sh - Check the files in the 'install' array exist.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
58
msys2/usr/share/makepkg/lint_pkgbuild/makedepends.sh
Normal file
58
msys2/usr/share/makepkg/lint_pkgbuild/makedepends.sh
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# makedepends.sh - Check the 'makedepends' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-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_LINT_PKGBUILD_MAKEDEPENDS_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
lint_pkgbuild_functions+=('lint_makedepends')
|
||||
|
||||
|
||||
lint_makedepends() {
|
||||
local makedepends_list makedepend name ver ret=0
|
||||
|
||||
get_pkgbuild_all_split_attributes makedepends makedepends_list
|
||||
|
||||
# this function requires extglob - save current status to restore later
|
||||
local shellopts=$(shopt -p extglob)
|
||||
shopt -s extglob
|
||||
|
||||
for makedepend in "${makedepends_list[@]}"; do
|
||||
name=${makedepend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${makedepend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname makedepends "$name" || ret=1
|
||||
if [[ $ver != $makedepend ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" makedepends || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
eval "$shellopts"
|
||||
|
||||
return $ret
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# optdepends.sh - Check the 'optdepends' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
@ -31,32 +31,22 @@ lint_pkgbuild_functions+=('lint_optdepends')
|
|||
|
||||
|
||||
lint_optdepends() {
|
||||
local a list name optdepends_list ret=0
|
||||
local optdepends_list optdepend name ver ret=0
|
||||
|
||||
optdepends_list=("${optdepends[@]}")
|
||||
for a in "${arch[@]}"; do
|
||||
array_build list "optdepends_$a"
|
||||
optdepends_list+=("${list[@]}")
|
||||
done
|
||||
get_pkgbuild_all_split_attributes optdepends optdepends_list
|
||||
|
||||
for name in "${pkgname[@]}"; do
|
||||
if extract_function_variable "package_$name" optdepends 1 list; then
|
||||
optdepends_list+=("${list[@]}")
|
||||
fi
|
||||
# this function requires extglob - save current status to restore later
|
||||
local shellopts=$(shopt -p extglob)
|
||||
shopt -s extglob
|
||||
|
||||
for a in "${arch[@]}"; do
|
||||
if extract_function_variable "package_$name" "optdepends_$a" 1 list; then
|
||||
optdepends_list+=("${list[@]}")
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
for name in "${optdepends_list[@]}"; do
|
||||
local pkg=${name%%:[[:space:]]*}
|
||||
# the '-' character _must_ be first or last in the character range
|
||||
if [[ $pkg != +([-[:alnum:]><=.+_:]) ]]; then
|
||||
error "$(gettext "Invalid syntax for %s: '%s'")" "optdepend" "$name"
|
||||
ret=1
|
||||
for optdepend in "${optdepends_list[@]%%:[[:space:]]*}"; do
|
||||
name=${optdepend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${optdepend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname optdepends "$name" || ret=1
|
||||
if [[ $ver != $optdepend ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" optdepends || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# options.sh - Check the 'options' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# package_function.sh - Check that required package functions exist.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# pkgbase.sh - Check the 'pkgbase' variable conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
@ -23,6 +23,7 @@ LIBMAKEPKG_LINT_PKGBUILD_PKGBASE_SH=1
|
|||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
|
||||
|
@ -30,21 +31,9 @@ lint_pkgbuild_functions+=('lint_pkgbase')
|
|||
|
||||
|
||||
lint_pkgbase() {
|
||||
local ret=0
|
||||
|
||||
if [[ ${pkgbase:0:1} = "-" ]]; then
|
||||
error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
|
||||
return 1
|
||||
fi
|
||||
if [[ ${pkgbase:0:1} = "." ]]; then
|
||||
error "$(gettext "%s is not allowed to start with a dot.")" "pkgbase"
|
||||
ret=1
|
||||
fi
|
||||
if [[ $pkgbase = *[^[:alnum:]+_.@-]* ]]; then
|
||||
error "$(gettext "%s contains invalid characters: '%s'")" \
|
||||
'pkgbase' "${i//[[:alnum:]+_.@-]}"
|
||||
ret=1
|
||||
if [[ -z $pkgbase ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return $ret
|
||||
lint_one_pkgname "pkgbase" "$pkgbase"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# pkglist.sh - Check the packages selected to build exist.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# pkgname.sh - Check the 'pkgname' variable conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
@ -29,29 +29,42 @@ source "$LIBRARY/util/message.sh"
|
|||
lint_pkgbuild_functions+=('lint_pkgname')
|
||||
|
||||
|
||||
lint_pkgname() {
|
||||
local ret=0 i
|
||||
lint_one_pkgname() {
|
||||
local type=$1 name=$2 ret=0
|
||||
|
||||
for i in "${pkgname[@]}"; do
|
||||
if [[ -z $i ]]; then
|
||||
error "$(gettext "%s is not allowed to be empty.")" "pkgname"
|
||||
ret=1
|
||||
continue
|
||||
fi
|
||||
if [[ ${i:0:1} = "-" ]]; then
|
||||
error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
|
||||
ret=1
|
||||
fi
|
||||
if [[ ${i:0:1} = "." ]]; then
|
||||
error "$(gettext "%s is not allowed to start with a dot.")" "pkgname"
|
||||
ret=1
|
||||
fi
|
||||
if [[ $i = *[^[:alnum:]+_.@-]* ]]; then
|
||||
error "$(gettext "%s contains invalid characters: '%s'")" \
|
||||
'pkgname' "${i//[[:alnum:]+_.@-]}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z $name ]]; then
|
||||
error "$(gettext "%s is not allowed to be empty.")" "$type"
|
||||
return 1
|
||||
fi
|
||||
if [[ ${name:0:1} = "-" ]]; then
|
||||
error "$(gettext "%s is not allowed to start with a hyphen.")" "$type"
|
||||
ret=1
|
||||
fi
|
||||
if [[ ${name:0:1} = "." ]]; then
|
||||
error "$(gettext "%s is not allowed to start with a dot.")" "$type"
|
||||
ret=1
|
||||
fi
|
||||
if [[ $name = *[^[:alnum:]+_.@-]* ]]; then
|
||||
error "$(gettext "%s contains invalid characters: '%s'")" \
|
||||
"$type" "${name//[[:alnum:]+_.@-]}"
|
||||
ret=1
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
lint_pkgname() {
|
||||
local ret=0 i
|
||||
|
||||
if [[ -z ${pkgname[@]} ]]; then
|
||||
error "$(gettext "%s is not allowed to be empty.")" "pkgname"
|
||||
ret=1
|
||||
else
|
||||
for i in "${pkgname[@]}"; do
|
||||
lint_one_pkgname "pkgname" "$i" || ret=1
|
||||
done
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# pkgrel.sh - Check the 'pkgrel' variable conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# pkgver.sh - Check the 'pkgver' variable conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
@ -30,13 +30,15 @@ lint_pkgbuild_functions+=('lint_pkgver')
|
|||
|
||||
|
||||
check_pkgver() {
|
||||
if [[ -z $1 ]]; then
|
||||
error "$(gettext "%s is not allowed to be empty.")" "pkgver"
|
||||
local ver=$1 type=$2
|
||||
|
||||
if [[ -z $ver ]]; then
|
||||
error "$(gettext "%s is not allowed to be empty.")" "pkgver${type:+ in $type}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 = *[[:space:]:-]* ]]; then
|
||||
error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
|
||||
if [[ $ver = *[[:space:]/:-]* ]]; then
|
||||
error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace.")" "pkgver${type:+ in $type}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@ -47,5 +49,5 @@ lint_pkgver() {
|
|||
return 0
|
||||
fi
|
||||
|
||||
check_pkgver $pkgver
|
||||
check_pkgver "$pkgver"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# provides.sh - Check the 'provides' array conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
@ -23,6 +23,8 @@ LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH=1
|
|||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
@ -31,32 +33,31 @@ lint_pkgbuild_functions+=('lint_provides')
|
|||
|
||||
|
||||
lint_provides() {
|
||||
local a list name provides_list ret=0
|
||||
local provides_list provide name ver ret=0
|
||||
|
||||
provides_list=("${provides[@]}")
|
||||
for a in "${arch[@]}"; do
|
||||
array_build list "provides_$a"
|
||||
provides_list+=("${list[@]}")
|
||||
done
|
||||
get_pkgbuild_all_split_attributes provides provides_list
|
||||
|
||||
for name in "${pkgname[@]}"; do
|
||||
if extract_function_variable "package_$name" provides 1 list; then
|
||||
provides_list+=("${list[@]}")
|
||||
fi
|
||||
|
||||
for a in "${arch[@]}"; do
|
||||
if extract_function_variable "package_$name" "provides_$a" 1 list; then
|
||||
provides_list+=("${list[@]}")
|
||||
fi
|
||||
done
|
||||
done
|
||||
# this function requires extglob - save current status to restore later
|
||||
local shellopts=$(shopt -p extglob)
|
||||
shopt -s extglob
|
||||
|
||||
for provide in "${provides_list[@]}"; do
|
||||
if [[ $provide == *['<>']* ]]; then
|
||||
error "$(gettext "%s array cannot contain comparison (< or >) operators.")" "provides"
|
||||
ret=1
|
||||
continue
|
||||
fi
|
||||
name=${provide%=*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${provide##$name=?(+([0-9]):)}
|
||||
lint_one_pkgname provides "$name" || ret=1
|
||||
if [[ $ver != $provide ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" provides || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
eval "$shellopts"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# source.sh - Check the 'source' array is not sparse.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# util.sh - utility functions for pkgbuild linting.
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# variable.sh - Check that variables are or are not arrays as appropriate
|
||||
#
|
||||
# Copyright (c) 2014-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2014-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
|
||||
|
@ -34,7 +34,8 @@ lint_variable() {
|
|||
local array=(arch backup checkdepends groups license noextract options
|
||||
validpgpkeys)
|
||||
local arch_array=(conflicts depends makedepends md5sums optdepends provides
|
||||
replaces sha1sums sha256sums sha384sums sha512sums source)
|
||||
replaces sha1sums sha224sums sha256sums sha384sums sha512sums
|
||||
source)
|
||||
local string=(changelog epoch install pkgdesc pkgrel pkgver url)
|
||||
|
||||
local i a v pkg keys out bad ret=0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# source.sh - functions for downloading and extracting sources
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
@ -48,7 +48,7 @@ download_sources() {
|
|||
get_vcs=0
|
||||
;;
|
||||
*)
|
||||
break 2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# bzr.sh - function for handling the download and "extraction" of Bazaar sources
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# file.sh - function for handling the download and extraction of source files
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
@ -96,7 +96,7 @@ extract_file() {
|
|||
fi
|
||||
|
||||
# do not rely on extension for file type
|
||||
local file_type=$(file -bizL "$file")
|
||||
local file_type=$(file -bizL -- "$file")
|
||||
local ext=${file##*.}
|
||||
local cmd=''
|
||||
case "$file_type" in
|
||||
|
@ -132,7 +132,7 @@ extract_file() {
|
|||
$cmd -xf "$file" || ret=$?
|
||||
else
|
||||
rm -f -- "${file%.*}"
|
||||
$cmd -dcf "$file" > "${file%.*}" || ret=$?
|
||||
$cmd -dcf -- "$file" > "${file%.*}" || ret=$?
|
||||
fi
|
||||
if (( ret )); then
|
||||
error "$(gettext "Failed to extract %s")" "$file"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# git.sh - function for handling the download and "extraction" of Git sources
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
@ -39,6 +39,7 @@ download_git() {
|
|||
local url=$(get_url "$netfile")
|
||||
url=${url#git+}
|
||||
url=${url%%#*}
|
||||
url=${url%%\?*}
|
||||
|
||||
if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
|
||||
msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
|
||||
|
@ -64,16 +65,10 @@ download_git() {
|
|||
}
|
||||
|
||||
extract_git() {
|
||||
local netfile=$1
|
||||
local netfile=$1 tagname
|
||||
|
||||
local fragment=${netfile#*#}
|
||||
if [[ $fragment = "$netfile" ]]; then
|
||||
unset fragment
|
||||
fi
|
||||
|
||||
local repo=${netfile##*/}
|
||||
repo=${repo%%#*}
|
||||
repo=${repo%%.git*}
|
||||
local fragment=$(get_uri_fragment "$netfile")
|
||||
local repo=$(get_filename "$netfile")
|
||||
|
||||
local dir=$(get_filepath "$netfile")
|
||||
[[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
|
||||
|
@ -115,6 +110,15 @@ extract_git() {
|
|||
esac
|
||||
fi
|
||||
|
||||
if [[ ${fragment%%=*} = tag ]]; then
|
||||
tagname="$(git tag -l --format='%(tag)' "$ref")"
|
||||
if [[ -n $tagname && $tagname != $ref ]]; then
|
||||
error "$(gettext "Failure while checking out version %s, the git tag has been forged")" "$ref"
|
||||
plain "$(gettext "Aborting...")"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $ref != "origin/HEAD" ]] || (( updating )) ; then
|
||||
if ! git checkout --force --no-track -B makepkg $ref; then
|
||||
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# hg.sh - function for handling the download and "extraction" of Mercurial sources
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# local.sh - function for handling the "download" of local sources
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# svn.sh - function for handling the download and "extraction" of Subversion sources
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
|
127
msys2/usr/share/makepkg/srcinfo.sh
Normal file
127
msys2/usr/share/makepkg/srcinfo.sh
Normal file
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# srcinfo.sh - functions for writing .SRCINFO files
|
||||
#
|
||||
# Copyright (c) 2014-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_SRCINFO_SH" ]] && return
|
||||
LIBMAKEPKG_SRCINFO_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
srcinfo_open_section() {
|
||||
printf '%s = %s\n' "$1" "$2"
|
||||
}
|
||||
|
||||
srcinfo_close_section() {
|
||||
echo
|
||||
}
|
||||
|
||||
srcinfo_write_attr() {
|
||||
# $1: attr name
|
||||
# $2: attr values
|
||||
|
||||
local attrname=$1 attrvalues=("${@:2}")
|
||||
|
||||
# normalize whitespace, strip leading and trailing
|
||||
attrvalues=("${attrvalues[@]//+([[:space:]])/ }")
|
||||
attrvalues=("${attrvalues[@]#[[:space:]]}")
|
||||
attrvalues=("${attrvalues[@]%[[:space:]]}")
|
||||
|
||||
printf "\t$attrname = %s\n" "${attrvalues[@]}"
|
||||
}
|
||||
|
||||
pkgbuild_extract_to_srcinfo() {
|
||||
# $1: pkgname
|
||||
# $2: attr name
|
||||
# $3: multivalued
|
||||
|
||||
local pkgname=$1 attrname=$2 isarray=$3 outvalue=
|
||||
|
||||
if get_pkgbuild_attribute "$pkgname" "$attrname" "$isarray" 'outvalue'; then
|
||||
srcinfo_write_attr "$attrname" "${outvalue[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
srcinfo_write_section_details() {
|
||||
local attr package_arch a
|
||||
local multivalued_arch_attrs=(source provides conflicts depends replaces
|
||||
optdepends makedepends checkdepends
|
||||
{md5,sha{1,224,256,384,512}}sums)
|
||||
|
||||
for attr in "${singlevalued[@]}"; do
|
||||
pkgbuild_extract_to_srcinfo "$1" "$attr" 0
|
||||
done
|
||||
|
||||
for attr in "${multivalued[@]}"; do
|
||||
pkgbuild_extract_to_srcinfo "$1" "$attr" 1
|
||||
done
|
||||
|
||||
get_pkgbuild_attribute "$1" 'arch' 1 'package_arch'
|
||||
for a in "${package_arch[@]}"; do
|
||||
# 'any' is special. there's no support for, e.g. depends_any.
|
||||
[[ $a = any ]] && continue
|
||||
|
||||
for attr in "${multivalued_arch_attrs[@]}"; do
|
||||
pkgbuild_extract_to_srcinfo "$1" "${attr}_$a" 1
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
srcinfo_write_global() {
|
||||
local singlevalued=(pkgdesc pkgver pkgrel epoch url install changelog)
|
||||
local multivalued=(arch groups license checkdepends makedepends
|
||||
depends optdepends provides conflicts replaces
|
||||
noextract options backup
|
||||
source validpgpkeys {md5,sha{1,224,256,384,512}}sums)
|
||||
|
||||
srcinfo_open_section 'pkgbase' "${pkgbase:-$pkgname}"
|
||||
srcinfo_write_section_details ''
|
||||
srcinfo_close_section
|
||||
}
|
||||
|
||||
srcinfo_write_package() {
|
||||
local singlevalued=(pkgdesc url install changelog)
|
||||
local multivalued=(arch groups license checkdepends depends optdepends
|
||||
provides conflicts replaces options backup)
|
||||
|
||||
srcinfo_open_section 'pkgname' "$1"
|
||||
srcinfo_write_section_details "$1"
|
||||
srcinfo_close_section
|
||||
}
|
||||
|
||||
write_srcinfo_header() {
|
||||
printf "# Generated by makepkg %s\n" "$makepkg_version"
|
||||
printf "# %s\n" "$(LC_ALL=C date -u)"
|
||||
}
|
||||
|
||||
write_srcinfo_content() {
|
||||
local pkg
|
||||
|
||||
srcinfo_write_global
|
||||
|
||||
for pkg in "${pkgname[@]}"; do
|
||||
srcinfo_write_package "$pkg"
|
||||
done
|
||||
}
|
||||
|
||||
write_srcinfo() {
|
||||
write_srcinfo_header
|
||||
write_srcinfo_content
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
# tidy.sh - functions for modifying/removing installed files before
|
||||
# package creation
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# docs.sh - Remove documentation files from the package
|
||||
#
|
||||
# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2008-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# emptydirs.sh - Remove empty directories from the package
|
||||
#
|
||||
# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2013-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
|
||||
|
@ -33,6 +33,7 @@ tidy_remove+=('tidy_emptydirs')
|
|||
tidy_emptydirs() {
|
||||
if check_option "emptydirs" "n"; then
|
||||
msg2 "$(gettext "Removing empty directories...")"
|
||||
find . -depth -type d -exec rmdir '{}' + 2>/dev/null
|
||||
# we are unable to use '-empty' as it is non-POSIX and not support by all find variants
|
||||
find . -depth -type d -exec rmdir '{}' \; 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# libtool.sh - Remove libtool files from the package
|
||||
#
|
||||
# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2013-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# purge.sh - Remove unwanted files from the package
|
||||
#
|
||||
# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2008-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# staticlibs.sh - Remove static library files from the package
|
||||
#
|
||||
# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2013-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# strip.sh - Strip debugging symbols from binary files
|
||||
#
|
||||
# Copyright (c) 2007-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2007-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
|
||||
|
@ -31,17 +31,30 @@ packaging_options+=('strip' 'debug')
|
|||
tidy_modify+=('tidy_strip')
|
||||
|
||||
|
||||
source_files() {
|
||||
LANG=C readelf "$1" --debug-dump | \
|
||||
awk '/DW_AT_name +:/{name=$8}/DW_AT_comp_dir +:/{{if (name !~ /^\//) {printf "%s/", $8}}{print name}}'
|
||||
}
|
||||
|
||||
strip_file() {
|
||||
local binary=$1; shift
|
||||
|
||||
case "$(file -bi "$binary")" in
|
||||
*application/x-dosexec*)
|
||||
if check_option "debug" "y"; then
|
||||
|
||||
if [[ -f "$dbgdir/$binary.debug" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# copy source files to debug directory
|
||||
local f t
|
||||
while read -r t; do
|
||||
f=${t/${dbgsrcdir}/"$srcdir"}
|
||||
mkdir -p "${dbgsrc/"$dbgsrcdir"/}${t%/*}"
|
||||
cp -- "$f" "${dbgsrc/"$dbgsrcdir"/}$t"
|
||||
done < <(source_files "$binary")
|
||||
|
||||
# copy debug symbols to debug directory
|
||||
mkdir -p "$dbgdir/${binary%/*}"
|
||||
msg2 "Separating debug info from $binary into $dbgdir/$binary.debug"
|
||||
# create a dbg file with proper debug info:
|
||||
|
@ -78,6 +91,7 @@ strip_file() {
|
|||
strip $@ "$binary"
|
||||
}
|
||||
|
||||
|
||||
tidy_strip() {
|
||||
if check_option "strip" "y"; then
|
||||
msg2 "$(gettext "Stripping unneeded symbols from binaries and libraries...")"
|
||||
|
@ -86,8 +100,11 @@ tidy_strip() {
|
|||
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
|
||||
|
||||
if check_option "debug" "y"; then
|
||||
dbgdir="$pkgdir-debug"
|
||||
mkdir -p "$dbgdir"
|
||||
|
||||
dbgdir="$pkgdirbase/$pkgbase-debug"
|
||||
dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}"
|
||||
dbgsrc="$pkgdirbase/$pkgbase-debug$dbgsrcdir"
|
||||
mkdir -p "$dbgdir" "$dbgsrc"
|
||||
fi
|
||||
|
||||
local binary strip_flags
|
||||
|
@ -175,6 +192,8 @@ tidy_strip() {
|
|||
esac;;
|
||||
*application/x-executable*) # Binaries
|
||||
strip_flags="$STRIP_BINARIES";;
|
||||
*application/x-pie-executable*) # Relocatable binaries
|
||||
strip_flags="$STRIP_SHARED";;
|
||||
*)
|
||||
continue ;;
|
||||
esac
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# zipman.sh - Compress man and info pages
|
||||
#
|
||||
# Copyright (c) 2011-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2011-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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# util.sh - utility functions for makepkg
|
||||
#
|
||||
# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
# Copyright (c) 2015-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
|
||||
|
|
47
msys2/usr/share/makepkg/util/compress.sh
Normal file
47
msys2/usr/share/makepkg/util/compress.sh
Normal 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
|
||||
}
|
41
msys2/usr/share/makepkg/util/error.sh
Normal file
41
msys2/usr/share/makepkg/util/error.sh
Normal 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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
173
msys2/usr/share/makepkg/util/parseopts.sh
Normal file
173
msys2/usr/share/makepkg/util/parseopts.sh
Normal 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
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue