summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh54
-rw-r--r--dist/dist_minipix.dist2
-rw-r--r--dist/dist_zipdist.dist10
-rw-r--r--etc/README.md159
-rw-r--r--etc/build.theme84
-rw-r--r--etc/build.usage159
-rw-r--r--etc/build.usage.short31
-rw-r--r--etc/pkgtool.theme56
-rwxr-xr-xpkgtool.sh66
-rw-r--r--subr.rtl/rtl_fetch.subr14
-rw-r--r--subr.rtl/rtl_fileop.subr36
-rw-r--r--subr.rtl/rtl_install_v2.subr2
-rw-r--r--subr.rtl/rtl_list.subr13
-rw-r--r--subr.rtl/rtl_log.subr87
-rw-r--r--subr.rtl/rtl_platform.subr4
-rw-r--r--subr/build_init.subr111
-rw-r--r--subr/ex_pkg.subr7
-rw-r--r--subr/ex_pkg_dispatch.subr4
-rw-r--r--subr/ex_pkg_env.subr2
-rw-r--r--subr/pkg_fetch_download.subr2
-rw-r--r--subr/pkg_install_files.subr4
-rw-r--r--subr/pkgtool_init.subr14
22 files changed, 561 insertions, 360 deletions
diff --git a/build.sh b/build.sh
index 404cc1d0..6b174e47 100755
--- a/build.sh
+++ b/build.sh
@@ -6,7 +6,7 @@ buildp_ast() {
trap '' HUP INT TERM USR1 USR2;
local _param="${1}" _pids="" _pids_niter=0 _pkg_name="" RTL_KILL_TREE_PIDS="";
if [ "${_param}" = "abort" ]; then
- rtl_log_msg fatalexit "Build aborted.";
+ rtl_log_msg "fatalexit" "Build aborted.";
fi;
while [ "${_pids_niter}" -lt 8 ]; do
_pids="$(rtl_lconcat "${_pids}" "${RTL_KILL_TREE_PIDS}")"; RTL_KILL_TREE_PIDS="";
@@ -18,14 +18,14 @@ buildp_ast() {
fi;
done;
if [ -n "${_pids}" ]; then
- rtl_log_msg verbose "Killed PID(s): %s" "$(rtl_uniq ${_pids})";
+ rtl_log_msg "verbose" "Killed PID(s): %s" "$(rtl_uniq ${_pids})";
fi;
if [ -n "${EX_PKG_DISPATCH_WAIT}" ]\
&& [ "${ARG_RESET_PKG}" -eq 1 ]; then
for _pkg_name in ${EX_PKG_DISPATCH_WAIT}; do
rtl_state_clear "${BUILD_WORKDIR}" "${_pkg_name}";
done;
- rtl_log_msg verbose "Reset package state for: %s" "${EX_PKG_DISPATCH_WAIT}";
+ rtl_log_msg "verbose" "Reset package state for: %s" "${EX_PKG_DISPATCH_WAIT}";
fi;
if [ -n "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
rtl_fileop rm "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}";
@@ -36,17 +36,17 @@ buildp_dispatch_fail_pkg() {
local _group_name="${1}" _pkg_name="${2}";
: $((BUILD_NFAIL+=1)); BUILD_PKGS_FAILED="$(rtl_lconcat "${BUILD_PKGS_FAILED}" "${_pkg_name}")";
if [ "${ARG_RELAXED:-0}" -eq 0 ]; then
- rtl_log_msg fatal "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log:";
+ rtl_log_msg "fatal" "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log:";
cat "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
if [ -n "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]; then
printf "%s\n" "${_pkg_name}" > "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}";
fi;
- rtl_log_msg fatal "Build failed in \`%s', check \`%s' for details." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
- else rtl_log_msg warning "Build failed in \`%s', check \`%s' for details." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
+ rtl_log_msg "fatal" "Build failed in \`%s', check \`%s' for details." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
+ else rtl_log_msg "warning" "Build failed in \`%s', check \`%s' for details." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
fi;
if [ "${ARG_DUMP_ON_ABORT:-0}" -eq 1 ]; then
- rtl_log_msg info "Logged environment dump for failed package \`%s' to \`%s'." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}.dump";
- rtl_log_msg info "Enter an interactive package build shell w/ the command line: ./pkgtool.sh -a %s -b %s \"%s\" PREFIX=\"%s\""\
+ rtl_log_msg "pkg_faildump" "Logged environment dump for failed package \`%s' to \`%s'." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}.dump";
+ rtl_log_msg "pkg_faildump" "Enter an interactive package build shell w/ the command line: ./pkgtool.sh -a %s -b %s \"%s\" PREFIX=\"%s\""\
"${ARCH}" "${BUILD_KIND}" "${_pkg_name}" "${PREFIX}";
fi;
if [ "${ARG_RELAXED:-0}" -eq 0 ]; then
@@ -57,31 +57,31 @@ buildp_dispatch_fail_pkg() {
buildp_dispatch_group_state() {
local _msg="${1}" _group_name="${2}";
case "${_msg}" in
- finish_group) rtl_log_msg success_end "[%3d%% ] [%03d/%03d] Finished \`%s' build group." "${6}" "${4}" "${5}" "${_group_name}"; ;;
- start_group) rtl_log_msg success "[%3d%% ] [%03d/%03d] Starting \`%s' build group..." "${6}" "${4}" "${5}" "${_group_name}"; ;;
+ finish_group) rtl_log_msg "group_finish" "[%3d%% ] [%03d/%03d] Finished \`%s' build group." "${6}" "${4}" "${5}" "${_group_name}"; ;;
+ start_group) rtl_log_msg "group_begin" "[%3d%% ] [%03d/%03d] Starting \`%s' build group..." "${6}" "${4}" "${5}" "${_group_name}"; ;;
esac;
};
buildp_dispatch_pkg_state() {
local _msg="${1}" _group_name="${2}" _pkg_name="${3}";
case "${_msg}" in
- disabled_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msg notice "Skipping disabled package \`%s'." "${_pkg_name}"; ;;
- missing_pkg) rtl_log_msg fatalexit "Error: unknown package \`%s'." "${_pkg_name}"; ;;
- msg_pkg) shift 3; rtl_log_msg notice "%s/%s: %s" "${_group_name}" "${_pkg_name}" "${*}"; ;;
- skipped_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msg notice "Skipping finished package \`%s'." "${_pkg_name}"; ;;
- start_pkg) rtl_log_msg info "[%3d%%/%3d%%] [%03d/%03d] Starting \`%s' build..." "${7}" "${6}" "${4}" "${5}" "${_pkg_name}"; ;;
- step_pkg) rtl_log_msg notice "Finished build step %s of package \`%s'." "${4}" "${_pkg_name}"; ;;
+ disabled_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msg "pkg_skip" "Skipping disabled package \`%s'." "${_pkg_name}"; ;;
+ missing_pkg) rtl_log_msg "fatalexit" "Error: unknown package \`%s'." "${_pkg_name}"; ;;
+ msg_pkg) shift 3; rtl_log_msg "pkg_msg" "%s/%s: %s" "${_group_name}" "${_pkg_name}" "${*}"; ;;
+ skipped_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msg "pkg_skip" "Skipping finished package \`%s'." "${_pkg_name}"; ;;
+ start_pkg) rtl_log_msg "pkg_begin" "[%3d%%/%3d%%] [%03d/%03d] Starting \`%s' build..." "${7}" "${6}" "${4}" "${5}" "${_pkg_name}"; ;;
+ step_pkg) rtl_log_msg "pkg_step" "Finished build step %s of package \`%s'." "${4}" "${_pkg_name}"; ;;
finish_pkg)
: $((BUILD_NFINI+=1));
- if rtl_lmatch "${ARG_VERBOSE_LEVELS}" "build" ","; then
+ if rtl_lmatch "${ARG_VERBOSE_TAGS}" "build" ","; then
cat "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
fi;
- rtl_log_msg info_end "[%3d%%/%3d%%] [%03d/%03d] Finished \`%s' build." "${7}" "${6}" "${4}" "${5}" "${_pkg_name}"; ;;
+ rtl_log_msg "pkg_finish" "[%3d%%/%3d%%] [%03d/%03d] Finished \`%s' build." "${7}" "${6}" "${4}" "${5}" "${_pkg_name}"; ;;
start_pkg_child)
if [ "${PKG_NO_LOG_VARS:-0}" -eq 0 ]; then
rtl_log_env_vars "notice" "build" $(rtl_get_vars_fast "^PKG_");
fi;
- if rtl_lmatch "${ARG_VERBOSE_LEVELS}" "xtrace" ","; then
+ if rtl_lmatch "${ARG_VERBOSE_TAGS}" "xtrace" ","; then
set -o xtrace;
fi; ;;
esac;
@@ -122,30 +122,30 @@ build() {
DEFAULT_TARGET="" DEFAULT_WGET_ARGS="" MIDIPIX_BUILD_PWD="";
DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME=""; EX_PKG_DISPATCH_WAIT="";
if ! . "${0%/*}/subr/build_init.subr"; then
- _rc=1; printf "Error: failed to source \`${0%/*}/subr/build_init.subr'." >&2;
+ printf "Error: failed to source \`${0%/*}/subr/build_init.subr'." >&2; exit "${_rc}";
elif ! build_init "${@}"; then
- _rc=1; _status="${_status}";
+ printf "Error during initilisation: %s.\n" "${_status}" >&2; exit "${_rc}";
elif [ -n "${_status}" ]; then
_rc=0; _status="${_status}";
else trap "buildp_ast exit" EXIT; trap "buildp_ast abort" HUP INT TERM USR1 USR2;
buildp_time_init;
- rtl_log_msg info "Build started by %s@%s at %s." "${BUILD_USER}" "${BUILD_HNAME}" "${BUILD_DATE_START}";
- rtl_log_env_vars "notice" "build (global)" ${DEFAULT_LOG_ENV_VARS};
+ rtl_log_msg "build_begin" "Build started by %s@%s at %s." "${BUILD_USER}" "${BUILD_HNAME}" "${BUILD_DATE_START}";
+ rtl_log_env_vars "build_vars" "build (global)" ${DEFAULT_LOG_ENV_VARS};
ex_pkg_dispatch "${DEFAULT_BUILD_STEPS}" "${DEFAULT_BUILD_VARS}" \
buildp_dispatch "${BUILD_GROUPS}" "${BUILD_GROUPS_INHIBIT_DEPS}" \
"${ARG_PARALLEL}" "${BUILD_WORKDIR}/build.fifo" "${ARG_RESTART}" \
"${ARG_RESTART_AT}" "${ARG_RESTART_RECURSIVE}" "${BUILD_WORKDIR}";
buildp_time_update;
- rtl_log_msg info "%s finished, %s skipped, and %s failed package(s)." "${BUILD_NFINI:-0}" "${BUILD_NSKIP:-0}" "${BUILD_NFAIL:-0}";
- rtl_log_msg info "Build time: %s hour(s), %s minute(s), and %s second(s)." "${_build_time_hours:-0}" "${_build_time_minutes:-0}" "${_build_time_secs:-0}";
+ rtl_log_msg "build_finish" "%s finished, %s skipped, and %s failed package(s)." "${BUILD_NFINI:-0}" "${BUILD_NSKIP:-0}" "${BUILD_NFAIL:-0}";
+ rtl_log_msg "build_finish_time" "Build time: %s hour(s), %s minute(s), and %s second(s)." "${_build_time_hours:-0}" "${_build_time_minutes:-0}" "${_build_time_secs:-0}";
if [ -n "${BUILD_PKGS_FAILED}" ]; then
_rc=1; _status="Build script failure(s) in: ${BUILD_PKGS_FAILED}.";
fi;
fi;
if [ "${_rc}" -ne 0 ]; then
- rtl_log_msg fatalexit "${_status}";
+ rtl_log_msg "fatalexit" "${_status}";
elif [ -n "${_status}" ]; then
- rtl_log_msg info "${_status}";
+ rtl_log_msg "info" "${_status}";
fi;
};
diff --git a/dist/dist_minipix.dist b/dist/dist_minipix.dist
index f5ea59be..f3dc4e01 100644
--- a/dist/dist_minipix.dist
+++ b/dist/dist_minipix.dist
@@ -72,7 +72,7 @@
pkg_dist_minipix_all() {
local _vflag="";
- if rtl_lmatch "${ARG_VERBOSE_LEVELS}" "install" ","; then
+ if rtl_lmatch "${ARG_VERBOSE_TAGS}" "install" ","; then
_vflag="-v";
fi;
if rtl_lmatch "${ARG_DIST}" "minipix" "," \
diff --git a/dist/dist_zipdist.dist b/dist/dist_zipdist.dist
index 0cdc9c65..7361a8a4 100644
--- a/dist/dist_zipdist.dist
+++ b/dist/dist_zipdist.dist
@@ -6,10 +6,10 @@ pkg_dist_zipdist_all() {
local _dist_fname="" _pkg_name="" _pkglist_fname="${PREFIX}/pkglist.native";
if rtl_lmatch "${ARG_DIST}" "zipdist" ","; then
echo "msg_pkg dist dist_zipdist Building deployable distribution ZIP archive..." >&3;
- rtl_log_msg info "Finished building deployable distribution ZIP archive.";
+ rtl_log_msg "zipdist" "Finished building deployable distribution ZIP archive.";
for _pkg_name in $(cat "${_pkglist_fname}"); do
if [ ! -e "${BUILD_WORKDIR}/${_pkg_name}-native-${DEFAULT_TARGET}" ]; then
- rtl_log_msg fatalexit "Error: missing package build directory for package \`%s'." "${_pkg_name}";
+ rtl_log_msg "fatalexit" "Error: missing package build directory for package \`%s'." "${_pkg_name}";
fi;
done;
_dist_fname="${DEFAULT_ZIPDIST_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.zip";
@@ -34,19 +34,19 @@ pkg_dist_zipdist_all() {
return 1;
else
echo "msg_pkg dist dist_zipdist Finished building deployable distribution ZIP archive." >&3;
- rtl_log_msg info "Finished building deployable distribution ZIP archive.";
+ rtl_log_msg "zipdist" "Finished building deployable distribution ZIP archive.";
if [ -n "${DEFAULT_ZIPDIST_SIGN_GPG_KEY:-}" ]\
&& [ -x "$(which gpg 2>/dev/null)" ]\
&& gpg --list-keys "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" >/dev/null 2>&1; then
echo "msg_pkg dist dist_zipdist Signing deployable distribution ZIP archive..." >&3;
- rtl_log_msg info "Signing deployable distribution ZIP archive...";
+ rtl_log_msg "zipdist" "Signing deployable distribution ZIP archive...";
if ! gpg --armor --passphrase-file /dev/null \
--local-user "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" \
--sign "${PREFIX}/${_dist_fname}"; then
return 1;
fi;
echo "msg_pkg dist dist_zipdist Signed deployable distribution ZIP archive." >&3;
- rtl_log_msg info "Signed deployable distribution ZIP archive.";
+ rtl_log_msg "zipdist" "Signed deployable distribution ZIP archive.";
fi;
fi;
fi;
diff --git a/etc/README.md b/etc/README.md
index b3a62709..9cce5684 100644
--- a/etc/README.md
+++ b/etc/README.md
@@ -496,87 +496,100 @@ env ARCH=nt64 BUILD_KIND=release PREFIX_ROOT="${HOME}/midipix_tmp" ./build.sh -D
usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]]
[-F ipv4|ipv6|offline] [-h|--help] [-p jobs|-P] [-r ALL|LAST]
[-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]] [-R]
- [-v[v]] [-V {notice,verbose,build,fileops,install,xtrace}] [-x]
+ [-v] [-V [+]tag|pat[,..]]
[--as-needed] [--debug-minipix] [--dump-on-abort] [--reset-state]
[--roar] [[=]<group>|<variable name>=<variable override>[ ..]]
- -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
- -b debug|release Selects debug or release build kind; defaults to debug.
- -C dir[,..] Clean build directory (build,) ${PREFIX} before processing build
- scripts (prefix,) source directory (src,) and/or destination
- directory (dest) after successful package builds.
- -D kind[,..] Produce minimal midipix distribution directory (minipix,) RPM
- binary packages (rpm,) and/or deployable distribution ZIP
- archive (zipdist.) zipdist implies minipix.
+ -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
+ -b debug|release Selects debug or release build kind; defaults to debug.
+ -C dir[,..] Clean build directory (build,) ${PREFIX} before processing build
+ scripts (prefix,) source directory (src,) and/or destination
+ directory (dest) after successful package builds.
+ -D kind[,..] Produce minimal midipix distribution directory (minipix,) RPM
+ binary packages (rpm,) and/or deployable distribution ZIP
+ archive (zipdist.) zipdist implies minipix.
-F ipv4|ipv6|offline
- Force IPv4 (ipv4) or IPv6 (ipv6) when downloading package
- archives and/or Git repositories or don't download either at all
- (offline.)
- -h|--help Show short/full help screen, respectively.
- -p jobs|-P Enables parallelisation at group-level, whenever applicable.
- The maximum count of jobs defaults to the number of logical
- processors on the host system divided by two (2.)
-
- If -R is not specified and at least one (1) package fails to
- build, all remaining package builds will be forcibly aborted.
-
- -r ALL|LAST Restart all packages or the last failed package and resume
- build, resp.
+ Force IPv4 (ipv4) or IPv6 (ipv6) when downloading package
+ archives and/or Git repositories or don't download either at all
+ (offline.)
+ -h|--help Show short/full help screen, respectively.
+ -p jobs|-P Enables parallelisation at group-level, whenever applicable.
+ The maximum count of jobs defaults to the number of logical
+ processors on the host system divided by two (2.)
+
+ If -R is not specified and at least one (1) package fails to
+ build, all remaining package builds will be forcibly aborted.
+
+ -r ALL|LAST Restart all packages or the last failed package and resume
+ build, resp.
-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]
- Restart the specified comma-separated package(s) w/ inhibition
- of package build step state resetting completely (`ALL',) starting
- at the resp. last successfully executed build steps (`LAST',) or the
- specified comma-separated list of build steps, optionally subject
- concerning package name(s) and/or build step(s) to the below modifiers:
-
- Prepend name w/ `*' to automatically include dependencies, `**'
- to forcibly rebuild all dependencies, and `***' to forcibly
- rebuild all packages that depend on the specified package(s).
-
- Prepend step w/ `^' to filter build steps with, `<' or `<='
- to constrain build steps to below or below or equal with, resp.,
- `>' or `>=' to constrain build steps to above or above or equal
- with, resp.
-
- Currently defined build steps are:
- fetch_clean, fetch_download, fetch_extract, configure_clean,
- configure_patch_pre, configure_autotools, configure_patch,
- configure, build_clean, build, install_clean, install_subdirs,
- install_make, install_files, install_libs, install, install_rpm,
- and clean.
-
- Additionally, the following virtual steps are provided:
- @fetch, @configure, @build, @install, @clean, and finish.
-
- -R Ignore build failures, skip printing package logs, and continue
- building (relaxed mode.)
-
- -v[v] -v: log at info, notice, -vv: log at info, notice, verbose level.
- -V level[,..] Be verbose concerning any of:
- notice...: log at info, notice level (-v,)
- verbose..: log at info, notice, verbose level (implies notice) (-vv,)
- build....: always print package build logs (implies notice,)
- fileops..: log RTL file operations (implies notice,)
- install..: log RTL installation DSL operations (implies notice,)
- xtrace...: set xtrace during package builds (implies notice) (-x.)
- -x Set xtrace during package builds.
-
- --as-needed Don't build unless the midipix_build repository has received
- new commits.
- --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix.
- --dump-on-abort Produce package environment dump files on build failure to be
- used in conjuction with pkg_shell.sh script (excludes -R.)
- --reset-state Reset package build step state on exit.
-
- <group>[ ..] One of: dev_packages, dist, host_deps, host_deps_rpm,
- host_toolchain, host_tools, minipix, native_packages,
- native_runtime, native_toolchain, native_tools.
-
- Prepend w/ `=' to inhibit group-group dependency expansion.
+ Restart the specified comma-separated package(s) w/ inhibition
+ of package build step state resetting completely (`ALL',) starting
+ at the resp. last successfully executed build steps (`LAST',) or the
+ specified comma-separated list of build steps, optionally subject
+ concerning package name(s) and/or build step(s) to the below modifiers:
+
+ Prepend name w/ `*' to automatically include dependencies, `**'
+ to forcibly rebuild all dependencies, and `***' to forcibly
+ rebuild all packages that depend on the specified package(s).
+
+ Prepend step w/ `^' to filter build steps with, `<' or `<='
+ to constrain build steps to below or below or equal with, resp.,
+ `>' or `>=' to constrain build steps to above or above or equal
+ with, resp.
+
+ Currently defined build steps are:
+ fetch_clean, fetch_download, fetch_extract, configure_clean,
+ configure_patch_pre, configure_autotools, configure_patch,
+ configure, build_clean, build, install_clean, install_subdirs,
+ install_make, install_files, install_libs, install, install_rpm,
+ and clean.
+
+ Additionally, the following virtual steps are provided:
+ @fetch, @configure, @build, @install, @clean, and finish.
+
+ -R Ignore build failures, skip printing package logs, and continue
+ building (relaxed mode.)
+
+ -v Increase logging verbosity.
+ -V [+]tag|pat[,..] Enable logging for messages with tag or pattern matching tags of:
+ + (prefix)..: initialise tags with normal verbosity (implies normal) (see etc/build.theme,)
+ all.........: log everything (see etc/build.theme,)
+ clear|none..: log nothing,
+ normal......: log at normal verbosity (see etc/build.theme,)
+ verbose.....: log at increased verbosity (implies normal) (see etc/build.theme) (-v,)
+
+ build.......: log package build logs,
+ fileops.....: log RTL file operations,
+ install.....: log RTL installation DSL operations,
+ zipdist.....: log deployable distribution ZIP archive operations,
+ xtrace......: set xtrace during package builds,
+
+ fatal.......: fatal, unrecoverable errors,
+ info........: informational messages,
+ verbose.....: verbose informational messages,
+ warning.....: warning messages possibly relating to imminent fatal, unrecoverable errors,
+
+ build_*.....: general build messages (viz.: begin, finish, finish_time, vars,)
+ group_*.....: build group messages (viz.: begin, finish,)
+ pkg_*.......: package build messages (viz.: begin, faildump, finish, msg, skip, step, strip.)
+
+ --as-needed Don't build unless the midipix_build repository has received
+ new commits.
+ --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix.
+ --dump-on-abort Produce package environment dump files on build failure to be
+ used in conjuction with pkg_shell.sh script (excludes -R.)
+ --reset-state Reset package build step state on exit.
+
+ <group>[ ..] One of: dev_packages, dist, host_deps, host_deps_rpm,
+ host_toolchain, host_tools, minipix, native_packages,
+ native_runtime, native_toolchain, native_tools.
+
+ Prepend w/ `=' to inhibit group-group dependency expansion.
<variable name>=<variable override>[ ..]
- Override build or package variable.
+ Override build or package variable.
```
[Back to top](#table-of-contents)
diff --git a/etc/build.theme b/etc/build.theme
new file mode 100644
index 00000000..5485a368
--- /dev/null
+++ b/etc/build.theme
@@ -0,0 +1,84 @@
+#
+# Theme file for build.sh
+#
+
+#
+# {{{ ANSI attributes reference
+#
+# Attribute Name Note
+# 0 Reset or normal All attributes off
+# 1 Bold or increased intensity As with faint, the color change is a PC (SCO / CGA) invention.[30][better source needed]
+# 2 Faint, decreased intensity, or dim May be implemented as a light font weight like bold.[31]
+# 4 Underline Style extensions exist for Kitty, VTE, mintty and iTerm2.[32][33]
+# 7 Reverse video or invert Swap foreground and background colors; inconsistent emulation[34]
+#
+# FG BG Colour name
+# 30 40 Black
+# 31 41 Red
+# 32 42 Green
+# 33 43 Yellow
+# 34 44 Blue
+# 35 45 Magenta
+# 36 46 Cyan
+# 37 47 White
+# 90 100 Bright Black (Gray)
+# 91 101 Bright Red
+# 92 102 Bright Green
+# 93 103 Bright Yellow
+# 94 104 Bright Blue
+# 95 105 Bright Magenta
+# 96 106 Bright Cyan
+# 97 107 Bright White
+# }}}
+#
+
+#
+# Tag sets
+#
+LOG_TAGS_all="build,fileop,install,zipdist,xtrace,fatal,info,verbose,warning,build_begin,build_finish,build_finish_time,build_vars,group_begin,group_finish,pkg_begin,pkg_faildump,pkg_finish,pkg_msg,pkg_skip,pkg_step,pkg_strip";
+LOG_TAGS_normal="fatal,info,warning,build_begin,build_finish,build_finish_time,pkg_begin,pkg_faildump,pkg_finish,pkg_msg";
+LOG_TAGS_verbose="${LOG_TAGS_normal:+${LOG_TAGS_normal},}verbose,build_vars,group_begin,group_finish,pkg_skip,pkg_step,pkg_strip";
+
+#
+# Subsystem tags
+#
+LOG_TAG_build=""; # (UNUSED)
+LOG_TAG_fileop=36; # Cyan
+LOG_TAG_install=36; # Cyan
+LOG_TAG_zipdist=93; # Bright yellow
+LOG_TAG_xtrace=""; # (UNUSED)
+
+#
+# General level tags
+#
+LOG_TAG_fatal=91; # Bright red
+LOG_TAG_info=93; # Bright yellow
+LOG_TAG_verbose=96; # Bright cyan
+LOG_TAG_warning=31; # Dark red
+
+#
+# General build tags
+#
+LOG_TAG_build_begin=93; # Bright yellow
+LOG_TAG_build_finish=93; # Bright yellow
+LOG_TAG_build_finish_time=93; # Bright yellow
+LOG_TAG_build_vars=33; # Dark yellow
+
+#
+# Build group tags
+#
+LOG_TAG_group_begin=33; # Dark yellow
+LOG_TAG_group_finish=32; # Dark green
+
+#
+# Package build tags
+#
+LOG_TAG_pkg_begin=93; # Bright yellow
+LOG_TAG_pkg_faildump=93; # Bright yellow
+LOG_TAG_pkg_finish=92; # Bright green
+LOG_TAG_pkg_msg=90; # Dark grey
+LOG_TAG_pkg_skip=90; # Dark grey
+LOG_TAG_pkg_step=90; # Dark grey
+LOG_TAG_pkg_strip=93; # Bright yellow
+
+# vim:foldmethod=marker ft=sh
diff --git a/etc/build.usage b/etc/build.usage
index 8bc7bdf6..218343d7 100644
--- a/etc/build.usage
+++ b/etc/build.usage
@@ -1,84 +1,97 @@
usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]]
[-F ipv4|ipv6|offline] [-h|--help] [-p jobs|-P] [-r ALL|LAST]
[-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]] [-R]
- [-v[v]] [-V {notice,verbose,build,fileops,install,xtrace}] [-x]
+ [-v] [-V [+]tag|pat[,..]]
[--as-needed] [--debug-minipix] [--dump-on-abort] [--reset-state]
[--roar] [[=]<group>|<variable name>=<variable override>[ ..]]
- -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
- -b debug|release Selects debug or release build kind; defaults to debug.
- -C dir[,..] Clean build directory (build,) ${PREFIX} before processing build
- scripts (prefix,) source directory (src,) and/or destination
- directory (dest) after successful package builds.
- -D kind[,..] Produce minimal midipix distribution directory (minipix,) RPM
- binary packages (rpm,) and/or deployable distribution ZIP
- archive (zipdist.) zipdist implies minipix.
+ -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
+ -b debug|release Selects debug or release build kind; defaults to debug.
+ -C dir[,..] Clean build directory (build,) ${PREFIX} before processing build
+ scripts (prefix,) source directory (src,) and/or destination
+ directory (dest) after successful package builds.
+ -D kind[,..] Produce minimal midipix distribution directory (minipix,) RPM
+ binary packages (rpm,) and/or deployable distribution ZIP
+ archive (zipdist.) zipdist implies minipix.
-F ipv4|ipv6|offline
- Force IPv4 (ipv4) or IPv6 (ipv6) when downloading package
- archives and/or Git repositories or don't download either at all
- (offline.)
- -h|--help Show short/full help screen, respectively.
- -p jobs|-P Enables parallelisation at group-level, whenever applicable.
- The maximum count of jobs defaults to the number of logical
- processors on the host system divided by two (2.)
-
- If -R is not specified and at least one (1) package fails to
- build, all remaining package builds will be forcibly aborted.
-
- -r ALL|LAST Restart all packages or the last failed package and resume
- build, resp.
+ Force IPv4 (ipv4) or IPv6 (ipv6) when downloading package
+ archives and/or Git repositories or don't download either at all
+ (offline.)
+ -h|--help Show short/full help screen, respectively.
+ -p jobs|-P Enables parallelisation at group-level, whenever applicable.
+ The maximum count of jobs defaults to the number of logical
+ processors on the host system divided by two (2.)
+
+ If -R is not specified and at least one (1) package fails to
+ build, all remaining package builds will be forcibly aborted.
+
+ -r ALL|LAST Restart all packages or the last failed package and resume
+ build, resp.
-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]
- Restart the specified comma-separated package(s) w/ inhibition
- of package build step state resetting completely (`ALL',) starting
- at the resp. last successfully executed build steps (`LAST',) or the
- specified comma-separated list of build steps, optionally subject
- concerning package name(s) and/or build step(s) to the below modifiers:
-
- Prepend name w/ `*' to automatically include dependencies, `**'
- to forcibly rebuild all dependencies, and `***' to forcibly
- rebuild all packages that depend on the specified package(s).
-
- Prepend step w/ `^' to filter build steps with, `<' or `<='
- to constrain build steps to below or below or equal with, resp.,
- `>' or `>=' to constrain build steps to above or above or equal
- with, resp.
-
- Currently defined build steps are:
- fetch_clean, fetch_download, fetch_extract, configure_clean,
- configure_patch_pre, configure_autotools, configure_patch,
- configure, build_clean, build, install_clean, install_subdirs,
- install_make, install_files, install_libs, install, install_rpm,
- and clean.
-
- Additionally, the following virtual steps are provided:
- @fetch, @configure, @build, @install, @clean, and finish.
-
- -R Ignore build failures, skip printing package logs, and continue
- building (relaxed mode.)
-
- -v[v] -v: log at info, notice, -vv: log at info, notice, verbose level.
- -V level[,..] Be verbose concerning any of:
- notice...: log at info, notice level (-v,)
- verbose..: log at info, notice, verbose level (implies notice) (-vv,)
- build....: always print package build logs (implies notice,)
- fileops..: log RTL file operations (implies notice,)
- install..: log RTL installation DSL operations (implies notice,)
- xtrace...: set xtrace during package builds (implies notice) (-x.)
- -x Set xtrace during package builds.
-
- --as-needed Don't build unless the midipix_build repository has received
- new commits.
- --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix.
- --dump-on-abort Produce package environment dump files on build failure to be
- used in conjuction with pkg_shell.sh script (excludes -R.)
- --reset-state Reset package build step state on exit.
-
- <group>[ ..] One of: dev_packages, dist, host_deps, host_deps_rpm,
- host_toolchain, host_tools, minipix, native_packages,
- native_runtime, native_toolchain, native_tools.
-
- Prepend w/ `=' to inhibit group-group dependency expansion.
+ Restart the specified comma-separated package(s) w/ inhibition
+ of package build step state resetting completely (`ALL',) starting
+ at the resp. last successfully executed build steps (`LAST',) or the
+ specified comma-separated list of build steps, optionally subject
+ concerning package name(s) and/or build step(s) to the below modifiers:
+
+ Prepend name w/ `*' to automatically include dependencies, `**'
+ to forcibly rebuild all dependencies, and `***' to forcibly
+ rebuild all packages that depend on the specified package(s).
+
+ Prepend step w/ `^' to filter build steps with, `<' or `<='
+ to constrain build steps to below or below or equal with, resp.,
+ `>' or `>=' to constrain build steps to above or above or equal
+ with, resp.
+
+ Currently defined build steps are:
+ fetch_clean, fetch_download, fetch_extract, configure_clean,
+ configure_patch_pre, configure_autotools, configure_patch,
+ configure, build_clean, build, install_clean, install_subdirs,
+ install_make, install_files, install_libs, install, install_rpm,
+ and clean.
+
+ Additionally, the following virtual steps are provided:
+ @fetch, @configure, @build, @install, @clean, and finish.
+
+ -R Ignore build failures, skip printing package logs, and continue
+ building (relaxed mode.)
+
+ -v Increase logging verbosity.
+ -V [+]tag|pat[,..] Enable logging for messages with tag or pattern matching tags of:
+ + (prefix)..: initialise tags with normal verbosity (implies normal) (see etc/build.theme,)
+ all.........: log everything (see etc/build.theme,)
+ clear|none..: log nothing,
+ normal......: log at normal verbosity (see etc/build.theme,)
+ verbose.....: log at increased verbosity (implies normal) (see etc/build.theme) (-v,)
+
+ build.......: log package build logs,
+ fileops.....: log RTL file operations,
+ install.....: log RTL installation DSL operations,
+ zipdist.....: log deployable distribution ZIP archive operations,
+ xtrace......: set xtrace during package builds,
+
+ fatal.......: fatal, unrecoverable errors,
+ info........: informational messages,
+ verbose.....: verbose informational messages,
+ warning.....: warning messages possibly relating to imminent fatal, unrecoverable errors,
+
+ build_*.....: general build messages (viz.: begin, finish, finish_time, vars,)
+ group_*.....: build group messages (viz.: begin, finish,)
+ pkg_*.......: package build messages (viz.: begin, faildump, finish, msg, skip, step, strip.)
+
+ --as-needed Don't build unless the midipix_build repository has received
+ new commits.
+ --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix.
+ --dump-on-abort Produce package environment dump files on build failure to be
+ used in conjuction with pkg_shell.sh script (excludes -R.)
+ --reset-state Reset package build step state on exit.
+
+ <group>[ ..] One of: dev_packages, dist, host_deps, host_deps_rpm,
+ host_toolchain, host_tools, minipix, native_packages,
+ native_runtime, native_toolchain, native_tools.
+
+ Prepend w/ `=' to inhibit group-group dependency expansion.
<variable name>=<variable override>[ ..]
- Override build or package variable.
+ Override build or package variable.
diff --git a/etc/build.usage.short b/etc/build.usage.short
index 3a529ecc..7e58f8b5 100644
--- a/etc/build.usage.short
+++ b/etc/build.usage.short
@@ -1,31 +1,24 @@
usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]]
[-F ipv4|ipv6|offline] [-h|--help] [-p jobs|-P] [-r ALL|LAST]
[-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]] [-R]
- [-v[v]] [-V {notice,verbose,build,fileops,install,xtrace}] [-x]
+ [-v] [-V [+]tag|pat[,..]]
[--as-needed] [--debug-minipix] [--dump-on-abort] [--reset-state]
[--roar] [[=]<group>|<variable name>=<variable override>[ ..]]
- -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
- -b debug|release Selects debug or release build kind; defaults to debug.
- -h|--help Show short/full help screen, respectively.
- -p jobs|-P Enables parallelisation at group-level, whenever applicable.
- -r ALL|LAST Restart all/the last failed/the specified comma-separated package(s).
+ -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
+ -b debug|release Selects debug or release build kind; defaults to debug.
+ -h|--help Show short/full help screen, respectively.
+ -p jobs|-P Enables parallelisation at group-level, whenever applicable.
+ -r ALL|LAST Restart all/the last failed/the specified comma-separated package(s).
-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]
- -v[v] -v: log at info, notice, -vv: log at info, notice, verbose level.
- -V level[,..] Be verbose concerning any of:
- notice...: log at info, notice level (-v,)
- verbose..: log at info, notice, verbose level (implies notice) (-vv,)
- build....: always print package build logs (implies notice,)
- fileops..: log RTL file operations (implies notice,)
- install..: log RTL installation DSL operations (implies notice,)
- xtrace...: set xtrace during package builds (implies notice) (-x.)
+ -v Increase logging verbosity.
- <group>[ ..] One of: dev_packages, dist, host_deps, host_deps_rpm,
- host_toolchain, host_tools, minipix, native_packages,
- native_runtime, native_toolchain, native_tools.
+ <group>[ ..] One of: dev_packages, dist, host_deps, host_deps_rpm,
+ host_toolchain, host_tools, minipix, native_packages,
+ native_runtime, native_toolchain, native_tools.
- Prepend w/ `=' to inhibit group-group dependency expansion.
+ Prepend w/ `=' to inhibit group-group dependency expansion.
<variable name>=<variable override>[ ..]
- Override build or package variable.
+ Override build or package variable.
diff --git a/etc/pkgtool.theme b/etc/pkgtool.theme
new file mode 100644
index 00000000..31ea331e
--- /dev/null
+++ b/etc/pkgtool.theme
@@ -0,0 +1,56 @@
+#
+# Theme file for pkgtool.sh
+#
+
+#
+# {{{ ANSI attributes reference
+#
+# Attribute Name Note
+# 0 Reset or normal All attributes off
+# 1 Bold or increased intensity As with faint, the color change is a PC (SCO / CGA) invention.[30][better source needed]
+# 2 Faint, decreased intensity, or dim May be implemented as a light font weight like bold.[31]
+# 4 Underline Style extensions exist for Kitty, VTE, mintty and iTerm2.[32][33]
+# 7 Reverse video or invert Swap foreground and background colors; inconsistent emulation[34]
+#
+# FG BG Colour name
+# 30 40 Black
+# 31 41 Red
+# 32 42 Green
+# 33 43 Yellow
+# 34 44 Blue
+# 35 45 Magenta
+# 36 46 Cyan
+# 37 47 White
+# 90 100 Bright Black (Gray)
+# 91 101 Bright Red
+# 92 102 Bright Green
+# 93 103 Bright Yellow
+# 94 104 Bright Blue
+# 95 105 Bright Magenta
+# 96 106 Bright Cyan
+# 97 107 Bright White
+# }}}
+#
+
+#
+# Tag sets
+#
+LOG_TAGS_all="fileop,install,fatal,info,verbose,warning";
+LOG_TAGS_normal="fatal,info,warning";
+LOG_TAGS_verbose="${LOG_TAGS_normal:+${LOG_TAGS_normal},}verbose";
+
+#
+# Subsystem tags
+#
+LOG_TAG_fileop=36; # Cyan
+LOG_TAG_install=36; # Cyan
+
+#
+# General level tags
+#
+LOG_TAG_fatal=91; # Bright red
+LOG_TAG_info=93; # Bright yellow
+LOG_TAG_verbose=96; # Bright cyan
+LOG_TAG_warning=31; # Dark red
+
+# vim:foldmethod=marker ft=sh
diff --git a/pkgtool.sh b/pkgtool.sh
index debc873c..c8eb3510 100755
--- a/pkgtool.sh
+++ b/pkgtool.sh
@@ -15,20 +15,20 @@ pkgtoolp_info() {
"${_group_name}" 1 "${_pkg_name}" "" "${BUILD_WORKDIR}"; then
_rc=1; _status="Error: failed to set package environment for \`${_pkg_name}'.";
else _pkg_version="$(rtl_get_var_unsafe -u "PKG_"${_pkg_name}"_VERSION")";
- rtl_log_env_vars "notice" "package" $(rtl_get_vars_fast "^PKG_${_pkg_name_uc}");
- rtl_log_msg info "Build group: %s" "${_group_name}";
+ rtl_log_env_vars "verbose" "package" $(rtl_get_vars_fast "^PKG_${_pkg_name_uc}");
+ rtl_log_msg "info" "Build group: %s" "${_group_name}";
if [ -z "${PKG_DEPENDS:-}" ]; then
- rtl_log_msg info "Package \`%s' has no dependencies." "${_pkg_name}";
- else rtl_log_msg info "Direct dependencies of \`%s': %s" "${_pkg_name}" "${PKG_DEPENDS}";
+ rtl_log_msg "info" "Package \`%s' has no dependencies." "${_pkg_name}";
+ else rtl_log_msg "info" "Direct dependencies of \`%s': %s" "${_pkg_name}" "${PKG_DEPENDS}";
if ! ex_pkg_unfold_depends 1 1 "${_group_name}" "${_pkg_names}" "${_pkg_name}" 0; then
- rtl_log_msg warning "Warning: failed to unfold dependency-expanded package name list for \`%s'." "${_pkg_name}";
+ rtl_log_msg "warning" "Warning: failed to unfold dependency-expanded package name list for \`%s'." "${_pkg_name}";
else EX_PKG_NAMES="$(rtl_lfilter "${EX_PKG_NAMES}" "${_pkg_name}")";
if [ -n "${EX_PKG_NAMES}" ]; then
- rtl_log_msg info "Full dependencies of \`%s': %s"\
+ rtl_log_msg "info" "Full dependencies of \`%s': %s"\
"${_pkg_name}" "$(rtl_lsort "${EX_PKG_NAMES}")";
fi;
if [ -n "${EX_PKG_DISABLED}" ]; then
- rtl_log_msg info "Full dependencies of \`%s' (disabled packages:) %s"\
+ rtl_log_msg "info" "Full dependencies of \`%s' (disabled packages:) %s"\
"${_pkg_name}" "$(rtl_lsort "${EX_PKG_DISABLED}")";
fi;
fi;
@@ -84,25 +84,25 @@ pkgtoolp_mirror_fetch() {
if _pkg_disabled="$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_DISABLED")"\
&& [ "${_pkg_disabled:-0}" -eq 1 ]; then
- rtl_log_msg notice "Package \`%s' (parent package: \`%s') disabled, skipping." "${_pkg_name}" "${_pkg_name_real}";
+ rtl_log_msg "verbose" "Package \`%s' (parent package: \`%s') disabled, skipping." "${_pkg_name}" "${_pkg_name_real}";
else if _pkg_url="$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_URL")"\
&& _pkg_sha256sum="$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_SHA256SUM")"; then
if [ -z "${_mirror_dname}" ]; then
- _rc=0; rtl_log_msg notice "Archive URL(s) mirroring disabled, skipping \`%s'." "${_pkg_name}";
+ _rc=0; rtl_log_msg "verbose" "Archive URL(s) mirroring disabled, skipping \`%s'." "${_pkg_name}";
elif [ "${_pkg_name}" != "${_pkg_name_real}" ]; then
- rtl_log_msg info "Mirroring package \`%s' (parent package: \`%s'), archive URL(s): \`%s'..." "${_pkg_name}" "${_pkg_name_real}" "${_pkg_url}";
+ rtl_log_msg "info" "Mirroring package \`%s' (parent package: \`%s'), archive URL(s): \`%s'..." "${_pkg_name}" "${_pkg_name_real}" "${_pkg_url}";
if ! rtl_fileop ln_symbolic "${_pkg_name_real}" "${_mirror_dname}/${_pkg_name}"; then
- _rc=1; rtl_log_msg warning "Failed to create symbolic link \`%s' for package \`%s' w/ parent package \`%s'."\
+ _rc=1; rtl_log_msg "warning" "Failed to create symbolic link \`%s' for package \`%s' w/ parent package \`%s'."\
"${_mirror_dname}/${_pkg_name}" "${_pkg_name}" "${_pkg_name_real}";
fi;
else
if ! _pkg_fname="$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_FNAME")"; then
_pkg_fname="${_pkg_url##*/}";
fi;
- rtl_log_msg info "Mirroring package \`%s', archive URL(s): \`%s'..." "${_pkg_name}" "${_pkg_url}";
+ rtl_log_msg "info" "Mirroring package \`%s', archive URL(s): \`%s'..." "${_pkg_name}" "${_pkg_url}";
if ! rtl_fileop mkdir "${_mirror_dname}/${_pkg_name}"\
|| ! rtl_fetch_url_wget "${_pkg_url}" "${_pkg_sha256sum}" "${_mirror_dname}/${_pkg_name}" "${_pkg_fname}" "${_pkg_name_real}" ""; then
- _rc=1; rtl_log_msg warning "Failed to mirror package \`%s', skipping." "${_pkg_name}";
+ _rc=1; rtl_log_msg "warning" "Failed to mirror package \`%s', skipping." "${_pkg_name}";
else
pkg_fetch_download_clean_dlcache "${_mirror_dname}" "${_pkg_name}" "${_pkg_fname}" "${_pkg_urls_git}";
fi;
@@ -110,20 +110,20 @@ pkgtoolp_mirror_fetch() {
fi;
if _pkg_urls_git="$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_URLS_GIT")"; then
if [ -z "${_mirror_dname_git}" ]; then
- _rc=0; rtl_log_msg notice "Git URL(s) mirroring disabled, skipping \`%s'." "${_pkg_name}";
+ _rc=0; rtl_log_msg "verbose" "Git URL(s) mirroring disabled, skipping \`%s'." "${_pkg_name}";
elif [ "$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_MIRRORS_GIT")" = "skip" ]; then
- _rc=0; rtl_log_msg notice "Package \`%s' specifies to skip Git URL(s) mirroring, skipping." "${_pkg_name}";
+ _rc=0; rtl_log_msg "verbose" "Package \`%s' specifies to skip Git URL(s) mirroring, skipping." "${_pkg_name}";
elif [ "${_pkg_name}" != "${_pkg_name_real}" ]; then
- rtl_log_msg info "Mirroring package \`%s' (parent package: \`%s'), Git URL(s): \`%s'..." "${_pkg_name}" "${_pkg_name_real}" "${_pkg_urls_git}";
+ rtl_log_msg "info" "Mirroring package \`%s' (parent package: \`%s'), Git URL(s): \`%s'..." "${_pkg_name}" "${_pkg_name_real}" "${_pkg_urls_git}";
if ! rtl_fileop ln_symbolic "${_pkg_name_real}" "${_mirror_dname_git}/${_pkg_name}"; then
- _rc=1; rtl_log_msg warning "Failed to create symbolic link \`%s' for package \`%s' w/ parent package \`%s'."\
+ _rc=1; rtl_log_msg "warning" "Failed to create symbolic link \`%s' for package \`%s' w/ parent package \`%s'."\
"${_mirror_dname_git}/${_pkg_name}" "${_pkg_name}" "${_pkg_name_real}";
fi;
else
- rtl_log_msg info "Mirroring package \`%s', Git URL(s): \`%s'..." "${_pkg_name}" "${_pkg_urls_git}";
+ rtl_log_msg "info" "Mirroring package \`%s', Git URL(s): \`%s'..." "${_pkg_name}" "${_pkg_urls_git}";
if ! rtl_fileop mkdir "${_mirror_dname_git}/${_pkg_name}"\
|| ! rtl_fetch_mirror_urls_git "${DEFAULT_GIT_ARGS}" "${_mirror_dname_git}/${_pkg_name}" ${_pkg_urls_git}; then
- _rc=1; rtl_log_msg warning "Failed to mirror package \`%s', skipping." "${_pkg_name}";
+ _rc=1; rtl_log_msg "warning" "Failed to mirror package \`%s', skipping." "${_pkg_name}";
else
pkg_fetch_download_clean_dlcache "${_mirror_dname_git}" "${_pkg_name}" "${_pkg_fname}" "${_pkg_urls_git}";
fi;
@@ -132,7 +132,7 @@ pkgtoolp_mirror_fetch() {
if [ -z "${_pkg_url}" ]\
&& [ -z "${_pkg_sha256sum}" ]\
&& [ -z "${_pkg_urls_git}" ]; then
- _rc=0; rtl_log_msg notice "Package \`%s' has neither archive nor Git URL(s), skipping." "${_pkg_name}";
+ _rc=0; rtl_log_msg "verbose" "Package \`%s' has neither archive nor Git URL(s), skipping." "${_pkg_name}";
fi;
fi; return "${_rc}";
};
@@ -164,7 +164,7 @@ pkgtoolp_rdepends() {
elif ! ex_pkg_unfold_rdepends_direct "${_group_name}" "${_pkg_names}" "${_pkg_name}"; then
_rc=1; _status="Error: failed to unfold reverse dependency-expanded package name list for \`${_pkg_name}'.";
elif [ -z "${EX_PKG_DISABLED}" ] && [ -z "${EX_PKG_RDEPENDS_DIRECT}" ]; then
- rtl_log_msg info "Package \`%s' has no reverse dependencies." "${_pkg_name}";
+ rtl_log_msg "info" "Package \`%s' has no reverse dependencies." "${_pkg_name}";
else for _pkg_name_rdepend in $(rtl_lsort "${EX_PKG_RDEPENDS_DIRECT}"); do
_pkg_rdepends="$(rtl_lconcat "${_pkg_rdepends}" "${_pkg_name_rdepend}")";
if _pkg_depends="$(rtl_lunfold_depends 'PKG_${_name}_DEPENDS' $(rtl_get_var_unsafe -u "PKG_"${_pkg_name}"_DEPENDS"))"\
@@ -173,10 +173,10 @@ pkgtoolp_rdepends() {
fi;
done;
if [ -n "${_pkg_rdepends}" ]; then
- rtl_log_msg info "Reverse dependencies of \`%s': %s" "${_pkg_name}" "${_pkg_rdepends}";
+ rtl_log_msg "info" "Reverse dependencies of \`%s': %s" "${_pkg_name}" "${_pkg_rdepends}";
fi;
if [ -n "${EX_PKG_DISABLED}" ]; then
- rtl_log_msg info "Reverse dependencies of \`%s' (disabled packages:) %s"\
+ rtl_log_msg "info" "Reverse dependencies of \`%s' (disabled packages:) %s"\
"${_pkg_name}" "$(rtl_lsort "${EX_PKG_DISABLED}")";
fi;
fi; return "${_rc}";
@@ -186,11 +186,11 @@ pkgtoolp_shell() {
local _pkg_name="${1}" _rc=0; _status="";
if ! ex_pkg_load_dump "${_pkg_name}" "${BUILD_WORKDIR}"; then
_rc=1; _status="${_status}";
- else rtl_log_env_vars "notice" "package" $(rtl_get_vars_fast "^PKG_");
- rtl_log_msg info "Launching shell \`%s' within package environment and \`%s'." "${SHELL}" "${PKG_BUILD_DIR}";
- rtl_log_msg info "Run \$R to rebuild \`%s'." "${_pkg_name}";
- rtl_log_msg info "Run \$RS <step> to restart the specified build step of \`%s'" "${_pkg_name}";
- rtl_log_msg info "Run \$D to automatically regenerate the patch for \`%s'." "${_pkg_name}";
+ else rtl_log_env_vars "verbose" "package" $(rtl_get_vars_fast "^PKG_");
+ rtl_log_msg "info" "Launching shell \`%s' within package environment and \`%s'." "${SHELL}" "${PKG_BUILD_DIR}";
+ rtl_log_msg "info" "Run \$R to rebuild \`%s'." "${_pkg_name}";
+ rtl_log_msg "info" "Run \$RS <step> to restart the specified build step of \`%s'" "${_pkg_name}";
+ rtl_log_msg "info" "Run \$D to automatically regenerate the patch for \`%s'." "${_pkg_name}";
export ARCH BUILD_KIND \
BUILD_DLCACHEDIR BUILD_WORKDIR \
MAKE="make LIBTOOL=${PKG_LIBTOOL:-slibtool}" \
@@ -225,7 +225,7 @@ pkgtoolp_tarball() {
_pkg_name_full="${_pkg_name}";
fi;
_tarball_fname="${_pkg_name_full}@${_hname}-${_date}.tbz2";
- rtl_log_msg info "Creating compressed tarball of \`%s' and \`%s_stderrout.log'..."\
+ rtl_log_msg "info" "Creating compressed tarball of \`%s' and \`%s_stderrout.log'..."\
"${PKG_BASE_DIR}" "${_pkg_name}";
if ! tar -C "${BUILD_WORKDIR}" -cpf - \
"${PKG_BASE_DIR#${BUILD_WORKDIR%/}/}" \
@@ -233,7 +233,7 @@ pkgtoolp_tarball() {
bzip2 -c -9 - > "${_tarball_fname}"; then
_rc=1; _status="Error: failed to create compressed tarball of \`${PKG_BASE_DIR}' and \`${_pkg_name}_stderrout.log'.";
else
- rtl_log_msg info "Created compressed tarball of \`%s' and \`%s_stderrout.log'."\
+ rtl_log_msg "info" "Created compressed tarball of \`%s' and \`%s_stderrout.log'."\
"${PKG_BASE_DIR}" "${_pkg_name}";
fi;
fi; return "${_rc}";
@@ -266,7 +266,7 @@ pkgtoolp_update_diff() {
elif ! rtl_fileop mv "${_diff_fname_src}" "${MIDIPIX_BUILD_PWD}/patches/${_diff_fname_dst}"; then
_rc=1; _status="Error: failed to rename diff(1) to \`${MIDIPIX_BUILD_PWD}/patches/${_diff_fname_dst}'.";
else trap - EXIT HUP INT TERM USR1 USR2;
- rtl_log_msg info "Updated \`%s/patches/%s'."\
+ rtl_log_msg "info" "Updated \`%s/patches/%s'."\
"${MIDIPIX_BUILD_PWD}" "${_diff_fname_dst}";
fi;
fi;
@@ -290,9 +290,9 @@ pkgtool() {
esac; _rc="${?}";
fi;
if [ "${_rc}" -ne 0 ]; then
- rtl_log_msg fatalexit "${_status}";
+ rtl_log_msg "fatalexit" "${_status}";
elif [ -n "${_status}" ]; then
- rtl_log_msg info "${_status}";
+ rtl_log_msg "info" "${_status}";
fi;
};
diff --git a/subr.rtl/rtl_fetch.subr b/subr.rtl/rtl_fetch.subr
index c8e12d1b..461893b6 100644
--- a/subr.rtl/rtl_fetch.subr
+++ b/subr.rtl/rtl_fetch.subr
@@ -37,30 +37,30 @@ rtl_fetch_url_wget() {
case "${_rc}" in
0) break; ;;
1) if [ "${_urls_count}" -ge 1 ]; then
- rtl_log_msg warning "Warning: failed to acquire fetching lock for URL \`%s', retrying with alternative URL..." "${_url}";
+ rtl_log_msg "warning" "Warning: failed to acquire fetching lock for URL \`%s', retrying with alternative URL..." "${_url}";
else
- rtl_log_msg fatal "Error: failed to acquire fetching lock for URL \`%s'." "${_url}";
+ rtl_log_msg "fatal" "Error: failed to acquire fetching lock for URL \`%s'." "${_url}";
rtl_fileop rm "${_target_fname_full}"; break;
fi; ;;
2) if [ "${_urls_count}" -ge 1 ]; then
- rtl_log_msg warning "Warning: hash mismatch for URL \`%s', retrying with alternative URL... (from build variables: %s.)"\
+ rtl_log_msg "warning" "Warning: hash mismatch for URL \`%s', retrying with alternative URL... (from build variables: %s.)"\
"${_url}" "${_sha256sum_src}";
else
if _sha256sum_target="$(sha256sum "${_target_fname_full}" |\
awk '{print $1}' 2>/dev/null)"; then
- rtl_log_msg fatal "Error: hash mismatch for URL \`%s' (should be: %s vs.: %s.)"\
+ rtl_log_msg "fatal" "Error: hash mismatch for URL \`%s' (should be: %s vs.: %s.)"\
"${_url}" "${_sha256sum_src}" "${_sha256sum_target}";
else
- rtl_log_msg fatal "Error: hash mismatch for URL \`%s' (should be: %s.)"\
+ rtl_log_msg "fatal" "Error: hash mismatch for URL \`%s' (should be: %s.)"\
"${_url}" "${_sha256sum_src}";
fi;
rtl_fileop rm "${_target_fname_full}"; break;
fi; ;;
*) if [ "${_urls_count}" -ge 1 ]; then
- rtl_log_msg warning "Warning: failed to fetch URL \`%s', retrying with alternative URL... (wget(1) exit status: %s)"\
+ rtl_log_msg "warning" "Warning: failed to fetch URL \`%s', retrying with alternative URL... (wget(1) exit status: %s)"\
"${_url}" "$((${_rc}-2))";
else
- rtl_log_msg fatal "Error: failed to fetch URL \`%s' (wget(1) exit status: %s)"\
+ rtl_log_msg "fatal" "Error: failed to fetch URL \`%s' (wget(1) exit status: %s)"\
"${_url}" "$((${_rc}-2))";
rtl_fileop rm "${_target_fname_full}"; break;
fi; ;;
diff --git a/subr.rtl/rtl_fileop.subr b/subr.rtl/rtl_fileop.subr
index d69cead7..4addffcd 100644
--- a/subr.rtl/rtl_fileop.subr
+++ b/subr.rtl/rtl_fileop.subr
@@ -3,10 +3,8 @@
#
#
-# Private globals and subroutines
+# Private subroutines
#
-RTLP_FILEOP_LOG=0;
-rtl_fileop_set_log() { RTLP_FILEOP_LOG="${1}"; };
rtlp_fileop_check() {
local _prefix="${1}" _pname="" _rname=""; shift;
@@ -16,38 +14,38 @@ rtlp_fileop_check() {
};
rtlp_fileop_log() {
- local _msg="${1}";
- if [ "${RTLP_FILEOP_LOG:-0}" -eq 1 ]; then
- rtl_log_msg notice "${_msg}";
- fi;
+ rtl_log_msg "fileop" "${1}";
};
+#
+# Public subroutines
+#
rtl_fileop() {
local _op="${1}" _dst="" _group="" _install_args="" _mode="" _owner="" _rc=0 _src=""; shift;
case "${_op}" in
cd) if [ \( -z "${1}" \) -o ! \( -L "${1}" -o -e "${1}" \) ]; then
- rtl_log_msg fatalexit "Invalid or non-existent directory \`%s'." "${1}";
+ rtl_log_msg "fatalexit" "Error: Invalid or non-existent directory \`%s'." "${1}";
elif rtlp_fileop_check "${PREFIX:-}" "${1}"; then
rtlp_fileop_log "Changing working directory to \`${1}'.";
cd -- "${1}"; _rc="${?}";
fi; ;;
chmod) if [ "${#}" -lt 2 ]; then
- rtl_log_msg fatalexit "Missing parameters (in: chmod %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: chmod %s.)" "${*}";
elif _mode="${1}" && shift\
&& rtlp_fileop_check "${PREFIX:-}" "${*}"; then
rtlp_fileop_log "Changing file mode bits of \`${*}' to \`${_mode}'.";
chmod -- "${_mode}" "${@}"; _rc="${?}";
fi; ;;
chgrp) if [ "${#}" -lt 2 ]; then
- rtl_log_msg fatalexit "Missing parameters (in: chgrp %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: chgrp %s.)" "${*}";
elif _group="${1}" && shift\
&& rtlp_fileop_check "${PREFIX:-}" "${*}"; then
rtlp_fileop_log "Changing file group of \`${*}' to \`${_group}'.";
chgrp -- "${_group}" "${@}"; _rc="${?}";
fi; ;;
chown) if [ "${#}" -lt 2 ]; then
- rtl_log_msg fatalexit "Missing parameters (in: chown %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: chown %s.)" "${*}";
elif _owner="${1}" && shift\
&& rtlp_fileop_check "${PREFIX:-}" "${*}"; then
rtlp_fileop_log "Changing file owner of \`${*}' to \`${_owner}'.";
@@ -55,7 +53,7 @@ rtl_fileop() {
fi; ;;
cp_follow)
if [ "${#}" -lt 2 ]; then
- rtl_log_msg fatalexit "Missing parameters (in: cp_follow %s}.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: cp_follow %s}.)" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${*}"; then
_src="${*}"; _src="${_src% *}";
_dst="${*}"; _dst="${_dst##* }";
@@ -63,7 +61,7 @@ rtl_fileop() {
cp -pLR -- "${@}"; _rc="${?}";
fi; ;;
cp) if [ "${#}" -lt 2 ]; then
- rtl_log_msg fatalexit "Missing parameters (in: cp %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: cp %s.)" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${*}"; then
_src="${*}"; _src="${_src% *}";
_dst="${*}"; _dst="${_dst##* }";
@@ -72,7 +70,7 @@ rtl_fileop() {
fi; ;;
install)
if [ "${#}" -lt 2 ]; then
- rtl_log_msg fatalexit "Missing parameters (in: install %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: install %s.)" "${*}";
else _dst="$(while [ ""${#}"" -gt 2 ]; do shift; done; printf "%s" "${2}")";
_install_args="$(while [ ""${#}"" -gt 2 ]; do printf "%s" "${1}"; shift; done)";
_src="$(while [ ""${#}"" -gt 2 ]; do shift; done; printf "%s" "${1}")";
@@ -83,7 +81,7 @@ rtl_fileop() {
fi; ;;
ln_symbolic)
if [ \( -z "${1}" \) -o \( -z "${2}" \) ]; then
- rtl_log_msg fatalexit "Missing parameters (in: ln_symbolic %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: ln_symbolic %s.)" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${2}"; then
if rtl_fileop test "${2}"; then
rtl_fileop rm "${2}";
@@ -94,13 +92,13 @@ rtl_fileop() {
fi;
fi; ;;
mv) if [ \( -z "${1}" \) -o \( -z "${2}" \) ]; then
- rtl_log_msg fatalexit "Missing parameters (in: mv %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: mv %s.)" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${1}" "${2}"; then
rtlp_fileop_log "Moving \`${1}' to \`${2}' w/ -fs";
mv -f -- "${1}" "${2}"; _rc="${?}";
fi; ;;
touch) if [ -z "${1}" ]; then
- rtl_log_msg fatalexit "Missing parameters (in: touch %s.)" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: touch %s.)" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${1}"; then
rtlp_fileop_log "Touching file \`${1}'${2:+ w/ timestamp \`${2}\'}.";
touch ${2:+-t "${2}"} -- "${1}"; _rc="${?}";
@@ -108,7 +106,7 @@ rtl_fileop() {
mkdir|mkfifo|rm|source|source_opt|test)
while [ \( "${?}" -eq 0 \) -a \( ""${#}"" -gt 0 \) ]; do
if [ -z "${1}" ]; then
- rtl_log_msg fatalexit "Missing parameters (in: %s %s.)" "${_op}" "${*}";
+ rtl_log_msg "fatalexit" "Error: Missing parameters (in: %s %s.)" "${_op}" "${*}";
elif [ "${_op}" = mkdir ]\
&& [ ! -d "${1}" ]\
&& rtlp_fileop_check "${PREFIX:-}" "${1}"; then
@@ -145,7 +143,7 @@ rtl_fileop() {
return 1;
fi; shift;
done; ;;
- *) rtl_log_msg fatalexit "Error: rtl_fileop() called w/ invalid parameter(s): %s" "${*}"; ;;
+ *) rtl_log_msg "fatalexit" "Error: rtl_fileop() called w/ invalid parameter(s): %s" "${*}"; ;;
esac; return "${_rc}";
};
diff --git a/subr.rtl/rtl_install_v2.subr b/subr.rtl/rtl_install_v2.subr
index 6d8881eb..210ade97 100644
--- a/subr.rtl/rtl_install_v2.subr
+++ b/subr.rtl/rtl_install_v2.subr
@@ -261,7 +261,7 @@ rtlp_install_rc() {
if [ "${_rir_nflag}" -eq 1 ]\
|| [ "${_rir_vflag}" -gt 0 ]; then
- rtl_log_msg notice "%s" "${_rir_fn}${_rir_fn:+ ${*}}";
+ rtl_log_msg "install" "%s" "${_rir_fn}${_rir_fn:+ ${*}}";
fi;
if [ "${_rir_nflag}" -eq 0 ]; then
"${_rir_fn}" "${@}"; _rir_rc="${?}";
diff --git a/subr.rtl/rtl_list.subr b/subr.rtl/rtl_list.subr
index e24973e9..07d401b8 100644
--- a/subr.rtl/rtl_list.subr
+++ b/subr.rtl/rtl_list.subr
@@ -143,6 +143,19 @@ rtl_lsearch() {
printf "%s" "${_lnew}";
};
+rtl_lsearch_patternl() {
+ local _list="${1}" _pattern="${2}" _sep="${3:- }" IFS="${3:-${IFS:- }}"\
+ _litem="" _lnew="";
+ if [ -n "${_pattern}" ]; then
+ for _litem in ${_list}; do
+ if [ "${_litem#${_pattern}}" != "${_litem}" ]; then
+ _lnew="${_lnew:+${_lnew}${_sep}}${_litem}";
+ fi;
+ done;
+ fi;
+ printf "%s" "${_lnew}";
+};
+
rtl_lsort() {
local _list="${1}" _sep="${2:- }";
printf "%s" "${_list}" | tr "${_sep}" "\n" | sort | paste -s -d "${_sep}";
diff --git a/subr.rtl/rtl_log.subr b/subr.rtl/rtl_log.subr
index 3e55ab85..0a1e275b 100644
--- a/subr.rtl/rtl_log.subr
+++ b/subr.rtl/rtl_log.subr
@@ -5,15 +5,14 @@
#
# Private globals and subroutines
#
-RTLP_LOG_NO_ATTR=0;
+
RTLP_LOG_FNAME="";
-RTLP_LOG_LVL="0";
-rtl_log_set_fname() { RTLP_LOG_FNAME="${1}"; };
-rtl_log_set_lvl() { RTLP_LOG_LVL="${1}"; };
-rtl_log_set_no_attr() { RTLP_LOG_NO_ATTR="${1}"; };
+RTLP_LOG_NO_ATTR=0;
+RTLP_LOG_TAGS="";
rtlp_log_printf() {
local _attr="${1}" _fmt="${2}"; shift 2; _msg="$(printf "${_fmt}" "${@}")";
+
if [ -n "${RTLP_LOG_FNAME}" ]; then
printf "%s\n" "${_msg}" >> "${RTLP_LOG_FNAME}";
fi;
@@ -21,59 +20,61 @@ rtlp_log_printf() {
printf "\033[0m\033[${_attr}m%s\033[0m\n" "${_msg}";
else
printf "%s\n" "${_msg}";
- fi;
+ fi; return 0;
};
#
-# Public globals
+# Public subroutines
#
-RTL_LOG_MSG_FATAL_COLOUR=91; # Bright red
-RTL_LOG_MSG_WARNING_COLOUR=31; # Dark red
-RTL_LOG_MSG_SUCCESS_COLOUR=33; # Dark yellow
-RTL_LOG_MSG_SUCCESS_END_COLOUR=32; # Dark green
-RTL_LOG_MSG_INFO_COLOUR=93; # Bright yellow
-RTL_LOG_MSG_INFO_END_COLOUR=92; # Bright green
-RTL_LOG_MSG_NOTICE_COLOUR=90; # Dark grey
-RTL_LOG_MSG_VERBOSE_COLOUR=96; # Bright cyan
-RTL_LOG_MSG_DEBUG_COLOUR=36; # Dark cyan
+rtl_log_clear_tags() {
+ RTLP_LOG_TAGS=""; return 0;
+};
+
+rtl_log_enable_tags() {
+ local IFS=","; set -- ${*};
+ while [ "${#}" -gt 0 ]; do
+ if ! rtl_lmatch "${RTLP_LOG_TAGS}" "${1}" ","; then
+ RTLP_LOG_TAGS="${RTLP_LOG_TAGS:+${RTLP_LOG_TAGS},}${1}";
+ fi; shift;
+ done; return 0;
+};
rtl_log_env_vars() {
- local _level="${1}" _type="${2}" _arg_len_max=0; shift 2;
- rtl_log_msg "${_level}" "Variables for this ${_type}:";
+ local _tag="${1}" _type="${2}" _arg_len_max=0; shift 2;
+
+ rtl_log_msg "${_tag}" "Variables for this ${_type}:";
_arg_len_max="$(rtl_lmax "${@}")";
while [ "${#}" -gt 0 ]; do
- rtl_log_msg "${_level}" \
+ rtl_log_msg "${_tag}" \
"%${_arg_len_max}.${_arg_len_max}s=%s" \
"${1%%=*}" "$(rtl_get_var_unsafe "${1#*=}")";
shift;
- done;
+ done; return 0;
};
rtl_log_msg() {
- local _lvl="${1}" _fmt="${2}" _attr=""; shift 2;
- case "${RTLP_LOG_LVL:-0}" in
- -1) rtl_lmatch "info notice verbose debug" "${_lvl}" && return; ;;
- 0) rtl_lmatch "notice verbose debug" "${_lvl}" && return; ;;
- 1) rtl_lmatch "verbose debug" "${_lvl}" && return; ;;
- 2) rtl_lmatch "debug" "${_lvl}" && return; ;;
- 3) ;;
- esac;
- case "${_lvl}" in
- fatal|fatalexit) _attr="${RTL_LOG_MSG_FATAL_COLOUR}"; ;;
- warning) _attr="${RTL_LOG_MSG_WARNING_COLOUR}"; ;;
- success) _attr="${RTL_LOG_MSG_SUCCESS_COLOUR}"; ;;
- success_end) _attr="${RTL_LOG_MSG_SUCCESS_END_COLOUR}"; ;;
- info) _attr="${RTL_LOG_MSG_INFO_COLOUR}"; ;;
- info_end) _attr="${RTL_LOG_MSG_INFO_END_COLOUR}"; ;;
- notice) _attr="${RTL_LOG_MSG_NOTICE_COLOUR}"; ;;
- verbose) _attr="${RTL_LOG_MSG_VERBOSE_COLOUR}"; ;;
- debug) _attr="${RTL_LOG_MSG_DEBUG_COLOUR}"; ;;
- esac;
- rtlp_log_printf "${_attr}" "==> %s ${_fmt}" "$(rtl_date)" "${@}";
- if [ "x${_lvl}" = "xfatalexit" ]; then
- exit 1;
- fi;
+ local _tag="${1}" _fmt="${2}" _attr="" _exitfl=0; shift 2;
+
+ [ "x${_tag}" = "xfatalexit" ] && { _tag="fatal"; _exitfl=1; };
+ if rtl_lmatch "${RTLP_LOG_TAGS}" "${_tag}" ","; then
+ eval _attr='${LOG_TAG_'"${_tag}"':-}';
+ if [ "${#_attr}" -eq 0 ]; then
+ rtlp_log_printf "" "==> FIXME TODO XXX UNKNOWN TAG \`%s' PASSED TO rtl_log_msg()\n" "${_tag}";
+ fi;
+ rtlp_log_printf "${_attr}" "==> %s ${_fmt}" "$(rtl_date)" "${@}";
+ if [ "${_exitfl}" -eq 1 ]; then
+ exit 1;
+ fi;
+ fi; return 0;
+};
+
+rtl_log_set_fname() {
+ RTLP_LOG_FNAME="${1}"; return 0;
+};
+
+rtl_log_set_no_attr() {
+ RTLP_LOG_NO_ATTR="${1}"; return 0;
};
# vim:filetype=sh
diff --git a/subr.rtl/rtl_platform.subr b/subr.rtl/rtl_platform.subr
index d510254a..af3365eb 100644
--- a/subr.rtl/rtl_platform.subr
+++ b/subr.rtl/rtl_platform.subr
@@ -86,9 +86,9 @@ rtl_rc() {
local _nflag="${1}" _cmd="${2}"; shift 2;
case "${_nflag}" in
1) if [ "${#}" -gt 0 ]; then
- rtl_log_msg verbose "Command line: %s %s" "${_cmd}" "${*}";
+ rtl_log_msg "verbose" "Command line: %s %s" "${_cmd}" "${*}";
else
- rtl_log_msg verbose "Command line: %s" "${_cmd}";
+ rtl_log_msg "verbose" "Command line: %s" "${_cmd}";
fi; ;;
*) "${_cmd}" "${@}";
esac;
diff --git a/subr/build_init.subr b/subr/build_init.subr
index c677f3ab..a6939b2a 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -14,18 +14,18 @@ buildp_init_args() {
esac;
if [ "${BUILD_HNAME:+1}" != 1 ]\
&& ! BUILD_HNAME="$(hostname)"; then
- _rc=1; _status="Error: failed to obtain hostname.";
+ _rc=1; _status="failed to obtain hostname.";
elif [ "${ARG_DUMP_ON_ABORT:-0}" -eq 1 ]\
&& [ "${ARG_RELAXED:-0}" -eq 1 ]; then
- _rc=1; _status="Error: --dump-on-abort excludes -R.";
+ _rc=1; _status="--dump-on-abort excludes -R.";
elif [ "${ARG_AS_NEEDED:-0}" -eq 1 ]\
&& [ -e "${PREFIX}/build.gitref" ]\
&& [ "$(git rev-parse HEAD)" = "$(cat "${PREFIX}/build.gitref")" ]; then
_rc=0; _status="Git repository has not changed since last build and --as-needed was specified.";
elif ! ex_pkg_process_restart_spec \$ARG_RESTART \$ARG_RESTART_AT \$ARG_RESTART_RECURSIVE; then
- _rc=1; _status="Error: failed to process -r specification: ${_status}.";
+ _rc=1; _status="failed to process -r specification: ${_status}.";
elif ! ex_pkg_load_groups; then
- _rc=1; _status="Error: failed to load build groups.";
+ _rc=1; _status="failed to load build groups.";
else if ! rtl_lmatch "${ARG_DIST:-}" "rpm" ","\
&& [ "${ARG_DUMP_IN:+1}" != 1 ]\
&& [ "${ARG_DUMP_ON_ABORT:-0}" -eq 0 ]; then
@@ -41,7 +41,7 @@ buildp_init_args() {
if [ "${_foundfl}" -eq 0 ]; then
_foundfl=0; for _group in ${BUILD_GROUPS}; do
if rtl_lmatch "${EX_PKG_BUILD_GROUPS}" "${_group}"; then
- _rc=1; _status="Error: unknown build group \`${_group}'."; break;
+ _rc=1; _status="unknown build group \`${_group}'."; break;
fi;
done;
fi;
@@ -59,8 +59,8 @@ buildp_init_args() {
done;
case "$(rtl_llength "${_pkg_names_unknown}")" in
0) ;;
- 1) _rc=1; _status="Error: unknown package \`${_pkg_names_unknown}'."; ;;
- *) _rc=1; _status="Error: unknown packages: $(rtl_subst "${_pkg_names_unknown}" " " ", ")"; ;;
+ 1) _rc=1; _status="unknown package \`${_pkg_names_unknown}'."; ;;
+ *) _rc=1; _status="unknown packages: $(rtl_subst "${_pkg_names_unknown}" " " ", ")"; ;;
esac;
fi;
fi;
@@ -76,9 +76,14 @@ buildp_init_env() {
printf "Error: failed to set umask(2).\n" >&2; exit 1;
elif ! BUILD_USER="$(id -nu)"; then
printf "Error: failed to obtain username." >&2; exit 1;
- else for _fname in $(find subr.rtl -name *.subr) $(find subr -name *.subr); do
+ else for _fname in \
+ $(find subr.rtl -name *.subr) \
+ $(find subr -name *.subr) \
+ etc/build.theme \
+ ;
+ do
if ! . "${_fname}"; then
- printf "Error: failed to source \`%s'.\n" "${_fname}"; exit 1;
+ printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
fi;
done;
fi; return "${_rc}";
@@ -90,11 +95,11 @@ buildp_init_files() {
if ! rtl_fileop mkdir "${BUILD_DLCACHEDIR}" "${BUILD_WORKDIR}"\
|| rtl_lmatch "${ARG_DIST}" "rpm" ","\
&& ! rtl_fileop mkdir "${PREFIX_RPM}"; then
- _rc=1; _status="Error: cannot create build directories.";
+ _rc=1; _status="cannot create build directories.";
elif [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
- _rc=1; _status="Error: another build targeting this architecture and build type is currently in progress.";
+ _rc=1; _status="another build targeting this architecture and build type is currently in progress.";
elif ! rtl_clean_env "${DEFAULT_CLEAR_ENV_VARS_EXCEPT}"; then
- _rc=1; _status="Error: failed to clean environment.";
+ _rc=1; _status="failed to clean environment.";
elif ! rtl_check_path_vars "${DEFAULT_CHECK_PATH_VARS}"; then
_rc=1; _status="${_status}";
else export TMP="${BUILD_WORKDIR}" TMPDIR="${BUILD_WORKDIR}";
@@ -109,11 +114,11 @@ buildp_init_files() {
fi;
rtl_fileop touch "${DEFAULT_BUILD_LOG_FNAME}"; rtl_log_set_fname "${DEFAULT_BUILD_LOG_FNAME}";
if rtl_lmatch "${ARG_CLEAN_BUILDS}" "prefix" ","; then
- trap "rm -f \"${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}\" 2>/dev/null; rtl_log_msg fatalexit \"Build aborted.\"" HUP INT TERM USR1 USR2;
- rtl_log_msg info "-C prefix specified, cleaning prefix...";
+ trap "rm -f \"${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}\" 2>/dev/null; rtl_log_msg \"fatalexit\" \"Build aborted.\"" HUP INT TERM USR1 USR2;
+ rtl_log_msg "info" "-C prefix specified, cleaning prefix...";
for _pname in ${DEFAULT_CLEAR_PREFIX_PATHS}; do
if ! rtl_fileop rm "${PREFIX}/${_pname}"; then
- _rc=1; _status="Error: failed to remove \`${PREFIX}/${_pname}'."; break;
+ _rc=1; _status="failed to remove \`${PREFIX}/${_pname}'."; break;
fi;
done;
trap - HUP INT TERM USR1 USR2;
@@ -124,12 +129,12 @@ buildp_init_files() {
};
buildp_init_getopts() {
- local _arg="" _level="" _opt="" _rc=0 _shiftfl=0 _verbose=0 OPTIND=0; _status="";
+ local _arg="" _opt="" _rc=0 _shiftfl=0 OPTIND=0; _status="";
: ${ARCH:="nt64"}; : ${BUILD_KIND:="debug"};
ARG_AS_NEEDED=0; ARG_CLEAN_BUILDS=""; ARG_DEBUG_MINIPIX=0; ARG_DIST=""; ARG_DUMP_IN="";
ARG_DUMP_ON_ABORT=0; ARG_FETCH_FORCE=""; ARG_PARALLEL=1; ARG_RELAXED=0; ARG_RESET_PKG=0;
- ARG_RESTART=""; ARG_RESTART_AT=""; ARG_RESTART_RECURSIVE=""; ARG_VERBOSE_LEVELS="";
+ ARG_RESTART=""; ARG_RESTART_AT=""; ARG_RESTART_RECURSIVE=""; ARG_VERBOSE=0; ARG_VERBOSE_TAGS="";
while [ "${#}" -gt 0 ]; do
case "${1}" in
@@ -137,7 +142,7 @@ buildp_init_getopts() {
--dump-in) if [ "${#}" -ge 2 ]; then
ARG_DUMP_IN="${2}"; ARG_DUMP_ON_ABORT=1; _shiftfl=2;
else
- _rc=1; _status="Error: missing argument to option --dump-in.";
+ _rc=1; _status="missing argument to option --dump-in.";
fi; ;;
--dump-on-abort)
ARG_DUMP_ON_ABORT=1; _shiftfl=1; ;;
@@ -150,7 +155,7 @@ buildp_init_getopts() {
fi; exit 0; ;;
--reset-state) ARG_RESET_PKG=1; _shiftfl=1; ;;
-v*) _opt="${1#-}"; while [ -n "${_opt}" ]; do
- : $((_verbose+=1)); _opt="${_opt#?}";
+ : $((ARG_VERBOSE+=1)); _opt="${_opt#?}";
done; _shiftfl=1; ;;
# {{{ --roar
--roar) printf "%s\n" '
@@ -190,12 +195,12 @@ buildp_init_getopts() {
P) ARG_PARALLEL="auto";
if [ -n "${2:-}" ]\
&& rtl_isnumber "${2}"; then
- _rc=1; _status="Error: maximum parallelisation job count is set with the \`-p jobs' option."; break
+ _rc=1; _status="maximum parallelisation job count is set with the \`-p jobs' option."; break
fi; ;;
r) ARG_RESTART="${OPTARG}"; ;;
R) ARG_RELAXED=1; ;;
- x) ARG_VERBOSE_LEVELS="${ARG_VERBOSE_LEVELS:+${ARG_VERBOSE_LEVELS},}xtrace"; ;;
- V) ARG_VERBOSE_LEVELS="${OPTARG}"; ;;
+ x) ARG_VERBOSE_TAGS="${ARG_VERBOSE_TAGS:+${ARG_VERBOSE_TAGS},}xtrace"; ;;
+ V) ARG_VERBOSE_TAGS="${OPTARG}"; ;;
*) cat etc/build.usage.short; exit 1; ;;
esac; shift $((${OPTIND}-1)); OPTIND=1;
else if rtl_match "${1}" "=*"; then
@@ -205,8 +210,8 @@ buildp_init_getopts() {
fi;
case "${_arg}" in
*=*) rtl_set_var_unsafe "${_arg%%=*}" "${_arg#*=}"; ;;
- [!a-zA-Z]*) _rc=1; _status="Error: build group names must start with [a-zA-Z] (in argument \`${_arg}'.)"; ;;
- *[!_a-zA-Z]*) _rc=1; _status="Error: build group names must not contain [!_a-zA-Z] (in argument \`${_arg}'.)"; ;;
+ [!a-zA-Z]*) _rc=1; _status="build group names must start with [a-zA-Z] (in argument \`${_arg}'.)"; ;;
+ *[!_a-zA-Z]*) _rc=1; _status="build group names must not contain [!_a-zA-Z] (in argument \`${_arg}'.)"; ;;
*) BUILD_GROUPS="$(rtl_lconcat "${BUILD_GROUPS}" "${_arg}")"; ;;
esac; shift;
fi;
@@ -214,39 +219,56 @@ buildp_init_getopts() {
if [ "${_rc:-0}" -eq 0 ]; then
case "${ARG_PARALLEL}" in
auto) if ! ARG_PARALLEL="$(rtl_get_cpu_count)"; then
- _rc=1; _status="Error: failed to get CPU count.";
+ _rc=1; _status="failed to get CPU count.";
else
ARG_PARALLEL=$((${ARG_PARALLEL}/2));
fi; ;;
"") ARG_PARALLEL=1; ;;
*) if ! rtl_isnumber "${ARG_PARALLEL}"; then
- _rc=1; _status="Error: invalid jobs count \`${ARG_PARALLEL}'.";
+ _rc=1; _status="invalid jobs count \`${ARG_PARALLEL}'.";
fi; ;;
esac;
if [ "${_rc:-0}" -eq 0 ]; then
DEFAULT_BUILD_CPUS="${ARG_PARALLEL}";
- case "${_verbose:-0}" in
- 0) ;;
- 1) ARG_VERBOSE_LEVELS="${ARG_VERBOSE_LEVELS:+${ARG_VERBOSE_LEVELS},}notice"; ;;
- 2) ARG_VERBOSE_LEVELS="${ARG_VERBOSE_LEVELS:+${ARG_VERBOSE_LEVELS},}verbose"; ;;
- *) _rc=1; _status="Error: invalid verbosity level (max. -vv)"; ;;
- esac;
- rtl_log_set_lvl 0;
- for _level in $(rtl_llift "${ARG_VERBOSE_LEVELS}" "," " "); do
- case "${_level}" in
- notice) rtl_log_set_lvl 1; ;;
- verbose) rtl_log_set_lvl 2; ;;
- build|install|xtrace)
- rtl_log_set_lvl 1; ;;
- fileops) rtl_log_set_lvl 1; rtl_fileop_set_log 1; ;;
- *) _rc=1; _status="Error: invalid verbosity level \`${_level}'"; ;;
- esac;
- done;
fi;
fi;
return "${_rc}";
};
+buildp_init_logging() {
+ local _tag="" _tags="" _rc=0; _status="";
+
+ rtl_log_clear_tags;
+ case "${ARG_VERBOSE}" in
+ 0) [ "${#ARG_VERBOSE_TAGS}" -eq 0 ] && rtl_log_enable_tags "${LOG_TAGS_normal}"; ;;
+ 1) rtl_log_enable_tags "${LOG_TAGS_verbose}"; ;;
+ *) _rc=1; _status="invalid verbosity level (max. -v)"; ;;
+ esac;
+ if [ "${_rc}" -eq 0 ]; then
+ case "${ARG_VERBOSE_TAGS}" in
+ +*) rtl_log_enable_tags "${LOG_TAGS_normal}";
+ ARG_VERBOSE_TAGS="${ARG_VERBOSE_TAGS#+}"; ;;
+ *) ;;
+ esac;
+ for _tag in $(rtl_llift "${ARG_VERBOSE_TAGS}" "," " "); do
+ case "${_tag}" in
+ all) rtl_log_enable_tags "${LOG_TAGS_all}"; ;;
+ clear|none) rtl_log_clear_tags; ;;
+ normal) rtl_log_enable_tags "${LOG_TAGS_normal}"; ;;
+ verbose) rtl_log_enable_tags "${LOG_TAGS_verbose}"; ;;
+ *)
+ _tags="$(rtl_lsearch_patternl "${LOG_TAGS_all}" "${_tag}" ",")";
+ if [ "${#_tags}" -gt 0 ]; then
+ rtl_log_enable_tags "${_tags}";
+ else
+ _rc=1; _status="invalid log tag or tag pattern \`${_tag}'"; break;
+ fi; ;;
+ esac;
+ done;
+ fi;
+ return "${_rc}";
+};
+
buildp_init_prereqs() {
if ! rtl_check_prereqs ${DEFAULT_PREREQS}; then
printf "%s\n" "${_status}" >&2; exit 1;
@@ -262,6 +284,7 @@ build_init() {
local _rc=0; _status="";
if ! buildp_init_env \
|| ! buildp_init_getopts "${@}" \
+ || ! buildp_init_logging \
|| ! ex_pkg_load_vars \
|| ! buildp_init_prereqs \
|| ! buildp_init_args \
@@ -270,4 +293,4 @@ build_init() {
fi; return "${_rc}";
};
-# vim:filetype=sh
+# vim:filetype=sh foldmethod=marker
diff --git a/subr/ex_pkg.subr b/subr/ex_pkg.subr
index 90cdf3ca..f8267f54 100644
--- a/subr/ex_pkg.subr
+++ b/subr/ex_pkg.subr
@@ -21,7 +21,7 @@ ex_pkg_check_depends() {
if ! rtl_lmatch "${_pkg_disabled}" "${_pkg_name_depend}"\
&& ! rtl_lmatch "${_pkg_finished}" "${_pkg_name_depend}"; then
if ! rtl_lmatch "${_pkg_names}" "${_pkg_name_depend}"; then
- rtl_log_msg fatalexit "Error: dependency \`%s' of \`%s' unknown." "${_pkg_name_depend}" "${_pkg_name}";
+ rtl_log_msg "fatalexit" "Error: dependency \`%s' of \`%s' unknown." "${_pkg_name_depend}" "${_pkg_name}";
else
_dependfl=1; break;
fi;
@@ -78,8 +78,8 @@ ex_pkg_get_packages() {
ex_pkg_load_dump() {
local _pkg_name="${1}" _workdir="${2}" _rc=0; _status="";
if [ ! -e "${_workdir}/${_pkg_name}.dump" ]; then
- rtl_log_msg warning "Warning: failed to locate environment dump for package \`%s' in \`%s'." "${_pkg_name}" "${_workdir}";
- rtl_log_msg info "Rebuilding package \`%s' w/ --dump-in build..." "${_pkg_name}";
+ rtl_log_msg "warning" "Warning: failed to locate environment dump for package \`%s' in \`%s'." "${_pkg_name}" "${_workdir}";
+ rtl_log_msg "info" "Rebuilding package \`%s' w/ --dump-in build..." "${_pkg_name}";
(export ARCH BUILD_KIND BUILD_DLCACHEDIR BUILD_WORKDIR \
PREFIX PREFIX_CROSS PREFIX_MINGW32 PREFIX_MINIPIX \
PREFIX_NATIVE PREFIX_ROOT PREFIX_RPM;
@@ -120,7 +120,6 @@ ex_pkg_load_vars() {
../midipix_build.vars \
./midipix.env; do
if [ -r "${_fname}" ]; then
- rtl_log_msg verbose "Sourcing \`%s'." "${_fname}";
rtl_fileop source "${_fname}";
fi;
done;
diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr
index 255aeccc..f91f536b 100644
--- a/subr/ex_pkg_dispatch.subr
+++ b/subr/ex_pkg_dispatch.subr
@@ -230,10 +230,10 @@ ex_pkg_dispatch() {
_perc_group="$(rtl_percentage "${EXP_PKG_DISPATCH_GROUP_CUR}" "${EXP_PKG_DISPATCH_GROUP_MAX}")";
if "${_dispatch_fn}" start_group "${_group_name}" "" "${EXP_PKG_DISPATCH_GROUP_CUR}" "${EXP_PKG_DISPATCH_GROUP_MAX}" "${_perc_group}"; then
if rtl_fileop mkdir "${_workdir}"\
- && rtl_log_msg verbose "Resolving \`%s' dependencies..." "${_group_name}"\
+ && rtl_log_msg "verbose" "Resolving \`%s' dependencies..." "${_group_name}"\
&& exp_pkg_dispatch_expand_packages "${_checkfl}" "${_forcefl}" "${_group_name}" "${_restart}" "${_reversefl}"\
&& exp_pkg_dispatch_complete "${_dispatch_fn}" "${_group_name}" "${EX_PKG_DISABLED}" "${EX_PKG_FINISHED}"\
- && rtl_log_msg verbose "Resolved \`%s' dependencies." "${_group_name}"\
+ && rtl_log_msg "verbose" "Resolved \`%s' dependencies." "${_group_name}"\
&& EXP_PKG_DISPATCH_COUNT_MAX="$(rtl_llength "${EX_PKG_NAMES}")"\
&& [ "${EXP_PKG_DISPATCH_COUNT_MAX}" -gt 0 ]; then
_pkg_names="$(rtl_lconcat "${_pkg_names}" "${EX_PKG_NAMES}")";
diff --git a/subr/ex_pkg_env.subr b/subr/ex_pkg_env.subr
index 8f3cfcb7..5367172c 100644
--- a/subr/ex_pkg_env.subr
+++ b/subr/ex_pkg_env.subr
@@ -26,7 +26,7 @@ exp_pkg_env_defaults() {
if [ -z "${PKG_SUBDIR:-}" ]; then
if [ -n "${PKG_URLS_GIT:-}" ]\
&& [ -n "${PKG_FNAME:-}" ]; then
- rtl_log_msg fatalexit "Error: \${PKG_SUBDIR} must be specified given both \${PKG_FNAME} and \${PKG_URLS_GIT}.";
+ rtl_log_msg "fatalexit" "Error: \${PKG_SUBDIR} must be specified given both \${PKG_FNAME} and \${PKG_URLS_GIT}.";
elif [ -n "${PKG_URLS_GIT:-}" ]; then
PKG_SUBDIR="${PKG_URLS_GIT%%=*}";
else case "${PKG_FNAME:-}" in
diff --git a/subr/pkg_fetch_download.subr b/subr/pkg_fetch_download.subr
index 8a33783f..9cd2fbe0 100644
--- a/subr/pkg_fetch_download.subr
+++ b/subr/pkg_fetch_download.subr
@@ -20,7 +20,7 @@ pkg_fetch_download_clean_dlcache() {
done;
if [ "${_skipfl}" -eq 0 ]; then
_fname="${_dlcachedir}/${_pkg_name}/${_fname}";
- rtl_log_msg verbose "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}";
+ rtl_log_msg "verbose" "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}";
rtl_fileop rm "${_fname}";
fi;
done;
diff --git a/subr/pkg_install_files.subr b/subr/pkg_install_files.subr
index 3280e74d..d387293b 100644
--- a/subr/pkg_install_files.subr
+++ b/subr/pkg_install_files.subr
@@ -14,7 +14,7 @@ pkgp_install_files_v2() {
local _vflag=""; _status="";
if [ -n "${PKG_INSTALL_FILES_V2:-}" ]; then
- if rtl_lmatch "${ARG_VERBOSE_LEVELS}" "install" ","; then
+ if rtl_lmatch "${ARG_VERBOSE_TAGS}" "install" ","; then
_vflag="-v";
fi;
if ! rtl_install_v2 \
@@ -92,7 +92,7 @@ pkgp_install_files_strip() {
if [ "${_stripfl:-0}" -eq 1 ]; then
for _bin_path in $(find "${_tree_root}" -perm /a=x -type f); do
if objdump -sj .debug_frame -j .debug_info "${_bin_path}" >/dev/null 2>&1; then
- rtl_log_msg info "Stripping %s..." "${_bin_path}";
+ rtl_log_msg "pkg_strip" "Stripping %s..." "${_bin_path}";
if ! "${PKG_TARGET}-strip" "${_bin_path}"; then
return 1;
fi;
diff --git a/subr/pkgtool_init.subr b/subr/pkgtool_init.subr
index 1bbcbf75..d7bbd14d 100644
--- a/subr/pkgtool_init.subr
+++ b/subr/pkgtool_init.subr
@@ -10,6 +10,9 @@ pkgtoolp_init_args() {
&& [ -z "${ARG_RESTART_AT}" ]\
&& [ "${ARG_UPDATE_DIFF:-0}" -eq 0 ]; then
cat etc/pkgtool.usage; _rc=1; _status="Error: one of -i, -m and/or -M, -r, -s, or -t must be specified.";
+ elif [ "${BUILD_HNAME:+1}" != 1 ]\
+ && ! BUILD_HNAME="$(hostname)"; then
+ _rc=1; _status="failed to obtain hostname.";
else _rc=0; export TMP="${BUILD_WORKDIR}" TMPDIR="${BUILD_WORKDIR}";
fi; return "${_rc}";
};
@@ -20,7 +23,12 @@ pkgtoolp_init_env() {
printf "Error: failed to change working directory to \`${0%/*}'." >&2; exit 1;
elif ! umask 022; then
printf "Error: failed to set umask(2).\n" >&2; exit 1;
- else for _fname in $(find subr.rtl -name *.subr) $(find subr -name *.subr); do
+ else for _fname in \
+ $(find subr.rtl -name *.subr) \
+ $(find subr -name *.subr) \
+ etc/pkgtool.theme \
+ ;
+ do
if ! . "${_fname}"; then
printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
fi;
@@ -75,8 +83,8 @@ pkgtoolp_init_getopts() {
_rc=1; _status="Error: missing package name.";
else export PKGTOOL_PKG_NAME;
case "${ARG_VERBOSE:-0}" in
- 0) rtl_fileop_set_log 0; rtl_log_set_lvl 0; ;;
- 1) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
+ 0) rtl_log_enable_tags "${LOG_TAGS_normal}"; ;;
+ 1) rtl_log_enable_tags "${LOG_TAGS_verbose}"; ;;
*) _rc=1; _status="Error: invalid verbosity level (max. -v)"; ;;
esac;
fi;