Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 00/14] Preventing style regressions using check-package v2
@ 2022-07-31 19:35 Ricardo Martincoski
  2022-07-31 19:35 ` [Buildroot] [PATCH v2 01/14] utils/check-package: decouple adding rules from fixing all intree files Ricardo Martincoski
                   ` (14 more replies)
  0 siblings, 15 replies; 25+ messages in thread
From: Ricardo Martincoski @ 2022-07-31 19:35 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Ricardo Martincoski

Hello,

Cc: Romain Naour <romain.naour@gmail.com>
Changes v1 -> v2:
  - drop patches already applied
  - drop patch starting a docker container from makefile (after review
    from Romain)
  - reword the manual (Romain)
  - mention utils/docker-run in the manual
  - create a make target to help update .checkpackageignore
  - add a RFC patch for a git pre-commit hook

This series:
- adds 'make check-package' to the workflow of sending patches to the
  list;
- ensures reproducible results for check-package (that will call
  shellcheck and flake8) when called with utils/docker-run;
- merges check-flake8 into check-package;
- makes check-package to check all shell scripts in the tree;
- makes check-package to check new directories in the tree;

The results of 'make check-package' already depends on the version of
shellcheck installed on the host and would also depend on the version of
flake8 installed on the host, making the results even less reproducible.
So in order to ensure reproducible results in local builds, specially
for newcomers, mention in the manual to run
'utils/docker-run make check-package' before sending patches to the
list.

After merging check-flake8 into check-package, 'make check-package'
takes much more time to run, 1-2 minutes instead of seconds.
But:
 - it can run inside the docker image, what ensures reproducible
 results;
 - it simplifies the dependency to the host tools when checking style:
   instead of installing shellcheck, flake8, and a growing number of
   python modules, the developer only needs docker and the docker image;
 - it standardizes the use and the developer must know only about one
   target: 'make check-package' instead of 'make check-flake8', 'make
   check-shellcheck', 'make check-somethingelse';

Patches 1 to 4 standardize the check for all files in the tree (yet
limited by the list of directories the check-package script knows that
it understand) and add a fine-grained ignore list for warnings in the
tree, making the creation of a new check_function in check-package to
take effect immediately when added to the tree.

Patch 5 adds 'utils/docker-run make check-package' to the default
workflow of sending patches, since its results are now reproducible and
depend only on docker installed on the host.

Patches 6 to 11 expand the list of files check-package do understand:
all shell scripts, all python scripts, and new directories: board,
support, utils.
At the end of this series, this is the output:

$ utils/docker-run make check-package
375242 lines processed
0 warnings generated

$ utils/docker-run make .checkpackageignore 
375242 lines processed
1422 warnings generated

Patch 12 is an example of fixing an ignored warning (and removing the
entry from the ignored list).

Patch 13 was in v1 an example of adding a new check_function to
check-package without fixing all warnings it would generate first. But
the fix was already applied.

Patch 14 is a RFC patch adding a git pre-commit hook that triggers
check-package.

Notice that even we are adding warnings to the ignore list, any new
patch sent to the list that triggers that new check_funtion will
generate warnings, preventing regressions.

This series intentionally do NOT make pkg-stats to check shell and
python scripts in the tree. pkg-stats remains counting warnings only to
files that do not depend on external tools (shellcheck, flake8) and
therefore already have reproducible results.
This change of checking all files in pkg-stats to count in the Warning
column is technically feasible, but in order to ensure reproducible
results, pkg-stats would need to run inside the docker image, and new
python modules would need to be added to the image: python3-aiohttp,
requests, ... too much complexity, I think.

Regards,
Ricardo

