From patchwork Tue Oct 18 12:13:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9382047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92B8C60839 for ; Tue, 18 Oct 2016 12:14:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8402329599 for ; Tue, 18 Oct 2016 12:14:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78E4C2959C; Tue, 18 Oct 2016 12:14:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 491F429599 for ; Tue, 18 Oct 2016 12:14:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 591946E6DF; Tue, 18 Oct 2016 12:14:24 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id D80926E6D8 for ; Tue, 18 Oct 2016 12:14:07 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id l131so2550760lfl.0 for ; Tue, 18 Oct 2016 05:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Zr8hQMntEKRlrukEYoyYuHPIcyWnUfLk/FOkhDbiy4Y=; b=WHJKXo83e7K/hBOJuz7RLTpJeYXYYr+sOmzRbbvX4T97JtA/jaB+vxE743sNw/hFXQ ufQhXl+534lW5CDA8ybexZ82iji7k1vxQC2L20iOd2/47Z7BAzSKdTY3pwVxmndpB4g7 9FCU7xyPpf1T08CSRdCqGAZXk+9poteO9URKw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Zr8hQMntEKRlrukEYoyYuHPIcyWnUfLk/FOkhDbiy4Y=; b=PMPwBRM5607dT1sXJmHWbkEKcBS9TIvZwLooXV6g/Y3mf8OdyTfGgCkJ9LNGTLglJF pH5EnP+KGJZNuhphnIpzBrwQ2waPhCbwTCdtfeUhtov66+DRpIvdhvQVnK121wiRdb7h 9KrBpM5oWjyPGm6U/WeCm1QVlPJcNl9bEHqYBaImModt0LqQHyp+I3YSJ6R9/kD+kSem uSN8k9NQM4JaaR+1zHnATxGsRd3Nkc24ZdtxghXthb2esioKTexmuY8suzFBNZ6rRdAl lysta7YQU6lSYiM7q/I7cjUVjbvTTL7IxMdoB5Js7oABzsQYy5VFI4FGJ9tmDS/skhUk 859g== X-Gm-Message-State: AA6/9RmBECggf7uX2E2qqhczhGQS4UqjkW5KhbWzxB6h2DoN5gu1VSHGYH/oZWPnJChoVQ== X-Received: by 10.28.6.198 with SMTP id 189mr512119wmg.16.1476792845667; Tue, 18 Oct 2016 05:14:05 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id c7sm62390226wjk.19.2016.10.18.05.14.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Oct 2016 05:14:04 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Tue, 18 Oct 2016 14:13:49 +0200 Message-Id: <20161018121356.9594-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161018121356.9594-1-daniel.vetter@ffwll.ch> References: <20161018121356.9594-1-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , DRI Development Subject: [Intel-gfx] [PATCH 03/10] dim: echoerr helper for printing to stderr X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Daniel Vetter --- dim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dim b/dim index 192d6ee10838..2601bb7dbbad 100755 --- a/dim +++ b/dim @@ -102,12 +102,17 @@ DRY= FORCE= HELP= +function echoerr +{ + echo "$@" >&2 +} + function warn_or_fail { if [[ $FORCE ]] ; then - echo WARNING: $1, but continuing + echoerr WARNING: $1, but continuing else - echo ERROR: $1, aborting + echoerr ERROR: $1, aborting exit 1 fi } @@ -128,7 +133,7 @@ while getopts hdfi opt; do HELP=1 ;; *) - echo "See '$dim help' for more information." >&2 + echoerr "See '$dim help' for more information." exit esac done @@ -167,18 +172,18 @@ function dim_uptodate local using="${BASH_SOURCE[0]}" if [[ ! -e "$using" ]]; then - echo "$dim: could not figure out the version being used ($using)." >&2 + echoerr "$dim: could not figure out the version being used ($using)." exit 1 fi if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; then - echo "$dim: could not find the upstream repo for $dim." >&2 + echoerr "$dim: could not find the upstream repo for $dim." exit 1 fi if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show @{upstream}:dim |\ diff "$using" - >& /dev/null; then - echo "$dim: not running upstream version of the script." >&2 + echoerr "$dim: not running upstream version of the script." exit 1 fi } @@ -1280,6 +1285,6 @@ subcmd_func=dim_${subcmd//-/_} if declare -f $subcmd_func >/dev/null; then $subcmd_func "$@" else - echo "$dim: '$subcommand' is not a dim command." >&2 + echoerr "$dim: '$subcommand' is not a dim command." dim_usage fi