Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2018 06:59:28 -0600
From:      Adam Weinberger <adamw@adamw.org>
To:        gerald@freebsd.org
Cc:        ports-committers@freebsd.org, svn-ports-all@freebsd.org,  svn-ports-head@freebsd.org
Subject:   Re: svn commit: r477561 - head/Tools/scripts
Message-ID:  <CAP7rwciqrNT-aMKf9oZttZB3G1vKwU%2BpCrY3N8ARryNX--Q8oQ@mail.gmail.com>
In-Reply-To: <201808190917.w7J9Hv1s093234@repo.freebsd.org>
References:  <201808190917.w7J9Hv1s093234@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 19, 2018 at 3:18 AM Gerald Pfeifer <gerald@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@adamw.org
https://www.adamw.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAP7rwciqrNT-aMKf9oZttZB3G1vKwU%2BpCrY3N8ARryNX--Q8oQ>