feat: check dummy function, do not echo
This commit is contained in:
56
leaf
56
leaf
@@ -363,29 +363,38 @@ leaf_remove_libtool_files() {
|
||||
find "${pkgdir}" -name "*.la" -delete
|
||||
}
|
||||
|
||||
leaf_noop() { :; }
|
||||
|
||||
leaf_reset_state() {
|
||||
options=()
|
||||
src_preinstall() {
|
||||
:
|
||||
}
|
||||
src_postinstall() {
|
||||
:
|
||||
}
|
||||
src_preremove() {
|
||||
:
|
||||
}
|
||||
src_postremove() {
|
||||
:
|
||||
}
|
||||
src_prepare() {
|
||||
:
|
||||
}
|
||||
src_build() {
|
||||
:
|
||||
}
|
||||
src_check() {
|
||||
:
|
||||
}
|
||||
src_preinstall() { leaf_noop; }
|
||||
src_postinstall() { leaf_noop; }
|
||||
src_preremove() { leaf_noop; }
|
||||
src_postremove() { leaf_noop; }
|
||||
|
||||
src_prepare() { leaf_noop; }
|
||||
src_build() { leaf_noop; }
|
||||
src_check() { leaf_noop; }
|
||||
src_install() { leaf_noop; }
|
||||
}
|
||||
|
||||
leaf_is_noop_func() {
|
||||
# usage: leaf_is_noop_func <funcname>
|
||||
local fn="$1" body
|
||||
|
||||
declare -F "$fn" >/dev/null || return 0
|
||||
|
||||
body="$(declare -f "$fn" \
|
||||
| sed -n '0,/{/d; :a; /}/q; p; n; ba')"
|
||||
|
||||
body="$(printf '%s' "$body" | tr -d '[:space:]' | tr -d ';')"
|
||||
|
||||
# allowd no-op form: leaf_noop, :, true
|
||||
case "$body" in
|
||||
leaf_noop|:|true) return 0 ;;
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
leaf_strip_files() {
|
||||
@@ -463,6 +472,11 @@ leaf_run_phase() {
|
||||
return 0
|
||||
}
|
||||
|
||||
if leaf_is_noop_func "$fn"; then
|
||||
LEAF_PHASE_RC=0
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}>>> ${PKG_PREFIX}/${PKG_NAME}: ${phase}${CLEAR_COLOR}"
|
||||
|
||||
set +e
|
||||
|
||||
Reference in New Issue
Block a user