summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-04-05 09:51:27 +0100
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-04-05 09:51:27 +0100
commit5cca78ff4955b2267f69409bf1c4c6cd627a93e6 (patch)
tree90f2c99909a4b0ad8d7f02229b53c865ef5f9caf
parent5daef9b642a90d0e4e15af397d8c4002c31abdd3 (diff)
downloadmidipix_build-5cca78ff4955b2267f69409bf1c4c6cd627a93e6.tar.bz2
midipix_build-5cca78ff4955b2267f69409bf1c4c6cd627a93e6.tar.xz
pkgtool.sh:pkgtoolp_mirror_fetch(), subr/pkgtool_init.subr: implement and honour -v.
etc/{pkgtool.usage,README.md}: updated.
-rw-r--r--etc/README.md3
-rw-r--r--etc/pkgtool.usage3
-rwxr-xr-xpkgtool.sh14
-rw-r--r--subr/pkgtool_init.subr12
4 files changed, 20 insertions, 12 deletions
diff --git a/etc/README.md b/etc/README.md
index ece5eae5..c728addd 100644
--- a/etc/README.md
+++ b/etc/README.md
@@ -379,7 +379,7 @@ for a list of package build steps and how they are overriden.
## 3.5. ``pkgtool.sh``
```
-usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|-r|-s|-t]
+usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|-r|-s|-t] [-v]
[<variable name>=<variable override>[ ..]] name
-a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
@@ -395,6 +395,7 @@ usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|
forcibly aborted and dumped prior to enterting the shell.
-t Produce tarball of package build root directory and build log
file for the purpose of distribution given build failure.
+ -v Increase verbosity.
<variable name>=<variable override>[ ..]
Override build variable.
diff --git a/etc/pkgtool.usage b/etc/pkgtool.usage
index dd991b36..a91c6670 100644
--- a/etc/pkgtool.usage
+++ b/etc/pkgtool.usage
@@ -1,4 +1,4 @@
-usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|-r|-s|-t]
+usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|-r|-s|-t] [-v]
[<variable name>=<variable override>[ ..]] name
-a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64.
@@ -14,6 +14,7 @@ usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|
forcibly aborted and dumped prior to enterting the shell.
-t Produce tarball of package build root directory and build log
file for the purpose of distribution given build failure.
+ -v Increase verbosity.
<variable name>=<variable override>[ ..]
Override build variable.
diff --git a/pkgtool.sh b/pkgtool.sh
index dcfa3abc..94fe57d6 100755
--- a/pkgtool.sh
+++ b/pkgtool.sh
@@ -83,11 +83,11 @@ 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 info "Package \`%s' (parent package: \`%s') disabled, skipping." "${_pkg_name}" "${_pkg_name_real}";
+ rtl_log_msg notice "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 warning "Archive URL(s) mirroring disabled, skipping \`%s'." "${_pkg_name}";
+ _rc=0; rtl_log_msg notice "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}";
if ! rtl_fileop ln_symbolic "${_pkg_name_real}" "${_mirror_dname}/${_pkg_name}"; then
@@ -107,17 +107,17 @@ pkgtoolp_mirror_fetch() {
"${_mirror_dname}/${_pkg_name}" \
-type f \
-not -name "${_pkg_fname}" \
- -not -name "${_pkg_fname}.fetch*"); do
- rtl_log_msg info "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}";
+ -not -name "${_pkg_fname}.fetched"); do
+ rtl_log_msg notice "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}";
rtl_fileop rm "${_fname}";
done;
fi;
fi;
elif _pkg_url="$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_URLS_GIT")"; then
if [ -z "${_mirror_dname_git}" ]; then
- _rc=0; rtl_log_msg warning "Git URL(s) mirroring disabled, skipping \`%s'." "${_pkg_name}";
+ _rc=0; rtl_log_msg notice "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 warning "Package \`%s' specifies to skip Git URL(s) mirroring, skipping." "${_pkg_name}";
+ _rc=0; rtl_log_msg notice "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_url}";
if ! rtl_fileop ln_symbolic "${_pkg_name_real}" "${_mirror_dname_git}/${_pkg_name}"; then
@@ -132,7 +132,7 @@ pkgtoolp_mirror_fetch() {
fi;
fi;
else
- _rc=0; rtl_log_msg warning "Package \`%s' has neither archive nor Git URL(s), skipping." "${_pkg_name}";
+ _rc=0; rtl_log_msg notice "Package \`%s' has neither archive nor Git URL(s), skipping." "${_pkg_name}";
fi;
fi; return "${_rc}";
};
diff --git a/subr/pkgtool_init.subr b/subr/pkgtool_init.subr
index 00a7367b..b7c04c70 100644
--- a/subr/pkgtool_init.subr
+++ b/subr/pkgtool_init.subr
@@ -30,8 +30,8 @@ pkgtoolp_init_env() {
pkgtoolp_init_getopts() {
local _opt="" _shiftfl=0 _rc=0 OPTIND=0; _status=""; : ${ARCH:="nt64"}; : ${BUILD_KIND:="debug"};
- ARG_INFO=0; ARG_MIRROR=0; ARG_MIRROR_DNAME=""; ARG_MIRROR_DNAME_GIT="";
- ARG_RESTART_AT=""; ARG_RDEPENDS=0; ARG_UPDATE_DIFF=0; ARG_SHELL=0; ARG_TARBALL=0;
+ ARG_INFO=0; ARG_MIRROR=0; ARG_MIRROR_DNAME=""; ARG_MIRROR_DNAME_GIT=""; ARG_RESTART_AT="";
+ ARG_RDEPENDS=0; ARG_UPDATE_DIFF=0; ARG_SHELL=0; ARG_TARBALL=0; ARG_VERBOSE=0;
while [ "${#}" -gt 0 ]; do
case "${1}" in
--update-diff)
@@ -49,7 +49,7 @@ pkgtoolp_init_getopts() {
break;
elif [ "${_shiftfl:-0}" -gt 0 ]; then
shift "${_shiftfl}"; continue;
- elif getopts a:b:him:M:rst _opt; then
+ elif getopts a:b:him:M:rstv _opt; then
case "${_opt}" in
a) ARCH="${OPTARG}"; ;;
b) BUILD_KIND="${OPTARG}"; ;;
@@ -60,6 +60,7 @@ pkgtoolp_init_getopts() {
r) ARG_RDEPENDS=1; ;;
s) ARG_SHELL=1; ;;
t) ARG_TARBALL=1; ;;
+ v) ARG_VERBOSE=1; ;;
*) cat etc/pkgtool.usage; exit 1; ;;
esac; shift $((${OPTIND}-1)); OPTIND=1;
else case "${1}" in
@@ -73,6 +74,11 @@ pkgtoolp_init_getopts() {
&& [ "${ARG_MIRROR:-0}" -eq 0 ]; then
_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; ;;
+ *) _rc=1; _status="Error: invalid verbosity level (max. -v)"; ;;
+ esac;
fi;
fi; return "${_rc}";
};