Skip to contentSkip to conversation

scripts: add git hook scripts for checkpatch and auto doc generation

PATCH New Ferruh Yigit 2 participants 10 messages Oct 29, 2015 – Dec 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: add git hook scripts for checkpatch and auto doc generation

These scripts are to automate some common tasks, scripts needs to be deployed to specific folder to become active.

Scripts:
post-commit: Triggers after commit complete, re-generates api and guides html documents. "RTE_DOC_OUT" environment variable configures document output folder. Same script can be used on server side with name "post-update", so documentation can auto updated after each push to server.

post-merge: Same script as "post-commit", but triggered after git pull

pre-commit: Does a checkpatch check before commit started. If script finds any error it will print warnings and fails. If checkpatch fails commit also fails. This guaranties every commit pass checkpatch. Default script is <dpdk>/scripts/checkpatch.pl but this can be changed by RTE_CHECKPATCH environment variable. Also a default list of checkpatch ignore items defined, new ones can be added by IGNORE environment variable.
This script can bypassed by commit "--no-verify" argument.

Deployment:
To make scripts active they need to be in <dpdk>/.git/hooks folder. Alternatively "deploy.sh" script can be used, it simply copies all scripts into proper folder. Script names are significant and shouldn't changed.

---
 scripts/git-hooks/deploy.sh   | 19 +++++++++++++++++++
 scripts/git-hooks/post-commit | 10 ++++++++++
 scripts/git-hooks/post-merge  | 10 ++++++++++
 scripts/git-hooks/pre-commit  | 44 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+)
 create mode 100755 scripts/git-hooks/deploy.sh
 create mode 100755 scripts/git-hooks/post-commit
 create mode 100755 scripts/git-hooks/post-merge
 create mode 100755 scripts/git-hooks/pre-commit
scripts/git-hooks/deploy.sh new file +19 -0
new file mode 100755
index 0000000..0aa7ffb
@@ -0,0 +1,19 @@
+
+NAME=$(basename $0)
+
+if [ ! -f ${NAME} ]; then
+	echo "Please run script from folder where script is"
+	exit 1
+fi
+
+FILES=$(ls | grep -v ${NAME})
+
+TARGET_FOLDER="../../.git/hooks"
+
+if [ ! -d ${TARGET_FOLDER} ]; then
+	exit 2
+fi
+
+for f in ${FILES}; do
+	cp -i ${f} ${TARGET_FOLDER}/
+done;
scripts/git-hooks/post-commit new file +10 -0
new file mode 100755
index 0000000..2a76f96
@@ -0,0 +1,10 @@
+#
+# Create docs after each commit
+#
+
+if [ -n "$RTE_DOC_OUT" ]; then
+	OUT_CMD="O=${RTE_DOC_OUT}"
+fi
+
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null
scripts/git-hooks/post-merge new file +10 -0
new file mode 100755
index 0000000..2a76f96
@@ -0,0 +1,10 @@
+#
+# Create docs after each commit
+#
+
+if [ -n "$RTE_DOC_OUT" ]; then
+	OUT_CMD="O=${RTE_DOC_OUT}"
+fi
+
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null
scripts/git-hooks/pre-commit new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 scripts: add git hook scripts for checkpatch and auto doc generation

Sorry for duplication, previous patch is not in the patchwork, this is the exact same patch and re-sent for patchwork.

Ferruh Yigit (1):
scripts: add git hook scripts for checkpatch and auto doc generation

 scripts/git-hooks/deploy.sh   | 19 +++++++++++++++++++
 scripts/git-hooks/post-commit | 10 ++++++++++
 scripts/git-hooks/post-merge  | 10 ++++++++++
 scripts/git-hooks/pre-commit  | 44 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+)
 create mode 100755 scripts/git-hooks/deploy.sh
 create mode 100755 scripts/git-hooks/post-commit
 create mode 100755 scripts/git-hooks/post-merge
 create mode 100755 scripts/git-hooks/pre-commit
