devtools: download scripts from linux if not found
PATCH 1/1 devtools: download scripts from linux if not found
Both checkpatches.sh and get-maintainer.sh require scripts that come from the linux sources. And they require DPDK_*_PATH variables to be set to point at these scripts locally. For new contributors this can be tedious since they will have to clone the whole linux sources just to have simple perl scripts.
Update checkpatches.sh and get-maintainer.sh to have them download the upstream scripts if they are not found locally. Store the downloaded scripts in the .git/ folder so that they are found for future runs.
If either DPDK_CHECKPATCH_PATH or DPDK_GETMAINTAINER_PATH are set, they will be used in priority.
--- devtools/checkpatches.sh | 6 ++++ devtools/get-maintainer.sh | 9 ++++++ devtools/load-devel-config | 45 +++++++++++++++++++++++++++++ doc/guides/contributing/patches.rst | 1 + 4 files changed, 61 insertions(+)
devtools/checkpatches.sh +6 -0
@@ -43,6 +43,8 @@ print_usage () { Run Linux kernel checkpatch.pl with DPDK options. The environment variable DPDK_CHECKPATCH_PATH can be set, if not we will try to find the script in the sources of the currently running kernel. + If the script cannot be found, you will be prompted for downloading it + from the upstream linux sources. The patches to check can be from stdin, files specified on the command line, latest git commits limited with -n option, or commits in the git range
@@ -376,10 +378,14 @@ while getopts hn:qr:v ARG ; do done shift $(($OPTIND - 1)) +url="https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl" + if [ ! -f "$DPDK_CHECKPATCH_PATH" ] || [ ! -x "$DPDK_CHECKPATCH_PATH" ] ; then default_path="/lib/modules/$(uname -r)/source/scripts/checkpatch.pl" if [ -f "$default_path" ] && [ -x "$default_path" ] ; then DPDK_CHECKPATCH_PATH="$default_path" + elif download_script DPDK_CHECKPATCH_PATH "$url"; then + true else print_usage >&2 echo
devtools/get-maintainer.sh +9 -0
@@ -18,10 +18,19 @@ print_usage () { the get_maintainer.pl script located in Linux kernel sources. Example: DPDK_GETMAINTAINER_PATH=~/linux/scripts/get_maintainer.pl + If the script cannot be found, you will be prompted for downloading it + from the upstream linux sources. + Also refer to devtools/load-devel-config to store your configuration. END_OF_HELP } +if [ ! -f "$DPDK_GETMAINTAINER_PATH" ] || + [ ! -x "$DPDK_GETMAINTAINER_PATH" ] ; then + download_script DPDK_GETMAINTAINER_PATH \ + "https://raw.githubusercontent.com/torvalds/linux/master/scripts/get_maintainer.pl" +fi + # Requires DPDK_GETMAINTAINER_PATH devel config option set if [ ! -f "$DPDK_GETMAINTAINER_PATH" ] || [ ! -x "$DPDK_GETMAINTAINER_PATH" ] ; then
devtools/load-devel-config +45 -0
52 lines not on this page · raw message
doc/guides/contributing/patches.rst +1 -0
@@ -462,6 +462,7 @@ This uses the Linux kernel development tool ``checkpatch.pl`` which can be obta updating the Linux kernel sources. The path to the original Linux script must be set in the environment variable ``DPDK_CHECKPATCH_PATH``. +If this variable is not set, ``checkpatches.sh`` will prompt before downloading it locally. Spell checking of commonly misspelled words is enabled by default if installed in ``/usr/share/codespell/dictionary.txt``.
Signature · 1 line
2.44.0
Quoted 6 lines · On Fri, 15 Mar 2024 15:14:42 +0100 Robin Jarry <[email protected]> wrote:
Both
checkpatches.shandget-maintainer.shrequire scripts that come from the linux sources. And they require DPDK_*_PATH variables to be set to point at these scripts locally. For new contributors this can be tedious since they will have to clone the whole linux sources just to have simple perl scripts.
Quoted 8 lines
Update
checkpatches.shandget-maintainer.shto have them download the upstream scripts if they are not found locally. Store the downloaded scripts in the .git/ folder so that they are found for future runs.If either
DPDK_CHECKPATCH_PATHorDPDK_GETMAINTAINER_PATHare set, they will be used in priority.Signed-off-by Robin Jarry <[email protected]>
This makes live easier for new contributors.
Not sure if is the best way to autodownload, or where to put the scripts but something is better than the current way.
04/10/2024 18:31, Stephen Hemminger:
Quoted 16 lines
Quoted 13 lines · On Fri, 15 Mar 2024 15:14:42 +0100 Robin Jarry <[email protected]> wrote:
Both
checkpatches.shandget-maintainer.shrequire scripts that come from the linux sources. And they require DPDK_*_PATH variables to be set to point at these scripts locally. For new contributors this can be tedious since they will have to clone the whole linux sources just to have simple perl scripts.Update
checkpatches.shandget-maintainer.shto have them download the upstream scripts if they are not found locally. Store the downloaded scripts in the .git/ folder so that they are found for future runs.If either
DPDK_CHECKPATCH_PATHorDPDK_GETMAINTAINER_PATHare set, they will be used in priority.
Quoted 7 lines
Quoted 1 line
Signed-off-by Robin Jarry <[email protected]>This makes live easier for new contributors.
Not sure if is the best way to autodownload, or where to put the scripts but something is better than the current way.
I would prefer we host our own fork of checkpatch.pl. There are too many irrelevant checks that we should drop.
Thomas Monjalon, Nov 26, 2024 at 15:03:
Quoted 2 lines
I would prefer we host our own fork of checkpatch.pl. There are too many irrelevant checks that we should drop.
How about get_maintainer.pl? Should we host our copy as well?
26/11/2024 16:16, Robin Jarry:
Quoted 5 lines
Thomas Monjalon, Nov 26, 2024 at 15:03:
Quoted 2 lines
I would prefer we host our own fork of checkpatch.pl. There are too many irrelevant checks that we should drop.
How about get_maintainer.pl? Should we host our copy as well?
It may makes sense.
The central question is to know how to get those GPL2 scripts accepted in DPDK.
Thomas Monjalon, Nov 26, 2024 at 16:36:
Quoted 1 line
The central question is to know how to get those GPL2 scripts accepted in DPDK.
These are scripts, not linked to any DPDK related binary. So I think it is OK in terms of license contamination. We MUST preserve the original license headers in these imported scripts though.
I could find this link that discusses the matter:
https://wiki.tcl-lang.org/page/GPL+Scripts
I am not a legal expert though :)
Quoted 10 lines · On Fri, 15 Mar 2024 15:14:42 +0100 Robin Jarry <[email protected]> wrote:
Both
checkpatches.shandget-maintainer.shrequire scripts that come from the linux sources. And they require DPDK_*_PATH variables to be set to point at these scripts locally. For new contributors this can be tedious since they will have to clone the whole linux sources just to have simple perl scripts.Update
checkpatches.shandget-maintainer.shto have them download the upstream scripts if they are not found locally. Store the downloaded scripts in the .git/ folder so that they are found for future runs.
Quoted 5 lines
If either
DPDK_CHECKPATCH_PATHorDPDK_GETMAINTAINER_PATHare set, they will be used in priority.Signed-off-by Robin Jarry <[email protected]>---
There are two many open questions on this patch.
That is why it never got merged.
As long as we document existing usage well enough it seems ok as is. Trying to be "helpful" by doing curl opens up more issues.
Lets just keep it as is. Longer term having better local solutions would be good. Ideally checkpatch can be replaced by AI and get maintainer could be python script in DPDK.