xref: /gfx-drm/usr/src/common/libdrm/Check-patches (revision 8f53f39d)
1#!/bin/sh
2
3# Copyright 2015 Gordon W. Ross
4#
5# Permission is hereby granted, free of charge, to any person obtaining a
6# copy of this software and associated documentation files (the
7# "Software"), to deal in the Software without restriction, including
8# without limitation the rights to use, copy, modify, merge, publish,
9# distribute, and/or sell copies of the Software, and to permit persons
10# to whom the Software is furnished to do so, provided that the above
11# copyright notice(s) and this permission notice appear in all copies of
12# the Software and that both the above copyright notice(s) and this
13# permission notice appear in supporting documentation.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
18# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
20# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
21# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
22# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
23# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24#
25# Except as contained in this notice, the name of a copyright holder
26# shall not be used in advertising or otherwise to promote the sale, use
27# or other dealings in this Software without prior written authorization
28# of the copyright holder.
29
30#
31# This is a convenience script for checking that your patches represent
32# all the differences between the checked out libdrm and a reference copy.
33# The only differences shown should be the name/date lines at the start of
34# each per-file section, i.e.
35#
36# 29,31c29,31
37# < index 8adb9d5..f9bedd0 100644
38# < --- a/include/drm/drm.h	2016-04-28 03:44:16.000000000 +0300
39# < +++ b/include/drm/drm.h	2016-05-24 10:27:22.341573589 +0300
40# ---
41# > diff ... libdrm-2.4.71/include/drm/drm.h
42# > --- libdrm-2.4.71-ref/include/drm/drm.h	Thu Apr 21 09:40:06 2016
43# > +++ libdrm-2.4.71/include/drm/drm.h	Sat Nov 19 21:07:12 2016
44#
45# Check out a "reference" copy of the same version of libdrm
46# (i.e. libdrm-2.4.71-ref below) before you run this.
47#
48# When developing, re-run this, and/or re-run diffs like:
49# diff {libdrm-2.4.71,libdrm-2.4.71-ref}/somedir/somefile.c
50# and use that to update the patches.
51#
52# One big patch might be easier than all this...
53# but for now the patches are split up as shown below.
54
55ref=libdrm-2.4.75-ref
56dir=libdrm-2.4.75
57
58# You make this directory by hand.  Not doing this automatically
59# because I want to make srue you to know it's being written into.
60chk=checkpatch
61
62diff_ref() {
63# echo find "${@:-.}" -type f -print
64( cd $dir && find "${@:-.}" -type f -print) |
65 sed -e 's:^./::' | sort |
66while read f
67do
68  cmp -s $ref/$f $dir/$f || {
69    echo diff ... $dir/$f
70    diff -u $ref/$f $dir/$f
71  }
72done
73}
74
75
76
77echo patches/etnaviv.patch
78diff_ref etnaviv -name '*.[ch]' > $chk/etnaviv.patch
79
80echo patches/exynos.patch
81diff_ref exynos tests/exynos -name '*.[ch]' > $chk/exynos.patch
82
83echo patches/freedreno.patch
84diff_ref freedreno -name '*.c' > $chk/freedreno.patch
85
86echo patches/intel-drm.patch
87diff_ref intel -name '*.c' > $chk/intel-drm.patch
88
89echo patches/omap.patch
90diff_ref omap -name '*.c' > $chk/omap.patch
91
92echo patches/pkgconfig-in.patch
93diff_ref . -name '*.pc.in' > $chk/pkgconfig-in.patch
94
95echo patches/incl-drm-drm-h.patch
96( head -27 patches/incl-drm-drm-h.patch ;
97  diff_ref include/drm/drm.h ) > $chk/incl-drm-drm-h.patch
98
99echo patches/incl-drm-i915-drm-h.patch
100( head -27 patches/incl-drm-i915-drm-h.patch ;
101  diff_ref include/drm/i915_drm.h ) > $chk/incl-drm-i915-drm-h.patch
102
103echo patches/libdrm-lists-h.patch
104diff_ref libdrm_lists.h > $chk/libdrm-lists-h.patch
105
106echo patches/util-double-list-h.patch
107diff_ref util_double_list.h > $chk/util-double-list-h.patch
108
109echo patches/util-math-h.patch
110diff_ref util_math.h > $chk/util-math-h.patch
111
112echo patches/xf86drm-c.patch
113diff_ref xf86drm.c > $chk/xf86drm-c.patch
114
115echo patches/xf86drm-h.patch
116( head -27 patches/xf86drm-h.patch ;
117  diff_ref xf86drm.h ) > $chk/xf86drm-h.patch
118
119echo patches/xf86drmMode-c.patch
120diff_ref xf86drmMode.c > $chk/xf86drmMode-c.patch
121
122
123diff -r patches $chk