Skip to contentSkip to conversation

devtools: refuse indent with tabs in Meson

PATCH In review David Marchand 3 participants 7 messages Oct 22, 2021 – Nov 2, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: refuse indent with tabs in Meson

The rule for indentation in Meson in DPDK is 4 spaces.

Any tab should be flagged as an issue, let's extend the check and fix existing offenders.

Fixes 4ad4b20a7905 ("drivers: change indentation in build files")
Fixes 2457705e6474 ("crypto/cnxk: add driver skeleton")
Fixes 634b73104482 ("app/testpmd: build on Windows")
Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
Fixes 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Fixes e1369718f553 ("common/octeontx: enable build only on 64-bit Linux")
Fixes 2b504721bfda ("app/bbdev: enable la12xx")
---
 app/pdump/meson.build                 |  6 +--
 app/proc-info/meson.build             |  6 +--
 app/test-acl/meson.build              |  6 +--
 app/test-bbdev/meson.build            |  8 ++--
 app/test-cmdline/meson.build          |  6 +--
 app/test-compress-perf/meson.build    |  6 +--
 app/test-crypto-perf/meson.build      |  6 +--
 app/test-eventdev/meson.build         |  6 +--
 app/test-fib/meson.build              |  6 +--
 app/test-flow-perf/meson.build        |  6 +--
 app/test-pipeline/meson.build         |  6 +--
 app/test-regex/meson.build            |  6 +--
 app/test-sad/meson.build              |  6 +--
 app/test/meson.build                  |  6 +--
 config/meson.build                    | 58 +++++++++++++--------------
 devtools/check-meson.py               |  3 ++
 drivers/compress/octeontx/meson.build |  6 +--
 drivers/crypto/cnxk/meson.build       |  6 +--
 drivers/crypto/qat/meson.build        |  2 +-
 drivers/net/ice/meson.build           |  2 +-
 20 files changed, 83 insertions(+), 80 deletions(-)
