diff options
author | Matthias Fechner <mfechner@FreeBSD.org> | 2019-03-28 17:01:17 +0000 |
---|---|---|
committer | Matthias Fechner <mfechner@FreeBSD.org> | 2019-03-28 17:01:17 +0000 |
commit | d747a7be638d9b2dabe5a095387bcfe654388e38 (patch) | |
tree | b9496c87d5c3f83e20ce50defb184d33e67a1b87 /Tools | |
parent | New port: textproc/up: Ultimate plumber, a tool for writing pipes with instan... (diff) |
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.
Notes
Notes:
svn path=/head/; revision=497031
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/scripts/README | 2 | ||||
-rwxr-xr-x | Tools/scripts/search_lib_depends_and_bump.sh | 107 |
2 files changed, 109 insertions, 0 deletions
diff --git a/Tools/scripts/README b/Tools/scripts/README index 280aef64eb59..fe8bb9bf045d 100644 --- a/Tools/scripts/README +++ b/Tools/scripts/README @@ -45,6 +45,8 @@ portsearch - A utility for searching the ports tree. It allows more detailed 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 diff --git a/Tools/scripts/search_lib_depends_and_bump.sh b/Tools/scripts/search_lib_depends_and_bump.sh new file mode 100755 index 000000000000..e033e4d17f8e --- /dev/null +++ b/Tools/scripts/search_lib_depends_and_bump.sh @@ -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 + |