From 952e33c71f296831cd33a60b3fc1f3c1b955a370 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Nov 16 2016 11:55:05 +0000 Subject: build.sh, subr/pkg.subr: export fewer variables. --- diff --git a/build.sh b/build.sh index f5cb4e3..359c0c7 100755 --- a/build.sh +++ b/build.sh @@ -77,11 +77,9 @@ for BUILD_TARGET_LC in $(subst_tgts ${BUILD_TARGETS_META}); do log_msg info "Invoking build script \`${BUILD_SCRIPT_FNAME}'${ARG_RESTART:+ (forcibly)} for package \`${BUILD_PACKAGE_LC}'."; fi; (set -o errexit -o noglob; - export MIDIPIX_BUILD_PWD=$(pwd) \ - PKG_BUILD=${BUILD} PKG_TARGET=${TARGET} \ - PKG_PREFIX=$(get_vars_unsafe ${BUILD_TARGET}_PREFIX \ - PKG_${BUILD_PACKAGE%.*}_PREFIX) \ - PREFIX PREFIX_CROSS PREFIX_MIDIPIX PREFIX_NATIVE PREFIX_ROOT; + MIDIPIX_BUILD_PWD=$(pwd); PKG_BUILD=${BUILD}; PKG_TARGET=${TARGET}; + PKG_PREFIX=$(get_vars_unsafe ${BUILD_TARGET}_PREFIX \ + PKG_${BUILD_PACKAGE%.*}_PREFIX); cd ${WORKDIR}; source_scripts); BUILD_SCRIPT_RC=${?}; case ${BUILD_SCRIPT_RC} in 0) log_msg succ "Finished \`${BUILD_PACKAGE_LC}' build."; diff --git a/subr/pkg.subr b/subr/pkg.subr index accdd33..0787394 100644 --- a/subr/pkg.subr +++ b/subr/pkg.subr @@ -85,27 +85,27 @@ parse_with_pkg_name() { else for _pwpn_vname in ${PKG_BUILD_VARS}; do if [ -n "$(get_var_unsafe DEFAULT_${_pwpn_vname})" ]; then - export "PKG_${_pwpn_vname}=$(get_var_unsafe DEFAULT_${_pwpn_vname})"; + set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe DEFAULT_${_pwpn_vname})"; fi; if [ -n "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})" ]; then - export "PKG_${_pwpn_vname}=$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})"; + set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})"; fi; if [ "${BUILD}" = "debug" ] \ && [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)" ]; then - export "PKG_${_pwpn_vname}=$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)"; + set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)"; elif [ "${BUILD}" = "release" ] \ && [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)" ]; then - export "PKG_${_pwpn_vname}=$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)"; + set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)"; elif [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})" ]; then - export "PKG_${_pwpn_vname}=$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})"; + set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})"; fi; done; unset _pwpn_vname; fi; [ -z "${PKG_FNAME}" ] && PKG_FNAME=${PKG_URL##*/}; [ -z "${PKG_SUBDIR}" ] && PKG_SUBDIR=${PKG_FNAME%%.tar*}; [ -n "${PKG_ENV_VARS_EXTRA}" ] && set_env_vars_with_sep : "${PKG_ENV_VARS_EXTRA}"; - for _pwpn_env_var in $(export); do - if [ "${_pwpn_env_var#PKG_}" != "${_pwpn_env_var}" ]; then + for _pwpn_env_var in $(set); do + if [ "${_pwpn_env_var#PKG_${_pwpn_pkg_name_uc}}" != "${_pwpn_env_var}" ]; then _pwpn_env_vars="${_pwpn_env_vars:+${_pwpn_env_vars} }${_pwpn_env_var%%=*}"; fi; done;