Signature · 1 line
2.5.0
#2 lore raw

PATCH 1/1 scripts: add git hook scripts for checkpatch and auto doc generation

These scripts are to automate some common tasks, scripts needs to be deployed to specific folder to become active.

Scripts:
post-commit: Triggers after commit complete, re-generates api and guides html documents. "RTE_DOC_OUT" environment variable configures document output folder. Same script can be used on server side with name "post-update", so documentation can auto updated after each push to server.

post-merge: Same script as "post-commit", but triggered after git pull

pre-commit: Does a checkpatch check before commit started. If script finds any error it will print warnings and fails. If checkpatch fails commit also fails. This guaranties every commit pass checkpatch. Default script is <dpdk>/scripts/checkpatch.pl but this can be changed by RTE_CHECKPATCH environment variable. Also a default list of checkpatch ignore items defined, new ones can be added by IGNORE environment variable.
This script can bypassed by commit "--no-verify" argument.

Deployment:
To make scripts active they need to be in <dpdk>/.git/hooks folder. Alternatively "deploy.sh" script can be used, it simply copies all scripts into proper folder. Script names are significant and shouldn't changed.

---
 scripts/git-hooks/deploy.sh   | 19 +++++++++++++++++++
 scripts/git-hooks/post-commit | 10 ++++++++++
 scripts/git-hooks/post-merge  | 10 ++++++++++
 scripts/git-hooks/pre-commit  | 44 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+)
 create mode 100755 scripts/git-hooks/deploy.sh
 create mode 100755 scripts/git-hooks/post-commit
 create mode 100755 scripts/git-hooks/post-merge
 create mode 100755 scripts/git-hooks/pre-commit
scripts/git-hooks/deploy.sh new file +19 -0
new file mode 100755
index 0000000..0aa7ffb
@@ -0,0 +1,19 @@
+
+NAME=$(basename $0)
+
+if [ ! -f ${NAME} ]; then
+	echo "Please run script from folder where script is"
+	exit 1
+fi
+
+FILES=$(ls | grep -v ${NAME})
+
+TARGET_FOLDER="../../.git/hooks"
+
+if [ ! -d ${TARGET_FOLDER} ]; then
+	exit 2
+fi
+
+for f in ${FILES}; do
+	cp -i ${f} ${TARGET_FOLDER}/
+done;
scripts/git-hooks/post-commit new file +10 -0
new file mode 100755
index 0000000..2a76f96
@@ -0,0 +1,10 @@
+#
+# Create docs after each commit
+#
+
+if [ -n "$RTE_DOC_OUT" ]; then
+	OUT_CMD="O=${RTE_DOC_OUT}"
+fi
+
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null
scripts/git-hooks/post-merge new file +10 -0
new file mode 100755
index 0000000..2a76f96
@@ -0,0 +1,10 @@
+#
+# Create docs after each commit
+#
+
+if [ -n "$RTE_DOC_OUT" ]; then
+	OUT_CMD="O=${RTE_DOC_OUT}"
+fi
+
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null
scripts/git-hooks/pre-commit new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.5.0
#3 lore raw

Thanks for the idea

2015-11-06 13:48, Ferruh Yigit:

Quoted 1 line

post-merge: Same script as "post-commit", but triggered after git pull

A symbolic link would be sufficient.
As it must be installed in the git hooks (probably making a symbolic link), duplicating the file is not needed at all.

Quoted 7 lines

pre-commit: Does a checkpatch check before commit started. If script finds any error it will print warnings and fails. If checkpatch fails commit also fails. This guaranties every commit pass checkpatch. Default script is <dpdk>/scripts/checkpatch.pl but this can be changed by RTE_CHECKPATCH environment variable. Also a default list of checkpatch ignore items defined, new ones can be added by IGNORE environment variable.

Please use the new scripts/checkpatches.sh:
http://dpdk.org/dev/patchwork/patch/9036/

Quoted 1 line