app/pdump/meson.build +3 -3
index db1fcadbfe..fb282bba1f 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2018 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files('main.c')
app/proc-info/meson.build +3 -3
index 82ed05bb0b..1062e0ef86 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2018 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files('main.c')
app/test-acl/meson.build +3 -3
index 14d36b33e9..c0dc4b221a 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2019 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files('main.c')
app/test-bbdev/meson.build +4 -4
index a726a5b3fa..76d4c26999 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2018 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files(
@@ -24,5 +24,5 @@ if dpdk_conf.has('RTE_BASEBAND_ACC100')
     deps += ['baseband_acc100']
 endif
 if dpdk_conf.has('RTE_LIBRTE_PMD_BBDEV_LA12XX')
-	deps += ['baseband_la12xx']
+    deps += ['baseband_la12xx']
 endif
app/test-cmdline/meson.build +3 -3
index 0898821200..6027f67919 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2019 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files('commands.c', 'cmdline_test.c')
app/test-compress-perf/meson.build +3 -3
index f29c6ee863..34dcfe5b8e 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2018 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files(
app/test-crypto-perf/meson.build +3 -3
index ef3582a87c..7b02b518f0 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2018 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files(
app/test-eventdev/meson.build +3 -3
index 17be360677..ab8769c755 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2017 Cavium, Inc
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files(
app/test-fib/meson.build +3 -3
index 3360ea02b0..eb36772cf3 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2019 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files('main.c')
app/test-flow-perf/meson.build +3 -3
index a33cad9078..766e4516ad 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2020 Mellanox Technologies, Ltd
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files(
app/test-pipeline/meson.build +3 -3
index 7d123e32fb..3add6b637b 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2019 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files(
app/test-regex/meson.build +3 -3
index 02b101980e..e3ba060e55 100644
@@ -2,9 +2,9 @@
 # Copyright 2020 Mellanox Technologies, Ltd
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files('main.c')
app/test-sad/meson.build +3 -3
index 3d15727a01..a50616a9c7 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2019 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 sources = files('main.c')
app/test/meson.build +3 -3
index 20f36a1803..3d9470df23 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
 endif
 
 if not get_option('tests')
config/meson.build +29 -29

76 lines not on this page · raw message

devtools/check-meson.py +3 -0
index 29f7887968..4b2338828d 100755
@@ -8,6 +8,7 @@
 
 import sys
 import os
+import re
 from os.path import relpath, join
 from argparse import ArgumentParser
 
@@ -50,6 +51,8 @@ def check_indentation(filename, contents):
         code, comments = split_code_comments(line)
         if not code.strip():
             continue
+        if re.match('^ *\t', code):
+            print(f'Error parsing {filename}:{lineno}, got some tabulation')
         if code.endswith('files('):
             if infiles:
                 raise(f'Error parsing {filename}:{lineno}, got "files(" when already parsing files list')
drivers/compress/octeontx/meson.build +3 -3
index cd8687fde3..3a29c3e609 100644
@@ -2,9 +2,9 @@
 # Copyright(c) 2018 Cavium, Inc
 
 if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
-	build = false
-	reason = 'only supported on 64-bit Linux'
-	subdir_done()
+    build = false
+    reason = 'only supported on 64-bit Linux'
+    subdir_done()
 endif
 
 sources = files('otx_zip.c', 'otx_zip_pmd.c')
drivers/crypto/cnxk/meson.build +3 -3
index 024109f7e9..23a1cc3aac 100644
@@ -3,9 +3,9 @@
 #
 
 if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
-	build = false
-	reason = 'only supported on 64-bit Linux'
-	subdir_done()
+    build = false
+    reason = 'only supported on 64-bit Linux'
+    subdir_done()
 endif
 
 sources = files(
drivers/crypto/qat/meson.build +1 -1
index b3b2d17258..544f481067 100644
@@ -19,7 +19,7 @@ if dep.found()
             'qat_sym_hw_dp.c',
             'qat_sym_pmd.c',
             'qat_sym_session.c',
-	)
+    )
     qat_ext_deps += dep
     qat_cflags += '-DBUILD_QAT_SYM'
     qat_cflags += '-DBUILD_QAT_ASYM'
drivers/net/ice/meson.build +1 -1
index 0b86d74a49..be15a2ed02 100644
@@ -71,6 +71,6 @@ sources += files('ice_dcf.c',
          'ice_dcf_vf_representor.c',
          'ice_dcf_ethdev.c',
          'ice_dcf_parent.c',
-	 'ice_dcf_sched.c')
+         'ice_dcf_sched.c')
 
 headers = files('rte_pmd_ice.h')
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · David Marchand

The rule for indentation in Meson in DPDK is 4 spaces.

Any tab should be flagged as an issue, let's extend the check and fix existing offenders.

Fixes 4ad4b20a7905 ("drivers: change indentation in build files")
Fixes 2457705e6474 ("crypto/cnxk: add driver skeleton")
Fixes 634b73104482 ("app/testpmd: build on Windows")
Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
Fixes 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Fixes e1369718f553 ("common/octeontx: enable build only on 64-bit Linux")
Fixes 2b504721bfda ("app/bbdev: enable la12xx")
Quoted 1 line

One small comment inline below.

Quoted 23 lines
---
 app/pdump/meson.build                 |  6 +--
 app/proc-info/meson.build             |  6 +--
 app/test-acl/meson.build              |  6 +--
 app/test-bbdev/meson.build            |  8 ++--
 app/test-cmdline/meson.build          |  6 +--
 app/test-compress-perf/meson.build    |  6 +--
 app/test-crypto-perf/meson.build      |  6 +--
 app/test-eventdev/meson.build         |  6 +--
 app/test-fib/meson.build              |  6 +--
 app/test-flow-perf/meson.build        |  6 +--
 app/test-pipeline/meson.build         |  6 +--
 app/test-regex/meson.build            |  6 +--
 app/test-sad/meson.build              |  6 +--
 app/test/meson.build                  |  6 +--
 config/meson.build                    | 58 +++++++++++++--------------
 devtools/check-meson.py               |  3 ++
 drivers/compress/octeontx/meson.build |  6 +--
 drivers/crypto/cnxk/meson.build       |  6 +--
 drivers/crypto/qat/meson.build        |  2 +-
 drivers/net/ice/meson.build           |  2 +-
 20 files changed, 83 insertions(+), 80 deletions(-)

<snip>

Quoted 13 lines
devtools/check-meson.py +1 -0
index 29f7887968..4b2338828d 100755
@@ -8,6 +8,7 @@
 
 import sys
 import os
+import re
 from os.path import relpath, join
 from argparse import ArgumentParser
 

devtools/check-meson.py def check_indentation(filename, contents): · line 58

Quoted 8 lines
devtools/check-meson.py +2 -0
@@ -50,6 +51,8 @@ def check_indentation(filename, contents):
         code, comments = split_code_comments(line)
         if not code.strip():
             continue
+        if re.match('^ *\t', code):
+            print(f'Error parsing {filename}:{lineno}, got some tabulation')
         if code.endswith('files('):
             if infiles:
                 raise(f'Error parsing {filename}:{lineno}, got "files(" when already parsing files list')

I wonder is there ever any scenario where we want to allow tabs on a line? If not, then rather than using regex, the check could be simplified to:

if '\t' in line:

Quoted 4 lines
drivers/compress/octeontx/meson.build +0 -0
index cd8687fde3..3a29c3e609 100644

<snip>

#2 lore raw
Quoted 4 lines · Bruce Richardson

I wonder is there ever any scenario where we want to allow tabs on a line? If not, then rather than using regex, the check could be simplified to:

if '\t' in line:

I am not sure.
I considered cases with tabs in log messages.

Signature · 1 line
David Marchand
#3 lore raw
Quoted 10 lines · David Marchand
Quoted 4 lines · Bruce Richardson

I wonder is there ever any scenario where we want to allow tabs on a line? If not, then rather than using regex, the check could be simplified to:

if '\t' in line:

I am not sure.
I considered cases with tabs in log messages.

Ok. I think we'd live without tabs in log messages if we had to, but for now your version is safer as it allows us to keep everything else unchanged.

/Bruce

author Acked-by Stephen Hemminger
#4 lore raw
In reply to Bruce Richardson
Quoted 15 lines · Bruce Richardson
Quoted 13 lines · David Marchand

The rule for indentation in Meson in DPDK is 4 spaces.

Any tab should be flagged as an issue, let's extend the check and fix existing offenders.

Fixes 4ad4b20a7905 ("drivers: change indentation in build files")
Fixes 2457705e6474 ("crypto/cnxk: add driver skeleton")
Fixes 634b73104482 ("app/testpmd: build on Windows")
Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
Fixes 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Fixes e1369718f553 ("common/octeontx: enable build only on 64-bit Linux")
Fixes 2b504721bfda ("app/bbdev: enable la12xx")
Quoted 2 lines
Quoted 1 line

Fixed new issues on main, and applied, thanks.

Signature · 1 line
David Marchand
#5 lore raw
In reply to David Marchand
Quoted 13 lines · On Fri, 22 Oct 2021 22:55:31 +0200 David Marchand <[email protected]>…

The rule for indentation in Meson in DPDK is 4 spaces.

Any tab should be flagged as an issue, let's extend the check and fix existing offenders.

Fixes 4ad4b20a7905 ("drivers: change indentation in build files")
Fixes 2457705e6474 ("crypto/cnxk: add driver skeleton")
Fixes 634b73104482 ("app/testpmd: build on Windows")
Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
Fixes 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Fixes e1369718f553 ("common/octeontx: enable build only on 64-bit Linux")
Fixes 2b504721bfda ("app/bbdev: enable la12xx")
Quoted 1 line

There is also a new one in the dumpcap program, but can send follow on for that one.

#6 lore raw
Quoted 17 lines · Stephen Hemminger
Quoted 13 lines · On Fri, 22 Oct 2021 22:55:31 +0200 David Marchand <[email protected]>…

The rule for indentation in Meson in DPDK is 4 spaces.

Any tab should be flagged as an issue, let's extend the check and fix existing offenders.

Fixes 4ad4b20a7905 ("drivers: change indentation in build files")
Fixes 2457705e6474 ("crypto/cnxk: add driver skeleton")
Fixes 634b73104482 ("app/testpmd: build on Windows")
Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
Fixes 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Fixes e1369718f553 ("common/octeontx: enable build only on 64-bit Linux")
Fixes 2b504721bfda ("app/bbdev: enable la12xx")
Quoted 6 lines
Quoted 1 line

There is also a new one in the dumpcap program, but can send follow on for that one.

I am not aware of this form of tag, and patchwork does not recognise it either. Converted to usual ack.

Signature · 1 line
David Marchand