From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 11 Jun 2021 09:53:18 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1lrbyg-0001io-ID for lore@lore.pengutronix.de; Fri, 11 Jun 2021 09:53:18 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1lrbyg-00066y-7q; Fri, 11 Jun 2021 09:53:18 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrbyT-00066g-CC for ptxdist@pengutronix.de; Fri, 11 Jun 2021 09:53:05 +0200 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1lrbyS-0007TQ-Si for ptxdist@pengutronix.de; Fri, 11 Jun 2021 09:53:04 +0200 Received: from mol by dude03.red.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lrbyS-007GwM-Pb for ptxdist@pengutronix.de; Fri, 11 Jun 2021 09:53:04 +0200 Date: Fri, 11 Jun 2021 09:53:04 +0200 From: Michael Olbrich To: ptxdist@pengutronix.de Message-ID: <20210611075304.GC839947@pengutronix.de> Mail-Followup-To: ptxdist@pengutronix.de References: <20210606140144.28444-1-rhi@pengutronix.de> <20210606140144.28444-2-rhi@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210606140144.28444-2-rhi@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [ptxdist] [PATCH 2/2] ptxd_make_world_lint: allow single linters to be run X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false On Sun, Jun 06, 2021 at 04:01:47PM +0200, Roland Hieber wrote: > Some linters can take a while to run. Speed up the run-edit loop during > recipe development by making it possible to run a single linter, and add > a way of listing available linters. > > Signed-off-by: Roland Hieber > --- > bin/ptxdist | 5 ++++- > doc/ref_parameter.rst | 4 +++- > scripts/lib/ptxd_make_world_lint.sh | 30 ++++++++++++++++++++++++----- > 3 files changed, 32 insertions(+), 7 deletions(-) > > diff --git a/bin/ptxdist b/bin/ptxdist > index c41065311f0c..97370d92fc03 100755 > --- a/bin/ptxdist > +++ b/bin/ptxdist > @@ -776,7 +776,8 @@ Misc: > printnext assumes that the contents of is another > variable and print the contents of this variable > licensecheck check md5sums of license files for all packages > - lint run some basic checks for the bsp and PTXdist > + lint [] run some basic checks for the BSP and PTXdist > + (see 'lint list' for a list of available linters) > list-packages print a list of all selected packages > local-src [] overwrite a package source with a locally provided > directory containing the sourcecode. > @@ -1831,6 +1832,8 @@ EOF > ;; > lint) > export PTXDIST_GEN_ALL=1 > + export PTXDIST_LINT_TARGET=${1:-all} > + shift > check_premake_compiler && > ptxd_make_log ptxdist-lint && > if [ -e "${PTXDIST_TEMPDIR}/lint-failed" ]; then > diff --git a/doc/ref_parameter.rst b/doc/ref_parameter.rst > index a5b9bfe9eca6..3b49ee68b7ce 100644 > --- a/doc/ref_parameter.rst > +++ b/doc/ref_parameter.rst > @@ -250,10 +250,12 @@ Misc Actions > For the specified package (or all selected packages), check the MD5 sums > of license files. > > -``lint`` > +``lint []`` > check the BSP and PTXdist for all kinds of issues. These are not checks > for things that cause build errors. Instead the checks look for > inconsistencies that may cause hidden problems. > + ```` can be a single linter to run, or ``list`` to print a list of > + available linters, or ``all`` to run all linters (the default). > > ``list-packages`` > print a list of all selected packages. This list does not include the > diff --git a/scripts/lib/ptxd_make_world_lint.sh b/scripts/lib/ptxd_make_world_lint.sh > index 06926e58d614..a08198411292 100644 > --- a/scripts/lib/ptxd_make_world_lint.sh > +++ b/scripts/lib/ptxd_make_world_lint.sh > @@ -199,10 +199,30 @@ export -f ptxd_make_world_lint_credits > PTXDIST_LINT_COMMANDS="${PTXDIST_LINT_COMMANDS} credits" > > ptxd_make_world_lint() { > - local command > - > - for command in ${PTXDIST_LINT_COMMANDS}; do > - ptxd_make_world_lint_${command} > - done > + local command done > + > + case "${PTXDIST_LINT_TARGET}" in > + list|help) > + echo "Available linters: ${PTXDIST_LINT_COMMANDS}" > + return > + ;; > + all) > + for command in ${PTXDIST_LINT_COMMANDS}; do > + ptxd_make_world_lint_${command} > + done > + ;; > + *) > + for command in ${PTXDIST_LINT_COMMANDS}; do > + if [ "${PTXDIST_LINT_TARGET}" = "${command}" ]; then > + done=1 > + ptxd_make_world_lint_${command} > + fi > + done > + if [ -z "${done}" ]; then > + ptxd_bailout "No such linter: '${PTXDIST_LINT_TARGET}'" \ > + "Available linters: ${PTXDIST_LINT_COMMANDS}" > + fi The indention is wrong. And I think we can allow multiple linters as arguments (untested): above: export PTXDIST_LINT_TARGET="${*:-all}" I don't think you need the 'shift'. If I'm wrong then 'set --' should help. for command in ${PTXDIST_LINT_TARGET}; do if [[ " ${command} " =~ " ${PTXDIST_LINT_COMMANDS} " ]]; then ptxd_make_world_lint_${command} else ptxd_bailout "No such linter: '${command}'" \ "Available linters: ${PTXDIST_LINT_COMMANDS}" fi Michael > + ;; > + esac > } > export -f ptxd_make_world_lint > -- > 2.29.2 > > > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de > To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de