This script can bypassed by commit "--no-verify" argument.

Could you document the --no-verify option in the script?

Quoted 5 lines

Deployment:
To make scripts active they need to be in <dpdk>/.git/hooks folder. Alternatively "deploy.sh" script can be used, it simply copies all scripts into proper folder. Script names are significant and shouldn't changed.

Why not using symbolic links?

#4 lore raw
Quoted 9 lines · Thomas Monjalon

Thanks for the idea

2015-11-06 13:48, Ferruh Yigit:

Quoted 1 line

post-merge: Same script as "post-commit", but triggered after git pull

A symbolic link would be sufficient.
As it must be installed in the git hooks (probably making a symbolic link), duplicating the file is not needed at all.

OK

Quoted 11 lines
Quoted 7 lines

pre-commit: Does a checkpatch check before commit started. If script finds any error it will print warnings and fails. If checkpatch fails commit also fails. This guaranties every commit pass checkpatch. Default script is <dpdk>/scripts/checkpatch.pl but this can be changed by RTE_CHECKPATCH environment variable. Also a default list of checkpatch ignore items defined, new ones can be added by IGNORE environment variable.

Please use the new scripts/checkpatches.sh:
http://dpdk.org/dev/patchwork/patch/9036/

OK, better to use that script, to prevent duplicated IGNORE flag and checkpatch.pl location maintenance.

Quoted 4 lines
Quoted 1 line

This script can bypassed by commit "--no-verify" argument.

Could you document the --no-verify option in the script?

This is git feature, with that flag script not called at all, I will add this comment into script.

Quoted 8 lines
Quoted 5 lines

Deployment:
To make scripts active they need to be in <dpdk>/.git/hooks folder. Alternatively "deploy.sh" script can be used, it simply copies all scripts into proper folder. Script names are significant and shouldn't changed.

Why not using symbolic links?

Yes we can use symbolic links.

I will send updated patch.

Thanks for the review,
ferruh

#5 lore raw
In reply to Ferruh Yigit
Quoted 3 lines · Ferruh Yigit

Sorry for duplication, previous patch is not in the patchwork, this is the exact same patch and re-sent for patchwork.

Incase anybody interested patchwork error seems because of a special char in message header "Received" field. Failed ones has: "... with œ id ..."

Not sure why specific host appends this char.

Thanks,
ferruh

#6 lore raw

PATCH v2 1/1 scripts: add git hook scripts for checkpatch and auto doc generation

In reply to Ferruh Yigit

These scripts are to automate some common tasks, scripts needs to be deployed to specific folder to become active.

Scripts:
post-commit: Triggers after commit complete, re-generates api and guides html documents. "RTE_DOC_OUT" environment variable configures document output folder. Same script can be used on server side with name "post-update", so documentation can auto updated after each push to server.

post-merge: Same script as "post-commit", but triggered after git pull

pre-commit: Does a checkpatch check before commit started. This script relies on scripts/checkpatches.sh script. checkpathes.sh should be running well to use this git hook script.
This script can bypassed by commit "--no-verify" argument.

Deployment:
To make scripts active they need to be in <dpdk>/.git/hooks folder. Alternatively "deploy.sh" script can be used, it simply links all scripts into proper folder. Script names are significant and shouldn't changed.

---
 scripts/checkpatches.sh       |  1 +
 scripts/git-hooks/deploy.sh   | 20 ++++++++++++++++++++
 scripts/git-hooks/post-commit | 10 ++++++++++
 scripts/git-hooks/post-merge  |  1 +
 scripts/git-hooks/pre-commit  | 17 +++++++++++++++++
 5 files changed, 49 insertions(+)
 create mode 100755 scripts/git-hooks/deploy.sh
 create mode 100755 scripts/git-hooks/post-commit
 create mode 120000 scripts/git-hooks/post-merge
 create mode 100755 scripts/git-hooks/pre-commit
