makepkg: undeclared local variables
Variables that are only meaningful within the function they are declared in are now prefixed by "local". Signed-off-by: Andres P <aepd87@gmail.com> [Allan: fix whitespace] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
9ebb596805
commit
1a9db4cac7
1 changed files with 20 additions and 8 deletions
|
@ -135,6 +135,8 @@ clean_up() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( ! EXIT_CODE && CLEANUP )); then
|
if (( ! EXIT_CODE && CLEANUP )); then
|
||||||
|
local pkg file
|
||||||
|
|
||||||
# If it's a clean exit and -c/--clean has been passed...
|
# If it's a clean exit and -c/--clean has been passed...
|
||||||
msg "$(gettext "Cleaning up...")"
|
msg "$(gettext "Cleaning up...")"
|
||||||
rm -rf "$pkgdir" "$srcdir"
|
rm -rf "$pkgdir" "$srcdir"
|
||||||
|
@ -308,7 +310,7 @@ get_downloadclient() {
|
||||||
for i in "${DLAGENTS[@]}"; do
|
for i in "${DLAGENTS[@]}"; do
|
||||||
local handler="${i%%::*}"
|
local handler="${i%%::*}"
|
||||||
if [[ $proto = $handler ]]; then
|
if [[ $proto = $handler ]]; then
|
||||||
agent="${i##*::}"
|
local agent="${i##*::}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -388,6 +390,7 @@ check_deps() {
|
||||||
# Also, a non-zero return value is not unexpected and we are manually dealing them
|
# Also, a non-zero return value is not unexpected and we are manually dealing them
|
||||||
set +E
|
set +E
|
||||||
local ret=0
|
local ret=0
|
||||||
|
local pmout
|
||||||
pmout=$(run_pacman -T "$@") || ret=$?
|
pmout=$(run_pacman -T "$@") || ret=$?
|
||||||
set -E
|
set -E
|
||||||
|
|
||||||
|
@ -655,7 +658,7 @@ extract_sources() {
|
||||||
msg "$(gettext "Extracting Sources...")"
|
msg "$(gettext "Extracting Sources...")"
|
||||||
local netfile
|
local netfile
|
||||||
for netfile in "${source[@]}"; do
|
for netfile in "${source[@]}"; do
|
||||||
file=$(get_filename "$netfile")
|
local file=$(get_filename "$netfile")
|
||||||
if in_array "$file" ${noextract[@]}; then
|
if in_array "$file" ${noextract[@]}; then
|
||||||
#skip source files in the noextract=() array
|
#skip source files in the noextract=() array
|
||||||
# these are marked explicitly to NOT be extracted
|
# these are marked explicitly to NOT be extracted
|
||||||
|
@ -732,7 +735,7 @@ run_function() {
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
pkgfunc="$1"
|
local pkgfunc="$1"
|
||||||
|
|
||||||
# clear user-specified makeflags if requested
|
# clear user-specified makeflags if requested
|
||||||
if [[ $(check_option makeflags) = "n" ]]; then
|
if [[ $(check_option makeflags) = "n" ]]; then
|
||||||
|
@ -748,8 +751,9 @@ run_function() {
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p)
|
||||||
|
|
||||||
local ret=0
|
local ret=0
|
||||||
|
local restoretrap
|
||||||
if (( LOGGING )); then
|
if (( LOGGING )); then
|
||||||
BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-$pkgfunc.log"
|
local BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-$pkgfunc.log"
|
||||||
if [[ -f $BUILDLOG ]]; then
|
if [[ -f $BUILDLOG ]]; then
|
||||||
local i=1
|
local i=1
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -804,6 +808,7 @@ run_build() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_package() {
|
run_package() {
|
||||||
|
local pkgfunc
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
pkgfunc="package"
|
pkgfunc="package"
|
||||||
else
|
else
|
||||||
|
@ -937,6 +942,7 @@ write_pkginfo() {
|
||||||
[[ $provides ]] && printf "provides = %s\n" "${provides[@]}"
|
[[ $provides ]] && printf "provides = %s\n" "${provides[@]}"
|
||||||
[[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
|
[[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
|
||||||
|
|
||||||
|
local it
|
||||||
for it in "${packaging_options[@]}"; do
|
for it in "${packaging_options[@]}"; do
|
||||||
local ret="$(check_option $it)"
|
local ret="$(check_option $it)"
|
||||||
if [[ $ret != "?" ]]; then
|
if [[ $ret != "?" ]]; then
|
||||||
|
@ -985,6 +991,7 @@ create_package() {
|
||||||
cd "$pkgdir"
|
cd "$pkgdir"
|
||||||
msg "$(gettext "Creating package...")"
|
msg "$(gettext "Creating package...")"
|
||||||
|
|
||||||
|
local nameofpkg
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
nameofpkg="$pkgname"
|
nameofpkg="$pkgname"
|
||||||
else
|
else
|
||||||
|
@ -1020,6 +1027,7 @@ create_package() {
|
||||||
# tar it up
|
# tar it up
|
||||||
msg2 "$(gettext "Compressing package...")"
|
msg2 "$(gettext "Compressing package...")"
|
||||||
|
|
||||||
|
local EXT
|
||||||
case "$PKGEXT" in
|
case "$PKGEXT" in
|
||||||
*tar.gz) EXT=${PKGEXT%.gz} ;;
|
*tar.gz) EXT=${PKGEXT%.gz} ;;
|
||||||
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
|
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
|
||||||
|
@ -1154,7 +1162,7 @@ install_package() {
|
||||||
msg "$(gettext "Installing %s package group with %s -U...")" "$pkgbase" "$PACMAN"
|
msg "$(gettext "Installing %s package group with %s -U...")" "$pkgbase" "$PACMAN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local pkglist
|
local pkg pkglist
|
||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
if [[ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]]; then
|
if [[ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]]; then
|
||||||
pkglist+=" $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
|
pkglist+=" $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
|
||||||
|
@ -1229,7 +1237,7 @@ check_sanity() {
|
||||||
|
|
||||||
local optdepend
|
local optdepend
|
||||||
for optdepend in "${optdepends[@]}"; do
|
for optdepend in "${optdepends[@]}"; do
|
||||||
pkg=${optdepend%%:*}
|
local pkg=${optdepend%%:*}
|
||||||
if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]*$ ]]; then
|
if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]*$ ]]; then
|
||||||
error "$(gettext "Invalid syntax for optdepend : '%s'")" "$optdepend"
|
error "$(gettext "Invalid syntax for optdepend : '%s'")" "$optdepend"
|
||||||
fi
|
fi
|
||||||
|
@ -1268,6 +1276,7 @@ check_sanity() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local pkg
|
||||||
if (( ${#pkgname[@]} > 1 )); then
|
if (( ${#pkgname[@]} > 1 )); then
|
||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
if ! declare -f package_${pkg} >/dev/null; then
|
if ! declare -f package_${pkg} >/dev/null; then
|
||||||
|
@ -1374,15 +1383,17 @@ devel_update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
backup_package_variables() {
|
backup_package_variables() {
|
||||||
|
local var
|
||||||
for var in ${splitpkg_overrides[@]}; do
|
for var in ${splitpkg_overrides[@]}; do
|
||||||
indirect="${var}_backup"
|
local indirect="${var}_backup"
|
||||||
eval "${indirect}=(\"\${$var[@]}\")"
|
eval "${indirect}=(\"\${$var[@]}\")"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_package_variables() {
|
restore_package_variables() {
|
||||||
|
local var
|
||||||
for var in ${splitpkg_overrides[@]}; do
|
for var in ${splitpkg_overrides[@]}; do
|
||||||
indirect="${var}_backup"
|
local indirect="${var}_backup"
|
||||||
if [[ -n ${!indirect} ]]; then
|
if [[ -n ${!indirect} ]]; then
|
||||||
eval "${var}=(\"\${$indirect[@]}\")"
|
eval "${var}=(\"\${$indirect[@]}\")"
|
||||||
else
|
else
|
||||||
|
@ -1411,6 +1422,7 @@ parse_options() {
|
||||||
local long_options=$1; shift;
|
local long_options=$1; shift;
|
||||||
local ret=0;
|
local ret=0;
|
||||||
local unused_options=""
|
local unused_options=""
|
||||||
|
local i
|
||||||
|
|
||||||
while [[ -n $1 ]]; do
|
while [[ -n $1 ]]; do
|
||||||
if [[ ${1:0:2} = '--' ]]; then
|
if [[ ${1:0:2} = '--' ]]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue