summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh87
-rw-r--r--subr/build.subr14
-rw-r--r--subr/mode_check_updates.subr5
3 files changed, 50 insertions, 56 deletions
diff --git a/build.sh b/build.sh
index 288f86aa..6430ff9f 100755
--- a/build.sh
+++ b/build.sh
@@ -6,6 +6,7 @@
#
#
for __ in subr/*.subr; do . ${__}; done;
+set -o noglob;
while [ ${#} -gt 0 ]; do
case ${1} in
-c) ARG_CLEAN=1; ;;
@@ -24,6 +25,7 @@ case ${1} in
else
ARG_RESTART=${2%:*}; ARG_RESTART_AT=${2#*:};
fi;
+ BUILD_PACKAGES_RESTART="$(echo ${ARG_RESTART} | sed "s/,/ /g")";
if [ -z "${ARG_RESTART_AT}" ]; then
ARG_RESTART_AT=ALL;
fi; shift; ;;
@@ -46,60 +48,40 @@ else
fi;
for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do
BUILD_TARGET=$(echo ${BUILD_TARGET_LC} | tr a-z A-Z);
- for BUILD_PACKAGE_LC in $(get_var_unsafe ${BUILD_TARGET}_PACKAGES); do
- BUILD_PACKAGE=$(echo ${BUILD_PACKAGE_LC} | tr a-z A-Z);
-
+ BUILD_PACKAGES=$(get_var_unsafe ${BUILD_TARGET}_PACKAGES);
+ if [ "${BUILD_TARGET}" != "INVARIANTS" ]\
+ && [ -n "${BUILD_PACKAGES_RESTART}" ]; then
+ BUILD_PACKAGES="$(lfilter "${BUILD_PACKAGES}" "${BUILD_PACKAGES_RESTART}")";
+ fi;
+ for BUILD_PACKAGE_LC in ${BUILD_PACKAGES}; do
#
#
#
- if [ "${BUILD_TARGET}" != "INVARIANTS" ]\
- && [ -n "${ARG_RESTART}" ]; then
- if [ "${ARG_RESTART}" != "ALL" ] &&\
- ! match_list ${ARG_RESTART} , ${BUILD_PACKAGE_LC}; then
- log_msg vnfo "Skipped \`${BUILD_PACKAGE_LC}' (-r specified.)";
- : $((BUILD_NSKIP+=1)); BUILD_SCRIPT_RC=0; continue;
- fi;
- fi;
if [ ${ARG_CHECK_UPDATES:-0} -eq 1 ]\
&& [ "${BUILD_PACKAGE#*.*}" = "${BUILD_PACKAGE}" ]; then
- mode_check_pkg_updates "${BUILD_PACKAGE_LC}" \
- "$(get_var_unsafe PKG_${BUILD_PACKAGE}_VERSION)" \
- "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL)" \
- "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL_TYPE)";
+ (mode_check_pkg_updates "${BUILD_PACKAGE_LC}" "${BUILD_PACKAGE}");
continue;
- fi;
- if [ "${BUILD_TARGET}" != "INVARIANTS" ]\
- && [ -z "${ARG_RESTART}" ]\
- && is_build_script_done finish "${BUILD_PACKAGE_LC}"; then
- log_msg vnfo "Skipped \`${BUILD_PACKAGE_LC}' (already built.)";
- : $((BUILD_NSKIP+=1)); BUILD_SCRIPT_RC=0; continue;
- elif [ -n "${ARG_RESTART}" ]; then
- log_msg vnfo "Forcing package \`${BUILD_PACKAGE_LC}'.";
- fi;
-
- #
- #
- #
- (set -o errexit -o noglob;
- PKG_PREFIX=$(get_vars_unsafe ${BUILD_TARGET}_PREFIX PKG_${BUILD_PACKAGE%%.*}_PREFIX);
- parse_with_pkg_name ${BUILD_PACKAGE_LC%.*};
- for __ in ${BUILD_STEPS}; do
- case ${__#*:} in
- abstract)
- if test_cmd pkg_${PKG_NAME}_${__%:*}; then
- pkg_${PKG_NAME}_${__%:*}; exit 0;
- fi; ;;
- always) pkg_${__%:*}; ;;
- main) if ! is_build_script_done ${__%:*}; then
+ else
+ (set -o errexit -o noglob;
+ parse_with_pkg_name "${BUILD_PACKAGE_LC%.*}";
+ for __ in ${BUILD_STEPS}; do
+ case ${__#*:} in
+ abstract)
if test_cmd pkg_${PKG_NAME}_${__%:*}; then
- pkg_${PKG_NAME}_${__%:*};
- else
- pkg_${__%:*};
- fi;
- fi; ;;
- esac;
- done;
- set_build_script_done finish); BUILD_SCRIPT_RC=${?};
+ pkg_${PKG_NAME}_${__%:*}; exit 0;
+ fi; ;;
+ always) pkg_${__%:*}; ;;
+ main) if ! is_build_script_done ${__%:*}; then
+ if test_cmd pkg_${PKG_NAME}_${__%:*}; then
+ pkg_${PKG_NAME}_${__%:*};
+ else
+ pkg_${__%:*};
+ fi;
+ fi; ;;
+ esac;
+ done;
+ set_build_script_done finish); BUILD_SCRIPT_RC=${?};
+ fi;
case ${BUILD_SCRIPT_RC} in
0) log_msg succ "Finished \`${BUILD_PACKAGE_LC}' build.";
: $((BUILD_NFINI+=1)); continue; ;;
@@ -111,15 +93,12 @@ for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do
break;
fi;
done;
-post_copy_etc; post_strip; post_tarballs; post_build_files;
+if [ ${BUILD_SCRIPT_RC:-0} -ne 0 ]; then
+ post_copy_etc; post_strip; post_tarballs; post_build_files;
+fi;
log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s).";
log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s).";
-exit ${BUILD_SCRIPT_RC})} 2>&1 | tee ${BUILD_LOG_FNAME} &
-
-#
-#
-#
-TEE_PID=${!};
+exit ${BUILD_SCRIPT_RC})} 2>&1 | tee ${BUILD_LOG_FNAME} & TEE_PID=${!};
trap "rm -f ${BUILD_STATUS_IN_PROGRESS_FNAME}; \
log_msg fail \"Build aborted.\"; \
echo kill ${TEE_PID}; \
diff --git a/subr/build.subr b/subr/build.subr
index a1009c2b..bd2e2581 100644
--- a/subr/build.subr
+++ b/subr/build.subr
@@ -29,6 +29,18 @@ set_env_vars_with_sep() {
done; unset _sevws_sep; pop_IFS;
};
+lfilter() {
+ _lf_list="${1}"; _lf_filter="${2}"; _lf_lnew="";
+ for _lf_litem in ${_lf_list}; do
+ for _lf_lfilter in ${_lf_filter}; do
+ if [ "${_lf_lfilter}" = "${_lf_litem}" ]; then
+ _lf_lnew="${_lf_lnew:+${_lf_lnew} }${_lf_litem}"; break;
+ fi;
+ done;
+ done;
+ echo ${_lf_lnew}; unset _lf_list _lf_filter _lf_lnew _lf_litem _lf_lfilter;
+};
+
log_msg() {
_lm_lvl=${1}; shift;
if [ "${_lm_lvl#v}" != "${_lm_lvl}" ]\
@@ -196,7 +208,7 @@ parse_with_pkg_name() {
unset _pwpn_pkg_name_uc;
log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars.";
else
- for _pwpn_vname in ${PKG_BUILD_VARS}; do
+ for _pwpn_vname in PREFIX ${PKG_BUILD_VARS}; do
if [ -n "$(get_var_unsafe DEFAULT_${_pwpn_vname})" ]; then
set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe DEFAULT_${_pwpn_vname})";
fi;
diff --git a/subr/mode_check_updates.subr b/subr/mode_check_updates.subr
index cc07b67e..312b81e0 100644
--- a/subr/mode_check_updates.subr
+++ b/subr/mode_check_updates.subr
@@ -50,7 +50,10 @@ modep_check_cpu_get_version() {
};
mode_check_pkg_updates() {
- cu_name="${1}"; cu_version="${2}"; cu_url="${3}"; cu_url_type="${4}";
+ cu_name="${1}"; cu_NAME="${2}";
+ cu_version="$(get_var_unsafe PKG_${cu_NAME}_VERSION)";
+ cu_url="$(get_var_unsafe PKG_${cu_NAME}_URL)";
+ cu_url_type="$(get_var_unsafe PKG_${cu_NAME}_URL_TYPE)";
. vars/check_updates.vars;
if match_list "${CHECK_UPDATES_SKIP}" " " "${cu_name}"; then
log_msg vnfo "Skipping \`${cu_name}' (set in \${CHECK_UPDATES_SKIP}.)";