scripts/checkpatches.sh +1 -0
index afc611b..8192514 100755
@@ -43,6 +43,7 @@ length=${DPDK_CHECKPATCH_LINE_LENGTH:-80}
 
 # override default Linux options
 options="--no-tree"
+options="$options ${GIT_HOOK_OPTIONS}"
 options="$options --max-line-length=$length"
 options="$options --show-types"
 options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
scripts/git-hooks/deploy.sh new file +20 -0
new file mode 100755
index 0000000..070fb6e
@@ -0,0 +1,20 @@
+
+SELF=$(basename $0)
+
+if [ ! -f ${SELF} ]; then
+	echo "Please run script from folder where script is"
+	exit 1
+fi
+
+FILES=$(ls | grep -v ${SELF})
+
+TARGET_FOLDER="../../.git/hooks"
+SCRIPT_FOLDER="../../scripts/git-hooks"
+
+if [ ! -d ${TARGET_FOLDER} ]; then
+	exit 2
+fi
+
+for f in ${FILES}; do
+	ln -sf ${SCRIPT_FOLDER}/${f} ${TARGET_FOLDER}/${f}
+done;
scripts/git-hooks/post-commit new file +10 -0
new file mode 100755
index 0000000..2a76f96
@@ -0,0 +1,10 @@
+#
+# Create docs after each commit
+#
+
+if [ -n "$RTE_DOC_OUT" ]; then
+	OUT_CMD="O=${RTE_DOC_OUT}"
+fi
+
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null
scripts/git-hooks/post-merge new file +1 -0
new file mode 120000
index 0000000..ace4560
@@ -0,0 +1 @@
+post-commit
\ No newline at end of file
scripts/git-hooks/pre-commit new file +17 -0
new file mode 100755
index 0000000..c46b27d
@@ -0,0 +1,17 @@
+#
+# Check patch with checkpatch script before commit
+#
+# If checkpatch fails, commit fails
+#
+# Relies on scripts/checkpathes.sh script as checkpatch.pl wrapper
+#
+# If "git commit" called with "--no-verify" option, pre-commit hooks
+# bypassed and this script not called, checkpatch bypassed
+#
+
+RTE_CHECKPATCH=$PWD/scripts/checkpatches.sh
+PATCH=/tmp/dpdk-git-auto-checkpatch-$$.patch
+export GIT_HOOK_OPTIONS=--no-signoff
+
+git diff --cached > ${PATCH}
+exec ${RTE_CHECKPATCH} ${PATCH}
Signature · 1 line
2.5.0
#7 lore raw

Ferruh,
I have a lot of questions :)

2015-11-27 14:34, Ferruh Yigit:

scripts/checkpatches.sh length=${DPDK_CHECKPATCH_LINE_LENGTH:-80} · line 46

Quoted 7 lines
scripts/checkpatches.sh +1 -0
@@ -43,6 +43,7 @@ length=${DPDK_CHECKPATCH_LINE_LENGTH:-80}
 
 # override default Linux options
 options="--no-tree"
+options="$options ${GIT_HOOK_OPTIONS}"

What is the purpose of this variable?
Why adding some options would be specific to git hooks?

scripts/checkpatches.sh line 7

Quoted 9 lines
scripts/checkpatches.sh +8 -0
+++ b/scripts/git-hooks/deploy.sh
@@ -0,0 +1,20 @@
+
+SELF=$(basename $0)
+
+if [ ! -f ${SELF} ]; then
+	echo "Please run script from folder where script is"
+	exit 1
+fi

You do not need to exit. Just cd $(dirname $0).

scripts/checkpatches.sh line 10

Quoted 3 lines
scripts/checkpatches.sh +3 -0
+for f in ${FILES}; do
+	ln -sf ${SCRIPT_FOLDER}/${f} ${TARGET_FOLDER}/${f}
+done;

You do not need the ;

scripts/git-hooks/post-commit line 7

