From owner-svn-ports-head@freebsd.org Wed Aug 3 13:27:48 2016 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACD9EBAC609; Wed, 3 Aug 2016 13:27:48 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ADBD1E1B; Wed, 3 Aug 2016 13:27:48 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73DRlMZ095051; Wed, 3 Aug 2016 13:27:47 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73DRlST095050; Wed, 3 Aug 2016 13:27:47 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201608031327.u73DRlST095050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Wed, 3 Aug 2016 13:27:47 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r419519 - head/Tools/scripts X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 13:27:48 -0000 Author: mat Date: Wed Aug 3 13:27:47 2016 New Revision: 419519 URL: https://svnweb.freebsd.org/changeset/ports/419519 Log: fixup last updates, and try to be better with slave ports. the case $? needs to have the exit status of the grep, not the awk line, so remove the awk line, it was not really helpful anyway. Also, with slave ports, most of the time, they don't have (PORT|DIST)VERSION, try to use CATEGORIES, PKGNAMEPREFIX or PKGNAMESUFFIX. PR: 211243 Submitted by: mat Approved by: maintainer timeout Sponsored by: Absolight Modified: head/Tools/scripts/bump-revision.sh Modified: head/Tools/scripts/bump-revision.sh ============================================================================== --- head/Tools/scripts/bump-revision.sh Wed Aug 3 13:01:15 2016 (r419518) +++ head/Tools/scripts/bump-revision.sh Wed Aug 3 13:27:47 2016 (r419519) @@ -51,7 +51,6 @@ do # If the Makefile exists, continue and empty the tempfile, set up variables echo -n > $tempfile revision_str=`grep "^PORTREVISION?\?=" "$1/Makefile"` - revision_num=`echo "$revision_str" | awk -F "\t+" '{ print $2 }'` case $? in 0) @@ -65,7 +64,7 @@ do ;; (*) # If the value of PORTREVISION is an integer, increase it by 1 - printc "INFO: $1 PORTREVISION= $revision_num found, bumping it by 1." "green" + printc "INFO: $1 $revision_str found, bumping it by 1." "green" rm -f $tempfile && awk -F "\t+" '/^PORTREVISION\??=/{ gsub ($2, $2+1) }; { print }' "$1/Makefile" > $tempfile \ && cat $tempfile > "$1/Makefile" \ || printc "ERROR: $1 PORTREVISION found but failed to bump it!" "red" @@ -80,8 +79,19 @@ do # If the exit code is 1 then PORTREVISION wasn't found, so we need to add one with value of 1 printc "INFO: $1 PORTREVISION not found, adding PORTREVISION= 1" "green" rm -f $tempfile && awk '/^(PORT|DIST)VERSION\??=\t/{ print; print "PORTREVISION=\t1"; next } { print }' "$1/Makefile" > $tempfile \ - && cat $tempfile > "$1/Makefile" \ - || printc "ERROR: $1 PORTREVISION found but failed to bump it!" "red" + && cat $tempfile > "$1/Makefile" + # If there is not PORTREVISION line, maybe it is a slave port, try + # to add it before a CATEGORIES, PKGNAMESUFFIX or PKGNAMEPREFIX line: + for line in CATEGORIES PKGNAMEPREFIX PKGNAMESUFFIX; do + if ! grep -q "^PORTREVISION?\?=" $1/Makefile; then + rm -f $tempfile && awk '/^'${line}'\??=\t/{ print "PORTREVISION=\t1"; print; next } { print }' "$1/Makefile" > $tempfile \ + && cat $tempfile > "$1/Makefile" + fi + done + # 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 ;; *) printc "ERROR: PORTREVISION grep for $1 exited with error!" "red"