From f69e8567aa6a344bcc848d4f79c755606b077365 Mon Sep 17 00:00:00 2001 From: Mathieu Arnold Date: Fri, 20 May 2016 19:01:59 +0000 Subject: [PATCH] Ease debugging of Mk/Scripts scripts. Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D6474 --- Mk/Scripts/actual-package-depends.sh | 2 ++ Mk/Scripts/check-stagedir.sh | 2 ++ Mk/Scripts/check_leftovers.sh | 2 ++ Mk/Scripts/depends-list.sh | 2 ++ Mk/Scripts/dialog4ports.sh | 2 ++ Mk/Scripts/do-depends.sh | 2 ++ Mk/Scripts/do-users-groups.sh | 2 ++ Mk/Scripts/find-lib.sh | 2 ++ Mk/Scripts/qa.sh | 2 ++ Mk/Scripts/smart_makepatch.sh | 1 + 10 files changed, 19 insertions(+) diff --git a/Mk/Scripts/actual-package-depends.sh b/Mk/Scripts/actual-package-depends.sh index 50b93efc01e7..18af33e57d39 100644 --- a/Mk/Scripts/actual-package-depends.sh +++ b/Mk/Scripts/actual-package-depends.sh @@ -2,6 +2,8 @@ # MAINTAINER: portmgr@FeeeBSD.org # $FreeBSD$ +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_ACTUAL_PACKAGE_DEPENDS}" ] && set -x + if [ -z "${PKG_BIN}" ]; then echo "PKG_BIN required in environment." >&2 exit 1 diff --git a/Mk/Scripts/check-stagedir.sh b/Mk/Scripts/check-stagedir.sh index 0fbb230cb707..a5febb04183e 100644 --- a/Mk/Scripts/check-stagedir.sh +++ b/Mk/Scripts/check-stagedir.sh @@ -229,6 +229,8 @@ esac validate_env STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \ TMPPLIST PLIST_SUB_SED SCRIPTSDIR PORT_OPTIONS NO_PREFIX_RMDIR +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_CHECK_STAGEDIR}" ] && set -x + set -u if [ $makeplist = 0 ] ; then diff --git a/Mk/Scripts/check_leftovers.sh b/Mk/Scripts/check_leftovers.sh index 1aa7bc38f8a8..3233e23f25e4 100644 --- a/Mk/Scripts/check_leftovers.sh +++ b/Mk/Scripts/check_leftovers.sh @@ -23,6 +23,8 @@ # The PLIST_SUB feature can be disabled by setting PLIST_SUB_SED= # in environment. +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_CHECK_LEFTOVERS}" ] && set -x + origin="$1" [ $# -eq 1 ] || { echo "Must supply ORIGIN as parameter" >&2; exit 1; } [ -n "${PORTSDIR}" ] || { echo "PORTSDIR must be set" >&2; exit 1; } diff --git a/Mk/Scripts/depends-list.sh b/Mk/Scripts/depends-list.sh index 4b2d7833070a..d2f26f1583e0 100644 --- a/Mk/Scripts/depends-list.sh +++ b/Mk/Scripts/depends-list.sh @@ -34,6 +34,8 @@ if [ ${recursive} -eq 1 -o ${requires_wrkdir} -eq 1 ]; then MAKE="${dp_MAKE}" export_ports_env >/dev/null fi +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DEPENDS_LIST}" ] && set -x + set -u check_dep() { diff --git a/Mk/Scripts/dialog4ports.sh b/Mk/Scripts/dialog4ports.sh index 18897a267d8e..61b855ee44b8 100644 --- a/Mk/Scripts/dialog4ports.sh +++ b/Mk/Scripts/dialog4ports.sh @@ -3,6 +3,8 @@ # Maintainer: portmgr@FreeBSD.org set -e +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DIALOG4PORTS}" ] && set -x + if [ -z "${DIALOG4PORTS}" -o -z "${PORTSDIR}" -o -z "${MAKE}" ]; then echo "DIALOG4PORTS, MAKE and PORTSDIR required in environment." >&2 exit 1 diff --git a/Mk/Scripts/do-depends.sh b/Mk/Scripts/do-depends.sh index 4bbddccf2a65..5e37d09c267a 100644 --- a/Mk/Scripts/do-depends.sh +++ b/Mk/Scripts/do-depends.sh @@ -13,6 +13,8 @@ validate_env dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \ dp_PKGNAME dp_STRICT_DEPENDS dp_LOCALBASE dp_LIB_DIRS dp_SH \ dp_SCRIPTSDIR PORTSDIR dp_MAKE +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_DEPENDS}" ] && set -x + set -u install_depends() diff --git a/Mk/Scripts/do-users-groups.sh b/Mk/Scripts/do-users-groups.sh index c8833d0730b7..4a48760deb72 100644 --- a/Mk/Scripts/do-users-groups.sh +++ b/Mk/Scripts/do-users-groups.sh @@ -12,6 +12,8 @@ validate_env dp_ECHO_MSG dp_GID_FILES dp_GID_OFFSET dp_GROUPS_BLACKLIST \ dp_UG_DEINSTALL dp_UG_INSTALL dp_UID_FILES dp_UID_OFFSET \ dp_USERS_BLACKLIST +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_USERS_GROUPS}" ] && set -x + set -u USERS=$1 diff --git a/Mk/Scripts/find-lib.sh b/Mk/Scripts/find-lib.sh index 7a792cfd090d..e442bcb7f2e9 100644 --- a/Mk/Scripts/find-lib.sh +++ b/Mk/Scripts/find-lib.sh @@ -2,6 +2,8 @@ # MAINTAINER: portmgr@FreeBSD.org # $FreeBSD$ +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_FIND_LIB}" ] && set -x + if [ -z "${LIB_DIRS}" -o -z "${LOCALBASE}" ]; then echo "LIB_DIRS, LOCALBASE required in environment." >&2 exit 1 diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh index ffcb3c42df7f..fdd30b662a1e 100644 --- a/Mk/Scripts/qa.sh +++ b/Mk/Scripts/qa.sh @@ -7,6 +7,8 @@ if [ -z "${STAGEDIR}" -o -z "${PREFIX}" -o -z "${LOCALBASE}" ]; then exit 1 fi +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_QA}" ] && set -x + LF=$(printf '\nX') LF=${LF%X} diff --git a/Mk/Scripts/smart_makepatch.sh b/Mk/Scripts/smart_makepatch.sh index cd95503a856b..b84416b235d1 100644 --- a/Mk/Scripts/smart_makepatch.sh +++ b/Mk/Scripts/smart_makepatch.sh @@ -25,6 +25,7 @@ # if those targets modify source files (e.g. with sed). You may also # want to disable EXTRA_PATCHES as well if that is being used. +[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_SMART_MAKEPATCH}" ] && set -x if [ -z "${PATCHDIR}" -o -z "${PATCH_WRKSRC}" -o -z "${WRKDIR}" ]; then echo "WRKDIR, PATCHDIR, and PATCH_WRKSRC required in environment." >&2