Quoted 5 lines
scripts/git-hooks/post-commit new file +3 -0
+if [ -n "$RTE_DOC_OUT" ]; then
+	OUT_CMD="O=${RTE_DOC_OUT}"
+fi

How to pass RTE_DOC_OUT to the hook?
Why not use load-devel-config.sh?

scripts/git-hooks/post-commit line 10

Quoted 2 lines
scripts/git-hooks/post-commit new file +2 -0
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null

Why hiding the errors?

scripts/git-hooks/post-merge

Quoted 2 lines
scripts/git-hooks/post-merge new file +0 -0

Does it work for "git pull --rebase"?

scripts/git-hooks/pre-commit line 9

Quoted 4 lines
scripts/git-hooks/pre-commit new file +2 -0
+# If "git commit" called with "--no-verify" option, pre-commit hooks
+# bypassed and this script not called, checkpatch bypassed

Possible reword: It is skipped with the option "--no-verify" of "git commit".

Quoted 1 line

+RTE_CHECKPATCH=$PWD/scripts/checkpatches.sh

What is PWD when calling the hook. May it be a subdir?

Quoted 1 line

+PATCH=/tmp/dpdk-git-auto-checkpatch-$$.patch

You need to remove this temporary file when exiting. But it would be better to use stdin.
It may need a patch on checkpatches.sh wrapper. In chekpatch.pl: "When FILE is - read standard input".

Quoted 1 line

+export GIT_HOOK_OPTIONS=--no-signoff

This variable is wrongly named.

scripts/git-hooks/pre-commit line 17

Quoted 2 lines
scripts/git-hooks/pre-commit new file +2 -0
+git diff --cached > ${PATCH}
+exec ${RTE_CHECKPATCH} ${PATCH}

When the new "make install" will be applied, I think we should skip these files. Please consider patching mk/rte.sdkinstall.mk. Thanks

#8 lore raw
Quoted 8 lines · Thomas Monjalon

Ferruh,
I have a lot of questions :)

2015-11-27 14:34, Ferruh Yigit:

Quoted 4 lines
scripts/checkpatches.sh +0 -0
@@ -43,6 +43,7 @@ length=${DPDK_CHECKPATCH_LINE_LENGTH:-80}
 
Quoted 7 lines

scripts/checkpatches.sh length=${DPDK_CHECKPATCH_LINE_LENGTH:-80} · line 46

Quoted 3 lines
scripts/checkpatches.sh +1 -0
 # override default Linux options
 options="--no-tree"
+options="$options ${GIT_HOOK_OPTIONS}"

What is the purpose of this variable?
Why adding some options would be specific to git hooks?

When you use "commit -s", sign-off msg added after this script run,
also when you do "commit --ammend" that piece of patch does not have sign-off part,
so pre-commit hook can have problems with sign-off check and git hook specific option is to pass --no-signoff option.

Quoted 12 lines

scripts/checkpatches.sh line 7

Quoted 9 lines
scripts/checkpatches.sh +8 -0
+++ b/scripts/git-hooks/deploy.sh
@@ -0,0 +1,20 @@
+
+SELF=$(basename $0)
+
+if [ ! -f ${SELF} ]; then
+	echo "Please run script from folder where script is"
+	exit 1
+fi

You do not need to exit. Just cd $(dirname $0).

Thanks, I will do that.

Quoted 6 lines

scripts/checkpatches.sh line 10

Quoted 3 lines
scripts/checkpatches.sh +3 -0
+for f in ${FILES}; do
+	ln -sf ${SCRIPT_FOLDER}/${f} ${TARGET_FOLDER}/${f}
+done;

You do not need the ;

OK

Quoted 9 lines

scripts/git-hooks/post-commit line 7

Quoted 5 lines
scripts/git-hooks/post-commit new file +3 -0
+if [ -n "$RTE_DOC_OUT" ]; then
+	OUT_CMD="O=${RTE_DOC_OUT}"
+fi

How to pass RTE_DOC_OUT to the hook?
Why not use load-devel-config.sh?

