diff mbox series

[v2,4/4] sync-with-kernel.sh: create v4l2-tracer patches

Message ID c8adf732788e3ab317024553c7b2137e3a541269.1701388238.git.deborah.brouwer@collabora.com (mailing list archive)
State New, archived
Headers show
Series v4l2-tracer: track changes from syncing with kernel | expand

Commit Message

Deborah Brouwer Dec. 1, 2023, 12:12 a.m. UTC
After v4l-utils is synced with the latest kernel headers, generate and
apply patches for the changes that need to be made to the v4l2-tracer.
This makes it easier to see how the kernel headers are changing the
v4l2-tracer and also to revert those changes if necessary.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
---
 sync-with-kernel.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Hans Verkuil Dec. 1, 2023, 8:27 a.m. UTC | #1
On 01/12/2023 01:12, Deborah Brouwer wrote:
> After v4l-utils is synced with the latest kernel headers, generate and
> apply patches for the changes that need to be made to the v4l2-tracer.
> This makes it easier to see how the kernel headers are changing the
> v4l2-tracer and also to revert those changes if necessary.
> 
> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
> ---
>  sync-with-kernel.sh | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/sync-with-kernel.sh b/sync-with-kernel.sh
> index ad5681c6..dec90620 100755
> --- a/sync-with-kernel.sh
> +++ b/sync-with-kernel.sh
> @@ -115,8 +115,35 @@ function freebsd {
>  	quilt push -a
>  }
>  
> +function v4l2-tracer {
> +	V4L2TRACERDIR="${TOPSRCDIR}/utils/v4l2-tracer"
> +	V4L2TRACERSOURCES="${TOPSRCDIR}/include/linux/v4l2-controls.h "
> +	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/videodev2.h "
> +	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/media.h "
> +	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/v4l2-common.h "
> +
> +	TMPDIR=$(mktemp -d "${V4L2TRACERDIR}/v4l2-tracer-gen.XXXXXXXXXX")

Hmm, bash already has TMPDIR with a special meaning.

I think it is better to pick a different name to avoid confusion.

Regards,

	Hans

> +
> +	perl "${V4L2TRACERDIR}/v4l2-tracer-gen.pl" -o $TMPDIR $V4L2TRACERSOURCES
> +
> +	diff -Naur "${V4L2TRACERDIR}/trace-gen.cpp" "${TMPDIR}/trace-gen.cpp" > "${TMPDIR}/trace-gen.patch"
> +	diff -Naur "${V4L2TRACERDIR}/trace-gen.h" "${TMPDIR}/trace-gen.h" > "${TMPDIR}/trace-gen-h.patch"
> +	diff -Naur "${V4L2TRACERDIR}/retrace-gen.cpp" "${TMPDIR}/retrace-gen.cpp" > "${TMPDIR}/retrace-gen.patch"
> +	diff -Naur "${V4L2TRACERDIR}/retrace-gen.h" "${TMPDIR}/retrace-gen.h" > "${TMPDIR}/retrace-gen-h.patch"
> +	diff -Naur "${V4L2TRACERDIR}/v4l2-tracer-info-gen.h" "${TMPDIR}/v4l2-tracer-info-gen.h" > "${TMPDIR}/v4l2-tracer-info-gen-h.patch"
> +
> +	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/trace-gen.patch
> +	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/trace-gen-h.patch
> +	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/retrace-gen.patch
> +	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/retrace-gen-h.patch
> +	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/v4l2-tracer-info-gen-h.patch
> +
> +	rm -r "$TMPDIR"
> +}
> +
>  keytable
>  libdvbv5
>  freebsd
>  ioctl-test
>  xc3028-firmware
> +v4l2-tracer
diff mbox series

Patch

diff --git a/sync-with-kernel.sh b/sync-with-kernel.sh
index ad5681c6..dec90620 100755
--- a/sync-with-kernel.sh
+++ b/sync-with-kernel.sh
@@ -115,8 +115,35 @@  function freebsd {
 	quilt push -a
 }
 
+function v4l2-tracer {
+	V4L2TRACERDIR="${TOPSRCDIR}/utils/v4l2-tracer"
+	V4L2TRACERSOURCES="${TOPSRCDIR}/include/linux/v4l2-controls.h "
+	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/videodev2.h "
+	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/media.h "
+	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/v4l2-common.h "
+
+	TMPDIR=$(mktemp -d "${V4L2TRACERDIR}/v4l2-tracer-gen.XXXXXXXXXX")
+
+	perl "${V4L2TRACERDIR}/v4l2-tracer-gen.pl" -o $TMPDIR $V4L2TRACERSOURCES
+
+	diff -Naur "${V4L2TRACERDIR}/trace-gen.cpp" "${TMPDIR}/trace-gen.cpp" > "${TMPDIR}/trace-gen.patch"
+	diff -Naur "${V4L2TRACERDIR}/trace-gen.h" "${TMPDIR}/trace-gen.h" > "${TMPDIR}/trace-gen-h.patch"
+	diff -Naur "${V4L2TRACERDIR}/retrace-gen.cpp" "${TMPDIR}/retrace-gen.cpp" > "${TMPDIR}/retrace-gen.patch"
+	diff -Naur "${V4L2TRACERDIR}/retrace-gen.h" "${TMPDIR}/retrace-gen.h" > "${TMPDIR}/retrace-gen-h.patch"
+	diff -Naur "${V4L2TRACERDIR}/v4l2-tracer-info-gen.h" "${TMPDIR}/v4l2-tracer-info-gen.h" > "${TMPDIR}/v4l2-tracer-info-gen-h.patch"
+
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/trace-gen.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/trace-gen-h.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/retrace-gen.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/retrace-gen-h.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${TMPDIR}/v4l2-tracer-info-gen-h.patch
+
+	rm -r "$TMPDIR"
+}
+
 keytable
 libdvbv5
 freebsd
 ioctl-test
 xc3028-firmware
+v4l2-tracer