libmakepkg: only save the shellopts we need
micro-optimization: We only care about temporarily enforcing extglob, so that is the only one we need to explicitly restore. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
2c94118dc1
commit
542c3cf812
7 changed files with 13 additions and 13 deletions
|
@ -37,8 +37,8 @@ lint_checkdepends() {
|
||||||
|
|
||||||
get_pkgbuild_all_split_attributes checkdepends checkdepends_list
|
get_pkgbuild_all_split_attributes checkdepends checkdepends_list
|
||||||
|
|
||||||
# save our shell options and turn on extglob
|
# this function requires extglob - save current status to restore later
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
for checkdepend in "${checkdepends_list[@]}"; do
|
for checkdepend in "${checkdepends_list[@]}"; do
|
||||||
|
|
|
@ -37,8 +37,8 @@ lint_conflicts() {
|
||||||
|
|
||||||
get_pkgbuild_all_split_attributes conflicts conflicts_list
|
get_pkgbuild_all_split_attributes conflicts conflicts_list
|
||||||
|
|
||||||
# save our shell options and turn on extglob
|
# this function requires extglob - save current status to restore later
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
for conflict in "${conflicts_list[@]}"; do
|
for conflict in "${conflicts_list[@]}"; do
|
||||||
|
|
|
@ -37,8 +37,8 @@ lint_depends() {
|
||||||
|
|
||||||
get_pkgbuild_all_split_attributes depends depends_list
|
get_pkgbuild_all_split_attributes depends depends_list
|
||||||
|
|
||||||
# save our shell options and turn on extglob
|
# this function requires extglob - save current status to restore later
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
for depend in "${depends_list[@]}"; do
|
for depend in "${depends_list[@]}"; do
|
||||||
|
|
|
@ -37,8 +37,8 @@ lint_makedepends() {
|
||||||
|
|
||||||
get_pkgbuild_all_split_attributes makedepends makedepends_list
|
get_pkgbuild_all_split_attributes makedepends makedepends_list
|
||||||
|
|
||||||
# save our shell options and turn on extglob
|
# this function requires extglob - save current status to restore later
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
for makedepend in "${makedepends_list[@]}"; do
|
for makedepend in "${makedepends_list[@]}"; do
|
||||||
|
|
|
@ -80,8 +80,8 @@ extract_function_variable() {
|
||||||
printf -v attr_regex '^[[:space:]]* %s\+?=[^(]' "$2"
|
printf -v attr_regex '^[[:space:]]* %s\+?=[^(]' "$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# save our shell options and turn on extglob
|
# this function requires extglob - save current status to restore later
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
while read -r; do
|
while read -r; do
|
||||||
|
|
|
@ -42,8 +42,8 @@ is_array() {
|
||||||
local v=$1
|
local v=$1
|
||||||
local ret=1
|
local ret=1
|
||||||
|
|
||||||
# this function requires extglob - save current options to restore later
|
# this function requires extglob - save current status to restore later
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
|
if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
|
||||||
|
|
|
@ -275,7 +275,7 @@ handle_deps() {
|
||||||
|
|
||||||
# we might need the new system environment
|
# we might need the new system environment
|
||||||
# save our shell options and turn off extglob
|
# save our shell options and turn off extglob
|
||||||
local shellopts=$(shopt -p)
|
local shellopts=$(shopt -p extglob)
|
||||||
shopt -u extglob
|
shopt -u extglob
|
||||||
source /etc/profile &>/dev/null
|
source /etc/profile &>/dev/null
|
||||||
eval "$shellopts"
|
eval "$shellopts"
|
||||||
|
|
Loading…
Add table
Reference in a new issue