3
# Copyright 2006-2008 (C) Kees Cook <kees@ubuntu.com>
4
# Modified by Siegfried-A. Gevatter <rainct@ubuntu.com>
5
# Modified by Daniel Hahler <ubuntu@thequod.de>
7
# ##################################################################
9
# This program is free software; you can redistribute it and/or
10
# modify it under the terms of the GNU General Public License
11
# as published by the Free Software Foundation; either version 3
12
# of the License, or (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# See file /usr/share/common-licenses/GPL for more details.
21
# ##################################################################
23
# By default only the name of the patch system is printed. Verbose mode can be
26
if [ "$1" = "-h" ] || [ "$1" = "--help" ]
31
Run this inside the source directory of a Debian package and it will detect
32
the patch system that it uses.
34
-v: Enable verbose mode:
35
- Print a list of all those files outside the debian/ directory that have
36
been modified (if any).
37
- Report additional details about patch systems, if available.
42
while [ ! -r debian/rules ];
44
if [ "$PWD" = "/" ]; then
45
echo "Can't find debian/rules."
57
if [ "$VERBOSE" -gt 0 ]; then
58
files=`lsdiff -z ../$(dpkg-parsechangelog | grep ^Source: | sed -e "s/^Source: //")_$(dpkg-parsechangelog | grep ^Version: | sed -e "s/^Version: //").diff.gz 2>/dev/null | grep -v 'debian/'`
61
echo "Following files were modified outside of the debian/ directory:"
63
echo "--------------------"
65
echo -n "Patch System: "
69
if fgrep -q quilt debian/source/format 2>/dev/null; then
74
# Do not change the output of existing checks by default, as there are build
75
# tools that rely on the exisitng output. If changes in reporting is needed,
76
# please check the "VERBOSE" flag (see below for examples). Feel free
77
# to add new patchsystem detection and reporting.
78
for filename in $(echo "debian/rules"; grep ^include debian/rules | fgrep -v '$(' | awk '{print $2}')
80
fgrep patchsys.mk "$filename" | grep -q -v "^#" && {
81
if [ "$VERBOSE" -eq 0 ]; then
84
echo "cdbs (patchsys.mk: see 'cdbs-edit-patch')"; exit 0;
87
fgrep quilt "$filename" | grep -q -v "^#" && { echo "quilt"; exit 0; }
88
fgrep dbs-build.mk "$filename" | grep -q -v "^#" && {
89
if [ "$VERBOSE" -eq 0 ]; then
92
echo "dbs (see 'dbs-edit-patch')"; exit 0;
95
fgrep dpatch "$filename" | grep -q -v "^#" && {
96
if [ "$VERBOSE" -eq 0 ]; then
97
echo "dpatch"; exit 0;
99
echo "dpatch (see 'patch-edit-patch')"; exit 0;
102
fgrep '*.diff' "$filename" | grep -q -v "^#" && {
103
if [ "$VERBOSE" -eq 0 ]; then
104
echo "diff splash"; exit 0;
106
echo "diff splash (check debian/rules)"; exit 0;
110
[ -d debian/patches ] || {
111
if [ "$VERBOSE" -eq 0 ]; then
112
echo "patchless?"; exit 0;
114
echo "patchless? (did not find debian/patches/)"; exit 0;
117
if [ "$VERBOSE" -eq 0 ]; then
118
echo "unknown patch system"
120
echo "unknown patch system (see debian/patches/ and debian/rules)"