svn commit: r477561 - head/Tools/scripts

Adam Weinberger adamw at adamw.org
Sun Aug 19 12:59:46 UTC 2018


On Sun, Aug 19, 2018 at 3:18 AM Gerald Pfeifer <gerald at freebsd.org> wrote:
>
> Author: gerald
> Date: Sun Aug 19 09:17:56 2018
> New Revision: 477561
> URL: https://svnweb.freebsd.org/changeset/ports/477561
>
> Log:
>   Add a stronger safety belt to this script by comparing the actual
>   PORTREVISION (using the Ports Collection framework, not just looking at
>   one Makefile individually at a time) before and after the bump.  If the
>   version after the bump isn't actually increased, flag that as an error.
>
>   As an example, before revision r464215 (cf. bug #226533) this script
>   would have wreaked wreak havoc on the multimedia/avidemux* ports.
>   This hardly can be blamed on bump-revision.sh, but with the additional
>   safety belt it does now detect such cases.
>
>   How to reproduce:
>
>     % cd $PORTSDIR
>     % svn up -r 464036 multimedia/
>     % Tools/scripts/bump-revision.sh multimedia/avidemux*
>
>   With this patch we print:
>
>     INFO: multimedia/avidemux PORTREVISION=     9 found, bumping it by 1.
>     INFO: multimedia/avidemux-cli PORTREVISION not found, adding PORTREVISION= 1
>     ERROR: multimedia/avidemux-cli PORTREVISION went backwards from 5 to 1!
>     INFO: multimedia/avidemux-plugins PORTREVISION not found, adding PORTREVISION= 1
>     ERROR: multimedia/avidemux-plugins PORTREVISION went backwards from 5 to 1!
>     INFO: multimedia/avidemux-qt4 PORTREVISION not found, adding PORTREVISION= 1
>     ERROR: multimedia/avidemux-qt4 PORTREVISION went backwards from 5 to 1!
>
>   The beauty of this approach is that it goes beyond a simple text search,
>   and leverages what the ports framework itself does.
>
>   PR:           226926, 226533
>   Approved by:  maintainer timeout (20+ weeks)
>   Reviewed by:  mandree, riggs
>
> Modified:
>   head/Tools/scripts/bump-revision.sh
>
> Modified: head/Tools/scripts/bump-revision.sh
> ==============================================================================
> --- head/Tools/scripts/bump-revision.sh Sun Aug 19 09:17:48 2018        (r477560)
> +++ head/Tools/scripts/bump-revision.sh Sun Aug 19 09:17:56 2018        (r477561)
> @@ -48,6 +48,12 @@ trap "rm -f $tempfile" 0 1 2 3 15
>  while [ $# -gt 0 ]
>  do
>      if [ -f "$1/Makefile" ]; then
> +        # See what the port thinks its PORTREVISION is and save that.
> +        startdir=`pwd`
> +        cd "$1"
> +        pre=$(make -V PORTREVISION)
> +        cd "$startdir"
> +
>          # If the Makefile exists, continue and empty the tempfile, set up variables
>         echo -n > $tempfile
>          revision_str=`grep "^PORTREVISION?\?=" "$1/Makefile"`
> @@ -91,6 +97,15 @@ do
>              # If it still is not there, bail out
>              if ! grep -q "^PORTREVISION?\?=" $1/Makefile; then
>                      printc "ERROR: $1 PORTREVISION not found and failed to add it!" "red"
> +            fi
> +
> +            # See what the port now has for PORTREVISION.
> +            cd "$1"
> +            post=$(make -V PORTREVISION)
> +            cd "$startdir"

You can just post=$(make -C "$1" -V PORTREVISION), instead of saving
pwd and cd'ing multiple times.

# Adam


-- 
Adam Weinberger
adamw at adamw.org
https://www.adamw.org


More information about the svn-ports-all mailing list