|
Lucio Andrés Illanes Albornoz |
8a27f9 |
#!/bin/sh
|
|
|
185480 |
# Copyright (c) 2020, 2021, 2022, 2023 LucĂa Andrea Illanes Albornoz <lucia@luciaillanes.de>
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
#
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
|
|
|
e9fa07 |
# {{{ pkgtoolp_init($_rstatus)
|
|
|
e9fa07 |
pkgtoolp_init() {
|
|
|
e9fa07 |
local _pi_rstatus="${1#\$}" \
|
|
|
e9fa07 |
_pi_args_long="" \
|
|
|
e9fa07 |
_pi_name_base="pkgtool" \
|
|
|
b570fd |
_pi_optstring="a:b:ehim:M:p:rRtv" \
|
|
|
e9fa07 |
_pi_prereqs="
|
|
|
e9fa07 |
awk bzip2 cat chmod cp date find grep hostname mkdir
|
|
|
e9fa07 |
mktemp mv paste printf readlink rm sed sort tar test
|
|
|
e9fa07 |
touch tr uniq" \
|
|
|
e9fa07 |
_pi_fname="" _pi_rc=0;
|
|
|
e9fa07 |
shift;
|
|
|
e9fa07 |
|
|
|
afd086 |
if [ -e "${HOME}/pkgtool.vars" ]; then
|
|
|
afd086 |
. "${HOME}/pkgtool.vars" || exit 1;
|
|
|
afd086 |
fi;
|
|
|
afd086 |
|
|
|
e9fa07 |
if ! . "${0%/*}/subr.ex/ex_init.subr"; then
|
|
|
e9fa07 |
_pi_rc=1;
|
|
|
e9fa07 |
_pi_status='failed to source \`'"${0%/*}/subr/ex_init.subr"\';
|
|
|
e9fa07 |
eval ${_pi_rstatus}=\"${_pi_status}\";
|
|
|
e9fa07 |
elif ! ex_init_help \
|
|
|
e9fa07 |
"${_pi_rstatus}" "${_pi_args_long}" \
|
|
|
e9fa07 |
"${_pi_name_base}" "${_pi_optstring}" "${@}" \
|
|
|
e9fa07 |
|| ! ex_init_env \
|
|
|
e9fa07 |
"${_pi_rstatus}" \$BUILD_HNAME \$BUILD_USER \
|
|
|
e9fa07 |
"${_pi_name_base}" \
|
|
|
e9fa07 |
|| ! ex_init_getopts \
|
|
|
e9fa07 |
"${_pi_rstatus}" "pkgtoolp_init_getopts_fn" \
|
|
|
e9fa07 |
"${_pi_optstring}" "${@}" \
|
|
|
3a7f9a |
|| ! ex_init_theme \
|
|
|
d982c0 |
"${_pi_rstatus}" "${BUILD_HNAME}" \
|
|
|
d982c0 |
"${_pi_name_base}" "${ARG_THEME:-}" \
|
|
|
e9fa07 |
|| ! ex_init_prereqs "${_pi_rstatus}" "${_pi_prereqs}" \
|
|
|
f6f7f2 |
|| ! ex_pkg_load_vars \
|
|
|
1aa81c |
"${_pi_rstatus}" \$ARCH \$BUILD_KIND \
|
|
|
e9fa07 |
|| ! pkgtoolp_init_args "${_pi_rstatus}";
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
_pi_rc=1;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
return "${_pi_rc}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
# }}}
|
|
|
e9fa07 |
# {{{ pkgtoolp_init_args($_rstatus)
|
|
|
e9fa07 |
pkgtoolp_init_args() {
|
|
|
e9fa07 |
local _ppia_rstatus="${1#\$}" \
|
|
|
e9fa07 |
_ppia_rc=0;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "$((${ARG_INFO:-0}
|
|
|
b570fd |
+ ${ARG_EDIT:-0}
|
|
|
e9fa07 |
+ ${ARG_MIRROR:-0}
|
|
|
9d89ab |
+ ${ARG_PROFILE:-0}
|
|
|
e9fa07 |
+ ${ARG_RDEPENDS:-0}
|
|
|
e9fa07 |
+ ${ARG_RDEPENDS_FULL:-0}
|
|
|
e9fa07 |
+ ${ARG_TARBALL:-0}))" -gt 1 ];
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
cat etc/pkgtool.usage;
|
|
|
e9fa07 |
_ppia_rc=1;
|
|
|
9d89ab |
rtl_setrstatus "${_ppia_rstatus}" 'only one of -i, -m and/or -M, -p, -r, -R, -s, or -t must be specified.';
|
|
|
e9fa07 |
elif [ "$((${ARG_INFO:-0}
|
|
|
b570fd |
+ ${ARG_EDIT:-0}
|
|
|
e9fa07 |
+ ${ARG_MIRROR:-0}
|
|
|
9d89ab |
+ ${ARG_PROFILE:-0}
|
|
|
e9fa07 |
+ ${ARG_RDEPENDS:-0}
|
|
|
e9fa07 |
+ ${ARG_RDEPENDS_FULL:-0}
|
|
|
e9fa07 |
+ ${ARG_TARBALL:-0}))" -eq 0 ];
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
cat etc/pkgtool.usage;
|
|
|
e9fa07 |
_ppia_rc=1;
|
|
|
9d89ab |
rtl_setrstatus "${_ppia_rstatus}" 'one of -i, -m and/or -M, -p, -r, -R, -s, or -t must be specified.';
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
_ppia_rc=0;
|
|
|
e9fa07 |
export TMP="${BUILD_WORKDIR}" TMPDIR="${BUILD_WORKDIR}";
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return "${_ppia_rc}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
# }}}
|
|
|
e9fa07 |
# {{{ pkgtoolp_init_getopts_fn(...)
|
|
|
e9fa07 |
pkgtoolp_init_getopts_fn() {
|
|
|
e9fa07 |
local _ppigf_rc=0 _ppigf_shiftfl=0;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
case "${1}" in
|
|
|
e9fa07 |
init)
|
|
|
e9fa07 |
local _ppigf_verb="${1}" _ppigf_rstatus="${2#\$}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
: ${ARCH:="nt64"};
|
|
|
e9fa07 |
: ${BUILD_KIND:="debug"};
|
|
|
e9fa07 |
|
|
|
b570fd |
ARG_INFO=0; ARG_EDIT=0; ARG_MIRROR=0; ARG_RDEPENDS=0;
|
|
|
afd086 |
ARG_RDEPENDS_FULL=0; ARG_TARBALL=0; ARG_VERBOSE=0;
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
longopt)
|
|
|
3a7f9a |
local _ppigf_verb="${1}" _ppigf_rstatus="${2#\$}" _ppigf_opt="${3}";
|
|
|
3a7f9a |
|
|
|
3a7f9a |
case "${_ppigf_opt}" in
|
|
|
3a7f9a |
--theme) shift 3;
|
|
|
3a7f9a |
if [ "${#}" != 1 ]; then
|
|
|
3a7f9a |
rtl_setrstatus "${_ppigf_rstatus}" 'missing argument to --theme option';
|
|
|
3a7f9a |
return 1;
|
|
|
3a7f9a |
else
|
|
|
3a7f9a |
ARG_THEME="${1:-}"; _ppigf_shiftfl=2;
|
|
|
3a7f9a |
fi;
|
|
|
3a7f9a |
;;
|
|
|
3a7f9a |
|
|
|
3a7f9a |
*) _ppigf_shiftfl=0; ;;
|
|
|
3a7f9a |
esac;
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
opt)
|
|
|
e9fa07 |
local _ppigf_verb="${1}" _ppigf_rstatus="${2#\$}" \
|
|
|
e9fa07 |
_ppigf_opt="${3}" _ppigf_optarg="${4:-}";
|
|
|
e9fa07 |
shift 4;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
case "${_ppigf_opt}" in
|
|
|
e9fa07 |
a) ARCH="${OPTARG}"; _ppigf_shiftfl=2; ;;
|
|
|
e9fa07 |
b) BUILD_KIND="${OPTARG}"; _ppigf_shiftfl=2; ;;
|
|
|
e9fa07 |
h) cat etc/pkgtool.usage; exit 0; ;;
|
|
|
b570fd |
e) ARG_EDIT=1; _ppigf_shiftfl=1; ;;
|
|
|
e9fa07 |
i) ARG_INFO=1; _ppigf_shiftfl=1; ;;
|
|
|
afd086 |
m) ARG_MIRROR=1;
|
|
|
afd086 |
if [ "${OPTARG:+1}" = 1 ]; then
|
|
|
afd086 |
ARG_MIRROR_DNAME="${OPTARG}";
|
|
|
afd086 |
elif [ "${ARG_MIRROR_DNAME:+1}" != 1 ]; then
|
|
|
afd086 |
rtl_setrstatus "${_ppigf_rstatus}" 'missing -m argument and no default present.';
|
|
|
afd086 |
fi;
|
|
|
afd086 |
_ppigf_shiftfl=2; ;;
|
|
|
afd086 |
M) ARG_MIRROR=1;
|
|
|
afd086 |
if [ "${OPTARG:+1}" = 1 ]; then
|
|
|
afd086 |
ARG_MIRROR_DNAME_GIT="${OPTARG}";
|
|
|
afd086 |
elif [ "${ARG_MIRROR_DNAME_GIT:+1}" != 1 ]; then
|
|
|
afd086 |
rtl_setrstatus "${_ppigf_rstatus}" 'missing -M argument and no default present.';
|
|
|
afd086 |
fi;
|
|
|
afd086 |
_ppigf_shiftfl=2; ;;
|
|
|
9d89ab |
p) ARG_PROFILE=1;
|
|
|
9d89ab |
if [ "${OPTARG:+1}" = 1 ]; then
|
|
|
9d89ab |
ARG_PROFILE_LOG_FNAME="${OPTARG}";
|
|
|
9d89ab |
else
|
|
|
9d89ab |
rtl_setrstatus "${_ppigf_rstatus}" 'missing -p argument.';
|
|
|
9d89ab |
fi;
|
|
|
9d89ab |
_ppigf_shiftfl=2; ;;
|
|
|
e9fa07 |
r) ARG_RDEPENDS=1; _ppigf_shiftfl=1; ;;
|
|
|
e9fa07 |
R) ARG_RDEPENDS_FULL=1; _ppigf_shiftfl=1; ;;
|
|
|
e9fa07 |
t) ARG_TARBALL=1; _ppigf_shiftfl=1; ;;
|
|
|
e9fa07 |
v) ARG_VERBOSE=1; _ppigf_shiftfl=1; ;;
|
|
|
e9fa07 |
*) cat etc/pkgtool.usage; exit 1; ;;
|
|
|
e9fa07 |
esac;
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
nonopt)
|
|
|
e9fa07 |
local _ppigf_verb="${1}" _ppigf_rstatus="${2#\$}";
|
|
|
e9fa07 |
shift 2;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
case "${1}" in
|
|
|
4243a1 |
*=*) rtl_set_var_from_spec "${_ppigf_rstatus}" "${1}";
|
|
|
f6f7f2 |
_ppigf_rc="${?}"; ;;
|
|
|
e9fa07 |
*) PKGTOOL_PKG_NAME="${1}"; ;;
|
|
|
e9fa07 |
esac;
|
|
|
f6f7f2 |
|
|
|
f6f7f2 |
if [ "${_ppigf_rc}" -ne 0 ]; then
|
|
|
f6f7f2 |
return "${_ppigf_rc}";
|
|
|
f6f7f2 |
else
|
|
|
f6f7f2 |
_ppigf_shiftfl=1;
|
|
|
f6f7f2 |
fi;
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
done)
|
|
|
e9fa07 |
local _ppigf_verb="${1}" _ppigf_rstatus="${2#\$}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${PKGTOOL_PKG_NAME:+1}" != 1 ]\
|
|
|
9d89ab |
&& [ "${ARG_MIRROR:-0}" -eq 0 ]\
|
|
|
9d89ab |
&& [ "${ARG_PROFILE:-0}" -eq 0 ]; then
|
|
|
e9fa07 |
_ppigf_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppigf_rstatus}" 'missing package name.';
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
export PKGTOOL_PKG_NAME;
|
|
|
e9fa07 |
case "${ARG_VERBOSE:-0}" in
|
|
|
e9fa07 |
|
|
|
4243a1 |
0) rtl_log_enable_tagsV "${LOG_TAGS_normal}"; ;;
|
|
|
4243a1 |
1) rtl_log_enable_tagsV "${LOG_TAGS_verbose}"; ;;
|
|
|
e9fa07 |
*) _ppigf_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppigf_rstatus}" 'invalid verbosity level (max. -v)';
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
esac;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_ppigf_rc}" -ne 0 ]; then
|
|
|
e9fa07 |
return "${_ppigf_rc}";
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
*)
|
|
|
e9fa07 |
return 1;
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
esac;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_ppigf_shiftfl}" -ge 1 ]; then
|
|
|
e9fa07 |
return "$((${_ppigf_shiftfl} + 1))";
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
return 0;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return "${_ppigf_rc}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
# }}}
|
|
|
e9fa07 |
|
|
|
b570fd |
# {{{ pkgtoolp_edit($_rstatus, $_pkg_name)
|
|
|
b570fd |
pkgtoolp_edit() {
|
|
|
94ccc0 |
local _ppe_rstatus="${1}" _ppe_pkg_name="${2}" \
|
|
|
94ccc0 |
_ppe_fname="" _ppe_group_fname="" _ppe_group_fname_nline="" _ppe_group_name="" \
|
|
|
94ccc0 |
_ppe_patch_idx=0 _ppe_pkg_disabled="" _ppe_pkg_finished="" _ppe_pkg_name_uc="" \
|
|
|
94ccc0 |
_ppe_pkg_names="" _ppe_pkg_vars="" _ppe_rc=0;
|
|
|
b570fd |
rtl_toupper2 \$_ppe_pkg_name \$_ppe_pkg_name_uc;
|
|
|
b570fd |
|
|
|
b570fd |
if ! ex_pkg_load_groups \$_ppe_groups \$_ppe_groups_noauto; then
|
|
|
b570fd |
_ppi_rc=1;
|
|
|
b570fd |
rtl_setrstatus "${_ppi_rstatus}" 'Error: failed to load build groups.';
|
|
|
b570fd |
elif ! ex_pkg_find_package \$_ppe_group_name "${_ppe_groups}" "${_ppe_pkg_name}"; then
|
|
|
b570fd |
_ppe_rc=1;
|
|
|
b570fd |
rtl_setrstatus "${_ppe_rstatus}" 'Error: unknown package \`'"${_ppe_pkg_name}'"'.';
|
|
|
b570fd |
elif ! ex_pkg_get_packages \$_ppe_pkg_names "${_ppe_group_name}"; then
|
|
|
b570fd |
_ppe_rc=1;
|
|
|
b570fd |
rtl_setrstatus "${_ppe_rstatus}" 'Error: failed to expand package list of build group \`'"${_ppe_group_name}'"'.';
|
|
|
b570fd |
elif ! ex_pkg_env "${DEFAULT_BUILD_STEPS}" "${DEFAULT_BUILD_VARS}"\
|
|
|
b570fd |
"${_ppe_group_name}" "${_ppe_pkg_name}" "" "${BUILD_WORKDIR}"; then
|
|
|
b570fd |
_ppe_rc=1;
|
|
|
b570fd |
rtl_setrstatus "${_ppe_rstatus}" 'Error: failed to set package environment for \`'"${_ppe_pkg_name}'"'.';
|
|
|
b570fd |
else
|
|
|
b570fd |
rtl_get_var_unsafe \$_ppe_group_fname -u "PKG_${_ppe_pkg_name}_GROUP_FNAME";
|
|
|
b570fd |
|
|
|
b570fd |
case "${EDITOR}" in
|
|
|
b570fd |
"")
|
|
|
b570fd |
rtl_setrstatus "${_ppe_rstatus}" 'Error: \${EDITOR} unset.';
|
|
|
b570fd |
;;
|
|
|
b570fd |
|
|
|
94ccc0 |
nano)
|
|
|
94ccc0 |
_ppe_group_fname_nline="$( \
|
|
|
94ccc0 |
grep -n "PKG_${_ppe_pkg_name_uc}_" "${_ppe_group_fname}" |\
|
|
|
94ccc0 |
awk -F: 'NR == 1 { print $1 }')";
|
|
|
94ccc0 |
"${EDITOR}" \
|
|
|
94ccc0 |
${_ppe_group_fname_nline:+"+${_ppe_group_fname_nline}"} \
|
|
|
94ccc0 |
"${_ppe_group_fname}"
|
|
|
94ccc0 |
_ppe_rc="${?}";
|
|
|
94ccc0 |
;;
|
|
|
94ccc0 |
|
|
|
b570fd |
vi|vim|nvi|nvim)
|
|
|
b570fd |
"${EDITOR}" "${_ppe_group_fname}" "+/PKG_${_ppe_pkg_name_uc}_/";
|
|
|
b570fd |
_ppe_rc="${?}";
|
|
|
b570fd |
;;
|
|
|
b570fd |
*)
|
|
|
b570fd |
"${EDITOR}" "${_ppe_group_fname}";
|
|
|
b570fd |
_ppe_rc="${?}";
|
|
|
b570fd |
;;
|
|
|
b570fd |
esac;
|
|
|
b570fd |
fi;
|
|
|
b570fd |
|
|
|
b570fd |
return "${_ppe_rc}";
|
|
|
b570fd |
};
|
|
|
b570fd |
# }}}
|
|
|
e9fa07 |
# {{{ pkgtoolp_info($_rstatus, $_pkg_name)
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
pkgtoolp_info() {
|
|
|
a790c7 |
local _ppi_rstatus="${1}" _ppi_pkg_name_list="${2}" \
|
|
|
a790c7 |
_ppi_groups="" _ppi_groups_noauto="" \
|
|
|
a790c7 |
_ppi_pkg_name="" _ppi_rc=0 _ppi_rc_single=0 \
|
|
|
a790c7 |
_ppi_status="";
|
|
|
a790c7 |
rtl_llift \$_ppi_pkg_name_list "," " ";
|
|
|
e9fa07 |
|
|
|
6a630d |
if ! ex_pkg_load_groups \$_ppi_groups \$_ppi_groups_noauto; then
|
|
|
e9fa07 |
_ppi_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppi_rstatus}" 'Error: failed to load build groups.';
|
|
|
a790c7 |
else
|
|
|
a790c7 |
for _ppi_pkg_name in ${_ppi_pkg_name_list}; do
|
|
|
a790c7 |
pkgtoolp_info_single \
|
|
|
a790c7 |
"${_ppi_rstatus}" "${_ppi_pkg_name}" \
|
|
|
a790c7 |
"${_ppi_groups}" "${_ppi_groups_noauto}";
|
|
|
a790c7 |
_ppi_rc_single="${?}";
|
|
|
a790c7 |
if [ "${_ppi_rc_single}" -ne 0 ]; then
|
|
|
a790c7 |
_ppi_rc="${_ppi_rc_single}";
|
|
|
a790c7 |
eval _ppi_status="\${${_ppi_rstatus#\$}}";
|
|
|
a790c7 |
rtl_log_msgV "fatal" "0;${_ppi_status}";
|
|
|
a790c7 |
fi;
|
|
|
a790c7 |
done;
|
|
|
a790c7 |
fi;
|
|
|
a790c7 |
|
|
|
a790c7 |
if [ "${_ppi_rc}" -ne 0 ]; then
|
|
|
a790c7 |
rtl_setrstatus "${_ppi_rstatus}" 'Failure in one or more package(s).';
|
|
|
a790c7 |
fi;
|
|
|
a790c7 |
return "${_ppi_rc}";
|
|
|
a790c7 |
};
|
|
|
a790c7 |
# }}}
|
|
|
a790c7 |
# {{{ pkgtoolp_info_single($_rstatus, $_pkg_name)
|
|
|
a790c7 |
pkgtoolp_info_single() {
|
|
|
a790c7 |
local _ppis_rstatus="${1}" _ppis_pkg_name="${2}" _ppis_groups="${3}" _ppis_groups_noauto="${4}" \
|
|
|
a790c7 |
_ppis_fname="" _ppis_group_fname="" _ppis_group_name="" _ppis_patch_idx=0 _ppis_pkg_disabled="" \
|
|
|
f36700 |
_ppis_pkg_finished="" _ppis_pkg_name_uc="" _ppis_pkg_names="" _ppis_pkg_vars="" _ppis_rc=0;
|
|
|
a790c7 |
rtl_toupper2 \$_ppis_pkg_name \$_ppis_pkg_name_uc;
|
|
|
a790c7 |
|
|
|
a790c7 |
if ! ex_pkg_find_package \$_ppis_group_name "${_ppis_groups}" "${_ppis_pkg_name}"; then
|
|
|
a790c7 |
_ppis_rc=1;
|
|
|
a790c7 |
rtl_setrstatus "${_ppis_rstatus}" 'Error: unknown package \`'"${_ppis_pkg_name}'"'.';
|
|
|
a790c7 |
elif ! ex_pkg_get_packages \$_ppis_pkg_names "${_ppis_group_name}"; then
|
|
|
a790c7 |
_ppis_rc=1;
|
|
|
a790c7 |
rtl_setrstatus "${_ppis_rstatus}" 'Error: failed to expand package list of build group \`'"${_ppis_group_name}'"'.';
|
|
Lucio Andrés Illanes Albornoz |
b6a9a1 |
elif ! ex_pkg_env "${DEFAULT_BUILD_STEPS}" "${DEFAULT_BUILD_VARS}"\
|
|
|
a790c7 |
"${_ppis_group_name}" "${_ppis_pkg_name}" "" "${BUILD_WORKDIR}"; then
|
|
|
a790c7 |
_ppis_rc=1;
|
|
|
a790c7 |
rtl_setrstatus "${_ppis_rstatus}" 'Error: failed to set package environment for \`'"${_ppis_pkg_name}'"'.';
|
|
|
e9fa07 |
else
|
|
|
a790c7 |
rtl_get_var_unsafe \$_ppis_group_fname -u "PKG_${_ppis_pkg_name}_GROUP_FNAME";
|
|
|
a790c7 |
rtl_get_var_unsafe \$_ppis_pkg_version -u "PKG_${_ppis_pkg_name}_VERSION";
|
|
|
34eeaf |
ex_pkg_get_package_vars \$_ppis_pkg_vars "${DEFAULT_BUILD_VARS}" "${_ppis_pkg_name}";
|
|
|
f36700 |
rtl_log_env_vars "package_vars" "Package variables" ${_ppis_pkg_vars};
|
|
|
a790c7 |
rtl_log_msgV "info_build_group" "${MSG_info_build_group}" "${_ppis_group_name}" "${_ppis_group_fname}";
|
|
|
16909c |
|
|
|
16909c |
if [ "${PKG_DISABLED:-0}" -eq 1 ]; then
|
|
|
a790c7 |
rtl_log_msgV "info_pkg_disabled" "${MSG_info_pkg_disabled}" "${_ppis_pkg_name}";
|
|
|
16909c |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${PKG_DEPENDS:+1}" != 1 ]; then
|
|
|
a790c7 |
rtl_log_msgV "info_pkg_no_deps" "${MSG_info_pkg_no_deps}" "${_ppis_pkg_name}";
|
|
|
e9fa07 |
else
|
|
|
a790c7 |
rtl_log_msgV "info_pkg_direct_deps" "${MSG_info_pkg_direct_deps}" "${_ppis_pkg_name}" "${PKG_DEPENDS}";
|
|
|
e9fa07 |
if ! ex_pkg_unfold_depends \
|
|
|
a790c7 |
\$_ppis_pkg_disabled \$_ppis_pkg_finished \
|
|
|
a790c7 |
\$_ppis_pkg_names 1 1 "${_ppis_group_name}" \
|
|
|
a790c7 |
"${_ppis_pkg_names}" "${_ppis_pkg_name}" 0 \
|
|
|
e9fa07 |
"${BUILD_WORKDIR}";
|
|
|
e9fa07 |
then
|
|
|
a790c7 |
rtl_log_msgV "warning" "${MSG_info_pkg_deps_fail}" "${_ppis_pkg_name}";
|
|
|
e9fa07 |
else
|
|
|
a790c7 |
rtl_lfilter \$_ppis_pkg_names "${_ppis_pkg_name}";
|
|
|
e9fa07 |
|
|
|
a790c7 |
if [ "${_ppis_pkg_names:+1}" = 1 ]; then
|
|
|
4243a1 |
rtl_log_msgV "info_pkg_deps_full" "${MSG_info_pkg_deps_full}"\
|
|
|
a790c7 |
"${_ppis_pkg_name}" "$(rtl_lsortV "${_ppis_pkg_names}")";
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
fi;
|
|
|
e9fa07 |
|
|
|
a790c7 |
if [ "${_ppis_pkg_disabled:+1}" = 1 ]; then
|
|
|
4243a1 |
rtl_log_msgV "info_pkg_deps_full_disabled" "${MSG_info_pkg_deps_full_disabled}"\
|
|
|
a790c7 |
"${_ppis_pkg_name}" "$(rtl_lsortV "${_ppis_pkg_disabled}")";
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
fi;
|
|
|
e9fa07 |
|
|
|
a790c7 |
_ppis_patch_idx=1;
|
|
|
138059 |
while ex_pkg_get_default \
|
|
|
a790c7 |
\$_ppis_fname "${_ppis_patch_idx}" \
|
|
|
a790c7 |
"${_ppis_pkg_name}" \
|
|
|
a790c7 |
"${_ppis_pkg_version}" \
|
|
|
138059 |
"vars_file patches_pre patches" \
|
|
|
a790c7 |
&& [ "${_ppis_fname:+1}" = 1 ];
|
|
|
e9fa07 |
do
|
|
|
a790c7 |
: $((_ppis_patch_idx += 1));
|
|
|
a790c7 |
if [ -e "${_ppis_fname}" ]; then
|
|
|
a790c7 |
sha256sum "${_ppis_fname}";
|
|
Lucio Andrés Illanes Albornoz |
1dd6a3 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
1dd6a3 |
done;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
a790c7 |
return "${_ppis_rc}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
# }}}
|
|
|
e9fa07 |
# {{{ pkgtoolp_mirror($_rstatus, $_mirror_dname, $_mirror_dname_git)
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
pkgtoolp_mirror() {
|
|
|
e9fa07 |
local _ppm_rstatus="${1}" _ppm_mirror_dname="${2}" _ppm_mirror_dname_git="${3}" \
|
|
|
e9fa07 |
_ppm_group_name="" _ppm_groups="" _ppm_groups_noauto="" _ppm_pkg_name="" \
|
|
|
24c714 |
_ppm_pkg_names="" _ppm_pkg_parent="" _ppm_pkgs_failed="" _ppm_rc=0;
|
|
Lucio Andrés Illanes Albornoz |
368962 |
|
|
Lucio Andrés Illanes Albornoz |
22d139 |
umask 022;
|
|
|
e9fa07 |
rtl_subst \$_ppm_mirror_dname "~" "${HOME}";
|
|
|
e9fa07 |
rtl_subst \$_ppm_mirror_dname_git "~" "${HOME}";
|
|
|
e9fa07 |
|
|
|
6a630d |
if ! ex_pkg_load_groups \$_ppm_groups \$_ppm_groups_noauto; then
|
|
|
e9fa07 |
_ppm_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppm_rstatus}" 'Error: failed to load build groups.';
|
|
|
e9fa07 |
elif [ "${_ppm_mirror_dname:+1}" = 1 ]\
|
|
|
e9fa07 |
&& ! rtl_fileop mkdir "${_ppm_mirror_dname}"; then
|
|
|
e9fa07 |
_ppm_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppm_rstatus}" 'Error: failed to create \`${_ppm_mirror_dname}'"'"'.';
|
|
|
e9fa07 |
elif [ "${_ppm_mirror_dname_git:+1}" = 1 ]\
|
|
|
e9fa07 |
&& ! rtl_fileop mkdir "${_ppm_mirror_dname_git}"; then
|
|
|
e9fa07 |
_ppm_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppm_rstatus}" 'Error: failed to create \`${_ppm_mirror_dname_git}'"'"'.';
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
for _ppm_group_name in ${_ppm_groups}; do
|
|
|
e9fa07 |
ex_pkg_get_packages \$_ppm_pkg_names "${_ppm_group_name}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
for _ppm_pkg_name in ${_ppm_pkg_names}; do
|
|
|
e9fa07 |
rtl_get_var_unsafe \$_ppm_pkg_parent -u "PKG_${_ppm_pkg_name}_INHERIT_FROM";
|
|
|
e9fa07 |
if ! pkgtoolp_mirror_fetch \
|
|
|
e9fa07 |
"${_ppm_rstatus}" "${_ppm_mirror_dname}" \
|
|
|
e9fa07 |
"${_ppm_mirror_dname_git}" "${_ppm_pkg_name}" \
|
|
|
24c714 |
"${_ppm_pkg_parent:-${_ppm_pkg_name}}" \
|
|
|
24c714 |
\$_ppm_pkgs_failed;
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
_ppm_rc=1;
|
|
|
24c714 |
rtl_setrstatus "${_ppm_rstatus}" 'Warning: failed to mirror one or more packages: '"${_ppm_pkgs_failed}";
|
|
Lucio Andrés Illanes Albornoz |
368962 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
done;
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
done;
|
|
|
e9fa07 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
|
|
|
e9fa07 |
return "${_ppm_rc}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
# }}}
|
|
|
24c714 |
# {{{ pkgtoolp_mirror_fetch($_rstatus, $_mirror_dname, $_mirror_dname_git, $_pkg_name, $_pkg_name_real, $_rpkgs_failed)
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
pkgtoolp_mirror_fetch() {
|
|
|
e9fa07 |
local _ppmf_rstatus="${1}" _ppmf_mirror_dname="${2}" _ppmf_mirror_dname_git="${3}" _ppmf_pkg_name="${4}" \
|
|
|
24c714 |
_ppmf_pkg_name_real="${5}" _ppmf_rpkgs_failed="${6#\$}" \
|
|
|
e9fa07 |
_ppmf_fname="" _ppmf_pkg_disabled=0 _ppmf_pkg_fname="" _ppmf_pkg_mirrors_git="" _ppmf_pkg_sha256sum="" \
|
|
|
e9fa07 |
_ppmf_pkg_url="" _ppmf_pkg_urls_git="" _ppmf_rc=0;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if rtl_get_var_unsafe \$_ppmf_pkg_disabled -u "PKG_${_ppmf_pkg_name_real}_DISABLED"\
|
|
|
e9fa07 |
&& [ "${_ppmf_pkg_disabled:-0}" -eq 1 ]; then
|
|
|
4243a1 |
rtl_log_msgV "verbose" "${MSG_mirror_pkg_disabled}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}";
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
if rtl_get_var_unsafe \$_ppmf_pkg_url -u "PKG_${_ppmf_pkg_name_real}_URL"\
|
|
|
7869da |
&& rtl_get_var_unsafe \$_ppmf_pkg_sha256sum -u "PKG_${_ppmf_pkg_name_real}_SHA256SUM"\
|
|
|
7869da |
&& [ "${_ppmf_pkg_url:+1}" = 1 ]\
|
|
|
7869da |
&& [ "${_ppmf_pkg_sha256sum:+1}" = 1 ];
|
|
|
7869da |
then
|
|
|
7869da |
|
|
|
e9fa07 |
if [ "${_ppmf_mirror_dname:+1}" != 1 ]; then
|
|
|
4243a1 |
_ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_archive_mirror}" "${_ppmf_pkg_name}";
|
|
|
7869da |
|
|
|
e9fa07 |
elif [ "${_ppmf_pkg_name}" != "${_ppmf_pkg_name_real}" ]; then
|
|
|
4243a1 |
rtl_log_msgV "mirror_pkg_archive_mirroring_parent" "${MSG_mirror_pkg_archive_mirroring_parent}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}" "${_ppmf_pkg_url}";
|
|
|
e9fa07 |
if ! rtl_fileop ln_symbolic "${_ppmf_pkg_name_real}" "${_ppmf_mirror_dname}/${_ppmf_pkg_name}"; then
|
|
|
4243a1 |
_ppmf_rc=1; rtl_log_msgV "warning" "${MSG_mirror_pkg_link_fail}"\
|
|
|
e9fa07 |
"${_ppmf_mirror_dname}/${_ppmf_pkg_name}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}";
|
|
Lucio Andrés Illanes Albornoz |
368962 |
fi;
|
|
|
7869da |
|
|
Lucio Andrés Illanes Albornoz |
a50e83 |
else
|
|
|
aec528 |
if rtl_get_var_unsafe \$_ppmf_pkg_fname -u "PKG_${_ppmf_pkg_name_real}_FNAME"\
|
|
|
aec528 |
&& [ "${_ppmf_pkg_fname:+1}" != 1 ]; then
|
|
|
e9fa07 |
_ppmf_pkg_fname="${_ppmf_pkg_url##*/}";
|
|
Lucio Andrés Illanes Albornoz |
fe3fd1 |
fi;
|
|
|
4243a1 |
rtl_log_msgV "mirror_pkg_archive_mirroring" "${MSG_mirror_pkg_archive_mirroring}" "${_ppmf_pkg_name}" "${_ppmf_pkg_url}";
|
|
|
aec528 |
|
|
|
e9fa07 |
if ! rtl_fileop mkdir "${_ppmf_mirror_dname}/${_ppmf_pkg_name}"\
|
|
|
aec528 |
|| ! rtl_fetch_url_wget \
|
|
|
aec528 |
"${_ppmf_pkg_url}" \
|
|
|
aec528 |
"${_ppmf_pkg_sha256sum}" \
|
|
|
aec528 |
"${_ppmf_mirror_dname}/${_ppmf_pkg_name}" \
|
|
|
aec528 |
"${_ppmf_pkg_fname}" "${_ppmf_pkg_name_real}" \
|
|
|
aec528 |
"";
|
|
|
aec528 |
then
|
|
|
24c714 |
_ppmf_rc=1;
|
|
|
4243a1 |
rtl_log_msgV "warning" "${MSG_mirror_pkg_mirror_fail}" "${_ppmf_pkg_name}";
|
|
|
24c714 |
rtl_lconcat "${_ppmf_rpkgs_failed}" "${_ppmf_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
5daef9 |
else
|
|
|
aec528 |
rtl_fetch_clean_dlcache \
|
|
|
aec528 |
"${_ppmf_mirror_dname}" \
|
|
|
aec528 |
"${_ppmf_pkg_name}" \
|
|
|
aec528 |
"${_ppmf_pkg_fname}" \
|
|
|
aec528 |
"${_ppmf_pkg_urls_git}";
|
|
Lucio Andrés Illanes Albornoz |
368962 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
a50e83 |
fi;
|
|
|
7869da |
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
fi;
|
|
|
e9fa07 |
|
|
|
7869da |
if rtl_get_var_unsafe \$_ppmf_pkg_urls_git -u "PKG_${_ppmf_pkg_name_real}_URLS_GIT"\
|
|
|
7869da |
&& [ "${_ppmf_pkg_urls_git:+1}" = 1 ];
|
|
|
7869da |
then
|
|
|
7869da |
|
|
|
e9fa07 |
if [ "${_ppmf_mirror_dname_git:+1}" != 1 ]; then
|
|
|
4243a1 |
_ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_git_mirror}" "${_ppmf_pkg_name}";
|
|
|
7869da |
|
|
|
e9fa07 |
elif rtl_get_var_unsafe \$_ppmf_pkg_mirrors_git -u "PKG_${_ppmf_pkg_name_real}_MIRRORS_GIT"\
|
|
|
e9fa07 |
&& [ "${_ppmf_pkg_mirrors_git}" = "skip" ]; then
|
|
|
4243a1 |
_ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_git_mirror_disabled}" "${_ppmf_pkg_name}";
|
|
|
7869da |
|
|
|
e9fa07 |
elif [ "${_ppmf_pkg_name}" != "${_ppmf_pkg_name_real}" ]; then
|
|
|
4243a1 |
rtl_log_msgV "mirror_pkg_git_mirroring_parent" "${MSG_mirror_pkg_git_mirroring_parent}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}" "${_ppmf_pkg_urls_git}";
|
|
|
e9fa07 |
if ! rtl_fileop ln_symbolic "${_ppmf_pkg_name_real}" "${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}"; then
|
|
|
24c714 |
_ppmf_rc=1;
|
|
|
4243a1 |
rtl_log_msgV "warning" "${MSG_mirror_pkg_link_fail}" \
|
|
|
24c714 |
"${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}";
|
|
|
24c714 |
rtl_lconcat "${_ppmf_rpkgs_failed}" "${_ppmf_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
368962 |
fi;
|
|
|
7869da |
|
|
Lucio Andrés Illanes Albornoz |
a50e83 |
else
|
|
|
4243a1 |
rtl_log_msgV "mirror_pkg_git_mirroring" "${MSG_mirror_pkg_git_mirroring}" "${_ppmf_pkg_name}" "${_ppmf_pkg_urls_git}";
|
|
|
e9fa07 |
if ! rtl_fileop mkdir "${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}"\
|
|
|
e9fa07 |
|| ! rtl_fetch_mirror_urls_git "${DEFAULT_GIT_ARGS}" "${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}" ${_ppmf_pkg_urls_git}; then
|
|
|
24c714 |
_ppmf_rc=1;
|
|
|
4243a1 |
rtl_log_msgV "warning" "${MSG_mirror_pkg_mirror_fail}" "${_ppmf_pkg_name}";
|
|
|
24c714 |
rtl_lconcat "${_ppmf_rpkgs_failed}" "${_ppmf_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
else
|
|
|
e9fa07 |
rtl_fetch_clean_dlcache "${_ppmf_mirror_dname_git}" "${_ppmf_pkg_name}" "${_ppmf_pkg_fname}" "${_ppmf_pkg_urls_git}";
|
|
Lucio Andrés Illanes Albornoz |
368962 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
a50e83 |
fi;
|
|
|
7869da |
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_ppmf_pkg_url:+1}" != 1 ]\
|
|
|
e9fa07 |
&& [ "${_ppmf_pkg_sha256sum:+1}" != 1 ]\
|
|
|
e9fa07 |
&& [ "${_ppmf_pkg_urls_git:+1}" != 1 ]; then
|
|
|
4243a1 |
_ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_no_urls}" "${_ppmf_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
fi;
|
|
|
e9fa07 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
|
|
|
e9fa07 |
return "${_ppmf_rc}";
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
};
|
|
|
e9fa07 |
# }}}
|
|
|
9d89ab |
# {{{ pkgtoolp_profile($_rstatus)
|
|
|
9d89ab |
pkgtoolp_profile() {
|
|
|
9d89ab |
local _ppp_rstatus="${1}" _ppp_log_fname="${2}" \
|
|
|
9d89ab |
_ppp_line="" \
|
|
|
9d89ab |
_ppp_ts=0 _ppp_ts_delta=0 _ppp_ts_last=0 _ppp_ts_max=0 \
|
|
|
9d89ab |
_ppp_pkg_name="" _ppp_pkg_step_max="" _ppp_rc=0 \
|
|
|
9d89ab |
IFS0="${IFS}" IFS;
|
|
|
9d89ab |
|
|
|
9d89ab |
_ppp_log_fname="profile.log";
|
|
|
9d89ab |
|
|
|
9d89ab |
for _ppp_pkg_name in $(find \
|
|
|
9d89ab |
"${BUILD_WORKDIR}" \
|
|
|
9d89ab |
-maxdepth 1 \
|
|
|
9d89ab |
-mindepth 1 \
|
|
|
9d89ab |
-name ".*.start" \
|
|
|
9d89ab |
-printf "%P\n");
|
|
|
9d89ab |
do
|
|
|
9d89ab |
_ppp_pkg_name="${_ppp_pkg_name%.start}";
|
|
|
9d89ab |
_ppp_pkg_name="${_ppp_pkg_name##.}";
|
|
|
9d89ab |
_ppp_ts_last=0; _ppp_ts_max=0; _ppp_pkg_step_max="";
|
|
|
9d89ab |
|
|
|
9d89ab |
rtl_set_IFS_nl;
|
|
|
9d89ab |
for _ppp_line in $( \
|
|
|
9d89ab |
find \
|
|
|
9d89ab |
"${BUILD_WORKDIR}" \
|
|
|
9d89ab |
-maxdepth 1 \
|
|
|
9d89ab |
-mindepth 1 \
|
|
|
9d89ab |
-name ".${_ppp_pkg_name}.*" \
|
|
|
9d89ab |
-printf "%T@ %P\n" | \
|
|
|
9d89ab |
sort -nk1);
|
|
|
9d89ab |
do
|
|
|
9d89ab |
IFS=" "; set -- ${_ppp_line}; rtl_set_IFS_nl;
|
|
|
9d89ab |
_ppp_ts="${1}"; _ppp_pkg_step="${2}";
|
|
|
9d89ab |
_ppp_ts="${_ppp_ts%%.*}";
|
|
|
9d89ab |
if [ "${_ppp_ts_last}" -eq 0 ]; then
|
|
|
9d89ab |
_ppp_ts_last="${_ppp_ts}";
|
|
|
9d89ab |
fi;
|
|
|
9d89ab |
|
|
|
9d89ab |
_ppp_ts_delta="$((${_ppp_ts}-${_ppp_ts_last}))";
|
|
|
9d89ab |
_ppp_ts_last="${_ppp_ts}";
|
|
|
9d89ab |
|
|
|
9d89ab |
if [ "${_ppp_ts_delta}" -gt "${_ppp_ts_max}" ]; then
|
|
|
9d89ab |
_ppp_ts_max="${_ppp_ts_delta}";
|
|
|
9d89ab |
_ppp_pkg_step_max="${_ppp_pkg_step#.${_ppp_pkg_name}.}";
|
|
|
9d89ab |
fi;
|
|
|
9d89ab |
done;
|
|
|
9d89ab |
printf "%20s %5u %s\n" \
|
|
|
9d89ab |
"${_ppp_pkg_step_max}" \
|
|
|
9d89ab |
"${_ppp_ts_max}" \
|
|
|
9d89ab |
"${_ppp_pkg_name}";
|
|
|
9d89ab |
done | sort -nk2 >"${_ppp_log_fname}";
|
|
|
9d89ab |
IFS="${IFS0}";
|
|
|
9d89ab |
|
|
|
9d89ab |
printf "%5u items written to \`%s'; tail -n25 follows:\n" \
|
|
|
9d89ab |
"$(wc -l < "${_ppp_log_fname}")" \
|
|
|
9d89ab |
"${_ppp_log_fname}";
|
|
|
9d89ab |
tail -n15 "${_ppp_log_fname}";
|
|
|
9d89ab |
|
|
|
9d89ab |
printf "\n";
|
|
|
9d89ab |
printf "By build step:\n";
|
|
|
9d89ab |
for _ppp_step in ${DEFAULT_BUILD_STEPS}; do
|
|
|
9d89ab |
printf "%20s %d\n" \
|
|
|
9d89ab |
"${_ppp_step}" \
|
|
|
9d89ab |
"$(grep " ${_ppp_step} " "${_ppp_log_fname}" | wc -l)";
|
|
|
9d89ab |
done | grep -v " [01]$" | sort -nk2;
|
|
|
9d89ab |
|
|
|
9d89ab |
return "${_ppp_rc}";
|
|
|
9d89ab |
};
|
|
|
9d89ab |
# }}}
|
|
|
e9fa07 |
# {{{ pkgtoolp_rdepends($_rstatus, $_pkg_name, $_full_rdependsfl)
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
pkgtoolp_rdepends() {
|
|
|
e9fa07 |
local _ppr_rstatus="${1}" _ppr_pkg_name="${2}" _ppr_full_rdependsfl="${3}" \
|
|
|
e9fa07 |
_ppr_depends="" _ppr_group_name="" _ppr_groups="" _ppr_groups_noauto="" \
|
|
|
e9fa07 |
_ppr_pkg_depends="" _ppr_pkg_disabled="" _ppr_pkg_finished="" \
|
|
|
e9fa07 |
_ppr_pkg_name_rdepend="" _ppr_pkg_names="" _ppr_pkg_rdepends="" \
|
|
|
e9fa07 |
_ppr_pkg_rdepends_direct="" _ppr_rc=0;
|
|
|
e9fa07 |
|
|
|
6a630d |
if ! ex_pkg_load_groups \$_ppr_groups \$_ppr_groups_noauto; then
|
|
|
e9fa07 |
_ppr_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppr_rstatus}" 'Error: failed to load build groups.';
|
|
|
e9fa07 |
elif ! ex_pkg_find_package \$_ppr_group_name "${_ppr_groups}" "${_ppr_pkg_name}"; then
|
|
|
e9fa07 |
_ppr_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppr_rstatus}" 'Error: unknown package \`'"${_ppr_pkg_name}'"'.';
|
|
|
e9fa07 |
elif ! ex_pkg_get_packages \$_ppr_pkg_names "${_ppr_group_name}"; then
|
|
|
e9fa07 |
_ppr_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppr_rstatus}" 'Error: failed to expand package list of build group \`'"${_ppr_group_name}'"'.';
|
|
|
e9fa07 |
elif ! ex_pkg_unfold_rdepends \
|
|
|
e9fa07 |
\$_ppr_pkg_disabled \$_ppr_pkg_finished \
|
|
|
e9fa07 |
\$_ppr_pkg_rdepends_direct \
|
|
|
e9fa07 |
"${_ppr_group_name}" "${_ppr_pkg_names}" \
|
|
|
e9fa07 |
"${_ppr_pkg_name}" 1 "${BUILD_WORKDIR}";
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
_ppr_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppr_rstatus}" 'Error: failed to unfold reverse dependency-expanded package name list for \`'"${_ppr_pkg_name}'"'.';
|
|
|
e9fa07 |
elif [ "${_ppr_pkg_disabled:+1}" != 1 ]\
|
|
|
e9fa07 |
&& [ "${_ppr_pkg_finished:+1}" != 1 ]\
|
|
|
e9fa07 |
&& [ "${_ppr_pkg_rdepends_direct:+1}" != 1 ];
|
|
|
e9fa07 |
then
|
|
|
4243a1 |
rtl_log_msgV "info" "${MSG_rdepends_pkg_deps_rev_none}" "${_ppr_pkg_name}";
|
|
|
e9fa07 |
else
|
|
|
dbea96 |
for _ppr_pkg_name_rdepend in $(rtl_lsortV \
|
|
|
e9fa07 |
${_ppr_pkg_finished} \
|
|
|
e9fa07 |
${_ppr_pkg_rdepends_direct});
|
|
|
e9fa07 |
do
|
|
|
e9fa07 |
rtl_lconcat \$_ppr_pkg_rdepends "${_ppr_pkg_name_rdepend}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_ppr_full_rdependsfl}" -eq 1 ]; then
|
|
|
e9fa07 |
rtl_get_var_unsafe \$_ppr_depends -u "PKG_"${_ppr_pkg_name}"_DEPENDS";
|
|
|
dbea96 |
if rtl_lunfold_dependsV 'PKG_${_rld_name}_DEPENDS' \$_ppr_pkg_depends ${_ppr_depends}\
|
|
|
e9fa07 |
&& [ "${_ppr_pkg_depends:+1}" = 1 ]; then
|
|
|
e9fa07 |
rtl_lconcat \$_ppr_pkg_rdepends "?[33m${_ppr_pkg_depends}?[93m";
|
|
|
e9fa07 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
57b30d |
fi;
|
|
Lucio Andrés Illanes Albornoz |
57b30d |
done;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_ppr_pkg_rdepends:+1}" = 1 ]; then
|
|
|
16909c |
if [ "${_ppr_full_rdependsfl}" -eq 1 ]; then
|
|
|
4243a1 |
rtl_log_msgV "info" "${MSG_rdepends_pkgs_deps_rev_recurse}" "${_ppr_pkg_name}" "${_ppr_pkg_rdepends}";
|
|
|
16909c |
else
|
|
|
4243a1 |
rtl_log_msgV "info" "${MSG_rdepends_pkgs_deps_rev}" "${_ppr_pkg_name}" "${_ppr_pkg_rdepends}";
|
|
|
16909c |
fi;
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_ppr_pkg_disabled:+1}" = 1 ]; then
|
|
|
4243a1 |
rtl_log_msgV "info" "${MSG_rdepends_pkgs_deps_rev_disabled}" "${_ppr_pkg_name}" "$(rtl_lsortV "${_ppr_pkg_disabled}")";
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
fi;
|
|
|
e9fa07 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
|
|
|
e9fa07 |
return "${_ppr_rc}";
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
};
|
|
|
e9fa07 |
# }}}
|
|
|
e9fa07 |
# {{{ pkgtoolp_tarball($_rstatus, $_pkg_name)
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
pkgtoolp_tarball() {
|
|
|
e9fa07 |
local _ppt_rstatus="${1}" _ppt_pkg_name="${2}" \
|
|
|
e9fa07 |
_ppt_date="" _ppt_group_name="" _ppt_groups="" _ppt_groups_noauto="" \
|
|
|
e9fa07 |
_ppt_hname="" _ppt_pkg_name_full="" _ppt_pkg_version="" _ppt_rc=0 \
|
|
|
e9fa07 |
_ppt_tarball_fname="";
|
|
Lucio Andrés Illanes Albornoz |
e493dc |
|
|
|
6a630d |
if ! ex_pkg_load_groups \$_ppt_groups \$_ppt_groups_noauto; then
|
|
|
e9fa07 |
_ppt_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppt_rstatus}" 'Error: failed to load build groups.';
|
|
|
e9fa07 |
elif ! ex_pkg_find_package \$_ppt_group_name "${_ppt_groups}" "${_ppt_pkg_name}"; then
|
|
|
e9fa07 |
_ppt_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppt_rstatus}" 'Error: unknown package \`'"${_ppt_pkg_name}'"'.';
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
elif ! ex_pkg_env "${DEFAULT_BUILD_STEPS}" "${DEFAULT_BUILD_VARS}" \
|
|
|
e9fa07 |
"${_ppt_group_name}" 0 "${_ppt_pkg_name}" "" "${BUILD_WORKDIR}";
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
_ppt_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppt_rstatus}" 'Error: failed to set package environment for \`'"${_ppt_pkg_name}'"'.';
|
|
|
e9fa07 |
elif ! _ppt_date="$(date +%Y%m%d_%H%M%S)"; then
|
|
|
e9fa07 |
_ppt_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppt_rstatus}" 'Error: failed to call date(1).';
|
|
|
e9fa07 |
elif ! _ppt_hname="$(hostname -f)"; then
|
|
|
e9fa07 |
_ppt_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppt_rstatus}" 'Error: failed to call hostname(1).';
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
if [ "${PKG_VERSION:+1}" = 1 ]; then
|
|
|
e9fa07 |
_ppt_pkg_name_full="${_ppt_pkg_name}-${PKG_VERSION}";
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
else
|
|
|
e9fa07 |
_ppt_pkg_name_full="${_ppt_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
60fba6 |
|
|
|
e9fa07 |
_ppt_tarball_fname="${_ppt_pkg_name_full}@${_ppt_hname}-${_ppt_date}.tbz2";
|
|
|
4243a1 |
rtl_log_msgV "info" "${MSG_tarball_creating}" "${PKG_BASE_DIR}" "${_ppt_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
e493dc |
|
|
|
e9fa07 |
if ! tar -C "${BUILD_WORKDIR}" -cpf - \
|
|
|
e9fa07 |
"${PKG_BASE_DIR#${BUILD_WORKDIR%/}/}" \
|
|
|
e9fa07 |
"${_ppt_pkg_name}_stderrout.log" |\
|
|
|
e9fa07 |
bzip2 -c -9 - > "${_ppt_tarball_fname}";
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
_ppt_rc=1;
|
|
|
e9fa07 |
rtl_setrstatus "${_ppt_rstatus}" 'Error: failed to create compressed tarball of \`'"${PKG_BASE_DIR}'"' and \`'"${_ppt_pkg_name}"'_stderrout.log'"'"'.';
|
|
Lucio Andrés Illanes Albornoz |
b6a9a1 |
else
|
|
|
4243a1 |
rtl_log_msgV "info" "${MSG_tarball_created}" "${PKG_BASE_DIR}" "${_ppt_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
b6a9a1 |
fi;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return "${_ppt_rc}";
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
};
|
|
|
e9fa07 |
# }}}
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
pkgtool() {
|
|
|
e9fa07 |
local _rc=0 _status="" \
|
|
|
e9fa07 |
BUILD_GROUPS="" ARCH BUILD_KIND \
|
|
|
e9fa07 |
BUILD_WORKDIR PKGTOOL_PKGNAME PREFIX;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if ! pkgtoolp_init \$_status "${@}"; then
|
|
|
e9fa07 |
_rc=1;
|
|
|
e9fa07 |
_status="Error: ${_status}";
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
case "1" in
|
|
|
b570fd |
"${ARG_EDIT:-0}") pkgtoolp_edit \$_status "${PKGTOOL_PKG_NAME}"; ;;
|
|
|
e9fa07 |
"${ARG_INFO:-0}") pkgtoolp_info \$_status "${PKGTOOL_PKG_NAME}"; ;;
|
|
|
e9fa07 |
"${ARG_MIRROR:-0}") pkgtoolp_mirror \$_status "${ARG_MIRROR_DNAME}" "${ARG_MIRROR_DNAME_GIT}"; ;;
|
|
|
9d89ab |
"${ARG_PROFILE:-0}") pkgtoolp_profile \$_status "${ARG_PROFILE_LOG_FNAME}"; ;;
|
|
|
e9fa07 |
"${ARG_RDEPENDS:-0}") pkgtoolp_rdepends \$_status "${PKGTOOL_PKG_NAME}" 0; ;;
|
|
|
e9fa07 |
"${ARG_RDEPENDS_FULL:-0}") pkgtoolp_rdepends \$_status "${PKGTOOL_PKG_NAME}" 1; ;;
|
|
|
e9fa07 |
"${ARG_TARBALL:-0}") pkgtoolp_tarball \$_status "${PKGTOOL_PKG_NAME}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
b6a9a1 |
esac; _rc="${?}";
|
|
Lucio Andrés Illanes Albornoz |
b6a9a1 |
fi;
|
|
|
e9fa07 |
|
|
Lucio Andrés Illanes Albornoz |
b6a9a1 |
if [ "${_rc}" -ne 0 ]; then
|
|
|
4243a1 |
rtl_log_enable_tagsV "${LOG_TAGS_all}";
|
|
|
4243a1 |
rtl_log_msgV "fatalexit" "0;${_status}";
|
|
|
e9fa07 |
elif [ "${_status:+1}" = 1 ]; then
|
|
|
4243a1 |
rtl_log_enable_tagsV "${LOG_TAGS_all}";
|
|
|
4243a1 |
rtl_log_msgV "info" "0;${_status}";
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
};
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
|
|
Lucio Andrés Illanes Albornoz |
e493dc |
set +o errexit -o noglob -o nounset; pkgtool "${@}";
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
|
|
Lucio Andrés Illanes Albornoz |
8a27f9 |
# vim:filetype=sh textwidth=0
|