diff options
-rw-r--r-- | etc/README.md | 5 | ||||
-rw-r--r-- | etc/pkgtool.usage | 5 | ||||
-rwxr-xr-x | pkgtool.sh | 21 | ||||
-rw-r--r-- | subr/pkgtool_init.subr | 10 |
4 files changed, 25 insertions, 16 deletions
diff --git a/etc/README.md b/etc/README.md index ef53ca8b..ece5eae5 100644 --- a/etc/README.md +++ b/etc/README.md @@ -379,13 +379,14 @@ 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 <dname1>,<dname2>|-r|-s|-t] +usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|-r|-s|-t] [<variable name>=<variable override>[ ..]] 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. - -m <dname1>,<dname2> Setup package archives mirror in <dname1> and Git repositories mirror in <dname2> + -m <dname> Setup package archives mirror in <dname> and/or + -M <dname> Setup Git repositories mirror in <dname> -r List reverse dependencies of single named package. -s Enter interactive package build shell environment for single named package; requires a package dump file. If the package diff --git a/etc/pkgtool.usage b/etc/pkgtool.usage index 0ebc5acf..dd991b36 100644 --- a/etc/pkgtool.usage +++ b/etc/pkgtool.usage @@ -1,10 +1,11 @@ -usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname1>,<dname2>|-r|-s|-t] +usage: ./pkgtool.sh [-a nt32|nt64] [-b debug|release] [-i|-m <dname> -M <dname>|-r|-s|-t] [<variable name>=<variable override>[ ..]] 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. - -m <dname1>,<dname2> Setup package archives mirror in <dname1> and Git repositories mirror in <dname2> + -m <dname> Setup package archives mirror in <dname> and/or + -M <dname> Setup Git repositories mirror in <dname> -r List reverse dependencies of single named package. -s Enter interactive package build shell environment for single named package; requires a package dump file. If the package @@ -51,15 +51,16 @@ pkgtoolp_info() { }; pkgtoolp_mirror() { - local _mirror_dnames="${1}" _group_name="" _mirror_dname="" _mirror_dname_git=""\ - _pkg_name="" _pkg_parent="" _rc=0; + local _mirror_dname="${1}" _mirror_dname_git="${2}" _group_name="" _pkg_name="" _pkg_parent="" _rc=0; - rtl_lassign "_mirror_dname _mirror_dname_git" "," "${_mirror_dnames}"; umask 022; + umask 022; if ! ex_pkg_load_groups; then _rc=1; _status="Error: failed to load build groups."; - elif ! rtl_fileop mkdir "${_mirror_dname}"; then + elif [ -n "${_mirror_dname}" ]\ + && ! rtl_fileop mkdir "${_mirror_dname}"; then _rc=1; _status="Error: failed to create \`${_mirror_dname}'."; - elif ! rtl_fileop mkdir "${_mirror_dname_git}"; then + elif [ -n "${_mirror_dname_git}" ]\ + && ! rtl_fileop mkdir "${_mirror_dname_git}"; then _rc=1; _status="Error: failed to create \`${_mirror_dname_git}'."; else for _group_name in ${EX_PKG_BUILD_GROUPS}; do for _pkg_name in $(ex_pkg_get_packages "${_group_name}"); do @@ -83,7 +84,9 @@ pkgtoolp_mirror_fetch() { rtl_log_msg info "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 [ "${_pkg_name}" != "${_pkg_name_real}" ]; then + if [ -z "${_mirror_dname}" ]; then + _rc=0; rtl_log_msg warning "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 _rc=1; rtl_log_msg warning "Failed to create symbolic link \`%s' for package \`%s' w/ parent package \`%s'."\ @@ -100,7 +103,9 @@ pkgtoolp_mirror_fetch() { fi; fi; elif _pkg_url="$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_URLS_GIT")"; then - if [ "$(rtl_get_var_unsafe -u "PKG_${_pkg_name_real}_MIRRORS_GIT")" = "skip" ]; then + if [ -z "${_mirror_dname_git}" ]; then + _rc=0; rtl_log_msg warning "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}"; 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}"; @@ -265,7 +270,7 @@ pkgtool() { _rc=1; _status="${_status}"; else case "1" in "${ARG_INFO:-0}") pkgtoolp_info "${PKGTOOL_PKG_NAME}"; ;; - "${ARG_MIRROR:-0}") pkgtoolp_mirror "${ARG_MIRROR_DNAME}"; ;; + "${ARG_MIRROR:-0}") pkgtoolp_mirror "${ARG_MIRROR_DNAME}" "${ARG_MIRROR_DNAME_GIT}"; ;; "${ARG_RDEPENDS:-0}") pkgtoolp_rdepends "${PKGTOOL_PKG_NAME}"; ;; "${ARG_RESTART_AT:+1}") pkgtoolp_restart_at "${PKGTOOL_PKG_NAME}"; ;; "${ARG_SHELL:-0}") pkgtoolp_shell "${PKGTOOL_PKG_NAME}"; ;; diff --git a/subr/pkgtool_init.subr b/subr/pkgtool_init.subr index b33795ee..00a7367b 100644 --- a/subr/pkgtool_init.subr +++ b/subr/pkgtool_init.subr @@ -5,11 +5,11 @@ pkgtoolp_init_args() { local _rc=0; _status=""; if [ "$((${ARG_INFO:-0} + ${ARG_MIRROR:-0} + ${ARG_RDEPENDS:-0} + ${ARG_SHELL:-0} + ${ARG_TARBALL:-0}))" -gt 1 ]; then - cat etc/pkgtool.usage; _rc=1; _status="Error: only one of -i, -r, -s, or -t must be specified."; + cat etc/pkgtool.usage; _rc=1; _status="Error: only one of -i, -m and/or -M, -r, -s, or -t must be specified."; elif [ "$((${ARG_INFO:-0} + ${ARG_MIRROR:-0} + ${ARG_RDEPENDS:-0} + ${ARG_SHELL:-0} + ${ARG_TARBALL:-0}))" -eq 0 ]\ && [ -z "${ARG_RESTART_AT}" ]\ && [ "${ARG_UPDATE_DIFF:-0}" -eq 0 ]; then - cat etc/pkgtool.usage; _rc=1; _status="Error: one of -i, -m, -r, -s, or -t must be specified."; + cat etc/pkgtool.usage; _rc=1; _status="Error: one of -i, -m and/or -M, -r, -s, or -t must be specified."; else _rc=0; export TMP="${BUILD_WORKDIR}" TMPDIR="${BUILD_WORKDIR}"; fi; return "${_rc}"; }; @@ -30,7 +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_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; while [ "${#}" -gt 0 ]; do case "${1}" in --update-diff) @@ -48,13 +49,14 @@ pkgtoolp_init_getopts() { break; elif [ "${_shiftfl:-0}" -gt 0 ]; then shift "${_shiftfl}"; continue; - elif getopts a:b:him:rst _opt; then + elif getopts a:b:him:M:rst _opt; then case "${_opt}" in a) ARCH="${OPTARG}"; ;; b) BUILD_KIND="${OPTARG}"; ;; h) cat etc/pkgtool.usage; exit 0; ;; i) ARG_INFO=1; ;; m) ARG_MIRROR=1; ARG_MIRROR_DNAME="${OPTARG}"; ;; + M) ARG_MIRROR=1; ARG_MIRROR_DNAME_GIT="${OPTARG}"; ;; r) ARG_RDEPENDS=1; ;; s) ARG_SHELL=1; ;; t) ARG_TARBALL=1; ;; |