diff options
-rw-r--r-- | etc/README.md | 4 | ||||
-rw-r--r-- | etc/pkgtool.usage | 4 | ||||
-rwxr-xr-x | pkgtool.sh | 105 |
3 files changed, 70 insertions, 43 deletions
diff --git a/etc/README.md b/etc/README.md index 7c486d49..39b60b1e 100644 --- a/etc/README.md +++ b/etc/README.md @@ -921,11 +921,11 @@ usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[ ```
usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|-p|-r|-R|-t]
[--theme theme] [-v]
- [<variable name>=<variable override>[ ..]] name
+ [<variable name>=<variable override>[ ..]] name[,name..]
-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.
- -i List package variables and dependencies of single named package.
+ -i List package variables and dependencies of named package(s).
-m <dname> Setup package archives mirror in <dname> and/or
-M <dname> Setup Git repositories mirror in <dname>
Specify "" or '' as <dname> to default to the defaults in
diff --git a/etc/pkgtool.usage b/etc/pkgtool.usage index 47f1daa1..b998bab7 100644 --- a/etc/pkgtool.usage +++ b/etc/pkgtool.usage @@ -1,10 +1,10 @@ [97musage[90m: [33m./[93mpkgtool.sh [90m[[33m-[93ma nt32[90m|[93mnt64[90m] [[33m-[93mb [93mdebug[90m|[93mrelease[90m] [[33m-[93mi[90m|[33m-[93mm [90m<[93mdname[90m> [33m-[93mM [90m<[93mdname[90m>|[33m-[93mp[90m|[33m-[93mr[90m|[33m-[93mR[90m|[33m-[93mt[90m][0m [90m[[93m--theme theme[90m] [90m[[33m-[93mv[90m][0m - [90m[<[93mvariable name[90m>[93m=[90m<[93mvariable override[90m>[ ..]] [93mname[90m + [90m[<[93mvariable name[90m>[93m=[90m<[93mvariable override[90m>[ ..]] [93mname[90m[,[93mname[90m..][0m [33m-[93ma nt32[90m|[93mnt64[0m [96mSelects 32-bit or 64-bit architecture; defaults to [93mnt64[96m.[0m [33m-[93mb debug[90m|[93mrelease[0m [96mSelects debug or release build kind; defaults to [93mdebug[96m.[0m - [33m-[93mi [96mList package variables and dependencies of single named package.[0m + [33m-[93mi [96mList package variables and dependencies of named package(s).[0m [33m-[93mm [90m<[93mdname[90m> [96mSetup package archives mirror in [90m<[93mdname[90m>[96m and/or[0m [33m-[93mM [90m<[93mdname[90m> [96mSetup Git repositories mirror in [90m<[93mdname[90m>[0m [96mSpecify "" or '' as <dname> to default to the defaults in[0m @@ -209,77 +209,104 @@ pkgtoolp_init_getopts_fn() { # {{{ pkgtoolp_info($_rstatus, $_pkg_name) pkgtoolp_info() { - local _ppi_rstatus="${1}" _ppi_pkg_name="${2}" \ - _ppi_fname="" _ppi_group_fname="" _ppi_group_name="" _ppi_groups="" \ - _ppi_groups_noauto="" _ppi_patch_idx=0 _ppi_pkg_disabled="" \ - _ppi_pkg_finished="" _ppi_pkg_name_uc="" _ppi_pkg_names="" _ppi_rc=0; - rtl_toupper2 \$_ppi_pkg_name \$_ppi_pkg_name_uc; + local _ppi_rstatus="${1}" _ppi_pkg_name_list="${2}" \ + _ppi_groups="" _ppi_groups_noauto="" \ + _ppi_pkg_name="" _ppi_rc=0 _ppi_rc_single=0 \ + _ppi_status=""; + rtl_llift \$_ppi_pkg_name_list "," " "; if ! ex_pkg_load_groups \$_ppi_groups \$_ppi_groups_noauto; then _ppi_rc=1; rtl_setrstatus "${_ppi_rstatus}" 'Error: failed to load build groups.'; - elif ! ex_pkg_find_package \$_ppi_group_name "${_ppi_groups}" "${_ppi_pkg_name}"; then - _ppi_rc=1; - rtl_setrstatus "${_ppi_rstatus}" 'Error: unknown package \`'"${_ppi_pkg_name}'"'.'; - elif ! ex_pkg_get_packages \$_ppi_pkg_names "${_ppi_group_name}"; then - _ppi_rc=1; - rtl_setrstatus "${_ppi_rstatus}" 'Error: failed to expand package list of build group \`'"${_ppi_group_name}'"'.'; + else + for _ppi_pkg_name in ${_ppi_pkg_name_list}; do + pkgtoolp_info_single \ + "${_ppi_rstatus}" "${_ppi_pkg_name}" \ + "${_ppi_groups}" "${_ppi_groups_noauto}"; + _ppi_rc_single="${?}"; + if [ "${_ppi_rc_single}" -ne 0 ]; then + _ppi_rc="${_ppi_rc_single}"; + eval _ppi_status="\${${_ppi_rstatus#\$}}"; + rtl_log_msgV "fatal" "0;${_ppi_status}"; + fi; + done; + fi; + + if [ "${_ppi_rc}" -ne 0 ]; then + rtl_setrstatus "${_ppi_rstatus}" 'Failure in one or more package(s).'; + fi; + return "${_ppi_rc}"; +}; +# }}} +# {{{ pkgtoolp_info_single($_rstatus, $_pkg_name) +pkgtoolp_info_single() { + local _ppis_rstatus="${1}" _ppis_pkg_name="${2}" _ppis_groups="${3}" _ppis_groups_noauto="${4}" \ + _ppis_fname="" _ppis_group_fname="" _ppis_group_name="" _ppis_patch_idx=0 _ppis_pkg_disabled="" \ + _ppis_pkg_finished="" _ppis_pkg_name_uc="" _ppis_pkg_names="" _ppis_rc=0; + rtl_toupper2 \$_ppis_pkg_name \$_ppis_pkg_name_uc; + + if ! ex_pkg_find_package \$_ppis_group_name "${_ppis_groups}" "${_ppis_pkg_name}"; then + _ppis_rc=1; + rtl_setrstatus "${_ppis_rstatus}" 'Error: unknown package \`'"${_ppis_pkg_name}'"'.'; + elif ! ex_pkg_get_packages \$_ppis_pkg_names "${_ppis_group_name}"; then + _ppis_rc=1; + rtl_setrstatus "${_ppis_rstatus}" 'Error: failed to expand package list of build group \`'"${_ppis_group_name}'"'.'; elif ! ex_pkg_env "${DEFAULT_BUILD_STEPS}" "${DEFAULT_BUILD_VARS}"\ - "${_ppi_group_name}" "${_ppi_pkg_name}" "" "${BUILD_WORKDIR}"; then - _ppi_rc=1; - rtl_setrstatus "${_ppi_rstatus}" 'Error: failed to set package environment for \`'"${_ppi_pkg_name}'"'.'; + "${_ppis_group_name}" "${_ppis_pkg_name}" "" "${BUILD_WORKDIR}"; then + _ppis_rc=1; + rtl_setrstatus "${_ppis_rstatus}" 'Error: failed to set package environment for \`'"${_ppis_pkg_name}'"'.'; else - rtl_get_var_unsafe \$_ppi_group_fname -u "PKG_${_ppi_pkg_name}_GROUP_FNAME"; - rtl_get_var_unsafe \$_ppi_pkg_version -u "PKG_${_ppi_pkg_name}_VERSION"; - rtl_log_env_vars "package_vars" "Package variables" $(rtl_get_vars_unsafe_fast "^PKG_${_ppi_pkg_name_uc}"); - rtl_log_msgV "info_build_group" "${MSG_info_build_group}" "${_ppi_group_name}" "${_ppi_group_fname}"; + rtl_get_var_unsafe \$_ppis_group_fname -u "PKG_${_ppis_pkg_name}_GROUP_FNAME"; + rtl_get_var_unsafe \$_ppis_pkg_version -u "PKG_${_ppis_pkg_name}_VERSION"; + rtl_log_env_vars "package_vars" "Package variables" $(rtl_get_vars_unsafe_fast "^PKG_${_ppis_pkg_name_uc}"); + rtl_log_msgV "info_build_group" "${MSG_info_build_group}" "${_ppis_group_name}" "${_ppis_group_fname}"; if [ "${PKG_DISABLED:-0}" -eq 1 ]; then - rtl_log_msgV "info_pkg_disabled" "${MSG_info_pkg_disabled}" "${_ppi_pkg_name}"; + rtl_log_msgV "info_pkg_disabled" "${MSG_info_pkg_disabled}" "${_ppis_pkg_name}"; fi; if [ "${PKG_DEPENDS:+1}" != 1 ]; then - rtl_log_msgV "info_pkg_no_deps" "${MSG_info_pkg_no_deps}" "${_ppi_pkg_name}"; + rtl_log_msgV "info_pkg_no_deps" "${MSG_info_pkg_no_deps}" "${_ppis_pkg_name}"; else - rtl_log_msgV "info_pkg_direct_deps" "${MSG_info_pkg_direct_deps}" "${_ppi_pkg_name}" "${PKG_DEPENDS}"; + rtl_log_msgV "info_pkg_direct_deps" "${MSG_info_pkg_direct_deps}" "${_ppis_pkg_name}" "${PKG_DEPENDS}"; if ! ex_pkg_unfold_depends \ - \$_ppi_pkg_disabled \$_ppi_pkg_finished \ - \$_ppi_pkg_names 1 1 "${_ppi_group_name}" \ - "${_ppi_pkg_names}" "${_ppi_pkg_name}" 0 \ + \$_ppis_pkg_disabled \$_ppis_pkg_finished \ + \$_ppis_pkg_names 1 1 "${_ppis_group_name}" \ + "${_ppis_pkg_names}" "${_ppis_pkg_name}" 0 \ "${BUILD_WORKDIR}"; then - rtl_log_msgV "warning" "${MSG_info_pkg_deps_fail}" "${_ppi_pkg_name}"; + rtl_log_msgV "warning" "${MSG_info_pkg_deps_fail}" "${_ppis_pkg_name}"; else - rtl_lfilter \$_ppi_pkg_names "${_ppi_pkg_name}"; + rtl_lfilter \$_ppis_pkg_names "${_ppis_pkg_name}"; - if [ "${_ppi_pkg_names:+1}" = 1 ]; then + if [ "${_ppis_pkg_names:+1}" = 1 ]; then rtl_log_msgV "info_pkg_deps_full" "${MSG_info_pkg_deps_full}"\ - "${_ppi_pkg_name}" "$(rtl_lsortV "${_ppi_pkg_names}")"; + "${_ppis_pkg_name}" "$(rtl_lsortV "${_ppis_pkg_names}")"; fi; - if [ "${_ppi_pkg_disabled:+1}" = 1 ]; then + if [ "${_ppis_pkg_disabled:+1}" = 1 ]; then rtl_log_msgV "info_pkg_deps_full_disabled" "${MSG_info_pkg_deps_full_disabled}"\ - "${_ppi_pkg_name}" "$(rtl_lsortV "${_ppi_pkg_disabled}")"; + "${_ppis_pkg_name}" "$(rtl_lsortV "${_ppis_pkg_disabled}")"; fi; fi; fi; - _ppi_patch_idx=1; + _ppis_patch_idx=1; while ex_pkg_get_default \ - \$_ppi_fname "${_ppi_patch_idx}" \ - "${_ppi_pkg_name}" \ - "${_ppi_pkg_version}" \ + \$_ppis_fname "${_ppis_patch_idx}" \ + "${_ppis_pkg_name}" \ + "${_ppis_pkg_version}" \ "vars_file patches_pre patches" \ - && [ "${_ppi_fname:+1}" = 1 ]; + && [ "${_ppis_fname:+1}" = 1 ]; do - : $((_ppi_patch_idx += 1)); - if [ -e "${_ppi_fname}" ]; then - sha256sum "${_ppi_fname}"; + : $((_ppis_patch_idx += 1)); + if [ -e "${_ppis_fname}" ]; then + sha256sum "${_ppis_fname}"; fi; done; fi; - return "${_ppi_rc}"; + return "${_ppis_rc}"; }; # }}} # {{{ pkgtoolp_mirror($_rstatus, $_mirror_dname, $_mirror_dname_git) |