It is possbile pass by exporting it as environment variable, but since load-devel-config is already there, I will use it.

Quoted 5 lines

scripts/git-hooks/post-commit line 10

Quoted 2 lines
scripts/git-hooks/post-commit new file +2 -0
+make ${OUT_CMD} doc-guides-html 2>&1 > /dev/null
+make ${OUT_CMD} doc-api-html 2>&1 > /dev/null

Why hiding the errors?

To prevent noise, but I double check and enabling error messages not noisy, so I will enable it.

Quoted 4 lines

scripts/git-hooks/post-merge

Quoted 2 lines
scripts/git-hooks/post-merge new file +0 -0

Does it work for "git pull --rebase"?

No, it is not working, for that pre-rebase is required,
easy to create a link for that but I am not sure about increasing number of hooks, with pre-rebase hook, an internal rebase too will trigger doc generation, which is not good I believe.

Quoted 8 lines

scripts/git-hooks/pre-commit line 9

Quoted 5 lines
scripts/git-hooks/pre-commit new file +2 -0
+# If "git commit" called with "--no-verify" option, pre-commit hooks
+# bypassed and this script not called, checkpatch bypassed

Possible reword: It is skipped with the option "--no-verify" of "git commit".

OK, thanks.

Quoted 4 lines
Quoted 1 line

+RTE_CHECKPATCH=$PWD/scripts/checkpatches.sh

What is PWD when calling the hook. May it be a subdir?

Even you call git commands from a subdir, git hooks scripts run from root dir, so this will be always correct.

Quoted 7 lines
Quoted 1 line

+PATCH=/tmp/dpdk-git-auto-checkpatch-$$.patch

You need to remove this temporary file when exiting. But it would be better to use stdin.
It may need a patch on checkpatches.sh wrapper. In chekpatch.pl: "When FILE is - read standard input".

I also prefer using stdin, and previous patch was like that,
but checkpatches.sh requires a file, let me check possible update in checkpatches.sh

Quoted 4 lines
Quoted 1 line

+export GIT_HOOK_OPTIONS=--no-signoff

This variable is wrongly named.

Will rename.

Quoted 5 lines

scripts/git-hooks/pre-commit line 17

Quoted 2 lines
scripts/git-hooks/pre-commit new file +2 -0
+git diff --cached > ${PATCH}
+exec ${RTE_CHECKPATCH} ${PATCH}

When the new "make install" will be applied, I think we should skip these files. Please consider patching mk/rte.sdkinstall.mk.

ok, I will update skdinstall.mk

Thanks for the review.

ferruh

#9 lore raw

PATCH v3 1/1 scripts: add git hook scripts for checkpatch and auto doc generation

These scripts are to automate some common tasks, scripts needs to be deployed to specific folder to become active.

Scripts:
post-commit: Triggers after commit complete, re-generates api and guides html documents. "RTE_DOC_OUT" environment variable configures document output folder. Same script can be used on server side with name "post-update", so documentation can auto updated after each push to server.

post-merge: Same script as "post-commit", but triggered after git pull

pre-commit: Does a checkpatch check before commit started. This script relies on scripts/checkpatches.sh script. checkpathes.sh should be running well to use this git hook script.
This script can bypassed by commit "--no-verify" argument.

Deployment:
To make scripts active they need to be in <dpdk>/.git/hooks folder. Alternatively "deploy.sh" script can be used, it simply links all scripts into proper folder. Script names are significant and shouldn't changed.

---
 mk/rte.sdkinstall.mk          |  6 +++++-
 scripts/checkpatches.sh       |  4 ++++
 scripts/git-hooks/deploy.sh   | 16 ++++++++++++++++
 scripts/git-hooks/post-commit | 14 ++++++++++++++
 scripts/git-hooks/post-merge  |  1 +
 scripts/git-hooks/pre-commit  | 13 +++++++++++++
 6 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100755 scripts/git-hooks/deploy.sh
 create mode 100755 scripts/git-hooks/post-commit
 create mode 120000 scripts/git-hooks/post-merge
 create mode 100755 scripts/git-hooks/pre-commit
