Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash
- #
- # makepkg - make packages compatible for use with pacman
- # Generated from makepkg.sh.in; do not edit by hand.
- #
- # Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
- # Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
- # Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
- # Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
- # Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
- # Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
- # Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.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/>.
- #
- # makepkg uses quite a few external programs during its execution. You
- # need to have at least the following installed for makepkg to function:
- # awk, bsdtar (libarchive), bzip2, coreutils, fakeroot, file, find (findutils),
- # gettext, gpg, grep, gzip, sed, tput (ncurses), xz
- # gettext initialization
- export TEXTDOMAIN='pacman-scripts'
- + export TEXTDOMAIN=pacman-scripts
- + TEXTDOMAIN=pacman-scripts
- export TEXTDOMAINDIR='/usr/share/locale'
- + export TEXTDOMAINDIR=/usr/share/locale
- + TEXTDOMAINDIR=/usr/share/locale
- # file -i does not work on Mac OSX unless legacy mode is set
- export COMMAND_MODE='legacy'
- + export COMMAND_MODE=legacy
- + COMMAND_MODE=legacy
- # Ensure CDPATH doesn't screw with our cd calls
- unset CDPATH
- + unset CDPATH
- # Ensure GREP_OPTIONS doesn't screw with our grep calls
- unset GREP_OPTIONS
- + unset GREP_OPTIONS
- declare -r makepkg_version='5.1.1'
- + declare -r makepkg_version=5.1.1
- declare -r confdir='/etc'
- + declare -r confdir=/etc
- declare -r BUILDSCRIPT='PKGBUILD'
- + declare -r BUILDSCRIPT=PKGBUILD
- declare -r startdir="$(pwd -P)"
- ++ pwd -P
- + declare -r startdir=/home/keltere
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- + LIBRARY=/usr/share/makepkg
- build_options=('ccache' 'distcc' 'buildflags' 'makeflags')
- + build_options=('ccache' 'distcc' 'buildflags' 'makeflags')
- splitpkg_overrides=('pkgdesc' 'arch' 'url' 'license' 'groups' 'depends'
- 'optdepends' 'provides' 'conflicts' 'replaces' 'backup'
- 'options' 'install' 'changelog')
- + splitpkg_overrides=('pkgdesc' 'arch' 'url' 'license' 'groups' 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' 'backup' 'options' 'install' 'changelog')
- readonly -a build_options splitpkg_overrides
- + readonly -a build_options splitpkg_overrides
- known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512' 'whirlpool')
- + known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512' 'whirlpool')
- # Options
- ASDEPS=0
- + ASDEPS=0
- BUILDFUNC=0
- + BUILDFUNC=0
- CHECKFUNC=0
- + CHECKFUNC=0
- CLEANBUILD=0
- + CLEANBUILD=0
- CLEANUP=0
- + CLEANUP=0
- DEP_BIN=0
- + DEP_BIN=0
- FORCE=0
- + FORCE=0
- GENINTEG=0
- + GENINTEG=0
- HOLDVER=0
- + HOLDVER=0
- IGNOREARCH=0
- + IGNOREARCH=0
- INFAKEROOT=0
- + INFAKEROOT=0
- INSTALL=0
- + INSTALL=0
- LOGGING=0
- + LOGGING=0
- NEEDED=0
- + NEEDED=0
- NOARCHIVE=0
- + NOARCHIVE=0
- NOBUILD=0
- + NOBUILD=0
- NODEPS=0
- + NODEPS=0
- NOEXTRACT=0
- + NOEXTRACT=0
- PKGFUNC=0
- + PKGFUNC=0
- PKGVERFUNC=0
- + PKGVERFUNC=0
- PREPAREFUNC=0
- + PREPAREFUNC=0
- REPKG=0
- + REPKG=0
- REPRODUCIBLE=0
- + REPRODUCIBLE=0
- RMDEPS=0
- + RMDEPS=0
- SKIPCHECKSUMS=0
- + SKIPCHECKSUMS=0
- SKIPPGPCHECK=0
- + SKIPPGPCHECK=0
- SIGNPKG=''
- + SIGNPKG=
- SPLITPKG=0
- + SPLITPKG=0
- SOURCEONLY=0
- + SOURCEONLY=0
- VERIFYSOURCE=0
- + VERIFYSOURCE=0
- if [[ -n $SOURCE_DATE_EPOCH ]]; then
- REPRODUCIBLE=1
- else
- SOURCE_DATE_EPOCH=$(date +%s)
- fi
- + [[ -n '' ]]
- ++ date +%s
- + SOURCE_DATE_EPOCH=1534416503
- export SOURCE_DATE_EPOCH
- + export SOURCE_DATE_EPOCH
- PACMAN_OPTS=()
- + PACMAN_OPTS=()
- shopt -s extglob
- + shopt -s extglob
- ### SUBROUTINES ###
- # Import libmakepkg
- for lib in "$LIBRARY"/*.sh; do
- source "$lib"
- done
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/integrity.sh
- #!/usr/bin/bash
- #
- # integrity.sh - functions relating to source integrity checking
- #
- # 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_SH" ]] && return
- ++ [[ -n '' ]]
- LIBMAKEPKG_INTEGRITY_SH=1
- ++ LIBMAKEPKG_INTEGRITY_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_MESSAGE_SH=1
- +++ LIBMAKEPKG_UTIL_MESSAGE_SH=1
- colorize() {
- # prefer terminal safe colored and bold text when tput is supported
- if tput setaf 0 &>/dev/null; then
- ALL_OFF="$(tput sgr0)"
- BOLD="$(tput bold)"
- BLUE="${BOLD}$(tput setaf 4)"
- GREEN="${BOLD}$(tput setaf 2)"
- RED="${BOLD}$(tput setaf 1)"
- YELLOW="${BOLD}$(tput setaf 3)"
- else
- ALL_OFF="\e[0m"
- BOLD="\e[1m"
- BLUE="${BOLD}\e[34m"
- GREEN="${BOLD}\e[32m"
- RED="${BOLD}\e[31m"
- YELLOW="${BOLD}\e[33m"
- fi
- readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
- }
- plain() {
- local mesg=$1; shift
- printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
- }
- msg() {
- local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
- }
- msg2() {
- local mesg=$1; shift
- printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
- }
- warning() {
- local mesg=$1; shift
- printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
- }
- error() {
- local mesg=$1; shift
- printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
- }
- for lib in "$LIBRARY/integrity/"*.sh; do
- source "$lib"
- done
- ++ for lib in "$LIBRARY/integrity/"*.sh
- ++ source /usr/share/makepkg/integrity/generate_checksum.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_INTEGRITY_GENERATE_CHECKSUM_SH=1
- +++ LIBMAKEPKG_INTEGRITY_GENERATE_CHECKSUM_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_PKGBUILD_SH=1
- ++++ LIBMAKEPKG_UTIL_PKGBUILD_SH=1
- have_function() {
- declare -f "$1" >/dev/null
- }
- grep_function() {
- { declare -f "$1" || declare -f package; } 2>/dev/null | grep -E "$2"
- }
- array_build() {
- local dest=$1 src=$2 i keys values
- # it's an error to try to copy a value which doesn't exist.
- declare -p "$2" &>/dev/null || return 1
- # Build an array of the indicies of the source array.
- eval "keys=(\"\${!$2[@]}\")"
- # Clear the destination array
- eval "$dest=()"
- # Read values indirectly via their index. This approach gives us support
- # for associative arrays, sparse arrays, and empty strings as elements.
- for i in "${keys[@]}"; do
- values+=("printf -v '$dest[$i]' %s \"\${$src[$i]}\";")
- done
- eval "${values[*]}"
- }
- extract_global_variable() {
- # $1: variable name
- # $2: multivalued
- # $3: name of output var
- local attr=$1 isarray=$2 outputvar=$3 ref
- if (( isarray )); then
- array_build ref "$attr"
- [[ ${ref[@]} ]] && array_build "$outputvar" "$attr"
- else
- [[ ${!attr} ]] && printf -v "$outputvar" %s "${!attr}"
- fi
- }
- extract_function_variable() {
- # $1: function name
- # $2: variable name
- # $3: multivalued
- # $4: name of output var
- local funcname=$1 attr=$2 isarray=$3 outputvar=$4 attr_regex= decl= r=1
- if (( isarray )); then
- printf -v attr_regex '^[[:space:]]* %s\+?=\(' "$2"
- else
- 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:]])}
- eval "${decl/#$attr/$outputvar}"
- # entering this loop at all means we found a match, so notify the caller.
- r=0
- done < <(grep_function "$funcname" "$attr_regex")
- eval "$shellopts"
- return $r
- }
- get_pkgbuild_attribute() {
- # $1: package name
- # $2: attribute name
- # $3: multivalued
- # $4: name of output var
- local pkgname=$1 attrname=$2 isarray=$3 outputvar=$4
- if (( isarray )); then
- eval "$outputvar=()"
- else
- printf -v "$outputvar" %s ''
- fi
- if [[ $pkgname ]]; then
- extract_global_variable "$attrname" "$isarray" "$outputvar"
- extract_function_variable "package_$pkgname" "$attrname" "$isarray" "$outputvar"
- else
- extract_global_variable "$attrname" "$isarray" "$outputvar"
- 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
- ##
- get_full_version() {
- if (( epoch > 0 )); then
- printf "%s\n" "$epoch:$pkgver-$pkgrel"
- else
- printf "%s\n" "$pkgver-$pkgrel"
- fi
- }
- ##
- # usage : get_pkg_arch( [$pkgname] )
- # return : architecture of the package
- ##
- get_pkg_arch() {
- if [[ -z $1 ]]; then
- if [[ $arch = "any" ]]; then
- printf "%s\n" "any"
- else
- printf "%s\n" "$CARCH"
- fi
- else
- local arch_override
- get_pkgbuild_attribute "$1" arch 1 arch_override
- (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}")
- if [[ $arch_override = "any" ]]; then
- printf "%s\n" "any"
- else
- printf "%s\n" "$CARCH"
- fi
- fi
- }
- print_all_package_names() {
- local version=$(get_full_version)
- local architecture pkg opts a
- for pkg in ${pkgname[@]}; do
- 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() {
- local aggregate l a
- if array_build l 'source'; then
- aggregate+=("${l[@]}")
- fi
- for a in "${arch[@]}"; do
- if array_build l "source_$a"; then
- aggregate+=("${l[@]}")
- fi
- done
- array_build "$1" "aggregate"
- }
- get_all_sources_for_arch() {
- local aggregate l
- if array_build l 'source'; then
- aggregate+=("${l[@]}")
- fi
- if array_build l "source_$CARCH"; then
- aggregate+=("${l[@]}")
- fi
- 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
- }
- 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
- }
- ++ for lib in "$LIBRARY/integrity/"*.sh
- ++ source /usr/share/makepkg/integrity/generate_signature.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_INTEGRITY_GENERATE_SIGNATURE_SH=1
- +++ LIBMAKEPKG_INTEGRITY_GENERATE_SIGNATURE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- 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
- }
- ++ for lib in "$LIBRARY/integrity/"*.sh
- ++ source /usr/share/makepkg/integrity/verify_checksum.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_INTEGRITY_CHECKSUM_SH=1
- +++ LIBMAKEPKG_INTEGRITY_CHECKSUM_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- 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
- }
- ++ for lib in "$LIBRARY/integrity/"*.sh
- ++ source /usr/share/makepkg/integrity/verify_signature.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_INTEGRITY_VERIFY_SIGNATURE_SH=1
- +++ LIBMAKEPKG_INTEGRITY_VERIFY_SIGNATURE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- 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
- }
- 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
- }
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/lint_config.sh
- #!/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
- ++ [[ -n '' ]]
- LIBMAKEPKG_LINT_CONFIG_SH=1
- ++ LIBMAKEPKG_LINT_CONFIG_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- source "$LIBRARY/util/util.sh"
- ++ source /usr/share/makepkg/util/util.sh
- #!/usr/bin/bash
- #
- # util.sh - general utility functions
- #
- # 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_UTIL_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_UTIL_SH=1
- +++ LIBMAKEPKG_UTIL_UTIL_SH=1
- ##
- # usage : in_array( $needle, $haystack )
- # return : 0 - found
- # 1 - not found
- ##
- in_array() {
- local needle=$1; shift
- local item
- for item in "$@"; do
- [[ $item = "$needle" ]] && return 0 # Found
- done
- return 1 # Not Found
- }
- # tests if a variable is an array
- is_array() {
- local v=$1
- local ret=1
- if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
- ret=0
- fi
- return $ret
- }
- # Canonicalize a directory path if it exists
- canonicalize_path() {
- local path="$1";
- if [[ -d $path ]]; then
- (
- cd_safe "$path"
- pwd -P
- )
- else
- printf "%s\n" "$path"
- fi
- }
- dir_is_empty() {
- (
- shopt -s dotglob nullglob
- files=("$1"/*)
- (( ${#files} == 0 ))
- )
- }
- cd_safe() {
- if ! cd "$1"; then
- error "$(gettext "Failed to change to directory %s")" "$1"
- plain "$(gettext "Aborting...")"
- 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
- }
- declare -a lint_config_functions
- ++ declare -a lint_config_functions
- for lib in "$LIBRARY/lint_config/"*.sh; do
- source "$lib"
- done
- ++ for lib in "$LIBRARY/lint_config/"*.sh
- ++ source /usr/share/makepkg/lint_config/paths.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_CONFIG_PATHS_SH=1
- +++ LIBMAKEPKG_LINT_CONFIG_PATHS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_config_functions+=('lint_paths')
- +++ 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
- }
- ++ for lib in "$LIBRARY/lint_config/"*.sh
- ++ source /usr/share/makepkg/lint_config/variable.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH=1
- +++ LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_config_functions+=('lint_variable')
- +++ lint_config_functions+=('lint_variable')
- lint_variable() {
- 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
- }
- readonly -a lint_config_functions
- ++ readonly -a lint_config_functions
- lint_config() {
- local ret=0
- for func in ${lint_config_functions[@]}; do
- $func || ret=1
- done
- return $ret
- }
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/lint_package.sh
- #!/usr/bin/bash
- #
- # lint_package.sh - functions for checking for packaging errors
- #
- # 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
- # 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_SH" ]] && return
- ++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PACKAGE_SH=1
- ++ LIBMAKEPKG_LINT_PACKAGE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- source "$LIBRARY/util/util.sh"
- ++ source /usr/share/makepkg/util/util.sh
- #!/usr/bin/bash
- #
- # util.sh - general utility functions
- #
- # 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_UTIL_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- declare -a lint_package_functions
- ++ declare -a lint_package_functions
- for lib in "$LIBRARY/lint_package/"*.sh; do
- source "$lib"
- done
- ++ for lib in "$LIBRARY/lint_package/"*.sh
- ++ source /usr/share/makepkg/lint_package/build_references.sh
- #!/usr/bin/bash
- #
- # build_references.sh - Warn about files containing references to build directories
- #
- # 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
- # 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_BUILD_REFERENCES_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PACKAGE_BUILD_REFERENCES_SH=1
- +++ LIBMAKEPKG_LINT_PACKAGE_BUILD_REFERENCES_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_package_functions+=('warn_build_references')
- +++ lint_package_functions+=('warn_build_references')
- warn_build_references() {
- 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
- return 0
- }
- ++ for lib in "$LIBRARY/lint_package/"*.sh
- ++ source /usr/share/makepkg/lint_package/dotfiles.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=1
- +++ LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_package_functions+=('check_dotfiles')
- +++ 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
- }
- ++ for lib in "$LIBRARY/lint_package/"*.sh
- ++ source /usr/share/makepkg/lint_package/file_names.sh
- #!/usr/bin/bash
- #
- # file_names.sh - check package file names
- #
- # 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_FILE_NAMES_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH=1
- +++ LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_package_functions+=('lint_file_names')
- +++ lint_package_functions+=('lint_file_names')
- lint_file_names() {
- local ret=0 paths
- # 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
- }
- ++ for lib in "$LIBRARY/lint_package/"*.sh
- ++ source /usr/share/makepkg/lint_package/missing_backup.sh
- #!/usr/bin/bash
- #
- # missing_backup.sh - Warn about missing files in the backup array
- #
- # 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
- # 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_MISSING_BACKUP_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PACKAGE_MISSING_BACKUP_SH=1
- +++ LIBMAKEPKG_LINT_PACKAGE_MISSING_BACKUP_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_package_functions+=('warn_missing_backup')
- +++ lint_package_functions+=('warn_missing_backup')
- warn_missing_backup() {
- local file
- for file in "${backup[@]}"; do
- if [[ ! -f $file ]]; then
- warning "$(gettext "%s entry file not in package : %s")" "backup" "$file"
- fi
- done
- return 0
- }
- readonly -a lint_package_functions
- ++ readonly -a lint_package_functions
- lint_package() {
- cd_safe "$pkgdir"
- msg "$(gettext "Checking for packaging issues...")"
- local ret=0
- for func in ${lint_package_functions[@]}; do
- $func || ret=1
- done
- return $ret
- }
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/lint_pkgbuild.sh
- #!/usr/bin/bash
- #
- # lint_pkgbuild.sh - functions for detecting PKGBUILD errors
- #
- # 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
- # 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_SH" ]] && return
- ++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_SH=1
- ++ LIBMAKEPKG_LINT_PKGBUILD_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- declare -a lint_pkgbuild_functions
- ++ declare -a lint_pkgbuild_functions
- for lib in "$LIBRARY/lint_pkgbuild/"*.sh; do
- source "$lib"
- done
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/arch.sh
- #!/usr/bin/bash
- #
- # arch.sh - Check the 'arch' 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_ARCH_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_ARCH_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_ARCH_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_arch')
- +++ lint_pkgbuild_functions+=('lint_arch')
- lint_arch() {
- local a name list ret=0
- if [[ $arch == 'any' ]]; then
- return 0
- fi
- for a in "${arch[@]}"; do
- if [[ $a = *[![:alnum:]_]* ]]; then
- error "$(gettext "%s contains invalid characters: '%s'")" \
- 'arch' "${a//[[:alnum:]_]}"
- ret=1
- fi
- done
- if (( ! IGNOREARCH )) && ! in_array "$CARCH" "${arch[@]}"; then
- error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgbase" "$CARCH"
- return 1
- fi
- for name in "${pkgname[@]}"; do
- get_pkgbuild_attribute "$name" 'arch' 1 list
- if [[ $list && $list != 'any' ]] && ! in_array $CARCH "${list[@]}"; then
- if (( ! IGNOREARCH )); then
- error "$(gettext "%s is not available for the '%s' architecture.")" "$name" "$CARCH"
- ret=1
- fi
- fi
- done
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/backup.sh
- #!/usr/bin/bash
- #
- # backup.sh - Check the 'backup' 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_BACKUP_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_BACKUP_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_BACKUP_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_backup')
- +++ lint_pkgbuild_functions+=('lint_backup')
- lint_backup() {
- local list name backup_list ret=0
- backup_list=("${backup[@]}")
- for name in "${pkgname[@]}"; do
- if extract_function_variable "package_$name" backup 1 list; then
- backup_list+=("${list[@]}")
- fi
- done
- for name in "${backup_list[@]}"; do
- if [[ ${name:0:1} = "/" ]]; then
- error "$(gettext "%s entry should not contain leading slash : %s")" "backup" "$name"
- ret=1
- fi
- done
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/changelog.sh
- #!/usr/bin/bash
- #
- # changelog.sh - Check the files in the 'changelog' array exist.
- #
- # 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_CHANGELOG_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_CHANGELOG_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_CHANGELOG_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/lint_pkgbuild/util.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/util.sh
- #!/usr/bin/bash
- #
- # util.sh - utility functions for pkgbuild linting.
- #
- # 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_UTIL_SH" ]] && return
- ++++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_UTIL_SH=1
- ++++ LIBMAKEPKG_LINT_PKGBUILD_UTIL_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++++ [[ -n 1 ]]
- +++++ return
- check_files_exist() {
- local kind=$1 files=("${@:2}") file ret=0
- for file in "${files[@]}"; do
- if [[ $file && ! -f $file ]]; then
- error "$(gettext "%s file (%s) does not exist or is not a regular file.")" \
- "$kind" "$file"
- ret=1
- fi
- done
- return $ret
- }
- lint_pkgbuild_functions+=('lint_changelog')
- +++ lint_pkgbuild_functions+=('lint_changelog')
- lint_changelog() {
- local name file changelog_list
- changelog_list=("${changelog[@]}")
- for name in "${pkgname[@]}"; do
- if extract_function_variable "package_$name" changelog 0 file; then
- changelog_list+=("$file")
- fi
- done
- check_files_exist 'changelog' "${changelog_list[@]}" || ret=1
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/checkdepends.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/lint_pkgbuild/pkgname.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgname.sh
- #!/usr/bin/bash
- #
- # pkgname.sh - Check the 'pkgname' variable 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_PKGNAME_SH" ]] && return
- ++++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_PKGNAME_SH=1
- ++++ LIBMAKEPKG_LINT_PKGBUILD_PKGNAME_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++++ [[ -n 1 ]]
- +++++ return
- lint_pkgbuild_functions+=('lint_pkgname')
- ++++ lint_pkgbuild_functions+=('lint_pkgname')
- lint_one_pkgname() {
- local type=$1 name=$2 ret=0
- 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
- }
- source "$LIBRARY/lint_pkgbuild/pkgver.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgver.sh
- #!/usr/bin/bash
- #
- # pkgver.sh - Check the 'pkgver' variable 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_PKGVER_SH" ]] && return
- ++++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_PKGVER_SH=1
- ++++ LIBMAKEPKG_LINT_PKGBUILD_PKGVER_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++++ [[ -n 1 ]]
- +++++ return
- lint_pkgbuild_functions+=('lint_pkgver')
- ++++ lint_pkgbuild_functions+=('lint_pkgver')
- check_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 [[ $ver = *[[:space:]/:-]* ]]; then
- error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace.")" "pkgver${type:+ in $type}"
- return 1
- fi
- }
- lint_pkgver() {
- if (( PKGVERFUNC )); then
- # defer check to after getting version from pkgver function
- return 0
- fi
- check_pkgver "$pkgver"
- }
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_checkdepends')
- +++ 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
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/conflicts.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/lint_pkgbuild/pkgname.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgname.sh
- #!/usr/bin/bash
- #
- # pkgname.sh - Check the 'pkgname' variable 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_PKGNAME_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/lint_pkgbuild/pkgver.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgver.sh
- #!/usr/bin/bash
- #
- # pkgver.sh - Check the 'pkgver' variable 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_PKGVER_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_conflicts')
- +++ 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
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/depends.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/lint_pkgbuild/pkgname.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgname.sh
- #!/usr/bin/bash
- #
- # pkgname.sh - Check the 'pkgname' variable 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_PKGNAME_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/lint_pkgbuild/pkgver.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgver.sh
- #!/usr/bin/bash
- #
- # pkgver.sh - Check the 'pkgver' variable 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_PKGVER_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_depends')
- +++ 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
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/epoch.sh
- #!/usr/bin/bash
- #
- # epoch.sh - Check the 'epoch' variable 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_EPOCH_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_EPOCH_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_EPOCH_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_epoch')
- +++ lint_pkgbuild_functions+=('lint_epoch')
- lint_epoch() {
- if [[ $epoch != *([[:digit:]]) ]]; then
- error "$(gettext "%s must be an integer, not %s.")" "epoch" "$epoch"
- return 1
- fi
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/install.sh
- #!/usr/bin/bash
- #
- # install.sh - Check the files in the 'install' array exist.
- #
- # 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_INSTALL_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_INSTALL_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_INSTALL_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/lint_pkgbuild/util.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/util.sh
- #!/usr/bin/bash
- #
- # util.sh - utility functions for pkgbuild linting.
- #
- # 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_UTIL_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_install')
- +++ lint_pkgbuild_functions+=('lint_install')
- lint_install() {
- local list file name install_list ret=0
- install_list=("${install[@]}")
- for name in "${pkgname[@]}"; do
- extract_function_variable "package_$name" install 0 file
- install_list+=("$file")
- done
- check_files_exist 'install' "${install_list[@]}" || ret=1
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/makedepends.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/lint_pkgbuild/pkgname.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgname.sh
- #!/usr/bin/bash
- #
- # pkgname.sh - Check the 'pkgname' variable 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_PKGNAME_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/lint_pkgbuild/pkgver.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgver.sh
- #!/usr/bin/bash
- #
- # pkgver.sh - Check the 'pkgver' variable 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_PKGVER_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_makedepends')
- +++ 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
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/optdepends.sh
- #!/usr/bin/bash
- #
- # optdepends.sh - Check the 'optdepends' 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_OPTDEPENDS_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_OPTDEPENDS_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_OPTDEPENDS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_optdepends')
- +++ lint_pkgbuild_functions+=('lint_optdepends')
- lint_optdepends() {
- local optdepends_list optdepend name ver ret=0
- get_pkgbuild_all_split_attributes optdepends optdepends_list
- # this function requires extglob - save current status to restore later
- local shellopts=$(shopt -p extglob)
- shopt -s extglob
- 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
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/options.sh
- #!/usr/bin/bash
- #
- # options.sh - Check the 'options' 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_OPTIONS_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_OPTIONS_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_OPTIONS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_options')
- +++ lint_pkgbuild_functions+=('lint_options')
- lint_options() {
- local ret=0 list name kopt options_list
- options_list=("${options[@]}")
- for name in "${pkgname[@]}"; do
- if extract_function_variable "package_$name" options 1 list; then
- options_list+=("${list[@]}")
- fi
- done
- for i in "${options_list[@]}"; do
- # check if option matches a known option or its inverse
- for kopt in "${packaging_options[@]}" "${build_options[@]}"; do
- if [[ $i = "$kopt" || $i = "!$kopt" ]]; then
- # continue to the next $i
- continue 2
- fi
- done
- error "$(gettext "%s array contains unknown option '%s'")" "options" "$i"
- ret=1
- done
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/package_function.sh
- #!/usr/bin/bash
- #
- # package_function.sh - Check that required package functions exist.
- #
- # 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_PACKAGE_FUNCTION_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_package_function')
- +++ lint_pkgbuild_functions+=('lint_package_function')
- lint_package_function() {
- local i ret=0
- if (( ${#pkgname[@]} == 1 )); then
- if have_function 'build' && ! { have_function 'package' || have_function "package_$pkgname"; }; then
- error "$(gettext "Missing %s function in %s")" "package()" "$BUILDFILE"
- ret=1
- fi
- else
- for i in "${pkgname[@]}"; do
- if ! have_function "package_$i"; then
- error "$(gettext "Missing %s function for split package '%s'")" "package_$i()" "$i"
- ret=1
- fi
- done
- fi
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/pkgbase.sh
- #!/usr/bin/bash
- #
- # pkgbase.sh - Check the 'pkgbase' variable 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_PKGBASE_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_PKGBASE_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_PKGBASE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/lint_pkgbuild/pkgname.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgname.sh
- #!/usr/bin/bash
- #
- # pkgname.sh - Check the 'pkgname' variable 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_PKGNAME_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_pkgbase')
- +++ lint_pkgbuild_functions+=('lint_pkgbase')
- lint_pkgbase() {
- if [[ -z $pkgbase ]]; then
- return 0
- fi
- lint_one_pkgname "pkgbase" "$pkgbase"
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/pkglist.sh
- #!/usr/bin/bash
- #
- # pkglist.sh - Check the packages selected to build exist.
- #
- # 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_PKGLIST_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/util.sh"
- +++ source /usr/share/makepkg/util/util.sh
- #!/usr/bin/bash
- #
- # util.sh - general utility functions
- #
- # 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_UTIL_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_pkglist')
- +++ lint_pkgbuild_functions+=('lint_pkglist')
- lint_pkglist() {
- local i ret=0
- for i in "${PKGLIST[@]}"; do
- if ! in_array "$i" "${pkgname[@]}"; then
- error "$(gettext "Requested package %s is not provided in %s")" "$i" "$BUILDFILE"
- ret=1
- fi
- done
- return $ret
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/pkgname.sh
- #!/usr/bin/bash
- #
- # pkgname.sh - Check the 'pkgname' variable 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_PKGNAME_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/pkgrel.sh
- #!/usr/bin/bash
- #
- # pkgrel.sh - Check the 'pkgrel' variable 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_PKGREL_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_PKGREL_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_PKGREL_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_pkgrel')
- +++ lint_pkgbuild_functions+=('lint_pkgrel')
- lint_pkgrel() {
- if [[ -z $pkgrel ]]; then
- error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
- return 1
- fi
- if [[ $pkgrel != +([0-9])?(.+([0-9])) ]]; then
- error "$(gettext "%s must be a decimal, not %s.")" "pkgrel" "$pkgrel"
- return 1
- fi
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/pkgver.sh
- #!/usr/bin/bash
- #
- # pkgver.sh - Check the 'pkgver' variable 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_PKGVER_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/provides.sh
- #!/usr/bin/bash
- #
- # provides.sh - Check the 'provides' 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_PROVIDES_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/lint_pkgbuild/pkgname.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgname.sh
- #!/usr/bin/bash
- #
- # pkgname.sh - Check the 'pkgname' variable 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_PKGNAME_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/lint_pkgbuild/pkgver.sh"
- +++ source /usr/share/makepkg/lint_pkgbuild/pkgver.sh
- #!/usr/bin/bash
- #
- # pkgver.sh - Check the 'pkgver' variable 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_PKGVER_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_provides')
- +++ lint_pkgbuild_functions+=('lint_provides')
- lint_provides() {
- local provides_list provide name ver ret=0
- get_pkgbuild_all_split_attributes provides provides_list
- # 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
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/source.sh
- #!/usr/bin/bash
- #
- # source.sh - Check the 'source' array is not sparse.
- #
- # 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_SOURCE_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_SOURCE_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_SOURCE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_source')
- +++ lint_pkgbuild_functions+=('lint_source')
- lint_source() {
- local idx=("${!source[@]}")
- if (( ${#source[*]} > 0 && (${idx[@]: -1} + 1) != ${#source[*]} )); then
- error "$(gettext "Sparse arrays are not allowed for source")"
- return 1
- fi
- }
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/util.sh
- #!/usr/bin/bash
- #
- # util.sh - utility functions for pkgbuild linting.
- #
- # 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_UTIL_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ++ for lib in "$LIBRARY/lint_pkgbuild/"*.sh
- ++ source /usr/share/makepkg/lint_pkgbuild/variable.sh
- #!/usr/bin/bash
- #
- # variable.sh - Check that variables are or are not arrays as appropriate
- #
- # 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_VARIABLE_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_LINT_PKGBUILD_VARIABLE_SH=1
- +++ LIBMAKEPKG_LINT_PKGBUILD_VARIABLE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- lint_pkgbuild_functions+=('lint_variable')
- +++ lint_pkgbuild_functions+=('lint_variable')
- lint_variable() {
- # TODO: refactor - similar arrays are used elsewhere
- local array=(arch backup checkdepends groups license noextract options
- validpgpkeys)
- local arch_array=(conflicts depends makedepends md5sums optdepends provides
- 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
- # global variables
- for i in ${array[@]} ${arch_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 a in ${arch[@]}; do
- [[ $a == "any" ]] && continue
- for i in ${arch_array[@]}; do
- v="${i}_${a}"
- eval "keys=(\"\${!${v}[@]}\")"
- if (( ${#keys[*]} > 0 )); then
- if ! is_array $v; then
- error "$(gettext "%s_%s should be an array")" "$i" "$a"
- ret=1
- fi
- fi
- done
- 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
- # package function variables
- for pkg in ${pkgname[@]}; do
- for i in ${array[@]} ${arch_array[@]}; do
- if extract_function_variable "package_$pkg" $i 0 out; then
- error "$(gettext "%s should be an array")" "$i"
- ret=1
- fi
- done
- for a in ${arch[@]}; do
- [[ $a == "any" ]] && continue
- for i in ${arch_array[@]}; do
- if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
- error "$(gettext "%s_%s should be an array")" "$i" "$a"
- ret=1
- fi
- done
- done
- for i in ${string[@]}; do
- if extract_function_variable "package_$pkg" $i 1 out; then
- error "$(gettext "%s should not be an array")" "$i"
- ret=1
- fi
- done
- done
- return $ret
- }
- readonly -a lint_pkgbuild_functions
- ++ readonly -a lint_pkgbuild_functions
- lint_pkgbuild() {
- local ret=0
- for func in ${lint_pkgbuild_functions[@]}; do
- $func || ret=1
- done
- return $ret
- }
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/source.sh
- #!/usr/bin/bash
- #
- # source.sh - functions for downloading and extracting sources
- #
- # 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
- # 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_SOURCE_SH" ]] && return
- ++ [[ -n '' ]]
- LIBMAKEPKG_SOURCE_SH=1
- ++ LIBMAKEPKG_SOURCE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- source "$LIBRARY/util/pkgbuild.sh"
- ++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- source "$LIBRARY/util/source.sh"
- ++ source /usr/share/makepkg/util/source.sh
- #!/usr/bin/bash
- #
- # source.sh - functions to extract information from source URLs
- #
- # 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
- # 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_SOURCE_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_SOURCE_SH=1
- +++ LIBMAKEPKG_UTIL_SOURCE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- # a source entry can have two forms :
- # 1) "filename::http://path/to/file"
- # 2) "http://path/to/file"
- # extract the URL from a source entry
- get_url() {
- # strip an eventual filename
- printf "%s\n" "${1#*::}"
- }
- # extract the protocol from a source entry - return "local" for local sources
- get_protocol() {
- if [[ $1 = *://* ]]; then
- # strip leading filename
- local proto="${1#*::}"
- printf "%s\n" "${proto%%://*}"
- elif [[ $1 = *lp:* ]]; then
- local proto="${1#*::}"
- printf "%s\n" "${proto%%lp:*}"
- else
- printf "%s\n" local
- fi
- }
- # extract the filename from a source entry
- get_filename() {
- local netfile=$1
- # if a filename is specified, use it
- if [[ $netfile = *::* ]]; then
- printf "%s\n" ${netfile%%::*}
- return
- fi
- local proto=$(get_protocol "$netfile")
- case $proto in
- bzr*|git*|hg*|svn*)
- filename=${netfile%%#*}
- filename=${filename%%\?*}
- filename=${filename%/}
- filename=${filename##*/}
- if [[ $proto = bzr* ]]; then
- filename=${filename#*lp:}
- fi
- if [[ $proto = git* ]]; then
- filename=${filename%%.git*}
- fi
- ;;
- *)
- # if it is just an URL, we only keep the last component
- filename="${netfile##*/}"
- ;;
- esac
- printf "%s\n" "${filename}"
- }
- # Return the absolute filename of a source entry
- get_filepath() {
- local file="$(get_filename "$1")"
- local proto="$(get_protocol "$1")"
- case $proto in
- bzr*|git*|hg*|svn*)
- if [[ -d "$startdir/$file" ]]; then
- file="$startdir/$file"
- elif [[ -d "$SRCDEST/$file" ]]; then
- file="$SRCDEST/$file"
- else
- return 1
- fi
- ;;
- *)
- if [[ -f "$startdir/$file" ]]; then
- file="$startdir/$file"
- elif [[ -f "$SRCDEST/$file" ]]; then
- file="$SRCDEST/$file"
- else
- return 1
- fi
- ;;
- esac
- 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
- # loop through DOWNLOAD_AGENTS variable looking for protocol
- local i
- for i in "${DLAGENTS[@]}"; do
- local handler="${i%%::*}"
- if [[ $proto = "$handler" ]]; then
- local agent="${i#*::}"
- break
- fi
- done
- # if we didn't find an agent, return an error
- if [[ -z $agent ]]; then
- error "$(gettext "Unknown download protocol: %s")" "$proto"
- plain "$(gettext "Aborting...")"
- exit 1 # $E_CONFIG_ERROR
- fi
- # ensure specified program is installed
- local program="${agent%% *}"
- if [[ ! -x $program ]]; then
- local baseprog="${program##*/}"
- error "$(gettext "The download program %s is not installed.")" "$baseprog"
- plain "$(gettext "Aborting...")"
- exit 1 # $E_MISSING_PROGRAM
- fi
- printf "%s\n" "$agent"
- }
- for lib in "$LIBRARY/source/"*.sh; do
- source "$lib"
- done
- ++ for lib in "$LIBRARY/source/"*.sh
- ++ source /usr/share/makepkg/source/bzr.sh
- #!/usr/bin/bash
- #
- # bzr.sh - function for handling the download and "extraction" of Bazaar sources
- #
- # 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
- # 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_SOURCE_BZR_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_SOURCE_BZR_SH=1
- +++ LIBMAKEPKG_SOURCE_BZR_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- download_bzr() {
- local netfile=$1
- local url=$(get_url "$netfile")
- if [[ $url != bzr+ssh* ]]; then
- url=${url#bzr+}
- fi
- url=${url%%#*}
- local repo=$(get_filename "$netfile")
- local displaylocation="$url"
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
- msg2 "$(gettext "Branching %s...")" "${displaylocation}"
- if ! bzr branch "$url" "$dir" --no-tree --use-existing-dir; then
- error "$(gettext "Failure while branching %s")" "${displaylocation}"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- elif (( ! HOLDVER )); then
- msg2 "$(gettext "Pulling %s...")" "${displaylocation}"
- cd_safe "$dir"
- if ! bzr pull "$url"; then
- # only warn on failure to allow offline builds
- warning "$(gettext "Failure while pulling %s")" "${displaylocation}"
- fi
- fi
- }
- extract_bzr() {
- local netfile=$1
- local repo=$(get_filename "$netfile")
- local fragment=${netfile#*#}
- if [[ $fragment = "$netfile" ]]; then
- unset fragment
- fi
- rev="last:1"
- if [[ -n $fragment ]]; then
- case ${fragment%%=*} in
- revision)
- rev="${fragment#*=}"
- displaylocation="$url -r ${fragment#*=}"
- ;;
- *)
- error "$(gettext "Unrecognized reference: %s")" "${fragment}"
- plain "$(gettext "Aborting...")"
- exit 1
- esac
- fi
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr"
- pushd "$srcdir" &>/dev/null
- if [[ -d "${dir##*/}" ]]; then
- cd_safe "${dir##*/}"
- if ! (bzr pull "$dir" -q --overwrite -r "$rev" && bzr clean-tree -q --detritus --force); then
- error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "bzr"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- elif ! bzr checkout "$dir" -r "$rev"; then
- error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- popd &>/dev/null
- }
- ++ for lib in "$LIBRARY/source/"*.sh
- ++ source /usr/share/makepkg/source/file.sh
- #!/usr/bin/bash
- #
- # file.sh - function for handling the download and extraction of source files
- #
- # 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
- # 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_SOURCE_FILE_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_SOURCE_FILE_SH=1
- +++ LIBMAKEPKG_SOURCE_FILE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- download_file() {
- local netfile=$1
- local filepath=$(get_filepath "$netfile")
- if [[ -n "$filepath" ]]; then
- msg2 "$(gettext "Found %s")" "${filepath##*/}"
- return
- fi
- local proto=$(get_protocol "$netfile")
- # find the client we should use for this URL
- local -a cmdline
- IFS=' ' read -a cmdline < <(get_downloadclient "$proto")
- (( ${#cmdline[@]} )) || exit
- local filename=$(get_filename "$netfile")
- local url=$(get_url "$netfile")
- if [[ $proto = "scp" ]]; then
- # scp downloads should not pass the protocol in the url
- url="${url##*://}"
- fi
- msg2 "$(gettext "Downloading %s...")" "$filename"
- # temporary download file, default to last component of the URL
- local dlfile="${url##*/}"
- # replace %o by the temporary dlfile if it exists
- if [[ ${cmdline[*]} = *%o* ]]; then
- dlfile=$filename.part
- cmdline=("${cmdline[@]//%o/$dlfile}")
- fi
- # add the URL, either in place of %u or at the end
- if [[ ${cmdline[*]} = *%u* ]]; then
- cmdline=("${cmdline[@]//%u/$url}")
- else
- cmdline+=("$url")
- fi
- if ! command -- "${cmdline[@]}" >&2; then
- [[ ! -s $dlfile ]] && rm -f -- "$dlfile"
- error "$(gettext "Failure while downloading %s")" "$url"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- # rename the temporary download file to the final destination
- if [[ $dlfile != "$filename" ]]; then
- mv -f "$SRCDEST/$dlfile" "$SRCDEST/$filename"
- fi
- }
- extract_file() {
- local file=$1
- local filepath=$(get_filepath "$file")
- rm -f "$srcdir/${file}"
- ln -s "$filepath" "$srcdir/"
- if in_array "$file" "${noextract[@]}"; then
- # skip source files in the noextract=() array
- # these are marked explicitly to NOT be extracted
- return 0
- fi
- # do not rely on extension for file type
- local file_type=$(file -bizL -- "$file")
- local ext=${file##*.}
- local cmd=''
- case "$file_type" in
- *application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*)
- cmd="bsdtar" ;;
- *application/x-gzip*)
- case "$ext" in
- gz|z|Z) cmd="gzip" ;;
- *) return;;
- esac ;;
- *application/x-bzip*)
- case "$ext" in
- bz2|bz) cmd="bzip2" ;;
- *) return;;
- esac ;;
- *application/x-xz*)
- case "$ext" in
- xz) cmd="xz" ;;
- *) return;;
- esac ;;
- *)
- # See if bsdtar can recognize the file
- if bsdtar -tf "$file" -q '*' &>/dev/null; then
- cmd="bsdtar"
- else
- return 0
- fi ;;
- esac
- local ret=0
- msg2 "$(gettext "Extracting %s with %s")" "$file" "$cmd"
- if [[ $cmd = "bsdtar" ]]; then
- $cmd -xf "$file" || ret=$?
- else
- rm -f -- "${file%.*}"
- $cmd -dcf -- "$file" > "${file%.*}" || ret=$?
- fi
- if (( ret )); then
- error "$(gettext "Failed to extract %s")" "$file"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- if (( EUID == 0 )); then
- # change perms of all source files to root user & root group
- chown -R 0:0 "$srcdir"
- fi
- }
- ++ for lib in "$LIBRARY/source/"*.sh
- ++ source /usr/share/makepkg/source/git.sh
- #!/usr/bin/bash
- #
- # git.sh - function for handling the download and "extraction" of Git sources
- #
- # 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
- # 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_SOURCE_GIT_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_SOURCE_GIT_SH=1
- +++ LIBMAKEPKG_SOURCE_GIT_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- download_git() {
- local netfile=$1
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- local repo=$(get_filename "$netfile")
- 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"
- if ! git clone --mirror "$url" "$dir"; then
- error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- elif (( ! HOLDVER )); then
- cd_safe "$dir"
- # Make sure we are fetching the right repo
- if [[ "$url" != "$(git config --get remote.origin.url)" ]] ; then
- error "$(gettext "%s is not a clone of %s")" "$dir" "$url"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "git"
- if ! git fetch --all -p; then
- # only warn on failure to allow offline builds
- warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git"
- fi
- fi
- }
- extract_git() {
- local netfile=$1 tagname
- local fragment=$(get_uri_fragment "$netfile")
- local repo=$(get_filename "$netfile")
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git"
- pushd "$srcdir" &>/dev/null
- local updating=0
- if [[ -d "${dir##*/}" ]]; then
- updating=1
- cd_safe "${dir##*/}"
- if ! git fetch; then
- error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "git"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- cd_safe "$srcdir"
- elif ! git clone "$dir" "${dir##*/}"; then
- error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- cd_safe "${dir##*/}"
- local ref=origin/HEAD
- if [[ -n $fragment ]]; then
- case ${fragment%%=*} in
- commit|tag)
- ref=${fragment##*=}
- ;;
- branch)
- ref=origin/${fragment##*=}
- ;;
- *)
- error "$(gettext "Unrecognized reference: %s")" "${fragment}"
- plain "$(gettext "Aborting...")"
- exit 1
- 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"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- fi
- popd &>/dev/null
- }
- ++ for lib in "$LIBRARY/source/"*.sh
- ++ source /usr/share/makepkg/source/hg.sh
- #!/usr/bin/bash
- #
- # hg.sh - function for handling the download and "extraction" of Mercurial sources
- #
- # 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
- # 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_SOURCE_HG_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_SOURCE_HG_SH=1
- +++ LIBMAKEPKG_SOURCE_HG_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- download_hg() {
- local netfile=$1
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- local repo=$(get_filename "$netfile")
- local url=$(get_url "$netfile")
- url=${url#hg+}
- url=${url%%#*}
- if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
- msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "hg"
- if ! hg clone -U "$url" "$dir"; then
- error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "hg"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- elif (( ! HOLDVER )); then
- msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "hg"
- cd_safe "$dir"
- if ! hg pull; then
- # only warn on failure to allow offline builds
- warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg"
- fi
- fi
- }
- extract_hg() {
- local netfile=$1
- local fragment=${netfile#*#}
- if [[ $fragment = "$netfile" ]]; then
- unset fragment
- fi
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- local repo=${netfile##*/}
- repo=${repo%%#*}
- msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg"
- pushd "$srcdir" &>/dev/null
- local ref=tip
- if [[ -n $fragment ]]; then
- case ${fragment%%=*} in
- branch|revision|tag)
- ref="${fragment##*=}"
- ;;
- *)
- error "$(gettext "Unrecognized reference: %s")" "${fragment}"
- plain "$(gettext "Aborting...")"
- exit 1
- esac
- fi
- if [[ -d "${dir##*/}" ]]; then
- cd_safe "${dir##*/}"
- if ! (hg pull && hg update -C -r "$ref"); then
- error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "hg"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- elif ! hg clone -u "$ref" "$dir" "${dir##*/}"; then
- error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- popd &>/dev/null
- }
- ++ for lib in "$LIBRARY/source/"*.sh
- ++ source /usr/share/makepkg/source/local.sh
- #!/usr/bin/bash
- #
- # local.sh - function for handling the "download" of local sources
- #
- # 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
- # 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_SOURCE_LOCAL_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_SOURCE_LOCAL_SH=1
- +++ LIBMAKEPKG_SOURCE_LOCAL_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- download_local() {
- local netfile=$1
- local filepath=$(get_filepath "$netfile")
- if [[ -n "$filepath" ]]; then
- msg2 "$(gettext "Found %s")" "${filepath##*/}"
- else
- local filename=$(get_filename "$netfile")
- error "$(gettext "%s was not found in the build directory and is not a URL.")" "$filename"
- exit 1 # $E_MISSING_FILE
- fi
- }
- ++ for lib in "$LIBRARY/source/"*.sh
- ++ source /usr/share/makepkg/source/svn.sh
- #!/usr/bin/bash
- #
- # svn.sh - function for handling the download and "extraction" of Subversion sources
- #
- # 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
- # 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_SOURCE_SVN_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_SOURCE_SVN_SH=1
- +++ LIBMAKEPKG_SOURCE_SVN_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/pkgbuild.sh"
- +++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- download_svn() {
- local netfile=$1
- local fragment=${netfile#*#}
- if [[ $fragment = "$netfile" ]]; then
- unset fragment
- fi
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- local repo=$(get_filename "$netfile")
- local url=$(get_url "$netfile")
- if [[ $url != svn+ssh* ]]; then
- url=${url#svn+}
- fi
- url=${url%%#*}
- local ref=HEAD
- if [[ -n $fragment ]]; then
- case ${fragment%%=*} in
- revision)
- ref="${fragment##*=}"
- ;;
- *)
- error "$(gettext "Unrecognized reference: %s")" "${fragment}"
- plain "$(gettext "Aborting...")"
- exit 1
- esac
- fi
- if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
- msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "svn"
- mkdir -p "$dir/.makepkg"
- if ! svn checkout -r ${ref} --config-dir "$dir/.makepkg" "$url" "$dir"; then
- error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "svn"
- plain "$(gettext "Aborting...")"
- exit 1
- fi
- elif (( ! HOLDVER )); then
- msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "svn"
- cd_safe "$dir"
- if ! svn update -r ${ref}; then
- # only warn on failure to allow offline builds
- warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn"
- fi
- fi
- }
- extract_svn() {
- local netfile=$1
- local dir=$(get_filepath "$netfile")
- [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
- local repo=${netfile##*/}
- repo=${repo%%#*}
- msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn"
- cp -au "$dir" "$srcdir"
- }
- download_sources() {
- local netfile all_sources
- local get_source_fn=get_all_sources_for_arch get_vcs=1
- msg "$(gettext "Retrieving sources...")"
- while true; do
- case $1 in
- allarch)
- get_source_fn=get_all_sources
- ;;
- novcs)
- get_vcs=0
- ;;
- *)
- break
- ;;
- esac
- shift
- done
- "$get_source_fn" 'all_sources'
- for netfile in "${all_sources[@]}"; do
- pushd "$SRCDEST" &>/dev/null
- local proto=$(get_protocol "$netfile")
- case "$proto" in
- local)
- download_local "$netfile"
- ;;
- bzr*)
- (( get_vcs )) && download_bzr "$netfile"
- ;;
- git*)
- (( get_vcs )) && download_git "$netfile"
- ;;
- hg*)
- (( get_vcs )) && download_hg "$netfile"
- ;;
- svn*)
- (( get_vcs )) && download_svn "$netfile"
- ;;
- *)
- download_file "$netfile"
- ;;
- esac
- popd &>/dev/null
- done
- }
- extract_sources() {
- msg "$(gettext "Extracting sources...")"
- local netfile all_sources
- get_all_sources_for_arch 'all_sources'
- for netfile in "${all_sources[@]}"; do
- local file=$(get_filename "$netfile")
- local proto=$(get_protocol "$netfile")
- case "$proto" in
- bzr*)
- extract_bzr "$netfile"
- ;;
- git*)
- extract_git "$netfile"
- ;;
- hg*)
- extract_hg "$netfile"
- ;;
- svn*)
- extract_svn "$netfile"
- ;;
- *)
- extract_file "$file"
- ;;
- esac
- done
- }
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/srcinfo.sh
- #!/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
- ++ [[ -n '' ]]
- LIBMAKEPKG_SRCINFO_SH=1
- ++ LIBMAKEPKG_SRCINFO_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/pkgbuild.sh"
- ++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- 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
- }
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/tidy.sh
- #!/usr/bin/bash
- #
- # tidy.sh - functions for modifying/removing installed files before
- # package creation
- #
- # 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
- # 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_TIDY_SH" ]] && return
- ++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_SH=1
- ++ LIBMAKEPKG_TIDY_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- ++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- declare -a packaging_options tidy_remove tidy_modify
- ++ declare -a packaging_options tidy_remove tidy_modify
- for lib in "$LIBRARY/tidy/"*.sh; do
- source "$lib"
- done
- ++ for lib in "$LIBRARY/tidy/"*.sh
- ++ source /usr/share/makepkg/tidy/docs.sh
- #!/usr/bin/bash
- #
- # docs.sh - Remove documentation files from the package
- #
- # 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_TIDY_DOCS_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_DOCS_SH=1
- +++ LIBMAKEPKG_TIDY_DOCS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/option.sh"
- +++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- ++++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_OPTION_SH=1
- ++++ LIBMAKEPKG_UTIL_OPTION_SH=1
- ##
- # usage : in_opt_array( $needle, $haystack )
- # return : 0 - enabled
- # 1 - disabled
- # 127 - not found
- ##
- in_opt_array() {
- local needle=$1; shift
- local i opt
- for (( i = $#; i > 0; i-- )); do
- opt=${!i}
- if [[ $opt = "$needle" ]]; then
- # enabled
- return 0
- elif [[ $opt = "!$needle" ]]; then
- # disabled
- return 1
- fi
- done
- # not found
- return 127
- }
- ##
- # Checks to see if options are present in makepkg.conf or PKGBUILD;
- # PKGBUILD options always take precedence.
- #
- # usage : check_option( $option, $expected_val )
- # return : 0 - matches expected
- # 1 - does not match expected
- # 127 - not found
- ##
- check_option() {
- in_opt_array "$1" ${options[@]}
- case $? in
- 0) # assert enabled
- [[ $2 = y ]]
- return ;;
- 1) # assert disabled
- [[ $2 = n ]]
- return
- esac
- # fall back to makepkg.conf options
- in_opt_array "$1" ${OPTIONS[@]}
- case $? in
- 0) # assert enabled
- [[ $2 = y ]]
- return ;;
- 1) # assert disabled
- [[ $2 = n ]]
- return
- esac
- # not found
- return 127
- }
- ##
- # Check if option is present in BUILDENV
- #
- # usage : check_buildenv( $option, $expected_val )
- # return : 0 - matches expected
- # 1 - does not match expected
- # 127 - not found
- ##
- check_buildenv() {
- in_opt_array "$1" ${BUILDENV[@]}
- case $? in
- 0) # assert enabled
- [[ $2 = "y" ]]
- return ;;
- 1) # assert disabled
- [[ $2 = "n" ]]
- return ;;
- esac
- # not found
- return 127
- }
- ##
- # Checks to see if options are present in BUILDENV or PKGBUILD;
- # PKGBUILD options always take precedence.
- #
- # usage : check_buildoption( $option, $expected_val )
- # return : 0 - matches expected
- # 1 - does not match expected
- # 127 - not found
- ##
- check_buildoption() {
- in_opt_array "$1" ${options[@]}
- case $? in
- 0) # assert enabled
- [[ $2 = y ]]
- return ;;
- 1) # assert disabled
- [[ $2 = n ]]
- return
- esac
- in_opt_array "$1" ${BUILDENV[@]}
- case $? in
- 0) # assert enabled
- [[ $2 = y ]]
- return ;;
- 1) # assert disabled
- [[ $2 = n ]]
- return
- esac
- # not found
- return 127
- }
- packaging_options+=('docs')
- +++ packaging_options+=('docs')
- tidy_remove+=('tidy_docs')
- +++ tidy_remove+=('tidy_docs')
- tidy_docs() {
- if check_option "docs" "n" && [[ -n ${DOC_DIRS[*]} ]]; then
- msg2 "$(gettext "Removing doc files...")"
- rm -rf -- ${DOC_DIRS[@]}
- fi
- }
- ++ for lib in "$LIBRARY/tidy/"*.sh
- ++ source /usr/share/makepkg/tidy/emptydirs.sh
- #!/usr/bin/bash
- #
- # emptydirs.sh - Remove empty directories from the package
- #
- # 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
- # 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_TIDY_EMPTYDIRS_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_EMPTYDIRS_SH=1
- +++ LIBMAKEPKG_TIDY_EMPTYDIRS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/option.sh"
- +++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- packaging_options+=('emptydirs')
- +++ packaging_options+=('emptydirs')
- tidy_remove+=('tidy_emptydirs')
- +++ tidy_remove+=('tidy_emptydirs')
- tidy_emptydirs() {
- if check_option "emptydirs" "n"; then
- msg2 "$(gettext "Removing empty directories...")"
- # 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
- }
- ++ for lib in "$LIBRARY/tidy/"*.sh
- ++ source /usr/share/makepkg/tidy/libtool.sh
- #!/usr/bin/bash
- #
- # libtool.sh - Remove libtool files from the package
- #
- # 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
- # 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_TIDY_LIBTOOL_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_LIBTOOL_SH=1
- +++ LIBMAKEPKG_TIDY_LIBTOOL_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/option.sh"
- +++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- packaging_options+=('libtool')
- +++ packaging_options+=('libtool')
- tidy_remove+=('tidy_libtool')
- +++ tidy_remove+=('tidy_libtool')
- tidy_libtool() {
- if check_option "libtool" "n"; then
- msg2 "$(gettext "Removing "%s" files...")" "libtool"
- find . ! -type d -name "*.la" -exec rm -f -- '{}' +
- fi
- }
- ++ for lib in "$LIBRARY/tidy/"*.sh
- ++ source /usr/share/makepkg/tidy/purge.sh
- #!/usr/bin/bash
- #
- # purge.sh - Remove unwanted files from the package
- #
- # 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_TIDY_PURGE_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_PURGE_SH=1
- +++ LIBMAKEPKG_TIDY_PURGE_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/option.sh"
- +++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- packaging_options+=('purge')
- +++ packaging_options+=('purge')
- tidy_remove+=('tidy_purge')
- +++ tidy_remove+=('tidy_purge')
- tidy_purge() {
- if check_option "purge" "y" && [[ -n ${PURGE_TARGETS[*]} ]]; then
- msg2 "$(gettext "Purging unwanted files...")"
- local pt
- for pt in "${PURGE_TARGETS[@]}"; do
- if [[ ${pt} = "${pt//\/}" ]]; then
- find . ! -type d -name "${pt}" -exec rm -f -- '{}' +
- else
- rm -f ${pt}
- fi
- done
- fi
- }
- ++ for lib in "$LIBRARY/tidy/"*.sh
- ++ source /usr/share/makepkg/tidy/staticlibs.sh
- #!/usr/bin/bash
- #
- # staticlibs.sh - Remove static library files from the package
- #
- # 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
- # 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_TIDY_STATICLIBS_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_STATICLIBS_SH=1
- +++ LIBMAKEPKG_TIDY_STATICLIBS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/option.sh"
- +++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- packaging_options+=('staticlibs')
- +++ packaging_options+=('staticlibs')
- tidy_remove+=('tidy_staticlibs')
- +++ tidy_remove+=('tidy_staticlibs')
- tidy_staticlibs() {
- if check_option "staticlibs" "n"; then
- msg2 "$(gettext "Removing static library files...")"
- local l
- while read -rd '' l; do
- if [[ -f "${l%.a}.so" || -h "${l%.a}.so" ]]; then
- rm "$l"
- fi
- done < <(find . ! -type d -name "*.a" -print0)
- fi
- }
- ++ for lib in "$LIBRARY/tidy/"*.sh
- ++ source /usr/share/makepkg/tidy/strip.sh
- #!/usr/bin/bash
- #
- # strip.sh - Strip debugging symbols from binary files
- #
- # 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
- # 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_TIDY_STRIP_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_STRIP_SH=1
- +++ LIBMAKEPKG_TIDY_STRIP_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/option.sh"
- +++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- packaging_options+=('strip' 'debug')
- +++ packaging_options+=('strip' 'debug')
- tidy_modify+=('tidy_strip')
- +++ tidy_modify+=('tidy_strip')
- build_id() {
- LANG=C readelf -n "$1" | sed -n '/Build ID/ { s/.*: //p; q; }'
- }
- 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
- if check_option "debug" "y"; then
- local bid=$(build_id "$binary")
- # has this file already been stripped
- if [[ -n "$bid" ]]; then
- if [[ -f "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" ]]; then
- return
- fi
- elif [[ -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%/*}"
- objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
- objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
- # create any needed hardlinks
- while read -rd '' file ; do
- if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then
- mkdir -p "$dbgdir/${file%/*}"
- ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug"
- fi
- done < <(find . -type f -perm -u+w -print0 2>/dev/null)
- if [[ -n "$bid" ]]; then
- local target
- mkdir -p "$dbgdir/.build-id/${bid:0:2}"
- target="../../../../../${binary#./}"
- target="${target/..\/..\/usr\/lib\/}"
- target="${target/..\/usr\/}"
- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}"
- target="../../${binary#./}.debug"
- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug"
- fi
- fi
- strip $@ "$binary"
- }
- tidy_strip() {
- if check_option "strip" "y"; then
- msg2 "$(gettext "Stripping unneeded symbols from binaries and libraries...")"
- # make sure library stripping variables are defined to prevent excess stripping
- [[ -z ${STRIP_SHARED+x} ]] && STRIP_SHARED="-S"
- [[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
- if check_option "debug" "y"; then
- dbgdir="$pkgdirbase/$pkgbase-debug/usr/lib/debug"
- dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}"
- dbgsrc="$pkgdirbase/$pkgbase-debug$dbgsrcdir"
- mkdir -p "$dbgdir" "$dbgsrc"
- fi
- local binary strip_flags
- find . -type f -perm -u+w -print0 2>/dev/null | while read -rd '' binary ; do
- case "$(file -bi "$binary")" in
- *application/x-sharedlib*) # Libraries (.so)
- strip_flags="$STRIP_SHARED";;
- *application/x-archive*) # Libraries (.a)
- strip_flags="$STRIP_STATIC";;
- *application/x-object*)
- case "$binary" in
- *.ko) # Kernel module
- strip_flags="$STRIP_SHARED";;
- *)
- continue;;
- esac;;
- *application/x-executable*) # Binaries
- strip_flags="$STRIP_BINARIES";;
- *application/x-pie-executable*) # Relocatable binaries
- strip_flags="$STRIP_SHARED";;
- *)
- continue ;;
- esac
- strip_file "$binary" ${strip_flags}
- done
- fi
- }
- ++ for lib in "$LIBRARY/tidy/"*.sh
- ++ source /usr/share/makepkg/tidy/zipman.sh
- #!/usr/bin/bash
- #
- # zipman.sh - Compress man and info pages
- #
- # 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_TIDY_ZIPMAN_SH" ]] && return
- +++ [[ -n '' ]]
- LIBMAKEPKG_TIDY_ZIPMAN_SH=1
- +++ LIBMAKEPKG_TIDY_ZIPMAN_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- source "$LIBRARY/util/option.sh"
- +++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- packaging_options+=('zipman')
- +++ packaging_options+=('zipman')
- tidy_modify+=('tidy_zipman')
- +++ tidy_modify+=('tidy_zipman')
- tidy_zipman() {
- if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then
- msg2 "$(gettext "Compressing man and info pages...")"
- local file files inode link
- while read -rd ' ' inode; do
- read file
- find ${MAN_DIRS[@]} -type l 2>/dev/null |
- while read -r link ; do
- if [[ "${file}" -ef "${link}" ]] ; then
- rm -f "$link" "${link}.gz"
- if [[ ${file%/*} = ${link%/*} ]]; then
- ln -s -- "${file##*/}.gz" "${link}.gz"
- else
- ln -s -- "/${file}.gz" "${link}.gz"
- fi
- fi
- done
- if [[ -z ${files[$inode]} ]]; then
- files[$inode]=$file
- gzip -9 -n -f "$file"
- else
- rm -f "$file"
- ln "${files[$inode]}.gz" "${file}.gz"
- chmod 644 "${file}.gz"
- fi
- done < <(find ${MAN_DIRS[@]} -type f \! -name "*.gz" \! -name "*.bz2" \
- -exec stat -c '%i %n' '{}' + 2>/dev/null)
- fi
- }
- readonly -a packaging_options tidy_remove tidy_modify
- ++ readonly -a packaging_options tidy_remove tidy_modify
- tidy_install() {
- cd_safe "$pkgdir"
- msg "$(gettext "Tidying install...")"
- # options that remove unwanted files
- for func in ${tidy_remove[@]}; do
- $func
- done
- # options that modify files
- for func in ${tidy_modify[@]}; do
- $func
- done
- }
- + for lib in "$LIBRARY"/*.sh
- + source /usr/share/makepkg/util.sh
- #!/usr/bin/bash
- #
- # util.sh - utility functions for makepkg
- #
- # 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
- # 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_SH" ]] && return
- ++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_SH=1
- ++ LIBMAKEPKG_UTIL_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- ++ LIBRARY=/usr/share/makepkg
- for lib in "$LIBRARY/util/"*.sh; do
- source "$lib"
- done
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/compress.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_COMPRESS_SH=1
- +++ LIBMAKEPKG_UTIL_COMPRESS_SH=1
- LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
- +++ LIBRARY=/usr/share/makepkg
- source "$LIBRARY/util/message.sh"
- +++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- ++++ [[ -n 1 ]]
- ++++ return
- # 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 -} ;;
- *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
- }
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/error.sh
- #!/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
- +++ [[ -n '' ]]
- LIBMAKEPKG_UTIL_ERROR_SH=1
- +++ LIBMAKEPKG_UTIL_ERROR_SH=1
- E_OK=0
- +++ E_OK=0
- E_FAIL=1 # Generic error
- +++ E_FAIL=1
- E_CONFIG_ERROR=2
- +++ E_CONFIG_ERROR=2
- E_INVALID_OPTION=3
- +++ E_INVALID_OPTION=3
- E_USER_FUNCTION_FAILED=4
- +++ E_USER_FUNCTION_FAILED=4
- E_PACKAGE_FAILED=5
- +++ E_PACKAGE_FAILED=5
- E_MISSING_FILE=6
- +++ E_MISSING_FILE=6
- E_MISSING_PKGDIR=7
- +++ E_MISSING_PKGDIR=7
- E_INSTALL_DEPS_FAILED=8
- +++ E_INSTALL_DEPS_FAILED=8
- E_REMOVE_DEPS_FAILED=9
- +++ E_REMOVE_DEPS_FAILED=9
- E_ROOT=10
- +++ E_ROOT=10
- E_FS_PERMISSIONS=11
- +++ E_FS_PERMISSIONS=11
- E_PKGBUILD_ERROR=12
- +++ E_PKGBUILD_ERROR=12
- E_ALREADY_BUILT=13
- +++ E_ALREADY_BUILT=13
- E_INSTALL_FAILED=14
- +++ E_INSTALL_FAILED=14
- E_MISSING_MAKEPKG_DEPS=15
- +++ E_MISSING_MAKEPKG_DEPS=15
- E_PRETTY_BAD_PRIVACY=16
- +++ E_PRETTY_BAD_PRIVACY=16
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/message.sh
- #!/usr/bin/bash
- #
- # message.sh - functions for outputting messages in 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_MESSAGE_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/option.sh
- #!/usr/bin/bash
- #
- # option.sh - functions to test if build/packaging options are enabled
- #
- # 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
- # 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_OPTION_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/parseopts.sh
- #!/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
- }
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/pkgbuild.sh
- #!/usr/bin/bash
- #
- # pkgbuild.sh - functions to extract information from PKGBUILD files
- #
- # 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
- # 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_PKGBUILD_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/source.sh
- #!/usr/bin/bash
- #
- # source.sh - functions to extract information from source URLs
- #
- # 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
- # 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_SOURCE_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ++ for lib in "$LIBRARY/util/"*.sh
- ++ source /usr/share/makepkg/util/util.sh
- #!/usr/bin/bash
- #
- # util.sh - general utility functions
- #
- # 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_UTIL_SH" ]] && return
- +++ [[ -n 1 ]]
- +++ return
- ##
- # Special exit call for traps, Don't print any error messages when inside,
- # the fakeroot call, the error message will be printed by the main call.
- ##
- trap_exit() {
- local signal=$1; shift
- if (( ! INFAKEROOT )); then
- echo
- error "$@"
- fi
- [[ -n $srclinks ]] && rm -rf "$srclinks"
- # unset the trap for this signal, and then call the default handler
- trap -- "$signal"
- kill "-$signal" "$$"
- }
- ##
- # Clean up function. Called automatically when the script exits.
- ##
- clean_up() {
- local EXIT_CODE=$?
- if (( INFAKEROOT )); then
- # Don't clean up when leaving fakeroot, we're not done yet.
- return 0
- fi
- if (( (EXIT_CODE == E_OK || EXIT_CODE == E_INSTALL_FAILED) && CLEANUP )); then
- local pkg file
- # If it's a clean exit and -c/--clean has been passed...
- msg "$(gettext "Cleaning up...")"
- rm -rf "$pkgdirbase" "$srcdir"
- if [[ -n $pkgbase ]]; then
- local fullver=$(get_full_version)
- # Can't do this unless the BUILDSCRIPT has been sourced.
- if (( PKGVERFUNC )); then
- rm -f "${pkgbase}-${fullver}-${CARCH}-pkgver.log"*
- fi
- if (( PREPAREFUNC )); then
- rm -f "${pkgbase}-${fullver}-${CARCH}-prepare.log"*
- fi
- if (( BUILDFUNC )); then
- rm -f "${pkgbase}-${fullver}-${CARCH}-build.log"*
- fi
- if (( CHECKFUNC )); then
- rm -f "${pkgbase}-${fullver}-${CARCH}-check.log"*
- fi
- if (( PKGFUNC )); then
- rm -f "${pkgbase}-${fullver}-${CARCH}-package.log"*
- elif (( SPLITPKG )); then
- for pkg in ${pkgname[@]}; do
- rm -f "${pkgbase}-${fullver}-${CARCH}-package_${pkg}.log"*
- done
- fi
- # clean up dangling symlinks to packages
- for pkg in ${pkgname[@]}; do
- for file in ${pkg}-*-*-*{${PKGEXT},${SRCEXT}}; do
- if [[ -h $file && ! -e $file ]]; then
- rm -f "$file"
- fi
- done
- done
- fi
- fi
- remove_deps
- }
- enter_fakeroot() {
- msg "$(gettext "Entering %s environment...")" "fakeroot"
- fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
- }
- # Automatically update pkgver variable if a pkgver() function is provided
- # Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
- update_pkgver() {
- newpkgver=$(run_function_safe pkgver)
- if ! check_pkgver "$newpkgver"; then
- error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
- exit $E_PKGBUILD_ERROR
- fi
- if [[ -n $newpkgver && $newpkgver != "$pkgver" ]]; then
- if [[ -f $BUILDFILE && -w $BUILDFILE ]]; then
- if ! /usr/bin/sed --follow-symlinks -i "s:^pkgver=[^ ]*:pkgver=$newpkgver:" "$BUILDFILE"; then
- error "$(gettext "Failed to update %s from %s to %s")" \
- "pkgver" "$pkgver" "$newpkgver"
- exit $E_PKGBUILD_ERROR
- fi
- /usr/bin/sed --follow-symlinks -i "s:^pkgrel=[^ ]*:pkgrel=1:" "$BUILDFILE"
- source_safe "$BUILDFILE"
- local fullver=$(get_full_version)
- msg "$(gettext "Updated version: %s")" "$pkgbase $fullver"
- else
- warning "$(gettext "%s is not writeable -- pkgver will not be updated")" \
- "$BUILDFILE"
- fi
- fi
- }
- # Print 'source not found' error message and exit makepkg
- missing_source_file() {
- error "$(gettext "Unable to find source file %s.")" "$(get_filename "$1")"
- plain "$(gettext "Aborting...")"
- exit $E_MISSING_FILE
- }
- run_pacman() {
- local cmd
- if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
- cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
- else
- cmd=("$PACMAN_PATH" "$@")
- fi
- if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
- if type -p sudo >/dev/null; then
- cmd=(sudo "${cmd[@]}")
- else
- cmd=(su root -c "$(printf '%q ' "${cmd[@]}")")
- fi
- fi
- "${cmd[@]}"
- }
- check_deps() {
- (( $# > 0 )) || return 0
- local ret=0
- local pmout
- pmout=$(run_pacman -T "$@")
- ret=$?
- if (( ret == 127 )); then #unresolved deps
- printf "%s\n" "$pmout"
- elif (( ret )); then
- error "$(gettext "'%s' returned a fatal error (%i): %s")" "$PACMAN" "$ret" "$pmout"
- return "$ret"
- fi
- }
- handle_deps() {
- local R_DEPS_SATISFIED=0
- local R_DEPS_MISSING=1
- (( $# == 0 )) && return $R_DEPS_SATISFIED
- local deplist=("$@")
- if (( ! DEP_BIN )); then
- return $R_DEPS_MISSING
- fi
- if (( DEP_BIN )); then
- # install missing deps from binary packages (using pacman -S)
- msg "$(gettext "Installing missing dependencies...")"
- if ! run_pacman -S --asdeps "${deplist[@]}"; then
- error "$(gettext "'%s' failed to install missing dependencies.")" "$PACMAN"
- exit $E_INSTALL_DEPS_FAILED
- fi
- fi
- # we might need the new system environment
- # save our shell options and turn off extglob
- local shellopts=$(shopt -p extglob)
- shopt -u extglob
- source /etc/profile &>/dev/null
- eval "$shellopts"
- # umask might have been changed in /etc/profile
- # ensure that sane default is set again
- umask 0022
- return $R_DEPS_SATISFIED
- }
- resolve_deps() {
- local R_DEPS_SATISFIED=0
- local R_DEPS_MISSING=1
- # deplist cannot be declared like this: local deplist=$(foo)
- # Otherwise, the return value will depend on the assignment.
- local deplist
- deplist=($(check_deps "$@")) || exit $E_INSTALL_DEPS_FAILED
- [[ -z $deplist ]] && return $R_DEPS_SATISFIED
- if handle_deps "${deplist[@]}"; then
- # check deps again to make sure they were resolved
- deplist=$(check_deps "$@") || exit $E_INSTALL_DEPS_FAILED
- [[ -z $deplist ]] && return $R_DEPS_SATISFIED
- fi
- msg "$(gettext "Missing dependencies:")"
- local dep
- for dep in ${deplist[@]}; do
- msg2 "$dep"
- done
- return $R_DEPS_MISSING
- }
- remove_deps() {
- (( ! RMDEPS )) && return 0
- # check for packages removed during dependency install (e.g. due to conflicts)
- # removing all installed packages is risky in this case
- if [[ -n $(grep -xvFf <(printf '%s\n' "${current_pkglist[@]}") \
- <(printf '%s\n' "${original_pkglist[@]}")) ]]; then
- warning "$(gettext "Failed to remove installed dependencies.")"
- return $E_REMOVE_DEPS_FAILED
- fi
- local deplist
- deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
- <(printf "%s\n" "${current_pkglist[@]}")))
- if [[ -z $deplist ]]; then
- return 0
- fi
- msg "Removing installed dependencies..."
- # exit cleanly on failure to remove deps as package has been built successfully
- if ! run_pacman -Rn ${deplist[@]}; then
- warning "$(gettext "Failed to remove installed dependencies.")"
- return $E_REMOVE_DEPS_FAILED
- fi
- }
- error_function() {
- if [[ -p $logpipe ]]; then
- rm "$logpipe"
- fi
- # first exit all subshells, then print the error
- if (( ! BASH_SUBSHELL )); then
- error "$(gettext "A failure occurred in %s().")" "$1"
- plain "$(gettext "Aborting...")"
- fi
- exit $E_USER_FUNCTION_FAILED
- }
- source_safe() {
- shopt -u extglob
- if ! source "$@"; then
- error "$(gettext "Failed to source %s")" "$1"
- exit $E_MISSING_FILE
- fi
- shopt -s extglob
- }
- merge_arch_attrs() {
- local attr supported_attrs=(
- provides conflicts depends replaces optdepends
- makedepends checkdepends)
- for attr in "${supported_attrs[@]}"; do
- eval "$attr+=(\"\${${attr}_$CARCH[@]}\")"
- done
- # ensure that calling this function is idempotent.
- unset -v "${supported_attrs[@]/%/_$CARCH}"
- }
- source_buildfile() {
- source_safe "$@"
- }
- prepare_buildenv() {
- # clear user-specified buildflags if requested
- if check_option "buildflags" "n"; then
- unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
- fi
- if check_option "debug" "y"; then
- DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
- DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
- CFLAGS+=" $DEBUG_CFLAGS"
- CXXFLAGS+=" $DEBUG_CXXFLAGS"
- fi
- # clear user-specified makeflags if requested
- if check_option "makeflags" "n"; then
- unset MAKEFLAGS
- fi
- # ensure all necessary build variables are exported
- export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
- local ccache=0
- # use ccache if it is requested (check buildenv and PKGBUILD opts)
- if check_buildoption "ccache" "y" && [[ -d /usr/lib/ccache/bin ]]; then
- export PATH="/usr/lib/ccache/bin:$PATH"
- ccache=1
- fi
- # use distcc if it is requested (check buildenv and PKGBUILD opts)
- if check_buildoption "distcc" "y"; then
- if (( ccache )); then
- export CCACHE_PREFIX="${CCACHE_PREFIX:+$CCACHE_PREFIX }distcc"
- export CCACHE_BASEDIR="$srcdir"
- elif [[ -d /usr/lib/distcc/bin ]]; then
- export PATH="/usr/lib/distcc/bin:$PATH"
- fi
- export DISTCC_HOSTS
- fi
- }
- run_function_safe() {
- local restoretrap restoreset restoreshopt
- # we don't set any special shopts of our own, but we don't want the user to
- # muck with our environment.
- restoreshopt=$(shopt -p)
- restoreset=$(shopt -o -p)
- shopt -o -s errexit errtrace
- restoretrap=$(trap -p ERR)
- trap "error_function '$1'" ERR
- run_function "$1"
- trap - ERR
- eval "$restoretrap"
- eval "$restoreset"
- eval "$restoreshopt"
- }
- run_function() {
- if [[ -z $1 ]]; then
- return 1
- fi
- local pkgfunc="$1"
- msg "$(gettext "Starting %s()...")" "$pkgfunc"
- cd_safe "$srcdir"
- # save our shell options so pkgfunc() can't override what we need
- local shellopts=$(shopt -p)
- local ret=0
- if (( LOGGING )); then
- local fullver=$(get_full_version)
- local BUILDLOG="$LOGDEST/${pkgbase}-${fullver}-${CARCH}-$pkgfunc.log"
- if [[ -f $BUILDLOG ]]; then
- local i=1
- while true; do
- if [[ -f $BUILDLOG.$i ]]; then
- i=$(($i +1))
- else
- break
- fi
- done
- mv "$BUILDLOG" "$BUILDLOG.$i"
- fi
- # ensure overridden package variables survive tee with split packages
- logpipe=$(mktemp -u "$LOGDEST/logpipe.XXXXXXXX")
- mkfifo "$logpipe"
- tee "$BUILDLOG" < "$logpipe" &
- local teepid=$!
- $pkgfunc &>"$logpipe"
- wait $teepid
- rm "$logpipe"
- else
- "$pkgfunc"
- fi
- # reset our shell options
- eval "$shellopts"
- }
- run_prepare() {
- run_function_safe "prepare"
- }
- run_build() {
- run_function_safe "build"
- }
- run_check() {
- run_function_safe "check"
- }
- run_package() {
- local pkgfunc
- if [[ -z $1 ]]; then
- pkgfunc="package"
- else
- pkgfunc="package_$1"
- fi
- run_function_safe "$pkgfunc"
- }
- find_libdepends() {
- local d sodepends;
- sodepends=0;
- for d in "${depends[@]}"; do
- if [[ $d = *.so ]]; then
- sodepends=1;
- break;
- fi
- done
- if (( sodepends == 0 )); then
- (( ${#depends[@]} )) && printf '%s\n' "${depends[@]}"
- return 0
- fi
- local libdeps filename soarch sofile soname soversion;
- declare -A libdeps;
- while read -r filename; do
- # get architecture of the file; if soarch is empty it's not an ELF binary
- soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
- [[ -n "$soarch" ]] || continue
- # process all libraries needed by the binary
- for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p')
- do
- # extract the library name: libfoo.so
- soname="${sofile%.so?(+(.+([0-9])))}".so
- # extract the major version: 1
- soversion="${sofile##*\.so\.}"
- if [[ ${libdeps[$soname]} ]]; then
- if [[ ${libdeps[$soname]} != *${soversion}-${soarch}* ]]; then
- libdeps[$soname]+=" ${soversion}-${soarch}"
- fi
- else
- libdeps[$soname]="${soversion}-${soarch}"
- fi
- done
- done < <(find "$pkgdir" -type f -perm -u+x)
- local libdepends v
- for d in "${depends[@]}"; do
- case "$d" in
- *.so)
- if [[ ${libdeps[$d]} ]]; then
- for v in ${libdeps[$d]}; do
- libdepends+=("$d=$v")
- done
- else
- warning "$(gettext "Library listed in %s is not required by any files: %s")" "'depends'" "$d"
- libdepends+=("$d")
- fi
- ;;
- *)
- libdepends+=("$d")
- ;;
- esac
- done
- (( ${#libdepends[@]} )) && printf '%s\n' "${libdepends[@]}"
- }
- find_libprovides() {
- local p libprovides missing
- for p in "${provides[@]}"; do
- missing=0
- case "$p" in
- *.so)
- mapfile -t filename < <(find "$pkgdir" -type f -name $p\*)
- if [[ $filename ]]; then
- # packages may provide multiple versions of the same library
- for fn in "${filename[@]}"; do
- # check if we really have a shared object
- if LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
- # get the string binaries link to (e.g. libfoo.so.1.2 -> libfoo.so.1)
- local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
- if [[ -z "$sofile" ]]; then
- warning "$(gettext "Library listed in %s is not versioned: %s")" "'provides'" "$p"
- libprovides+=("$p")
- continue
- fi
- # get the library architecture (32 or 64 bit)
- local soarch=$(LC_ALL=C readelf -h "$fn" | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
- # extract the library major version
- local soversion="${sofile##*\.so\.}"
- libprovides+=("${p}=${soversion}-${soarch}")
- else
- warning "$(gettext "Library listed in %s is not a shared object: %s")" "'provides'" "$p"
- libprovides+=("$p")
- fi
- done
- else
- libprovides+=("$p")
- missing=1
- fi
- ;;
- *)
- libprovides+=("$p")
- ;;
- esac
- if (( missing )); then
- warning "$(gettext "Cannot find library listed in %s: %s")" "'provides'" "$p"
- fi
- done
- (( ${#libprovides[@]} )) && printf '%s\n' "${libprovides[@]}"
- }
- write_kv_pair() {
- local key="$1"
- shift
- for val in "$@"; do
- if [[ $val = *$'\n'* ]]; then
- error "$(gettext "Invalid value for %s: %s")" "$key" "$val"
- exit $E_PKGBUILD_ERROR
- fi
- printf "%s = %s\n" "$key" "$val"
- done
- }
- write_pkginfo() {
- local size="$(/usr/bin/du -sk --apparent-size)"
- size="$(( ${size%%[^0-9]*} * 1024 ))"
- merge_arch_attrs
- msg2 "$(gettext "Generating %s file...")" ".PKGINFO"
- printf "# Generated by makepkg %s\n" "$makepkg_version"
- printf "# using %s\n" "$(fakeroot -v)"
- write_kv_pair "pkgname" "$pkgname"
- write_kv_pair "pkgbase" "$pkgbase"
- local fullver=$(get_full_version)
- write_kv_pair "pkgver" "$fullver"
- # TODO: all fields should have this treatment
- local spd="${pkgdesc//+([[:space:]])/ }"
- spd=("${spd[@]#[[:space:]]}")
- spd=("${spd[@]%[[:space:]]}")
- write_kv_pair "pkgdesc" "$spd"
- write_kv_pair "url" "$url"
- write_kv_pair "builddate" "$SOURCE_DATE_EPOCH"
- write_kv_pair "packager" "$PACKAGER"
- write_kv_pair "size" "$size"
- write_kv_pair "arch" "$pkgarch"
- mapfile -t provides < <(find_libprovides)
- mapfile -t depends < <(find_libdepends)
- write_kv_pair "license" "${license[@]}"
- write_kv_pair "replaces" "${replaces[@]}"
- write_kv_pair "group" "${groups[@]}"
- write_kv_pair "conflict" "${conflicts[@]}"
- write_kv_pair "provides" "${provides[@]}"
- write_kv_pair "backup" "${backup[@]}"
- write_kv_pair "depend" "${depends[@]}"
- write_kv_pair "optdepend" "${optdepends[@]//+([[:space:]])/ }"
- write_kv_pair "makedepend" "${makedepends[@]}"
- write_kv_pair "checkdepend" "${checkdepends[@]}"
- }
- write_buildinfo() {
- msg2 "$(gettext "Generating %s file...")" ".BUILDINFO"
- write_kv_pair "format" "1"
- write_kv_pair "pkgname" "$pkgname"
- write_kv_pair "pkgbase" "$pkgbase"
- local fullver=$(get_full_version)
- write_kv_pair "pkgver" "$fullver"
- write_kv_pair "pkgarch" "$pkgarch"
- local sum="$(sha256sum "${BUILDFILE}")"
- sum=${sum%% *}
- write_kv_pair "pkgbuild_sha256sum" $sum
- write_kv_pair "packager" "${PACKAGER}"
- write_kv_pair "builddate" "${SOURCE_DATE_EPOCH}"
- write_kv_pair "builddir" "${BUILDDIR}"
- write_kv_pair "buildenv" "${BUILDENV[@]}"
- write_kv_pair "options" "${OPTIONS[@]}"
- local pkginfos_parsed=($(LC_ALL=C run_pacman -Qi | awk -F': ' '\
- /^Name .*/ {printf "%s", $2} \
- /^Version .*/ {printf "-%s", $2} \
- /^Architecture .*/ {print "-"$2} \
- '))
- write_kv_pair "installed" "${pkginfos_parsed[@]}"
- }
- # build a sorted NUL-separated list of the full contents of the current
- # directory suitable for passing to `bsdtar --files-from`
- # database files are placed at the beginning of the package regardless of
- # sorting
- list_package_files() {
- (find . -path './.*' \! -name '.'; find . \! -path './.*' \! -name '.' | LC_ALL=C sort) |
- sed -e 's|^\./||' | tr '\n' '\0'
- }
- create_package() {
- (( NOARCHIVE )) && return 0
- if [[ ! -d $pkgdir ]]; then
- error "$(gettext "Missing %s directory.")" "\$pkgdir/"
- plain "$(gettext "Aborting...")"
- exit $E_MISSING_PKGDIR
- fi
- cd_safe "$pkgdir"
- msg "$(gettext "Creating package \"%s\"...")" "$pkgname"
- pkgarch=$(get_pkg_arch)
- write_pkginfo > .PKGINFO
- write_buildinfo > .BUILDINFO
- # check for changelog/install files
- for i in 'changelog/.CHANGELOG' 'install/.INSTALL'; do
- IFS='/' read -r orig dest < <(printf '%s\n' "$i")
- if [[ -n ${!orig} ]]; then
- msg2 "$(gettext "Adding %s file...")" "$orig"
- if ! cp "$startdir/${!orig}" "$dest"; then
- error "$(gettext "Failed to add %s file to package.")" "$orig"
- exit $E_MISSING_FILE
- fi
- chmod 644 "$dest"
- fi
- done
- # tar it up
- local fullver=$(get_full_version)
- local pkg_file="$PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT}"
- local ret=0
- [[ -f $pkg_file ]] && rm -f "$pkg_file"
- [[ -f $pkg_file.sig ]] && rm -f "$pkg_file.sig"
- # ensure all elements of the package have the same mtime
- find . -exec touch -h -d @$SOURCE_DATE_EPOCH {} +
- msg2 "$(gettext "Generating .MTREE file...")"
- list_package_files | LANG=C bsdtar -cnf - --format=mtree \
- --options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \
- --null --files-from - --exclude .MTREE | gzip -c -f -n > .MTREE
- touch -d @$SOURCE_DATE_EPOCH .MTREE
- msg2 "$(gettext "Compressing package...")"
- # TODO: Maybe this can be set globally for robustness
- shopt -s -o pipefail
- list_package_files | LANG=C bsdtar -cnf - --null --files-from - |
- compress_as "$PKGEXT" > "${pkg_file}" || ret=$?
- shopt -u -o pipefail
- if (( ret )); then
- error "$(gettext "Failed to create package file.")"
- exit $E_PACKAGE_FAILED
- fi
- }
- create_debug_package() {
- # check if a debug package was requested
- if ! check_option "debug" "y" || ! check_option "strip" "y"; then
- return 0
- fi
- pkgdir="$pkgdirbase/$pkgbase-debug"
- # check if we have any debug symbols to package
- if dir_is_empty "$pkgdir/usr/lib/debug"; then
- return 0
- fi
- unset groups depends optdepends provides conflicts replaces backup install changelog
- local pkg
- for pkg in ${pkgname[@]}; do
- if [[ $pkg != $pkgbase ]]; then
- provides+=("$pkg-debug")
- fi
- done
- pkgdesc="Detached debugging symbols for $pkgname"
- pkgname=$pkgbase-debug
- create_package
- }
- create_srcpackage() {
- local ret=0
- msg "$(gettext "Creating source package...")"
- local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)"
- mkdir "${srclinks}"/${pkgbase}
- msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT"
- ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}"
- msg2 "$(gettext "Generating %s file...")" .SRCINFO
- write_srcinfo > "$srclinks/$pkgbase"/.SRCINFO
- local file all_sources
- get_all_sources 'all_sources'
- for file in "${all_sources[@]}"; do
- if [[ "$file" = "$(get_filename "$file")" ]] || (( SOURCEONLY == 2 )); then
- local absfile
- absfile=$(get_filepath "$file") || missing_source_file "$file"
- msg2 "$(gettext "Adding %s...")" "${absfile##*/}"
- ln -s "$absfile" "$srclinks/$pkgbase"
- fi
- done
- local i
- for i in 'changelog' 'install'; do
- local file files
- [[ ${!i} ]] && files+=("${!i}")
- for name in "${pkgname[@]}"; do
- if extract_function_variable "package_$name" "$i" 0 file; then
- files+=("$file")
- fi
- done
- for file in "${files[@]}"; do
- if [[ $file && ! -f "${srclinks}/${pkgbase}/$file" ]]; then
- msg2 "$(gettext "Adding %s file (%s)...")" "$i" "${file}"
- ln -s "${startdir}/$file" "${srclinks}/${pkgbase}/"
- fi
- done
- done
- local fullver=$(get_full_version)
- local pkg_file="$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
- # tar it up
- msg2 "$(gettext "Compressing source package...")"
- cd_safe "${srclinks}"
- # TODO: Maybe this can be set globally for robustness
- shopt -s -o pipefail
- LANG=C bsdtar -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$?
- shopt -u -o pipefail
- if (( ret )); then
- error "$(gettext "Failed to create source package file.")"
- exit $E_PACKAGE_FAILED
- fi
- cd_safe "${startdir}"
- rm -rf "${srclinks}"
- }
- install_package() {
- (( ! INSTALL )) && return 0
- if (( ! SPLITPKG )); then
- msg "$(gettext "Installing package %s with %s...")" "$pkgname" "$PACMAN -U"
- else
- msg "$(gettext "Installing %s package group with %s...")" "$pkgbase" "$PACMAN -U"
- fi
- local fullver pkgarch pkg pkglist
- (( ASDEPS )) && pkglist+=('--asdeps')
- (( NEEDED )) && pkglist+=('--needed')
- for pkg in ${pkgname[@]}; do
- fullver=$(get_full_version)
- pkgarch=$(get_pkg_arch $pkg)
- pkglist+=("$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}")
- if [[ -f "$PKGDEST/${pkg}-debug-${fullver}-${pkgarch}${PKGEXT}" ]]; then
- pkglist+=("$PKGDEST/${pkg}-debug-${fullver}-${pkgarch}${PKGEXT}")
- fi
- done
- if ! run_pacman -U "${pkglist[@]}"; then
- warning "$(gettext "Failed to install built package(s).")"
- return $E_INSTALL_FAILED
- fi
- }
- get_vcsclient() {
- local proto=${1%%+*}
- local i
- for i in "${VCSCLIENTS[@]}"; do
- local handler="${i%%::*}"
- if [[ $proto = "$handler" ]]; then
- local client="${i##*::}"
- break
- fi
- done
- # if we didn't find an client, return an error
- if [[ -z $client ]]; then
- error "$(gettext "Unknown download protocol: %s")" "$proto"
- plain "$(gettext "Aborting...")"
- exit $E_CONFIG_ERROR
- fi
- printf "%s\n" "$client"
- }
- check_vcs_software() {
- local netfile all_sources all_deps deps ret=0
- if (( SOURCEONLY == 1 )); then
- # we will not download VCS sources
- return $ret
- fi
- if [[ -z $PACMAN_PATH ]]; then
- warning "$(gettext "Cannot find the %s binary needed to check VCS source requirements.")" "$PACMAN"
- return $ret
- fi
- # we currently only use global depends/makedepends arrays for --syncdeps
- for attr in depends makedepends; do
- get_pkgbuild_attribute "$pkg" "$attr" 1 'deps'
- all_deps+=("${deps[@]}")
- get_pkgbuild_attribute "$pkg" "${attr}_$CARCH" 1 'deps'
- all_deps+=("${deps[@]}")
- done
- get_all_sources_for_arch 'all_sources'
- for netfile in ${all_sources[@]}; do
- local proto=$(get_protocol "$netfile")
- case $proto in
- bzr*|git*|hg*|svn*)
- if ! type -p ${proto%%+*} > /dev/null; then
- local client
- client=$(get_vcsclient "$proto") || exit $?
- # ensure specified program is installed
- local uninstalled
- uninstalled=$(check_deps "$client") || exit $E_INSTALL_DEPS_FAILED
- # if not installed, check presence in depends or makedepends
- if [[ -n "$uninstalled" ]] && (( ! NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then
- if ! in_array "$client" ${all_deps[@]}; then
- error "$(gettext "Cannot find the %s package needed to handle %s sources.")" \
- "$client" "${proto%%+*}"
- ret=1
- fi
- fi
- fi
- ;;
- *)
- # non VCS source
- ;;
- esac
- done
- return $ret
- }
- check_software() {
- # check for needed software
- local ret=0
- # check for PACMAN if we need it
- if (( ! NODEPS || DEP_BIN || RMDEPS || INSTALL )); then
- if [[ -z $PACMAN_PATH ]]; then
- error "$(gettext "Cannot find the %s binary required for dependency operations.")" "$PACMAN"
- ret=1
- fi
- fi
- # check for sudo if we will need it during makepkg execution
- if (( DEP_BIN || RMDEPS || INSTALL )); then
- if ! type -p sudo >/dev/null; then
- warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su"
- fi
- fi
- # fakeroot - correct package file permissions
- if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
- if ! type -p fakeroot >/dev/null; then
- error "$(gettext "Cannot find the %s binary.")" "fakeroot"
- ret=1
- fi
- fi
- # gpg - package signing
- if [[ $SIGNPKG == 'y' ]] || { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; }; then
- if ! type -p gpg >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for signing packages.")" "gpg"
- ret=1
- fi
- fi
- # gpg - source verification
- if (( ! SKIPPGPCHECK )) && source_has_signatures; then
- if ! type -p gpg >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for verifying source files.")" "gpg"
- ret=1
- fi
- fi
- # checksum operations
- if (( GENINTEG || ! SKIPCHECKSUMS )); then
- local integlist
- IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
- local integ
- for integ in "${integlist[@]}"; do
- if ! type -p "${integ}sum" >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for source file checksums operations.")" "${integ}sum"
- ret=1
- fi
- done
- fi
- # distcc - compilation with distcc
- if check_buildoption "distcc" "y"; then
- if ! type -p distcc >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for distributed compilation.")" "distcc"
- ret=1
- fi
- fi
- # ccache - compilation with ccache
- if check_buildoption "ccache" "y"; then
- if ! type -p ccache >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for compiler cache usage.")" "ccache"
- ret=1
- fi
- fi
- # strip - strip symbols from binaries/libraries
- if check_option "strip" "y"; then
- if ! type -p strip >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for object file stripping.")" "strip"
- ret=1
- fi
- fi
- # gzip - compressig man and info pages
- if check_option "zipman" "y"; then
- if ! type -p gzip >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for compressing man and info pages.")" "gzip"
- ret=1
- fi
- fi
- # tools to download vcs sources
- if ! check_vcs_software; then
- ret=1
- fi
- return $ret
- }
- check_build_status() {
- if (( ! SPLITPKG )); then
- fullver=$(get_full_version)
- pkgarch=$(get_pkg_arch)
- if [[ -f $PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT} ]] \
- && ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then
- if (( INSTALL )); then
- warning "$(gettext "A package has already been built, installing existing package...")"
- install_package
- exit $?
- else
- error "$(gettext "A package has already been built. (use %s to overwrite)")" "-f"
- exit $E_ALREADY_BUILT
- fi
- fi
- else
- allpkgbuilt=1
- somepkgbuilt=0
- for pkg in ${pkgname[@]}; do
- fullver=$(get_full_version)
- pkgarch=$(get_pkg_arch $pkg)
- if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then
- somepkgbuilt=1
- else
- allpkgbuilt=0
- fi
- done
- if ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then
- if (( allpkgbuilt )); then
- if (( INSTALL )); then
- warning "$(gettext "The package group has already been built, installing existing packages...")"
- install_package
- exit $?
- else
- error "$(gettext "The package group has already been built. (use %s to overwrite)")" "-f"
- exit $E_ALREADY_BUILT
- fi
- fi
- if (( somepkgbuilt && ! PKGVERFUNC )); then
- error "$(gettext "Part of the package group has already been built. (use %s to overwrite)")" "-f"
- exit $E_ALREADY_BUILT
- fi
- fi
- unset allpkgbuilt somepkgbuilt
- fi
- }
- backup_package_variables() {
- local var
- for var in ${splitpkg_overrides[@]}; do
- local indirect="${var}_backup"
- eval "${indirect}=(\"\${$var[@]}\")"
- done
- }
- restore_package_variables() {
- local var
- for var in ${splitpkg_overrides[@]}; do
- local indirect="${var}_backup"
- if [[ -n ${!indirect} ]]; then
- eval "${var}=(\"\${$indirect[@]}\")"
- else
- unset ${var}
- fi
- done
- }
- run_split_packaging() {
- local pkgname_backup=("${pkgname[@]}")
- for pkgname in ${pkgname_backup[@]}; do
- pkgdir="$pkgdirbase/$pkgname"
- mkdir "$pkgdir"
- backup_package_variables
- run_package $pkgname
- tidy_install
- lint_package || exit $E_PACKAGE_FAILED
- create_package
- restore_package_variables
- done
- pkgname=("${pkgname_backup[@]}")
- create_debug_package
- }
- usage() {
- printf "makepkg (pacman) %s\n" "$makepkg_version"
- echo
- printf -- "$(gettext "Make packages compatible for use with pacman")\n"
- echo
- printf -- "$(gettext "Usage: %s [options]")\n" "$0"
- echo
- printf -- "$(gettext "Options:")\n"
- printf -- "$(gettext " -A, --ignorearch Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT"
- printf -- "$(gettext " -c, --clean Clean up work files after build")\n"
- printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/"
- printf -- "$(gettext " -d, --nodeps Skip all dependency checks")\n"
- printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/"
- printf -- "$(gettext " -f, --force Overwrite existing package")\n"
- printf -- "$(gettext " -g, --geninteg Generate integrity checks for source files")\n"
- printf -- "$(gettext " -h, --help Show this help message and exit")\n"
- printf -- "$(gettext " -i, --install Install package after successful build")\n"
- printf -- "$(gettext " -L, --log Log package build process")\n"
- printf -- "$(gettext " -m, --nocolor Disable colorized output messages")\n"
- printf -- "$(gettext " -o, --nobuild Download and extract files only")\n"
- printf -- "$(gettext " -p <file> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
- printf -- "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")\n"
- printf -- "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")\n"
- printf -- "$(gettext " -s, --syncdeps Install missing dependencies with %s")\n" "pacman"
- printf -- "$(gettext " -S, --source Generate a source-only tarball without downloaded sources")\n"
- printf -- "$(gettext " -V, --version Show version information and exit")\n"
- printf -- "$(gettext " --allsource Generate a source-only tarball including downloaded sources")\n"
- printf -- "$(gettext " --check Run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
- printf -- "$(gettext " --config <file> Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf"
- printf -- "$(gettext " --holdver Do not update VCS sources")\n"
- printf -- "$(gettext " --key <key> Specify a key to use for %s signing instead of the default")\n" "gpg"
- printf -- "$(gettext " --noarchive Do not create package archive")\n"
- printf -- "$(gettext " --nocheck Do not run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
- printf -- "$(gettext " --noprepare Do not run the %s function in the %s")\n" "prepare()" "$BUILDSCRIPT"
- printf -- "$(gettext " --nosign Do not create a signature for the package")\n"
- printf -- "$(gettext " --packagelist Only list package filepaths that would be produced")\n"
- printf -- "$(gettext " --printsrcinfo Print the generated SRCINFO and exit")\n"
- printf -- "$(gettext " --sign Sign the resulting package with %s")\n" "gpg"
- printf -- "$(gettext " --skipchecksums Do not verify checksums of the source files")\n"
- printf -- "$(gettext " --skipinteg Do not perform any verification checks on source files")\n"
- printf -- "$(gettext " --skippgpcheck Do not verify source files with PGP signatures")\n"
- printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\n"
- echo
- printf -- "$(gettext "These options can be passed to %s:")\n" "pacman"
- echo
- printf -- "$(gettext " --asdeps Install packages as non-explicitly installed")\n"
- printf -- "$(gettext " --needed Do not reinstall the targets that are already up to date")\n"
- printf -- "$(gettext " --noconfirm Do not ask for confirmation when resolving dependencies")\n"
- printf -- "$(gettext " --noprogressbar Do not show a progress bar when downloading files")\n"
- echo
- printf -- "$(gettext "If %s is not specified, %s will look for '%s'")\n" "-p" "makepkg" "$BUILDSCRIPT"
- echo
- }
- version() {
- printf "makepkg (pacman) %s\n" "$makepkg_version"
- printf -- "$(gettext "\
- Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n\
- Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n\n\
- This is free software; see the source for copying conditions.\n\
- There is NO WARRANTY, to the extent permitted by law.\n")"
- }
- # PROGRAM START
- # ensure we have a sane umask set
- umask 0022
- + umask 0022
- # determine whether we have gettext; make it a no-op if we do not
- if ! type -p gettext >/dev/null; then
- gettext() {
- printf "%s\n" "$@"
- }
- fi
- + type -p gettext
- ARGLIST=("$@")
- + ARGLIST=("$@")
- # Parse Command Line Options.
- OPT_SHORT="AcCdefFghiLmop:rRsSV"
- + OPT_SHORT=AcCdefFghiLmop:rRsSV
- OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
- 'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild'
- 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist'
- 'printsrcinfo' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg'
- 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version')
- + OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' 'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild' 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist' 'printsrcinfo' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version')
- # Pacman Options
- OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar')
- + OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar')
- if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
- exit $E_INVALID_OPTION;
- fi
- + parseopts AcCdefFghiLmop:rRsSV allsource check clean cleanbuild config: force geninteg help holdver ignorearch install key: log noarchive nobuild nocolor nocheck nodeps noextract noprepare nosign packagelist printsrcinfo repackage rmdeps sign skipchecksums skipinteg skippgpcheck source syncdeps verifysource version asdeps noconfirm needed noprogressbar --
- + local opt= optarg= i= shortopts=AcCdefFghiLmop:rRsSV
- + longopts=()
- + unused_argv=()
- + local -a longopts unused_argv
- + shift
- + [[ -n allsource ]]
- + [[ allsource != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n check ]]
- + [[ check != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n clean ]]
- + [[ clean != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n cleanbuild ]]
- + [[ cleanbuild != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n config: ]]
- + [[ config: != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n force ]]
- + [[ force != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n geninteg ]]
- + [[ geninteg != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n help ]]
- + [[ help != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n holdver ]]
- + [[ holdver != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n ignorearch ]]
- + [[ ignorearch != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n install ]]
- + [[ install != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n key: ]]
- + [[ key: != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n log ]]
- + [[ log != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n noarchive ]]
- + [[ noarchive != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n nobuild ]]
- + [[ nobuild != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n nocolor ]]
- + [[ nocolor != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n nocheck ]]
- + [[ nocheck != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n nodeps ]]
- + [[ nodeps != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n noextract ]]
- + [[ noextract != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n noprepare ]]
- + [[ noprepare != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n nosign ]]
- + [[ nosign != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n packagelist ]]
- + [[ packagelist != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n printsrcinfo ]]
- + [[ printsrcinfo != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n repackage ]]
- + [[ repackage != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n rmdeps ]]
- + [[ rmdeps != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n sign ]]
- + [[ sign != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n skipchecksums ]]
- + [[ skipchecksums != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n skipinteg ]]
- + [[ skipinteg != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n skippgpcheck ]]
- + [[ skippgpcheck != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n source ]]
- + [[ source != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n syncdeps ]]
- + [[ syncdeps != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n verifysource ]]
- + [[ verifysource != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n version ]]
- + [[ version != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n asdeps ]]
- + [[ asdeps != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n noconfirm ]]
- + [[ noconfirm != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n needed ]]
- + [[ needed != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n noprogressbar ]]
- + [[ noprogressbar != \-\- ]]
- + longopts+=("$1")
- + shift
- + [[ -n -- ]]
- + [[ -- != \-\- ]]
- + shift
- + (( 0 ))
- + OPTRET+=('--' "${unused_argv[@]}" "$@")
- + unset longoptmatch
- + return 0
- set -- "${OPTRET[@]}"
- + set -- --
- unset OPT_SHORT OPT_LONG OPTRET
- + unset OPT_SHORT OPT_LONG OPTRET
- while true; do
- case "$1" in
- # Pacman Options
- --asdeps) ASDEPS=1;;
- --needed) NEEDED=1;;
- --noconfirm) PACMAN_OPTS+=("--noconfirm") ;;
- --noprogressbar) PACMAN_OPTS+=("--noprogressbar") ;;
- # Makepkg Options
- --allsource) SOURCEONLY=2 ;;
- -A|--ignorearch) IGNOREARCH=1 ;;
- -c|--clean) CLEANUP=1 ;;
- -C|--cleanbuild) CLEANBUILD=1 ;;
- --check) RUN_CHECK='y' ;;
- --config) shift; MAKEPKG_CONF=$1 ;;
- -d|--nodeps) NODEPS=1 ;;
- -e|--noextract) NOEXTRACT=1 ;;
- -f|--force) FORCE=1 ;;
- -F) INFAKEROOT=1 ;;
- # generating integrity checks does not depend on architecture
- -g|--geninteg) GENINTEG=1 IGNOREARCH=1;;
- --holdver) HOLDVER=1 ;;
- -i|--install) INSTALL=1 ;;
- --key) shift; GPGKEY=$1 ;;
- -L|--log) LOGGING=1 ;;
- -m|--nocolor) USE_COLOR='n'; PACMAN_OPTS+=("--color" "never") ;;
- --noarchive) NOARCHIVE=1 ;;
- --nocheck) RUN_CHECK='n' ;;
- --noprepare) RUN_PREPARE='n' ;;
- --nosign) SIGNPKG='n' ;;
- -o|--nobuild) NOBUILD=1 ;;
- -p) shift; BUILDFILE=$1 ;;
- --packagelist) PACKAGELIST=1 IGNOREARCH=1;;
- --printsrcinfo) PRINTSRCINFO=1 IGNOREARCH=1;;
- -r|--rmdeps) RMDEPS=1 ;;
- -R|--repackage) REPKG=1 ;;
- --sign) SIGNPKG='y' ;;
- --skipchecksums) SKIPCHECKSUMS=1 ;;
- --skipinteg) SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;;
- --skippgpcheck) SKIPPGPCHECK=1;;
- -s|--syncdeps) DEP_BIN=1 ;;
- -S|--source) SOURCEONLY=1 ;;
- --verifysource) VERIFYSOURCE=1 ;;
- -h|--help) usage; exit $E_OK ;;
- -V|--version) version; exit $E_OK ;;
- --) shift; break ;;
- esac
- shift
- done
- + true
- + case "$1" in
- + shift
- + break
- # attempt to consume any extra argv as environment variables. this supports
- # overriding (e.g. CC=clang) as well as overriding (e.g. CFLAGS+=' -g').
- extra_environment=()
- + extra_environment=()
- while [[ $1 ]]; do
- if [[ $1 = [_[:alpha:]]*([[:alnum:]_])?(+)=* ]]; then
- extra_environment+=("$1")
- fi
- shift
- done
- + [[ -n '' ]]
- # setup signal traps
- trap 'clean_up' 0
- + trap clean_up 0
- for signal in TERM HUP QUIT; do
- trap "trap_exit $signal \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal"
- done
- + for signal in TERM HUP QUIT
- ++ gettext '%s signal caught. Exiting...'
- + trap 'trap_exit TERM "%s signal caught. Exiting..." "TERM"' TERM
- + for signal in TERM HUP QUIT
- ++ gettext '%s signal caught. Exiting...'
- + trap 'trap_exit HUP "%s signal caught. Exiting..." "HUP"' HUP
- + for signal in TERM HUP QUIT
- ++ gettext '%s signal caught. Exiting...'
- + trap 'trap_exit QUIT "%s signal caught. Exiting..." "QUIT"' QUIT
- trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
- + trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
- trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
- + trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
- # preserve environment variables to override makepkg.conf
- restore_envvars=$(declare -p PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR PKGEXT SRCEXT GPGKEY PACKAGER CARCH 2>/dev/null || true)
- ++ declare -p PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR PKGEXT SRCEXT GPGKEY PACKAGER CARCH
- ++ true
- + restore_envvars=
- # default config is makepkg.conf
- MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}
- + MAKEPKG_CONF=/etc/makepkg.conf
- # Source the config file; fail if it is not found
- if [[ -r $MAKEPKG_CONF ]]; then
- source_safe "$MAKEPKG_CONF"
- else
- error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
- plain "$(gettext "Aborting...")"
- exit $E_CONFIG_ERROR
- fi
- + [[ -r /etc/makepkg.conf ]]
- + source_safe /etc/makepkg.conf
- + shopt -u extglob
- + source /etc/makepkg.conf
- #!/hint/bash
- #
- # /etc/makepkg.conf
- #
- #########################################################################
- # SOURCE ACQUISITION
- #########################################################################
- #
- #-- The download utilities that makepkg should use to acquire sources
- # Format: 'protocol::agent'
- DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
- 'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
- 'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
- 'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
- 'rsync::/usr/bin/rsync --no-motd -z %u %o'
- 'scp::/usr/bin/scp -C %u %o')
- ++ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' 'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' 'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' 'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' 'rsync::/usr/bin/rsync --no-motd -z %u %o' 'scp::/usr/bin/scp -C %u %o')
- # Other common tools:
- # /usr/bin/snarf
- # /usr/bin/lftpget -c
- # /usr/bin/wget
- #-- The package required by makepkg to download VCS sources
- # Format: 'protocol::package'
- VCSCLIENTS=('bzr::bzr'
- 'git::git'
- 'hg::mercurial'
- 'svn::subversion')
- ++ VCSCLIENTS=('bzr::bzr' 'git::git' 'hg::mercurial' 'svn::subversion')
- #########################################################################
- # ARCHITECTURE, COMPILE FLAGS
- #########################################################################
- #
- CARCH="x86_64"
- ++ CARCH=x86_64
- CHOST="x86_64-pc-linux-gnu"
- ++ CHOST=x86_64-pc-linux-gnu
- #-- Compiler and Linker Flags
- CPPFLAGS="-D_FORTIFY_SOURCE=2"
- ++ CPPFLAGS=-D_FORTIFY_SOURCE=2
- CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
- ++ CFLAGS='-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt'
- CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
- ++ CXXFLAGS='-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt'
- LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
- ++ LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
- #-- Make Flags: change this for DistCC/SMP systems
- #MAKEFLAGS="-j2"
- #-- Debugging flags
- DEBUG_CFLAGS="-g -fvar-tracking-assignments"
- ++ DEBUG_CFLAGS='-g -fvar-tracking-assignments'
- DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
- ++ DEBUG_CXXFLAGS='-g -fvar-tracking-assignments'
- #########################################################################
- # BUILD ENVIRONMENT
- #########################################################################
- #
- # Defaults: BUILDENV=(!distcc !color !ccache check !sign)
- # A negated environment option will do the opposite of the comments below.
- #
- #-- distcc: Use the Distributed C/C++/ObjC compiler
- #-- color: Colorize output messages
- #-- ccache: Use ccache to cache compilation
- #-- check: Run the check() function if present in the PKGBUILD
- #-- sign: Generate PGP signature file
- #
- BUILDENV=(!distcc color !ccache check !sign)
- ++ BUILDENV=(!distcc color !ccache check !sign)
- #
- #-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
- #-- specify a space-delimited list of hosts running in the DistCC cluster.
- #DISTCC_HOSTS=""
- #
- #-- Specify a directory for package building.
- #BUILDDIR=/tmp/makepkg
- #########################################################################
- # GLOBAL PACKAGE OPTIONS
- # These are default values for the options=() settings
- #########################################################################
- #
- # Default: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug)
- # A negated option will do the opposite of the comments below.
- #
- #-- strip: Strip symbols from binaries/libraries
- #-- docs: Save doc directories specified by DOC_DIRS
- #-- libtool: Leave libtool (.la) files in packages
- #-- staticlibs: Leave static library (.a) files in packages
- #-- emptydirs: Leave empty directories in packages
- #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
- #-- purge: Remove files specified by PURGE_TARGETS
- #-- debug: Add debugging flags as specified in DEBUG_* variables
- #
- OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug)
- ++ OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug)
- #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
- INTEGRITY_CHECK=(md5)
- ++ INTEGRITY_CHECK=(md5)
- #-- Options to be used when stripping binaries. See `man strip' for details.
- STRIP_BINARIES="--strip-all"
- ++ STRIP_BINARIES=--strip-all
- #-- Options to be used when stripping shared libraries. See `man strip' for details.
- STRIP_SHARED="--strip-unneeded"
- ++ STRIP_SHARED=--strip-unneeded
- #-- Options to be used when stripping static libraries. See `man strip' for details.
- STRIP_STATIC="--strip-debug"
- ++ STRIP_STATIC=--strip-debug
- #-- Manual (man and info) directories to compress (if zipman is specified)
- MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
- ++ MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
- #-- Doc directories to remove (if !docs is specified)
- DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
- ++ DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
- #-- Files to be removed from all packages (if purge is specified)
- PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
- ++ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
- #-- Directory to store source code in for debug packages
- DBGSRCDIR="/usr/src/debug"
- ++ DBGSRCDIR=/usr/src/debug
- #########################################################################
- # PACKAGE OUTPUT
- #########################################################################
- #
- # Default: put built package and cached source in build directory
- #
- #-- Destination: specify a fixed directory where all packages will be placed
- #PKGDEST=/home/packages
- #-- Source cache: specify a fixed directory where source files will be cached
- #SRCDEST=/home/sources
- #-- Source packages: specify a fixed directory where all src packages will be placed
- #SRCPKGDEST=/home/srcpackages
- #-- Log files: specify a fixed directory where all log files will be placed
- #LOGDEST=/home/makepkglogs
- #-- Packager: name/email of the person or organization building packages
- #PACKAGER="John Doe <john@doe.com>"
- #-- Specify a key to use for package signing
- #GPGKEY=""
- #########################################################################
- # COMPRESSION DEFAULTS
- #########################################################################
- #
- COMPRESSGZ=(gzip -c -f -n)
- ++ COMPRESSGZ=(gzip -c -f -n)
- COMPRESSBZ2=(bzip2 -c -f)
- ++ COMPRESSBZ2=(bzip2 -c -f)
- COMPRESSXZ=(xz -c -z -)
- ++ COMPRESSXZ=(xz -c -z -)
- COMPRESSLRZ=(lrzip -q)
- ++ COMPRESSLRZ=(lrzip -q)
- COMPRESSLZO=(lzop -q)
- ++ COMPRESSLZO=(lzop -q)
- COMPRESSZ=(compress -c -f)
- ++ COMPRESSZ=(compress -c -f)
- #########################################################################
- # EXTENSION DEFAULTS
- #########################################################################
- #
- # WARNING: Do NOT modify these variables unless you know what you are
- # doing.
- #
- PKGEXT='.pkg.tar.xz'
- ++ PKGEXT=.pkg.tar.xz
- SRCEXT='.src.tar.gz'
- ++ SRCEXT=.src.tar.gz
- + shopt -s extglob
- # Source user-specific makepkg.conf overrides, but only if no override config
- # file was specified
- XDG_PACMAN_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/pacman"
- + XDG_PACMAN_DIR=/home/keltere/.config/pacman
- if [[ "$MAKEPKG_CONF" = "$confdir/makepkg.conf" ]]; then
- if [[ -r "$XDG_PACMAN_DIR/makepkg.conf" ]]; then
- source_safe "$XDG_PACMAN_DIR/makepkg.conf"
- elif [[ -r "$HOME/.makepkg.conf" ]]; then
- source_safe "$HOME/.makepkg.conf"
- fi
- fi
- + [[ /etc/makepkg.conf = \/\e\t\c\/\m\a\k\e\p\k\g\.\c\o\n\f ]]
- + [[ -r /home/keltere/.config/pacman/makepkg.conf ]]
- + [[ -r /home/keltere/.makepkg.conf ]]
- eval "$restore_envvars"
- + eval ''
- # override settings from extra variables on commandline, if any
- if (( ${#extra_environment[*]} )); then
- export "${extra_environment[@]}"
- fi
- + (( 0 ))
- # canonicalize paths and provide defaults if anything is still undefined
- for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR; do
- printf -v "$var" "$(canonicalize_path "${!var:-$startdir}")"
- done
- + for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR
- ++ canonicalize_path /home/keltere
- ++ local path=/home/keltere
- ++ [[ -d /home/keltere ]]
- ++ cd_safe /home/keltere
- ++ cd /home/keltere
- ++ pwd -P
- + printf -v PKGDEST /home/keltere
- + for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR
- ++ canonicalize_path /home/keltere
- ++ local path=/home/keltere
- ++ [[ -d /home/keltere ]]
- ++ cd_safe /home/keltere
- ++ cd /home/keltere
- ++ pwd -P
- + printf -v SRCDEST /home/keltere
- + for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR
- ++ canonicalize_path /home/keltere
- ++ local path=/home/keltere
- ++ [[ -d /home/keltere ]]
- ++ cd_safe /home/keltere
- ++ cd /home/keltere
- ++ pwd -P
- + printf -v SRCPKGDEST /home/keltere
- + for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR
- ++ canonicalize_path /home/keltere
- ++ local path=/home/keltere
- ++ [[ -d /home/keltere ]]
- ++ cd_safe /home/keltere
- ++ cd /home/keltere
- ++ pwd -P
- + printf -v LOGDEST /home/keltere
- + for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR
- ++ canonicalize_path /home/keltere
- ++ local path=/home/keltere
- ++ [[ -d /home/keltere ]]
- ++ cd_safe /home/keltere
- ++ cd /home/keltere
- ++ pwd -P
- + printf -v BUILDDIR /home/keltere
- unset var
- + unset var
- PACKAGER=${PACKAGER:-"Unknown Packager"}
- + PACKAGER='Unknown Packager'
- # set pacman command if not already defined
- PACMAN=${PACMAN:-pacman}
- + PACMAN=pacman
- # save full path to command as PATH may change when sourcing /etc/profile
- PACMAN_PATH=$(type -P $PACMAN)
- ++ type -P pacman
- + PACMAN_PATH=/usr/bin/pacman
- # check if messages are to be printed using color
- if [[ -t 2 && $USE_COLOR != "n" ]] && check_buildenv "color" "y"; then
- colorize
- else
- unset ALL_OFF BOLD BLUE GREEN RED YELLOW
- fi
- + [[ -t 2 ]]
- + unset ALL_OFF BOLD BLUE GREEN RED YELLOW
- # check makepkg.conf for some basic requirements
- lint_config || exit $E_CONFIG_ERROR
- + lint_config
- + local ret=0
- + for func in ${lint_config_functions[@]}
- + lint_paths
- + pathvars=(BUILDDIR PKGDEST SRCDEST SRCPKGDEST LOGDEST PKGEXT SRCEXT)
- + local pathvars
- + local i ret=0
- + for i in ${pathvars[@]}
- + [[ /home/keltere = *\
- * ]]
- + for i in ${pathvars[@]}
- + [[ /home/keltere = *\
- * ]]
- + for i in ${pathvars[@]}
- + [[ /home/keltere = *\
- * ]]
- + for i in ${pathvars[@]}
- + [[ /home/keltere = *\
- * ]]
- + for i in ${pathvars[@]}
- + [[ /home/keltere = *\
- * ]]
- + for i in ${pathvars[@]}
- + [[ .pkg.tar.xz = *\
- * ]]
- + for i in ${pathvars[@]}
- + [[ .src.tar.gz = *\
- * ]]
- + return 0
- + for func in ${lint_config_functions[@]}
- + lint_variable
- + array=(arch backup checkdepends groups license noextract options validpgpkeys)
- + local array
- + arch_array=(conflicts depends makedepends md5sums optdepends provides replaces sha1sums sha224sums sha256sums sha384sums sha512sums source)
- + local arch_array
- + string=(changelog epoch install pkgdesc pkgrel pkgver url)
- + local string
- + local i a v pkg keys out bad ret=0
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!arch[@]}")'
- keys=("${!arch[@]}")
- ++ keys=("${!arch[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!backup[@]}")'
- keys=("${!backup[@]}")
- ++ keys=("${!backup[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!checkdepends[@]}")'
- keys=("${!checkdepends[@]}")
- ++ keys=("${!checkdepends[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!groups[@]}")'
- keys=("${!groups[@]}")
- ++ keys=("${!groups[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!license[@]}")'
- keys=("${!license[@]}")
- ++ keys=("${!license[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!noextract[@]}")'
- keys=("${!noextract[@]}")
- ++ keys=("${!noextract[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!options[@]}")'
- keys=("${!options[@]}")
- ++ keys=("${!options[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!validpgpkeys[@]}")'
- keys=("${!validpgpkeys[@]}")
- ++ keys=("${!validpgpkeys[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!conflicts[@]}")'
- keys=("${!conflicts[@]}")
- ++ keys=("${!conflicts[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!depends[@]}")'
- keys=("${!depends[@]}")
- ++ keys=("${!depends[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!makedepends[@]}")'
- keys=("${!makedepends[@]}")
- ++ keys=("${!makedepends[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!md5sums[@]}")'
- keys=("${!md5sums[@]}")
- ++ keys=("${!md5sums[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!optdepends[@]}")'
- keys=("${!optdepends[@]}")
- ++ keys=("${!optdepends[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!provides[@]}")'
- keys=("${!provides[@]}")
- ++ keys=("${!provides[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!replaces[@]}")'
- keys=("${!replaces[@]}")
- ++ keys=("${!replaces[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!sha1sums[@]}")'
- keys=("${!sha1sums[@]}")
- ++ keys=("${!sha1sums[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!sha224sums[@]}")'
- keys=("${!sha224sums[@]}")
- ++ keys=("${!sha224sums[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!sha256sums[@]}")'
- keys=("${!sha256sums[@]}")
- ++ keys=("${!sha256sums[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!sha384sums[@]}")'
- keys=("${!sha384sums[@]}")
- ++ keys=("${!sha384sums[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!sha512sums[@]}")'
- keys=("${!sha512sums[@]}")
- ++ keys=("${!sha512sums[@]}")
- + (( 0 > 0 ))
- + for i in ${array[@]} ${arch_array[@]}
- + eval 'keys=("${!source[@]}")'
- keys=("${!source[@]}")
- ++ keys=("${!source[@]}")
- + (( 0 > 0 ))
- + for i in ${string[@]}
- + eval 'keys=("${!changelog[@]}")'
- keys=("${!changelog[@]}")
- ++ keys=("${!changelog[@]}")
- + (( 0 > 0 ))
- + for i in ${string[@]}
- + eval 'keys=("${!epoch[@]}")'
- keys=("${!epoch[@]}")
- ++ keys=("${!epoch[@]}")
- + (( 0 > 0 ))
- + for i in ${string[@]}
- + eval 'keys=("${!install[@]}")'
- keys=("${!install[@]}")
- ++ keys=("${!install[@]}")
- + (( 0 > 0 ))
- + for i in ${string[@]}
- + eval 'keys=("${!pkgdesc[@]}")'
- keys=("${!pkgdesc[@]}")
- ++ keys=("${!pkgdesc[@]}")
- + (( 0 > 0 ))
- + for i in ${string[@]}
- + eval 'keys=("${!pkgrel[@]}")'
- keys=("${!pkgrel[@]}")
- ++ keys=("${!pkgrel[@]}")
- + (( 0 > 0 ))
- + for i in ${string[@]}
- + eval 'keys=("${!pkgver[@]}")'
- keys=("${!pkgver[@]}")
- ++ keys=("${!pkgver[@]}")
- + (( 0 > 0 ))
- + for i in ${string[@]}
- + eval 'keys=("${!url[@]}")'
- keys=("${!url[@]}")
- ++ keys=("${!url[@]}")
- + (( 0 > 0 ))
- + return 0
- + return 0
- # check that all settings directories are user-writable
- if ! ensure_writable_dir "BUILDDIR" "$BUILDDIR"; then
- plain "$(gettext "Aborting...")"
- exit $E_FS_PERMISSIONS
- fi
- + ensure_writable_dir BUILDDIR /home/keltere
- + local dirtype=BUILDDIR dirpath=/home/keltere
- + mkdir -p /home/keltere
- + [[ ! -w /home/keltere ]]
- + return 0
- if (( ! (NOBUILD || GENINTEG) )) && ! ensure_writable_dir "PKGDEST" "$PKGDEST"; then
- plain "$(gettext "Aborting...")"
- exit $E_FS_PERMISSIONS
- fi
- + (( ! (NOBUILD || GENINTEG) ))
- + ensure_writable_dir PKGDEST /home/keltere
- + local dirtype=PKGDEST dirpath=/home/keltere
- + mkdir -p /home/keltere
- + [[ ! -w /home/keltere ]]
- + return 0
- if ! ensure_writable_dir "SRCDEST" "$SRCDEST" ; then
- plain "$(gettext "Aborting...")"
- exit $E_FS_PERMISSIONS
- fi
- + ensure_writable_dir SRCDEST /home/keltere
- + local dirtype=SRCDEST dirpath=/home/keltere
- + mkdir -p /home/keltere
- + [[ ! -w /home/keltere ]]
- + return 0
- if (( SOURCEONLY )); then
- if ! ensure_writable_dir "SRCPKGDEST" "$SRCPKGDEST"; then
- plain "$(gettext "Aborting...")"
- exit $E_FS_PERMISSIONS
- fi
- # If we're only making a source tarball, then we need to ignore architecture-
- # dependent behavior.
- IGNOREARCH=1
- fi
- + (( SOURCEONLY ))
- if (( LOGGING )) && ! ensure_writable_dir "LOGDEST" "$LOGDEST"; then
- plain "$(gettext "Aborting...")"
- exit $E_FS_PERMISSIONS
- fi
- + (( LOGGING ))
- if (( ! INFAKEROOT )); then
- if (( EUID == 0 )); then
- error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
- catastrophic damage to your system.")" "makepkg"
- exit $E_ROOT
- fi
- else
- if [[ -z $FAKEROOTKEY ]]; then
- error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg"
- exit $E_INVALID_OPTION
- fi
- fi
- + (( ! INFAKEROOT ))
- + (( EUID == 0 ))
- unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides
- + unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides
- unset md5sums replaces depends conflicts backup source install changelog build
- + unset md5sums replaces depends conflicts backup source install changelog build
- unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys
- + unset sha1sums sha224sums sha256sums sha384sums sha512sums makedepends optdepends options noextract validpgpkeys
- unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}"
- + unset
- unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}"
- + unset
- unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}"
- + unset
- unset "${!sha384sums_@}" "${!sha512sums_@}"
- + unset
- BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
- + BUILDFILE=PKGBUILD
- if [[ ! -f $BUILDFILE ]]; then
- error "$(gettext "%s does not exist.")" "$BUILDFILE"
- exit $E_USER_FUNCTION_FAILED
- else
- if [[ $(<"$BUILDFILE") = *$'\r'* ]]; then
- error "$(gettext "%s contains %s characters and cannot be sourced.")" "$BUILDFILE" "CRLF"
- exit $E_PKGBUILD_ERROR
- fi
- if [[ ! $BUILDFILE -ef $PWD/${BUILDFILE##*/} ]]; then
- error "$(gettext "%s must be in the current working directory.")" "$BUILDFILE"
- exit $E_PKGBUILD_ERROR
- fi
- if [[ ${BUILDFILE:0:1} != "/" ]]; then
- BUILDFILE="$startdir/$BUILDFILE"
- fi
- source_buildfile "$BUILDFILE"
- fi
- + [[ ! -f PKGBUILD ]]
- ++ gettext '%s does not exist.'
- + error '%s does not exist.' PKGBUILD
- + local 'mesg=%s does not exist.'
- + shift
- ++ gettext ERROR:
- + printf '==> ERROR: %s does not exist.\n' PKGBUILD
- ==> ERROR: PKGBUILD does not exist.
- + exit 4
- clean_up
- + clean_up
- + local EXIT_CODE=4
- + (( INFAKEROOT ))
- + (( (EXIT_CODE == E_OK || EXIT_CODE == E_INSTALL_FAILED) && CLEANUP ))
- + remove_deps
- + (( ! RMDEPS ))
- + return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement