From owner-svn-ports-all@freebsd.org Tue Jan 23 15:53:57 2018 Return-Path: Delivered-To: svn-ports-all@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 77FF0EB488D; Tue, 23 Jan 2018 15:53:57 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5456A834A6; Tue, 23 Jan 2018 15:53:57 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACC3610A41; Tue, 23 Jan 2018 15:53:56 +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 w0NFruxx029749; Tue, 23 Jan 2018 15:53:56 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NFruOs029748; Tue, 23 Jan 2018 15:53:56 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201801231553.w0NFruOs029748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Tue, 23 Jan 2018 15:53:56 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r459782 - head/Tools/scripts X-SVN-Group: ports-head X-SVN-Commit-Author: mat X-SVN-Commit-Paths: head/Tools/scripts X-SVN-Commit-Revision: 459782 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jan 2018 15:53:57 -0000 Author: mat Date: Tue Jan 23 15:53:56 2018 New Revision: 459782 URL: https://svnweb.freebsd.org/changeset/ports/459782 Log: Run Tools/scripts/mfh through devel/hs-ShellCheck. SC2068: Double quote array expansions to avoid re-splitting elements. SC2034: revs appears unused. Verify it or export it. SC2039: In POSIX sh, XXX is undefined. type -> command -v echo -n -> printf read -p -> printf + read SC2162: read without -r will mangle backslashes. SC2086: Double quote to prevent globbing and word splitting. Sponsored by: Absolight Modified: head/Tools/scripts/mfh Modified: head/Tools/scripts/mfh ============================================================================== --- head/Tools/scripts/mfh Tue Jan 23 15:52:45 2018 (r459781) +++ head/Tools/scripts/mfh Tue Jan 23 15:53:56 2018 (r459782) @@ -54,18 +54,19 @@ ask() { answer=x while [ "${answer}" != "y" -a "${answer}" != "n" ] ; do - read -p "${question} [y/n] " answer + printf "%s [y/n] " "${question}" + read -r answer done [ "${answer}" = "y" ] && return 0 return 1 } -: ${svnserver:="svn+ssh://repo.FreeBSD.org"} +: "${svnserver:="svn+ssh://repo.FreeBSD.org"}" -if [ -n "$(type svn 2>/dev/null)" ]; then +if [ -n "$(command -v svn 2>/dev/null)" ]; then svn=svn -elif [ -n "$(type svnlite 2>/dev/null)" ]; then +elif [ -n "$(command -v svnlite 2>/dev/null)" ]; then svn=svnlite else err "Neither svn(1) nor svnlite(1) found. Please install devel/subversion." @@ -73,21 +74,20 @@ fi latest_branch=$("${svn}" ls ${svnserver}/ports/branches/|sed -ne '/^2.*Q./s|/$||p'|tail -1) -[ $# -lt 1 ] && err "$(basename $0) requires at least 1 arguments: [] [...]" +[ $# -lt 1 ] && err "$(basename "$0") requires at least 1 arguments: [] [...]" branch=$1 # I sure hope by 2030 we'll be doing something else. Yes, famous last words. -if expr ${branch} : '20[12][0-9]Q[1-4]' > /dev/null; then +if expr "${branch}" : '20[12][0-9]Q[1-4]' > /dev/null; then shift - if [ ${latest_branch} != ${branch} ]; then + if [ "${latest_branch}" != "${branch}" ]; then ask "/!\\ The latest branch is ${latest_branch}, do you really want to commit to ${branch}?" || exit 1 fi else branch=${latest_branch} fi -revs="" -for rev in $@ +for rev in "$@" do rev=${rev##r} # remove a leading "r" case ${rev} in @@ -102,17 +102,17 @@ cd "${dir}" "${svn}" co --depth=empty ${svnserver}/ports/branches/"${branch}" filelist="" -echo -n "MFH:" > commit.txt -for rev in $@ +printf "MFH:" > commit.txt +for rev in "$@" do rev=${rev##r} - echo -n " r${rev}" >> commit.txt + printf " r%s" "${rev}" >> commit.txt done echo >> commit.txt -for rev in $@ +for rev in "$@" do rev=${rev##r} - for f in $("${svn}" diff --summarize -c r${rev} ${svnserver}/ports/head); do + for f in $("${svn}" diff --summarize -c "r${rev}" "${svnserver}/ports/head"); do case ${f} in */*) ;; *)continue;; @@ -121,17 +121,17 @@ do f=${f%/*} filelist="${filelist}${LF}${f}" done - "${svn}" log -r${rev##-} ${svnserver}/ports/head | sed '1,2d;$d;/^MFH:/d' \ + "${svn}" log "-r${rev##-}" ${svnserver}/ports/head | sed '1,2d;$d;/^MFH:/d' \ | sed '$d' >> commit.txt done filelist=$(printf '%s\n' "${filelist}" | sort -u) "${svn}" up --parents $(printf '%s\n' $filelist \ | sed "s}^}${branch}/}") "${svn}" up --quiet "${branch}" -for rev in $@ +for rev in "$@" do rev=${rev##r} - "${svn}" merge -c r${rev} ^/head/ "${branch}" + "${svn}" merge -c "r${rev}" ^/head/ "${branch}" done "${svn}" up --quiet "${branch}" "${svn}" status "${branch}"