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
|
find "${pkgdir}" -name "*.la" -delete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leaf_noop() { :; }
|
||||||
|
|
||||||
leaf_reset_state() {
|
leaf_reset_state() {
|
||||||
options=()
|
options=()
|
||||||
src_preinstall() {
|
src_preinstall() { leaf_noop; }
|
||||||
:
|
src_postinstall() { leaf_noop; }
|
||||||
}
|
src_preremove() { leaf_noop; }
|
||||||
src_postinstall() {
|
src_postremove() { leaf_noop; }
|
||||||
:
|
|
||||||
}
|
src_prepare() { leaf_noop; }
|
||||||
src_preremove() {
|
src_build() { leaf_noop; }
|
||||||
:
|
src_check() { leaf_noop; }
|
||||||
}
|
src_install() { leaf_noop; }
|
||||||
src_postremove() {
|
}
|
||||||
:
|
|
||||||
}
|
leaf_is_noop_func() {
|
||||||
src_prepare() {
|
# usage: leaf_is_noop_func <funcname>
|
||||||
:
|
local fn="$1" body
|
||||||
}
|
|
||||||
src_build() {
|
declare -F "$fn" >/dev/null || return 0
|
||||||
:
|
|
||||||
}
|
body="$(declare -f "$fn" \
|
||||||
src_check() {
|
| 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() {
|
leaf_strip_files() {
|
||||||
@@ -463,6 +472,11 @@ leaf_run_phase() {
|
|||||||
return 0
|
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}"
|
echo -e "${GREEN_COLOR}>>> ${PKG_PREFIX}/${PKG_NAME}: ${phase}${CLEAR_COLOR}"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|||||||
Reference in New Issue
Block a user