From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id 5636C324D for ; Thu, 1 Nov 2018 07:45:34 +0100 (CET) Received: by mail-io1-f65.google.com with SMTP id 79-v6so11508453iou.2 for ; Wed, 31 Oct 2018 23:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qwilt-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pyr8sGInm/vfoEYpmR+WdSgT15ikuRGx/eh2DPhqWH0=; b=EqBuqfO8jgReH0uXQV0ZsXYOnIJR6EHZKAksXsDUHqD+zqe5HRh0PAFwRfSa1vFgEg ob+tgGPO/F6VaKYbAjFPNpGPJUYhZSuXEWAxcvB07nDY1xpFgjtsvACm8ymFGQlmxPsB hgJX0rspDaQBalNGA7//S/rA9+TF0/I6QwqMvWulvIqkKu224CW+ZxFmPKsdcu1Pf5ms EZXKdiW17AgSYr2HtzptI3UBfFhgzwBJcxzsWlnir0b7e90ugBS07qg0yP3EIgtJN/N8 jq5+9DC991OsKe5uPj93jOTFfD1iCy+7JfuZ2OJ6zRWnrJeXOQgJse4+d//juip3t53C BYTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pyr8sGInm/vfoEYpmR+WdSgT15ikuRGx/eh2DPhqWH0=; b=qAKiLFQHRnSpxophuW+FHSaqDcD6zeUrwzMxBu9zfz5WMX9awLOY8ZC5RxzAiXPwS4 V3SopxPf5Qht3s22SptM3ulVGD8NlKH5AxpJmp8tf0sEUJEetouUrbph4F+sLWMyJ3GH OB1VHI4qXM3Af+jzA/p3dIS9GiqfiDKey5nlJJ5RIaDIw5EZS5g633Ra5Ccui1ELgNen IWd1d1Y96/z4VDewxa4xWV0QOAXyBumAxEqK7JpaxJQaHSDidNe0rkS/M5dbjJWp9/ck sWuVfrXuctHZbHPNzylwf2ZBedBk0LvmN3ADE17yAEkXyY6DkxHo3tEMVKE1KQxf2+ZU s6zA== X-Gm-Message-State: AGRZ1gLO6Aorp3Zxm7X6dGjRuhMmM36m09NOz6xsENWu5JsXD5pMIbaX /4jOJBaz8eL3cL/Gne9/axOP0VB87KQ6qku4KCIcLA== X-Google-Smtp-Source: AJdET5cGv82X5pMMmdtmYtAhQn/1kpRDIk6Ojr6wdtIKnstK57a3tyyraTjcIMeJZxNu4Ll5uBemy7mFtYd06MzW7W0= X-Received: by 2002:a5e:8707:: with SMTP id y7-v6mr4047533ioj.8.1541054733520; Wed, 31 Oct 2018 23:45:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:5502:0:0:0:0:0 with HTTP; Wed, 31 Oct 2018 23:45:32 -0700 (PDT) In-Reply-To: <20181031162842.19431-1-thomas@monjalon.net> References: <20181031110548.31184-1-thomas@monjalon.net> <20181031162842.19431-1-thomas@monjalon.net> From: Arnon Warshavsky Date: Thu, 1 Nov 2018 08:45:32 +0200 Message-ID: To: Thomas Monjalon Cc: dev@dpdk.org, john.mcnamara@intel.com, marko.kovacevic@intel.com Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2] devtools: check wrong svg include in guides X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 06:45:34 -0000 Hi >PS: the warning contains the regex. May it be improved? How about passing an explicit warning message to the awk instead of the regex? +++ b/devtools/check-forbidden-tokens.awk END { if (count > 0) { print "Warning in " substr(last_file,6) ":" - print "are you sure you want to add the following:" - for (key in expressions) { - if (expressions[key] > 0) { - print key - } - } + print MESSAGE exit RET_ON_FAIL } } +++ b/devtools/checkpatches.sh -check_forbidden_additions() { +check_forbidden_additions() { # + local ret=0 # refrain from new additions of rte_panic() and rte_exit() # multiple folders and expressions are separated by spaces awk -v FOLDERS="lib drivers" \ -v EXPRESSIONS="rte_panic\\\( rte_exit\\\(" \ -v RET_ON_FAIL=1 \ - -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk - + -v MESSAGE='Usage of rte_panic/rte_exit' \ + -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk \ + "$1" + if [ $? -ne 0 ] ; then + ret=1 + fi + # svg figures must be included with wildcard extension + # because of png conversion for pdf docs + awk -v FOLDERS='doc' \ + -v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using explicit .svg extention in figures instead of .*' \ + -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk \ + "$1" + if [ $? -ne 0 ] ; then + ret=1 + fi + + return $ret } I also noticed that there is a need to keep the return value from each check in case the first fails and the latter succeeds thanks /Arnon On Wed, Oct 31, 2018 at 6:28 PM, Thomas Monjalon wrote: > Including svg files with the svg extension is a common mistake: > .. figure:: example.svg > must be > .. figure:: example.* > So it will work also when building pdf doc with figures converted > to png files. > > A check is added in checkpatches.sh. > > Signed-off-by: Thomas Monjalon > Signed-off-by: Arnon Warshavsky > > PS: the warning contains the regex. May it be improved? > > Warning in /doc/guides/nics/mvpp2.rst: > are you sure you want to add the following: > ::[[:space:]]*[^[:space:]]*\.svg > > Cc: Arnon Warshavsky > --- > devtools/checkpatches.sh | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh > index bf3114f95..fb9e9f76d 100755 > --- a/devtools/checkpatches.sh > +++ b/devtools/checkpatches.sh > @@ -43,13 +43,21 @@ print_usage () { > END_OF_HELP > } > > -check_forbidden_additions() { > +check_forbidden_additions() { # > # refrain from new additions of rte_panic() and rte_exit() > # multiple folders and expressions are separated by spaces > awk -v FOLDERS="lib drivers" \ > -v EXPRESSIONS="rte_panic\\\( rte_exit\\\(" \ > -v RET_ON_FAIL=1 \ > - -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk > - > + -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk > \ > + "$1" > + # svg figures must be included with wildcard extension > + # because of png conversion for pdf docs > + awk -v FOLDERS='doc' \ > + -v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \ > + -v RET_ON_FAIL=1 \ > + -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk > \ > + "$1" > } > > number=0 > @@ -115,7 +123,7 @@ check () { # > fi > > ! $verbose || printf '\nChecking forbidden tokens additions:\n' > - report=$(check_forbidden_additions <"$tmpinput") > + report=$(check_forbidden_additions "$tmpinput") > if [ $? -ne 0 ] ; then > $headline_printed || print_headline "$3" > printf '%s\n' "$report" > -- > 2.19.0 > > -- *Arnon Warshavsky* *Qwilt | work: +972-72-2221634 | mobile: +972-50-8583058 | arnon@qwilt.com <arnon@qwilt.com>*