Ricardo Martincoski (14):
  utils/check-package: decouple adding rules from fixing all intree
    files
  support/testing: test check-package ignore list
  Makefile: add target to update .checkpackageignore
  Makefile: make check-package assume a git tree
  docs/manual: check-package before submitting patch
  support/docker: add python3-magic
  utils/check-package: check all shell scripts
  utils/check-package: check files in utils/
  utils/check-package: check files in board/
  utils/check-package: check files in support/
  Makefile: merge check-flake8 into check-package
  utils/docker-run: fix shellcheck warnings
  utils/checkpackagelib: warn about $(HOST_DIR)/usr
  utils/git_hooks: new script

 .checkpackageignore                           | 340 ++++++++++++++++++
 DEVELOPERS                                    |   1 +
 Makefile                                      |  17 +-
 docs/manual/contribute.txt                    |   6 +
 support/docker/Dockerfile                     |   1 +
 support/misc/gitlab-ci.yml.in                 |   4 -
 support/scripts/generate-gitlab-ci-yml        |   2 +-
 support/scripts/pkg-stats                     |   2 +-
 .../utils/br2-external/.checkpackageignore    |   1 +
 .../br2-external/package/.checkpackageignore  |   1 +
 .../package/.checkpackageignore_outdated      |   1 +
 .../tests/utils/br2-external/utils/x-python   |   2 +
 .../utils/br2-external/utils/x-shellscript    |   2 +
 .../testing/tests/utils/test_check_package.py |  65 ++++
 utils/check-package                           | 124 ++++++-
 utils/checkpackagelib/lib_mk.py               |  12 +
 utils/checkpackagelib/lib_python.py           |   1 +
 utils/checkpackagelib/lib_shellscript.py      |   5 +
 utils/checkpackagelib/lib_sysv.py             |   3 +
 utils/checkpackagelib/test_lib_mk.py          |  23 ++
 utils/checkpackagelib/test_tool.py            |  28 ++
 utils/checkpackagelib/tool.py                 |  20 ++
 utils/docker-run                              |  15 +-
 utils/git_hooks/pre-commit                    |  46 +++
 24 files changed, 686 insertions(+), 36 deletions(-)
 create mode 100644 .checkpackageignore
 create mode 100644 support/testing/tests/utils/br2-external/.checkpackageignore
 create mode 100644 support/testing/tests/utils/br2-external/package/.checkpackageignore
 create mode 100644 support/testing/tests/utils/br2-external/package/.checkpackageignore_outdated
 create mode 100644 support/testing/tests/utils/br2-external/utils/x-python
 create mode 100755 support/testing/tests/utils/br2-external/utils/x-shellscript
 create mode 100644 utils/checkpackagelib/lib_python.py
 create mode 100644 utils/checkpackagelib/lib_shellscript.py
 create mode 100644 utils/git_hooks/pre-commit

-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-05-01 19:50 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-31 19:35 [Buildroot] [PATCH v2 00/14] Preventing style regressions using check-package v2 Ricardo Martincoski
2022-07-31 19:35 ` [Buildroot] [PATCH v2 01/14] utils/check-package: decouple adding rules from fixing all intree files Ricardo Martincoski
2023-02-06 21:22   ` Thomas Petazzoni via buildroot
2022-07-31 19:35 ` [Buildroot] [PATCH v2 02/14] support/testing: test check-package ignore list Ricardo Martincoski
2023-02-06 21:23   ` Thomas Petazzoni via buildroot
2022-07-31 19:35 ` [Buildroot] [PATCH v2 03/14] Makefile: add target to update .checkpackageignore Ricardo Martincoski
2023-02-06 21:23   ` Thomas Petazzoni via buildroot
2022-07-31 19:35 ` [Buildroot] [PATCH v2 04/14] Makefile: make check-package assume a git tree Ricardo Martincoski
2023-02-06 21:23   ` Thomas Petazzoni via buildroot
2022-07-31 19:35 ` [Buildroot] [PATCH v2 05/14] docs/manual: check-package before submitting patch Ricardo Martincoski
2023-02-06 21:23   ` Thomas Petazzoni via buildroot
2022-07-31 19:35 ` [Buildroot] [PATCH v2 06/14] support/docker: add python3-magic Ricardo Martincoski
2023-02-06 21:24   ` Thomas Petazzoni via buildroot
2022-07-31 19:35 ` [Buildroot] [PATCH v2 07/14] utils/check-package: check all shell scripts Ricardo Martincoski
2023-02-08 12:30   ` Arnout Vandecappelle
2022-07-31 19:35 ` [Buildroot] [PATCH v2 08/14] utils/check-package: check files in utils/ Ricardo Martincoski
2023-02-08 14:29   ` Arnout Vandecappelle
2022-07-31 19:35 ` [Buildroot] [PATCH v2 09/14] utils/check-package: check files in board/ Ricardo Martincoski
2022-07-31 19:35 ` [Buildroot] [PATCH v2 10/14] utils/check-package: check files in support/ Ricardo Martincoski
2022-07-31 19:35 ` [Buildroot] [PATCH v2 11/14] Makefile: merge check-flake8 into check-package Ricardo Martincoski
2022-07-31 19:35 ` [Buildroot] [PATCH v2 12/14] utils/docker-run: fix shellcheck warnings Ricardo Martincoski
2022-07-31 19:35 ` [Buildroot] [PATCH v2 13/14] utils/checkpackagelib: warn about $(HOST_DIR)/usr Ricardo Martincoski
2022-07-31 19:35 ` [Buildroot] [RFC 14/14] utils/git_hooks: new script Ricardo Martincoski
2023-04-23 19:41   ` Yann E. MORIN
2023-05-01 19:50 ` [Buildroot] [PATCH v2 00/14] Preventing style regressions using check-package v2 Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox