Date: Thu, 28 Mar 2019 17:01:17 +0000 (UTC) From: Matthias Fechner <mfechner@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r497031 - head/Tools/scripts Message-ID: <201903281701.x2SH1HDv062874@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mfechner Date: Thu Mar 28 17:01:17 2019 New Revision: 497031 URL: https://svnweb.freebsd.org/changeset/ports/497031 Log: Added a script to bump PORTREVISION if a library has changed a version like libgit2. Just execute it in the root of you ports with e.g. Tools/scripts/search_lib_depends_and_bump.sh devel/libgit2 This will search over all existing ports, check if they need to be bumped. After all ports are bumped it triggers a portlint for each modified port. The portlint loop continues till all errors and warnings are fixed. Feel free to break this loop using CTRL+C. Added: head/Tools/scripts/search_lib_depends_and_bump.sh (contents, props changed) Modified: head/Tools/scripts/README Modified: head/Tools/scripts/README ============================================================================== --- head/Tools/scripts/README Thu Mar 28 16:49:39 2019 (r497030) +++ head/Tools/scripts/README Thu Mar 28 17:01:17 2019 (r497031) @@ -45,6 +45,8 @@ portsearch - A utility for searching the ports tree. I all perl(1) regular expressions. resolveportsfromlibs.sh - Prints the name(s) of ports(s) given a library filename, suitable for direct use in LIB_DEPENDS. +search_lib_depends_and_bump.sh - Give it a port that has changed and it will bump + all ports having a LIB_DEPENDS on this port splitpatch.pl - A small script to convert multi-file patches to several appropriately named single-file patches. tindex - script used to build INDEXes for supported FreeBSD branches, which Added: head/Tools/scripts/search_lib_depends_and_bump.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Tools/scripts/search_lib_depends_and_bump.sh Thu Mar 28 17:01:17 2019 (r497031) @@ -0,0 +1,107 @@ +#!/bin/sh +# +# You pass the script a port where the library has changed its ABI. +# The script will search for this port over the complete directory you are located now +# and will bump all ports using `Tools/scripts/bump-revision.sh` +# +# Version 0.1 +# License: MIT +# Matthias Fechner <mfechner@FreeBSD.org> + +usage() { + echo "$0 devel/libgit2" + echo "" + echo "Search for all ports having devel/libgit2 as a LIB_DEPENDS" + echo "and bump the REVISION using the script 'Tools/scripts/bump-revision.sh'" + echo "After this check all modified ports with portlint." + echo "" + echo "Make sure you execute the script in the ports directory." + exit 1 +} + +[ "${1}" != "" ] || usage + +# check that portlint is available +if [ x`which portlint` = x"" ]; then + echo "Please install portlint with" + echo "pkg install portlint" + echo "to continue." + exit 1; +fi + +PORT_TO_SEARCH=${1} +BASEDIR=$(pwd) +# Get a list of all ports +echo "Prepare a list of all ports" +ports=$(find . -name Makefile -path "./editors/*" ! -path "./Tools/* | sort") +echo "done." +echo + +PORTS_TO_BUMP="" +echo Check ports with dependency to ${PORT_TO_SEARCH} +for port in ${ports}; do + DIR=$(dirname "${port}") + printf "Analyse ${DIR}" + LIBDEPENDS=$(make -n -V LIB_DEPENDS -C ${DIR}) + #echo "Search >${PORT_TO_SEARCH}< in >${LIBDEPENDS}<" + case "${LIBDEPENDS}" in + *"${PORT_TO_SEARCH}"*) + PORTS_TO_BUMP="${PORTS_TO_BUMP} ${DIR}";; + esac + printf "\033[2K\r" +done +echo "done." + +echo "Bump PORTREVISION of following ports:" +for PORT_TO_BUMP in ${PORTS_TO_BUMP}; do + echo ${PORT_TO_BUMP} +done +echo +read -p "Press CTRL+c to stop or ENTER to continue..." USERINPUT + +for PORT_TO_BUMP in ${PORTS_TO_BUMP}; do + sh ./Tools/scripts/bump-revision.sh ${PORT_TO_BUMP} +done + +# Now we run portlint on all port we modified +# I borrowed here code from doportlint +echo +TMPFILE=$(mktemp) +while [ "1" = "1" ] +do + FAILED_PORTS="" + FAILURES=0 + echo "Use TMP file ${TMPFILE}" + for PORT in ${PORTS_TO_BUMP}; do + FAILURE=0 + echo "Running portlint in ${PORT}" + cd ${PORT} + portlint > ${TMPFILE} 2> /dev/null || FAILURE=1 + grep '^looks fine\.$' ${TMPFILE} > /dev/null 2> /dev/null || FAILURE=1 + + if [ x${FAILURE} = "x1" ]; then + FAILURES=$((${FAILURES}+1)) + FAILED_PORTS="${FAILED_PORTS} ${PORT}" + { echo '--------------- portlint failed for '${PORT}; \ + grep -v '^OK:' ${TMPFILE} |\ + sed -e 's/^0 fatal errors and //'; } + echo "" + fi + rm -f ${TMPFILE} + cd ${BASEDIR} + done + if [ x${FAILURES} = "x0" ]; then + echo "All portlint test successfull, please review the changes before you commit them carefully." + echo "You maybe want to run now" + echo "git diff" + echo "svn diff" + echo + break; + fi + PORTS_TO_BUMP=${FAILED_PORTS} + read -p "${FAILURES} failures, please fix portlint error and warnings and press ENTER to retest" USERINPUT + echo + echo + echo "------------------------------------ NEW Portlint -----------------------------" +done +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903281701.x2SH1HDv062874>