From b4980cacd67eed419935f4262cd287dc62b6ee55 Mon Sep 17 00:00:00 2001 From: bapt Date: Wed, 9 Oct 2013 15:11:32 +0000 Subject: First set of Q/A for staged ports. A couple of Q/A tests are done if the DEVELOPER macros is set in make.conf Right now the tests are: - Check if the symlinks are properly created - Check if the binaries are stripped (just warn) - Check if the STAGEDIR or the WORKDIR are referenced in the final files - Check if the ports provide script with bad shebangs. --- Mk/Scripts/qa.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Mk/bsd.port.mk | 7 +++++ Mk/bsd.stage.mk | 8 ++++++ 3 files changed, 97 insertions(+) create mode 100644 Mk/Scripts/qa.sh diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh new file mode 100644 index 000000000000..c9a3915bc9f3 --- /dev/null +++ b/Mk/Scripts/qa.sh @@ -0,0 +1,82 @@ +#!/bin/sh +# MAINTAINER: portmgr@FreeBSD.org +# $FreeBSD$ + +if [ -z "${STAGEDIR}" -o -z "${PREFIX}" -o -z "${LOCALBASE}" ]; then + echo "STAGEDIR, PREFIX, LOCALBASE required in environment." >&2 + exit 1 +fi + +warn() { + echo "Warning: $@" >&2 +} + +err() { + echo "Error: $@" >&2 +} + +shebang() { + rc=0 + for f in `find ${STAGEDIR} -type f`; do + interp=$(sed -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p' $f) + case "$interp" in + "") ;; + /usr/bin/env) ;; + ${LOCALBASE}/*) ;; + ${PREFIX}/*) ;; + /usr/bin/awk) ;; + /usr/bin/sed) ;; + /bin/sh) ;; + *) + err "${interp} is an invalid shebang you need USES=shebangfix for ${f#${STAGEDIR}${PREFIX}/}" + rc=1 + ;; + esac + done +} + +symlinks() { + rc=0 + for l in `find ${STAGEDIR} -type l`; do + link=$(readlink ${l}) + case "${link}" in + ${STAGEDIR}*) err "Bad symlinks ${l} pointing inside the stage directory" + rc=1 + ;; + esac + done +} + +paths() { + rc=0 + dirs="${STAGEDIR} ${WRKDIR}" + for f in `find ${STAGEDIR} -type f`;do + for d in ${dirs}; do + if grep -q ${d} ${f} ; then + err "${f} is referring to ${d}" + rc=1 + fi + done + done +} + +# For now do not raise an error, just warnings +stripped() { + [ -x /usr/bin/file ] || return + for f in `find ${STAGEDIR} -type f`; do + output=`/usr/bin/file ${f}` + case "${output}" in + *:*\ ELF\ *,\ not\ stripped*) warn "${f} is not stripped";; + esac + done +} + +checks="shebang symlinks paths stripped" + +ret=0 +cd ${STAGEDIR} +for check in ${checks}; do + ${check} || ret=1 +done + +exit $ret diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 73506d5ccb59..87eb92d263a1 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1129,6 +1129,7 @@ _DISTDIR?= ${DISTDIR}/${DIST_SUBDIR} INDEXDIR?= ${PORTSDIR} SRC_BASE?= /usr/src USESDIR?= ${PORTSDIR}/Mk/Uses +SCRIPTSDIR?= ${PORTSDIR}/Mk/Scripts LIB_DIRS?= /lib /usr/lib ${LOCALBASE}/lib .if defined(FORCE_STAGE) @@ -4341,11 +4342,17 @@ _STAGE_SUSEQ= create-users-groups do-install post-install post-stage compress-ma install-rc-script install-ldconfig-file install-license \ install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ add-plist-data add-plist-post fix-plist-sequence +.if defined(DEVELOPER) +_STAGE_SUSEQ+= stage-qa +.endif .else _STAGE_SEQ+= create-users-groups do-install post-install post-stage compress-man \ install-rc-script install-ldconfig-file install-license \ install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ add-plist-data add-plist-post fix-plist-sequence +.if defined(DEVELOPER) +_STAGE_SEQ+= stage-qa +.endif .endif .if defined(WITH_PKGNG) _INSTALL_DEP= stage diff --git a/Mk/bsd.stage.mk b/Mk/bsd.stage.mk index dcdb44384b57..3c78e30bf7d0 100644 --- a/Mk/bsd.stage.mk +++ b/Mk/bsd.stage.mk @@ -6,6 +6,8 @@ STAGEDIR?= ${WRKDIR}/stage DESTDIRNAME?= DESTDIR MAKE_ARGS+= ${DESTDIRNAME}=${STAGEDIR} +QA_ENV+= STAGEDIR=${STAGEDIR} PREFIX=${PREFIX} \ + LOCALBASE=${LOCALBASE} .if !target(stage-dir) stage-dir: @@ -153,3 +155,9 @@ check-orphans: stage -e "s,${DATADIR},%%DATADIR%%,g" \ -e "s,${PREFIX}/,,g" | ${GREP} -v "^@dirrmtry share/licenses" || ${TRUE} .endif + +.if !target(stage-qa) +stage-qa: + @${ECHO_CMD} "====> Running Q/A tests" ; \ + ${SETENV} ${QA_ENV} ${SH} ${SCRIPTSDIR}/qa.sh +.endif -- cgit nome-3.22 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
path: root/devel/pep8/distinfo
Commit message (Expand)AuthorAgeFilesLines