mk/rte.sdkinstall.mk +5 -1
index c611d45..8e67c07 100644
@@ -139,7 +139,11 @@ install-sdk:
 	    tar -xf -      -C $(DESTDIR)$(includedir) --strip-components=1 \
 		--keep-newer-files --warning=no-ignore-newer
 	$(Q)$(call rte_mkdir,                            $(DESTDIR)$(sdkdir))
-	$(Q)cp -a               $(RTE_SDK)/{mk,scripts}  $(DESTDIR)$(sdkdir)
+	$(Q)cp -a               $(RTE_SDK)/mk            $(DESTDIR)$(sdkdir)
+	$(Q)$(call rte_mkdir,                            $(DESTDIR)$(sdkdir)/scripts)
+	$(Q)tar -chf -     -C $(RTE_SDK) scripts --exclude git-hooks | \
+	    tar -xf -      -C $(DESTDIR)$(sdkdir)/scripts --strip-components=1 \
+		--keep-newer-files --warning=no-ignore-newer
 	$(Q)$(call rte_mkdir,                            $(DESTDIR)$(targetdir))
 	$(Q)cp -a               $O/.config               $(DESTDIR)$(targetdir)
 	$(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include)
scripts/checkpatches.sh +4 -0
index afc611b..6e841ba 100755
@@ -66,6 +66,10 @@ while getopts hqv ARG ; do
 done
 shift $(($OPTIND - 1))
 
+if [ -z "$@" ]; then
+	exec $DPDK_CHECKPATCH_PATH -q $options -
+fi
+
 status=0
 for p in "$@" ; do
 	! $verbose || printf '\n### %s\n\n' "$p"
scripts/git-hooks/deploy.sh new file +16 -0
new file mode 100755
index 0000000..6b0147d
@@ -0,0 +1,16 @@
+
+SELF=$(basename $0)
+
+cd $(dirname $0)
+FILES=$(ls | grep -v ${SELF})
+
+TARGET_FOLDER="../../.git/hooks"
+SCRIPT_FOLDER="../../scripts/git-hooks"
+
+if [ ! -d ${TARGET_FOLDER} ]; then
+	exit 2
+fi
+
+for f in ${FILES}; do
+	ln -sf ${SCRIPT_FOLDER}/${f} ${TARGET_FOLDER}/${f}
+done
scripts/git-hooks/post-commit new file +14 -0
new file mode 100755
index 0000000..882b3c2
@@ -0,0 +1,14 @@
+#
+# Create docs after each commit
+#
+
+# Load config options:
+# - DPDK_GITHOOK_DOC_OUT
+. scripts/load-devel-config.sh
+if [ -n "$DPDK_GITHOOK_DOC_OUT" ]; then
+	OUT_CMD="O=${DPDK_GITHOOK_DOC_OUT}"
+fi
+
+echo "Generating documents ..."
+make ${OUT_CMD} doc-guides-html > /dev/null
+make ${OUT_CMD} doc-api-html > /dev/null
scripts/git-hooks/post-merge new file +1 -0
new file mode 120000
index 0000000..ace4560
@@ -0,0 +1 @@
+post-commit
\ No newline at end of file
scripts/git-hooks/pre-commit new file +13 -0
new file mode 100755
index 0000000..f3d6be4
@@ -0,0 +1,13 @@
+#
+# Check patch with checkpatch script before commit
+#
+# If checkpatch fails, commit fails
+#
+# Relies on scripts/checkpathes.sh script as checkpatch.pl wrapper
+#
+# It is skipped with the option "--no-verify" of "git commit".
+#
+
+RTE_CHECKPATCH=$PWD/scripts/checkpatches.sh
+
+exec git diff --cached | ${RTE_CHECKPATCH}
Signature · 1 line
2.5.0